Motion/Vibration sensor for model railway

jensmith25

Senior Member
Hi all,

I have another project I'm working on for a customer. He has an O gauge model railway and wants to light up the carriages when motion is detected. He previously bought a little motion detection microprocessor which is designed to run off a 3v coin cell but it's designed for N & OO Gauge and isn't powerful enough for the extra LEDs required to light up an O gauge scale carriage. (One goes in each carriage with a 3v LED strip). I provided a longer LED strip with extra LEDs but the carriage is barely lit using the microprocessor while being very bright when lit directly off 3v (2 x AAA's) so there must be a lot of resistance in their circuit.

Anyway, that is the background.

I have established that I can power the 3v LED strip with 9 LEDs with the tiny AXE231 via a FET but what I need is the best way to detect the motion of the train. The idea being that when the train moves the lights come on and then switch off after it stops. There would be one in each carriage and he wants to do this rather than wire the carriages together.

I know you can use an IR receiver and transmitter but this seems more suited to performing actions like turning on signals etc rather than keeping lights on.

After extensive searching on the forum and Google I found a reference to a vibration sensor SEN015
http://www.picaxestore.com/index.php/en_gb/electronic-components/switches/sen015.html

and wanted to check if this will do what I need or if there's a better way of doing it. There's no data sheet or much info on the page as to how it works!

EDIT: - I've also found this one as an alternative which says it's for use with moving objects like bike lights etc. Not sure if it would be better or if they do the same thing: http://www.rapidonline.com/electronic-components/sensolute-micro-vibration-sensor-omnidirectional-178104

Thanks for your help.

Jennifer,
 
Last edited:

premelec

Senior Member
I think you can use a piezo unit connected by READADC - basically a voltage generating microphone - then you look for any change in this voltage as activity. I saw a piezo with a weight glued to it as a motion sensor in a toy once... Perhaps someone can give further clues how to use this and you can search this forum for use of piezo inputs - usually they are used as a sounding output...
 

jensmith25

Senior Member
Thanks guys.

I've read about some piezo units but it looks like they can generate high voltages which could be an issue and I ned it to work off 3v to keep the size compact. I think the switch might be the easiest solution if it's suitable.

I assume that as long as there is movement then the reading will remain 'HIGH'?
 

premelec

Senior Member
The switch will respond to vibration rather than steady motion - however the train might be jerky enough to give a signal - as a strategy you can start a delay and hold on assuming there will be another jerk later...
 

jensmith25

Senior Member
Thanks premelec. That was my concern but I'm guessing there could well be quite a few jerky motions on a model railway.

If I set a delay for say 4 minutes I'm guessing that should cover it? Then the lights will stay on during stops as well as round the track, hopefully..
 

goom

Senior Member
Perhaps you could use your original "low power" sensor output to drive a transistor switch.
A 3V coin cell has quite high internal resistance, so that could be the reason for the low output current rather than the detector itself. Try powering the unit from 2 x AAA's instead of the coin cell.
 

premelec

Senior Member
Probably less than that but ask the railroader what's good... btw with the piezo the voltage may be high but current is very low so likely not a problem [or put a zener diode across the input]. Happy train spotting.... ;-)
 

jensmith25

Senior Member
Try powering the unit from 2 x AAA's instead of the coin cell.
Goom - we tried that but even with 2 x AA's the LEDs were not bright enough to light the coach which makes me think it's the detector. I've not seen the "microprocessor switch" myself - my customer bought it and was disappointed with the results.
 

Circuit

Senior Member
There is a full article on this subject in the current Journal of the Model Electronics Railway Group (MERG Vol49:Issue1, 2015, pp3-6). Several methods are described (with some schematics and a commentary on success for each gauge/scale). These include: reed switch with toggle; Tilt sensors; Vibration sensors; Accelerometers; Track-monitoring Infra-Red. Most are fed into a microcontroller - a PICAXE could certainly be substituted in each case. Piezo electric are also evaluated but they proved to be too sensitive to other vibrations on the layout.

May be worth the subscription if you are working in this field - see www.merg.org.uk.
 

oracacle

Senior Member
my understanding of the small "coin" piezo (SPE003) was you tied one side high (red wire), the other to the adc pin and from there to ground via something like a 10k

this maybe useful
http://makezine.com/2010/11/25/how-to-arduino-high-speed-photograp/
it will take a little modification to get what you need but should give an idea on how to wire the piezo.

