I am kind of new to Arduino and electronics. I am a software professional and have a fair idea about C language. I am 3D print hobbyist. I have basic knowledge of electronics.
Recently, I purchased Alaska Freight Lionchief set O gauge model. Power to the train is supplied through the tracks. I am trying to build now 3D printed custom train tracks for the train. I need some advice on how I can design my track system with Arduino.
I am planning to use ARduino nano 33 IOT for this project .
Track system will have below features:
- All tracks will have 4 LED lights. I want to control LEDs through ARduino. Arduino should be able to switch off lights for individual tracks.
- MY 3D printed tracks will be set of either small straight or curved tracks with maximum length of 10 inches. Each track will have three rails made of conductive material. Power to the train will be supplied through tracks (middle track is +18v and outer two tracks are ground.). I am basically replicating the same power delivery system that came with original train set. I do not have to worry about the power supply adapter because I will use the existing one.
- Each individual track can be taken out of the power delivery system so that one particular section of the track system will go out of power. This is to stop a train in that section only. However, other trains running on same track on other sections will not be affected due to power loss in one track. I plan to use relay to cut the power supply to middle track through Arduino.
- I plan to add a sensor on each track to detect whether the track has train running on it. Idea is, Arduino should be aware of where is the train running. I will probably use color detectors to use this.
For above requirements, I am trying to figure out what ICs and bus system I should. In total, I need to build 72 such individual tracks so I am sure that I need at least 7 bit address system to identify individual tracks.
Problem which I am facing is:
- What bus system I should use? - I am trying to explore I2C bus system but I am not able to figure out ICs which will go on individual tracks
- Two way communication is needed - A) from Arduino to individual tracks - to turn off power supply or control LED lights B) Tracks to Arduino - to indicate if current track has train running on it.
I was thinking to use 8 bit shift register to control LEDs. But this approach require lot of bus running through all tracks unnecessarily. Same problem persists if I try to read track input through shift register.
Any advice on how should i address these problems?