Sometimes early mistakes make you work twice as hard later.
When I set to build this layout I was considering a NCE DCC system with JMRI but eventually I landed on a PiSprog. This presented challenges as its a open book but not well documented on how to input sensors and such.
I knew when I started that I wanted to go with switch machines but did not want external decoders and switch machines like the venerable Tortoise and the SMAILs were not well tested. I went with Walthers Switch Machines but they presented a challenge. They have a form of DCC decoder in them won't report to the DCC system when you do a local trigger of a route change. Fortunately Walthers was smart enough to put limit switches on the side which can be used to trigger a Arduino sensor shield for reporting. I will cover this in a later post.
The shield also comes with a added benefit of Caboose Ground Throws can be used to report the status of their routing to JMRI. The easiest way to do this is to buy the ground throws with built in contacts. I did not do such a thing because I did not come up with this idea until after I had all the normal ground throws installed. This is where Geoff Bunza from Model Railroad Hobbyist comes in. His SMA28 Blog about covers a project that uses a Arduino Sensor Shield and a Mega 2560 to send sensor updates to JMRI via scripts. His work saved me a lot of time and effort figuring this out myself. Below I will go over how to set this up.
List of Materials: (none are affiliate links at the moment)
Arduino Mega 2560(first party version but clones work well for much cheaper)
Arduino Sensor Shield for Mega 2560
Hall Effect Sensors (only if you are installing on the ground throws with no contacts)
Servo cables long enough to connect to the hall sensors
Magnets the stronger the better 2x1mm (if using the hall effect sensors)
Caboose Ground Throws, contact version or normal.
First you need a working JMRI setup, be it on a PiSprog, a Pi running it linked to NCE, Digitrax or ESU etc. Next head to Geoff's blog and SMA28, set up the Arduino Mega 2560 and Arduino Sensor Shield. Once you have this setup you can easily test this by crossing the Signal and Ground pins on one of the sensor headers. Once you have this working right you can move onto the next step.
Next you will need to take your hall effect sensors and desolder the sensor itself from the board if your base board and scenery are deeper than the lead on the sensor. It is as simple as soldering the actual sensor itself and soldering in longer wires then wrapping the exposed leads on the sensor.
It should look like this on the right. Stock sensor on the left.
Next you will want to mount the magnet to the throw arm of the ground throw. At this point you have a choice to make, what side do you want to be sensed, be it continuing or diverging. That doesn't matter beyond your own spacing and what logic you will use later in JMRI. The side you want to be sensed should have a side facing the layout baseboards, this is where you will glue the magnet. These sensors are directional so they will only sense one side of the magnet, you want to check which side the magnet is sensed by the sensor and mark it with a sharpie, this will be the side away from the ground throw arm. Glue the non marked side now, you can paint it black to hide it.
The end of the arm will look like this when done.
Mark a hole in the baseboard and then drill a hole through just large enough to fit the sensor head. Feed the sensor head up through the layout and bring it up with some of the slack. You will likely want to bend the head of the sensor perpendicular to the wires so the sensor ends up parallel with the ground, the side facing up should be the side with the writing and also the beveled edges. Pull the sensor back down and then put the turnout arm back in the position you want the sensor to activate in. Adjust the sensor head until the light on the sensor board lights up, you are now adjusted and can glue the sensor in place. Scenic as necessary, paint and thin sand over the sensor won't impact sensing, but test it before you commit.
It should end up looking like this.
I knew when I started that I wanted to go with switch machines but did not want external decoders and switch machines like the venerable Tortoise and the SMAILs were not well tested. I went with Walthers Switch Machines but they presented a challenge. They have a form of DCC decoder in them won't report to the DCC system when you do a local trigger of a route change. Fortunately Walthers was smart enough to put limit switches on the side which can be used to trigger a Arduino sensor shield for reporting. I will cover this in a later post.
The shield also comes with a added benefit of Caboose Ground Throws can be used to report the status of their routing to JMRI. The easiest way to do this is to buy the ground throws with built in contacts. I did not do such a thing because I did not come up with this idea until after I had all the normal ground throws installed. This is where Geoff Bunza from Model Railroad Hobbyist comes in. His SMA28 Blog about covers a project that uses a Arduino Sensor Shield and a Mega 2560 to send sensor updates to JMRI via scripts. His work saved me a lot of time and effort figuring this out myself. Below I will go over how to set this up.
List of Materials: (none are affiliate links at the moment)
Arduino Mega 2560(first party version but clones work well for much cheaper)
Arduino Sensor Shield for Mega 2560
Hall Effect Sensors (only if you are installing on the ground throws with no contacts)
Servo cables long enough to connect to the hall sensors
Magnets the stronger the better 2x1mm (if using the hall effect sensors)
Caboose Ground Throws, contact version or normal.
First you need a working JMRI setup, be it on a PiSprog, a Pi running it linked to NCE, Digitrax or ESU etc. Next head to Geoff's blog and SMA28, set up the Arduino Mega 2560 and Arduino Sensor Shield. Once you have this setup you can easily test this by crossing the Signal and Ground pins on one of the sensor headers. Once you have this working right you can move onto the next step.
Next you will need to take your hall effect sensors and desolder the sensor itself from the board if your base board and scenery are deeper than the lead on the sensor. It is as simple as soldering the actual sensor itself and soldering in longer wires then wrapping the exposed leads on the sensor.
It should look like this on the right. Stock sensor on the left.
Next you will want to mount the magnet to the throw arm of the ground throw. At this point you have a choice to make, what side do you want to be sensed, be it continuing or diverging. That doesn't matter beyond your own spacing and what logic you will use later in JMRI. The side you want to be sensed should have a side facing the layout baseboards, this is where you will glue the magnet. These sensors are directional so they will only sense one side of the magnet, you want to check which side the magnet is sensed by the sensor and mark it with a sharpie, this will be the side away from the ground throw arm. Glue the non marked side now, you can paint it black to hide it.
The end of the arm will look like this when done.
Mark a hole in the baseboard and then drill a hole through just large enough to fit the sensor head. Feed the sensor head up through the layout and bring it up with some of the slack. You will likely want to bend the head of the sensor perpendicular to the wires so the sensor ends up parallel with the ground, the side facing up should be the side with the writing and also the beveled edges. Pull the sensor back down and then put the turnout arm back in the position you want the sensor to activate in. Adjust the sensor head until the light on the sensor board lights up, you are now adjusted and can glue the sensor in place. Scenic as necessary, paint and thin sand over the sensor won't impact sensing, but test it before you commit.
It should end up looking like this.
Alternatively you could use another one of Geoffs ideas and put the magnet on the end of the tie bar opposite the ground throw and basically flush mount the hall effect sensor as seen here from Geoff.
Photo to come later.
Next you are going to want to mount the hall sensor in some way. I am just hot gluing them to the bottom of the layout. It makes them easy to remove should they by some super slim chance go bad or need adjusting. I may pick a better solution later but I don't want to make the harness to the hall sensor too long. After this you can plug the hall board into sensor shield. Just match the S pin on the shield to the S pin on the hall sensor. Pick a color standard and stick to it and pick a sensor header on the board, this will be the sensor you will be using in JMRI. You cannot pick sensor 1 due to limitations explained in SMA28. Also don't worry if you manage to burn out a sensor on the arduino. The rest should work unless you force a lot of voltage down the line. If you burn to many sensors you can replace the Mega.
If you see a red light when the magnet is near you are good to move on to the JMRI configuration.
Actually at the moment the JMRI side of things will come shortly, I will publish this now because I am the only one here.
You made it this far, in my next installment I will cover sensor feedback from Walthers Switch Machines back to JMRI for when you use fascia control.
Comments
Post a Comment