Creating a circuit to control dual color LED based on physical movement.

Thread Starter

Volphin

Joined Mar 21, 2018
2
Sorry if I mess up... I'm a newbie here everyone.

I'm trying to design a circuit, as small as possible that will use 9-19v AC to control two bi-color LEDs. Obviously the LEDs will use DC. The color of the LEDs need to change based on movement of a model train car along the rails. There would be two states. The resting state, which will trigger the led to emit one color, and moving state (either forward or reverse) for the other color. I have been reading about H bridges and how they work. It might be the way to go with this, but don't really know how to lay it out or what component would be best to trigger the circuit for motion, whether it be a tiny accelerometer, optical sensor, or Hall effect sensor. I have never designed a circuit but am familiar with basic electrical theory. Thanks for reading, and I would greatly appreciate any help you gurus could provide.
 

-live wire-

Joined Dec 22, 2017
959
First step: rectify the AC and smooth it out with caps. You will want a stable dc power supply to not have LEDs flicker and for control circuits. You may also want to step the AC down before-hand, or use a small dc-dc buck converter. Or use a few diodes. Just make sure your components can handle whatever voltage you are using. Then after that you have a few options for controlling the LEDs.

1. You can go with a simple tilt switch/vibration sensor. They act as an open switch when there is no vibration, and a closed one when motion is detected. You simply have two MOSFETs, one pnp and one npn. The drains control your two LEDs. No vibration, and they both get pulled to ground through resistor, turning the p-fet on, the n-fet off. That turns you "static" LED on, the "motion" one off. Then when they are pulled up to power through the switch (and maybe with low value resistor), the static one turns off and the motion one turns on. The switches are not the best, and may false-trigger, but this needs few components, is cheap, and would be compact.

2. Use a microcontroller and accelerometer IC. This will be much more accurate, and you can easily do more things (left indicator led, right indicator led, etc.). Here are some good tutorials. You just write some simple code, and then it can easily turn them on/off when it senses motion. I recommend an Arduino nano/pro-mini, but there exist many other microcontrollers out there. Those would be small and low profile, cheap, and have many features. The accelerometer IC would be fairly cheap and small. This option is more precise but might take up a little more space. Here are some good tutorials:

3. Use a hall-effect sensor or reed switch if it always stops at a certain point and you know it will start moving when it passes a certain spot. This would be difficult and is not really recommended, as it would be complicated, need many parts, and be very imprecise (only turning on/off at certain points).

4. There are many other sensors out there, and there might be something I have not thought of.
 

ElectricSpidey

Joined Dec 2, 2017
2,786
Back in my model train days, we just detected the voltage or current on the tracks to determine whether a train was moving or in proximity...hell of a lot simpler and easier than using some kind of motion sensor.
 

Thread Starter

Volphin

Joined Mar 21, 2018
2
Back in my model train days, we just detected the voltage or current on the tracks to determine whether a train was moving or in proximity...hell of a lot simpler and easier than using some kind of motion sensor.
Model railroading has changed to a command control environment today. In 1/48 scale, the scale I model, a constant 18v AC at the track is the norm with remotes using RF, and even Bluetooth from your phone in some cases. The Bluetooth even comes on starter sets today... so conventional operation via transformer throttles has become a dinosaur.
 
Top