I would also consider modifying the output of the movement sensor you currently have. maybe have it drive a FET which then drives the LEDs. If you need to have 2 power supplies ensure they have a shared ground and you will be fine.
 

jensmith25

Senior Member
Thanks.

I think the vibration sensor will be most suitable and have ordered some to try.

@oracacle - I was going to use a FET to drive the LEDs anyway as the strip will be more than 20mA but so I understand fully, what is the reasoning behind powering the FET with the movement sensor?

I would prefer only 1 power supply as there's not a lot of room in the carriage for extra batteries.
 

The bear

Senior Member
Hi Jen,
As you will gather, I know nothing about model railways.
If the lights need to be on when the train is in motion, the train motor requires power, so can you link the lights to the motor?

Regards, Bear..
 

jensmith25

Senior Member
Hi Bear,

Power is normally supplied through the track so you can get the power via pickups on the wheels but in this case the chap wants to power them separately. Powering via the track can be tricky and you need a bridge rectifier to allow the lights to stay lit in forward and reverse and a capacitor to stop them flickering when the train stops.
 

westaust55

Moderator
Powering via the rails is not a major problem.
Australian company DCC Concepts have phosphor bronze springs to fit to axles on carriage bogies as well as LEDs and strip PCBs for the lighting.
These are available also from various outlets in the UK.
Batteries will only last so long and then need replacement - an ongoing cost and if not mounted to underside of carriage then the carriage needs opening up from time to time to replace batteries.
Coin cell type 3V batteries usually have a capacity of the order of 180 mAh so let's say 6 LEDs each drawing only 2 mA then a carriage allowing for other circuitry may have a current draw of the order of 20 mA in which case that 3V coil cell may be "flat" in around 9 hours.
 

jensmith25

Senior Member
Thanks westaust55. I have seen DCC concepts range. My customer wants to power it off a separate battery. He was trying the Train Tech coin cell microprocessor but it's not designed for O gauge. I have heard that their carriage lighting lasts 9-12 months with 1 x CR2032 but they say they use very efficient chip LEDs. Train Tech must get plenty of customers wanting to have the lights powered separately or they wouldn't have such a large range.

Anyway, I'm not proposing to use a coin cell as that is clearly not fit for purpose and doesn't provide enough power to light my strip. It will likely be powered by 2 x AA's (or 2 x AAA's) which should last ok and he plans to store them inside the carriage roof. I realise it may seem a bit of an odd choice but I'm just providing what I've been asked for.
 

Circuit

Senior Member
You could use one of the Train Tech devices as a trigger; take the LED output and use it to fire up a transistor amplified relay to your more powerful LED circuit. Alternatively, the LED output from a Train Tech unit could wake up a sleeping PICAXE chip if you wish to alter the timing of the lights remaining on etc.
 

oracacle

Senior Member
Thanks.

I think the vibration sensor will be most suitable and have ordered some to try.

@oracacle - I was going to use a FET to drive the LEDs anyway as the strip will be more than 20mA but so I understand fully, what is the reasoning behind powering the FET with the movement sensor?

I would prefer only 1 power supply as there's not a lot of room in the carriage for extra batteries.
the reason the LEDs are dim when driven from their circuit is it is unable to provide the current (ie the max current from the unit maybe 15mA while you need 20mA) the LEDs need to be bright. a logic level FET does not need much current (FETs are voltage drive, not current driven) to open the gate and will allow a all the current that the LEDs need to flow. you could use a normal transistor but voltage drop would need to be taken into account.
 

jensmith25

Senior Member
@oracacle - Ah, I think I misunderstood. I was thinking you were referring to the movement sensor I was incorporating into my design rather than the one from Train Tech. As I don't own that, the customer does, I can't modify it.

I am though using a FET to drive my own LED strip which is working well and allows good brightness.
 

oracacle

Senior Member
ok makes a little more sense to me too now. if the train tech devices are cheap enough, it maybe worth buying some to modify in a similar way to circuits' suggestion.
 

jensmith25

Senior Member
Thanks to all for your help with this project. Got it working and off to customer. If anyone is interested this is a demo video - set with a 30sec timer. https://youtu.be/MrehuH87u28

The actual code checks the switch every few ms and resets the timer if there's still movement. If none is detected then the lights go off after 4 mins. Seems to work nicely.
 
Top