My dad has a model railway, which he wants to have automated traffic lights on, which will detect an approaching train, go green, then cycle through yellow to red. I am fairly computer savvy, however have no idea where to even start with this project.
If anyone could help me towards some practice codes whichwould lead me in the right direction, or if anyone has done anything similar and has any advice it would be amazing.
I currently have the arduino starter set, and can purchase necessary detectors etc.
Thanks in advance to those who can help
the first thing you need to do, is figure out something to measure. The Arduino can directly measure a voltage between 0v and 5V, or measure ON, OFF (5v or 0V).
With your model train what can you measure?
On fullsize trains they run an electrical signal out one rail, the train wheels and axles are solid steel. The wheel sets act to short the signal across the rails. They measure a current out one rail and back in the other. I am not familiar with model trains.
You other options are vibrations sensors, (usually too sensitive. Most model layout are quite compact), weight sensors( switches under the track that are depressed by the presence of the train), photo interrupters, (photo electric eyes), Ultrasonic (sound radar bouncers, these can measure distance over a small range, usually 2cm to 400cm.
Figure out what you can measure, that will dictate what you need to build. After you have a working 'detector' then you can write the software to use this 'detection' signal to activate your signal lights.
Check out my Kickstarter Project Memory Panes an expansion RAM Shield for Mega2560's. It adds 1MB of RAM for those projects where 8KB is not enough.