So I have another little hack I am working on – I have to get a locomotive and some track yet. Speaking of that, if anyone wants to be charitable and has an extra HO scale locomotive and some track (cheap toy store stuff is ok) and you want to donate it to the cause, please feel free to contact me! :) Anyrate, I have another hack planned and this was is very simple but neat. I want to setup an Arduino Duemilanove micro-controller to measure and report the scale speed of a passing locomotive. The way I want to do this is pretty simple – I envision  (feel free to comment with suggestions, mistakes in my thinking, ideas, etc…)using two opto-interruptors (see my Arduino Controlled Model Railroad Turntable hack for a good description of opto-interruptors) as a means of starting and stopping the Arduino internal timer (might have to use an external crystal if I want something really accurate) with the opto-interruptors positioned at a known distance away from each other on a straight track, I  should be able to calculate how fast the train took to traverse that known distance and then calculate the HO scale miles per hour based on that. Locomotive comes along and breaks the first opto-interruptor and starts the Arduino timer function based on the Arduino clock. The Arduino is now waiting for the train to break the second opto-interruptor to stop the timer function. Once the train does break the second opto-interruptor, the Arduino sketch then determines the HO scale speed based on the following formula:

[ad#Adsense3]

Calculation for HO Scale Speed

v = (d * K) / t

v = speed, in scale MPH for 1:87.1
d = real distance covered, in inches
t = elapsed time, in seconds, to cover d
K = scale constant (4.943 for HO, 9.091 for N, and 2.727 for O scale)

So, for example, covering a 6″ piece of track in 0.8 seconds would be:
v = (6 * 4.943) / 0.8
v = 37 HO scale MPH

Click here to use my nifty Adobe Flash based Model Railroad Scale Speed Calculator based on the above equation!

[ad#Adsense2]

So  I need to program the Arduino sketch with a timer function, to watch for the opto-interruptors for triggering and then stopping the timer function, then the final clculation above, and maybe spitting it out to either a connected computer or even better to a control panel mounted LCD – how kewl would that be? 8) There are a lot of terrific LCD shields for the Arduino micro-controllers so I think I’ll go with that one for the next installment for this hack. After that, all I need is some DC power to run the opto-interruptors and the Arduino. To that end I think, I’ll forgo a separate power supply and just use the DC out from the power supply for the train.

So that’s it. Pretty simple and pretty neat too! I’ll post additional updates to this hack as soon as I begin work on it. Enhanced by Zemanta

  4 Responses to “Arduino Model Railroad Scale Speedometer Hack”

 Leave a Reply

(required)

(required)


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 Track Hacker Suffusion theme by Sayontan Sinha