Model Train Forum banner

Mobile Train SpeedoMeter

4K views 36 replies 7 participants last post by  jlc41 
#1 ·
Suggested by another member, slightly different than the stationary speedometer ..
Anyways, Arduino Nano with a non latching Hall Effect sensor triggered by a wheelset mounted 2mm x 1mm rare earth magnet [or super magnet] ..
I used the OH360U sensor , active low .with a single trigger magnet ..
The code [as current] displays both mph and kph, and is coded for a 33" wheel, readily changes to a 36" if end user requires..and is not scale dependant ..except for physical room to mount the electronics...
The display shows speed [including tenths] below 10 mph / kph, and whole numbers above that ..
Currently the display being used [and coded for], is a standard 1602 /I2C, but will be replaced with a two digit seven segment when they come in ..just for easier viewing at longer distances ..
Results show to both display and Aruino IDE serial monitor as currently coded..
Hard parts are the nano, I2c display, sensor, one magnet & one resistor ...
For installation in a boxcar or similar .. other parts would be power pickup trucks, a small capacitor fr possible power interruptions, a bridge, and a voltage regulator ..ideally for DCC or AC / DC voltages consistently over 10V ..
I'm waiting for the larger displays before I build myself one..
If anyone wants the code, I can post it..
 
See less See more
#4 ·
Great Idea! Here is another way the approach to the design for anybody that might be interested.

The Bluno Beetle board could be used with just a battery, on/off switch and tachometer sensor. The display would be a hand-held Adriano-thing with a slightly modified “Bluno Basic Demo” App.
Bob
 

Attachments

#6 ·
Here are some photos of my current project....it's in pre-production stage, but alkmost ready.....

It still needs tweaking of the packaging, and the obvious size issues are because my home-made PCBs are single sided, and to put all this together, I need access from the 'wrong' side of the PCBs to make the solder connections.....that causes the connectors to be significantly LONGER than those that will be used eventually.

The display shows MPH & KPH, and on the second line shows average speed and odometer in scale miles:









You can plainly see the magnets around the wheel and the hall effect sensor mounted on the power pickup truck.
 
#8 ·
I'm guessing any mouse mechanism would have a real problem with the irregular surface of the roadbed between the rails.

I do have a question, do you really need that many magnets? Wouldn't one or two give you sufficient accuracy?

BTW, have you looked at OSH Park for prototype PCB? It's my "go to" place for small quantities of PC boards.
 
#10 ·
I'm retired and 'poor', plus sort of cheap.....final prototypes and probably initial 'production' will have the boards made professionally. For now, homemade is fine, and I'm quite good at it. I use laser transfer to copper clad PCB, and I can make a PCB in an hour, depending on how many holes I need to drill. The only real problem I have with the homemade stuff is that the copper is nowhere near as robust as a professionally made part....I can lift the traces much too easily, but that's a tradeoff I can live with for now.

The code averages the timings of all the magnet detections primarily because motion start and stop are not accurate at all.

The code also does NOT use a simple detection of the magnet to trigger each part of the timing.....the initial detection presets the logic, and when the magnet detection goes away, that action is the trigger.

All that really requires more than one magnet, and actually, the more magnets yield better accuracy...I use 5, which yields 4 timings.

I agree on your assesment of the mouse HW for movement detection, as the focus distance is critical, PLUS the HW would need to decode what the mouse HW was sending...it send a pulse train which isn't simplistic.
 
#9 ·
I went a slightly different approach on mine, just the sensor on the truck, no pcb, three wires up .. and no pcb for the nano ..three wires to sensor , and four to the current I2C display ..
I still prefer 7segment displays for visibility, but am currently trying double height numbers using both lines for the digits ..
I assume that you are running averaging on the speed, if the magnets are even 10 thou out of the correct angle, it will change the speed reading constantly..

The blue display does have nicer contrast than the yellow ones that I have :)
 
#11 ·
I'm trying to make something for sale, so PCBs are a necessity. Unfortunately, the most expensive part is the power pickup truck. Almost all the other parts are Asia purchases.

I originally started to use 7 segment displays, and I have about 300 of them laying around from other jobs that I did, but they are power hogs, requiring 20ma per segment, so worst case was almost 400ma for the whole setup. I started to use a LM317 regulator, but dropping 11volts at 400ma was just too much heat to dissapate(4+ watts), so I went to a DC-DC converter and the LCD display. Even when I add the 433mhz radio(running at minimal power output), the current load will be less than 100ma or so. With +90% efficiency of the buck converter, the thermal load is acceptable for mounting inside an HO scale or larger car. I've decided that N-scale isn't practical, as the radio or display is just too large......
 
#15 ·
I finally received my seven segment displays, and no matter how I try to mount them for good visibility, they still look horrible ...and using LCD display makes to hard to see at longer distances, plus half the time it's upside down anyways
So I ordered some WiFi modules, and will try to send speedometer data to PC or phone..

Might also try mounting them on the sides of a boxcar, for some reason never thought of that until now.. always tried top mounting for some reason?
 
#16 ·
I'm using HC-12 radios, althouigh I haven't actually tested the link yet.....I have the same issues trying to read a moving display.

I've decided to make my speedometer cars do dual duty......they can send(and display) data or act as a receiver to display the data. I expect the receiving car to sit in a powered siding while the other car gets dragged around the layout.
 
#18 ·
That's probably the way it may wind up in the end, I should have some of the ESP WiFi modules, but couldn't find them ..

But I did find some four digit seven segment modules, a little bit smaller, look like the 0.59 height .. left overs from an old project, and still have a half dozen left .. easy hookup, only four wires, and I think they were fairly low power draw.. old project was run on a 9V battery..maybe just paint over the first digit , maybe second as well, don't really need the extra decimal readout ..no real need for it to read a hundred miles per hour .. dunno?

In the photo they are at full brightness, have to lower it somewhat,

They should fit into the small two bay hopper that I put the sensor into ..Minor snag right now, I was hoping to use the AtTiny85, found a couple of those still in the anti static pouches, but it looks like it has an issue with the TM1637 display library ..sigh ..

I might have to go with the Nano, but I was saving those for project builds that actually generate income..a grain bin temperature reader .. have to look around some more , there should some pro mini's someplace ...

Technology Electronic device Wire Display device Electronics
 
#19 ·
I don't know how much control you have over those 7-segment displays, but if you had complete control, you could alternately display the data upside down periodically, so it could be read from either direction.....I did something like that on a project decades ago, and it worked well, and was easy to do, as long as I had complete control of the decode for the display.
 
#20 ·
If you have enough display control you could have speed on the minutes part upside down and the hours rightside up. Hm, might be just as confusing. I think billboard style on the side of the boxcar is the best. What else could you display on the other 2 digits that would have meaning and not be confusing. Acceleration, Lateral g's ( for those tight turns you take at high speed? I'm wondering if maybe you should just get some really large display digits for the wall?
 
#28 ·
John, the display and the Nano computer will look a little smaller on the O scale version:D. I keep a Nano next to the computer I use most of the time, just to try out things like servo control, GRBL (CNC firmware) and whatever project triggers something. Takes me back to the days of the Intel 8080, but with a lot less hassle!
 
#34 ·
Well, kinda yes and kinda no ...
from the arduino.cc description ..

"The processor at the heart of any Arduino has two different kinds of interrupts: “external”, and “pin change”. There are only two external interrupt pins on the ATmega168/328 (ie, in the Arduino Uno/Nano/Duemilanove), INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. The triggers are interpreted by hardware, and the interrupt is very fast.",

so actually either way will work, just a personal preference.. I'm a messy coder... :)
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top