Quick Video of a hardware
POC, will upload another version of this video with narration later. When I say POC, I mean this is purely for learning, will use these findings to come up with the final design. Also, I'm new to this stuff, I do iOS software development, but am learning Arduino for the first time.
1. have 2 sonic sensors (HC-SR04), a eastbound and westbound which will detect the presence of a train, and know it's direction of travel. I chose sound over light detection because I wasn't a fan of how much light you had to have on in the room for the sensors to work normally. I also did a version using voltage detection, but then it would only detect the engine and not the whole train
... Everything is connected to the
Arduino Mega.
I've also used a
Uno for testing, but opted for the
Mega because the signal bridge has SO many lights. The sonic sensors use the great New
Ping library (https://bitbucket.org/teckel12/arduino-new-ping/wiki/
Home).
2.
Once a train is detected I activate my crossing gates (NJI 1164, only showing 1 here in the video because I broke the other one) These are controlled by a servo mounted underneath the board (this uses the Servo library). The crossing gates lights are common anode. Also at this time I'm using a 5v active low relay to toggle 12 vdc to the Innovative
Train Technology Products HQ-300 module (make sure you get the 5v active low version, I mistakenly got the 12v active low version*), which is in loop mode, so the modern crossing gate sound turns on. Depending on the track/direction, the BLMA 3 track modern signal bridge will update as well. (only have the middle ones working right now as I only have 1 pair of sonic sensors hooked up, also these lights are common anode, so remember 5v is common, ground/
LOW to turn them on). Everything in the program is done with timers, no delays used here.
3. I also have a Bluefruit LE
UART Friend board hooked up in hardware serial, that I'm connecting to with a custom iOS app I built.
Hardware serial is
DEAD simple, and easiest way to send data back and forth to the
BLE board. For the iOS app, I used the Bluefruit iOS swift example to get important info like the hardware
UDID and how they were handling central/peripheral. The app right now activate the crossing gates, can reset the signal bridge, and can fire the Circuitron slow motion tortoise. Will expand this app out with more functionality, and when I have a layout
I'll make a iPad version.
4. The slow motion tortoise is connected to a 2 channel relay, to handle both forward and reverse scenarios of the dc motor. That relay also controls a 12 vdc source, and I have it on a timer in the program to only feed voltage for a few seconds. The tortoise itself has a relay which toggles the NJI dwarf and in the future power to the frog on the turnout.
Currently the dc motor is causing some
EMI to the servo when it's moving, will upgrade all the wire to shielded/twisted, and maybe add some filters soldered across the motor terminals in the final version.
* with the 12v active low version, the led lights will light up and change on the relay, but you'll notice the relay itself doesn't fire because Arduino is only 5v
- published: 17 Apr 2016
- views: 6