Skip to main content

After the Actuator in the Lionel Nutcracker Gateman tried to burn down the house last year, it was deemed best to get rid of the noise and hot actuator.   This a overview of what was done and pictures of finished product.

 

  • I built a control board using a Arduino Pro Mini 5V/16MHz sourced from Sparkfun (Adafruit now also has a version of it).  The 5VDC 16MHz version works best with the servo library that Adafruit has for Arduino.  I originally wanted to try to use a ATTiny, but could not get the servos to work well with it, so I went to the easier to use Pro mini.  
  • Since I reused the lights on for the Christmas tree on the gateman, I needed to have 12VDC to get them bright.  For power to the control board, I used a 5VDC regulator fed from a 12VDC power supply.  The 12VDC is used for the tree lights.  I used the output from the 5VDC supply to power the Arduino, the servo, and the LEDs. The LEDs are all triggered via FETs to provide higher currents.  The FETs are probably overkill, but were needed for the first attempt at LEDs.  The Pro Mini board does not have as much current source support, so it is best to trigger external anyways.
  • I used Candle Flickering LEDs (sourced from http://www.evilmadscientist.com/ for the interior lights and also hot glued one to the lantern of the gateman.  This one activates prior to the door opening and soon after it closes.  Just like the gateman lighting his lantern before heading out.  I have LEDs by the windows that are always on.  There are 2 more by the front door that come on when the Gateman comes out.  The front LEDs shut off a few seconds after the door closes.
  • For the trigger, I used a pressure sensitive round resistor with a voltage divider.  When the train presses the resistor, the divider voltage changes.  In code, I have tuned it when the train is present, but not just the track alone.  It works pretty well.   I think a improvement would be to run two of them to be able to activate in either direction so the gateman is out before the train comes by.  This could be done using separate inputs pins and just monitoring both of them.
  • I also have a pin on the Arduino set to activate on a contact closure in the AIU.    There are enough pins that another contact could be added for a localized push button.  I have this set with a pull up resistor to provide 5VDC to the pin when the contact is open and ground (0VDC) when closed.
  • To move the gateman, I am using a small servo that uses the original pivot and mech sans the actuator.  The servo moves about 80 degrees or so.  I do not use the full extent of the movement possible, leaving a bit of space on open and closing to ensure there is no binding.  The door closes enough to not have light show, but it is not a tight fit.  Even with the 16MHz arduino, the servos have a tendency to chatter a bit.  I use the detach and attach commands just before and soon after the movement to be sure that there is no extra buzz.    Also, if you have the movement to tight on open and close there will be chatter.  
  • Mounting and Holes added:  
    • The control board was glued to the side of the house on the inside.  The L shape allowed for the wind to not be blocked.
    • I made a hole in the top that is big enough to gain access to the FTDI pins for programming.  The Pro Mini needs a FTDI adapter to program it.
    • There are 4 LEDs installed in the roof, 1 by each window and 2 by the front door.
    • I did not have to modify the metal as I used the cut out provided for the servo to swing the arm in.  
    • The actuator required it to be cut out.  So the tabs were removed via a dremel.
    • The external wires exit out the rear of the base.  The cardboard bottom is also present.
    • The servo is attached to by double side tape.  The action wire is stripped 20AWG wire.
  • Some other comments:
    • I had tried to add movement to the Nutcracker's arm; my hope was to have the arm swing back and forth.  This did not work.  The first servo tried was too small and did not have the torque to move the arm will out killing itself.  The attempt had the servo glued to the back of the nutcracker.  I did order a better servo, but in trying to get it to work, the arm of the gateman broke off.  That sealed the deal that the arm was not going to move.  His arm is glued tight.
    • The Candle Flicker LEDs are a too white.  It would be better to get a more yellow LED to simulate the lantern.  It still looks cool though.  I started with basic Yellow LEDs, they just did not look right and needed a lot of power to get bright.  That is also why I started with the FETs.  The Candle Flicker LEDs are a lot brighter on on 20mA.  So the FETs are overkill.
    • I went to the pressure resistor for the trigger as it would act funny trying to do a common rail. The ground on the AC and ground on the DC supply do not like to sync.  This was just easier than trying to figure out the grounds.  It is probably about 90% reliable and sometime will not continue to trigger if the train is slow and the cars are light or long.  No big deal though.  If you did not know this and were watching the layout you would have not thought it to be odd.
    • Coding this is very simple overall.  There are many examples on Adafruits learning pages that give you most of the code.  You just need to arrange it and do minor adjustments to get it too work.  Young or old could do this as a first project and have success. 

 

Parts

https://www.sparkfun.com/products/11113  Arduino Pro Mini 5V/16MHz,  Adafruit has a one here that is equivalent: http://www.adafruit.com/products/2000 

http://www.evilmadscientist.com/  Lots of LEDs to chose from

http://www.adafruit.com/products/166  Round force resistor.  This is the same one that also comes in the Arduino beginners kit

http://www.adafruit.com/products/169  Servo, this is the same servo that comes in the Arduino beginners kit

http://www.adafruit.com/products/355  Mosfets, I had these from another project, so they are highly over rated for this application.

http://www.lionel.com/Products...neID=&CatalogId=  Gateman

 

 

Here it is in action on Youtube http://youtu.be/dNq0s1oYLf8 

 

 Nutcracker has come out to play

20141210_202940

 

 

You can see the control board inside

 

20141210_202956

 

Rear of control board

20131123_134519

 

 

Front of control board

20131123_134538

 

 

Top of house with old LEDs shown and FETs.

20131123_145039

 

 

The Flicker LEDs were very bright and bled out of the roof.  A bit of black tape keeps the light from showing under the roof.

20141210_203031

 

 

 

Attachments

Images (6)
  • 20141210_202940
  • 20141210_202956
  • 20131123_134519
  • 20131123_134538
  • 20131123_145039
  • 20141210_203031
Last edited by Mr.Bill
Original Post

Replies sorted oldest to newest

Originally Posted by Mr.Bill:

  • For the trigger, I used a pressure sensitive round resistor with a voltage divider.  When the train presses the resistor, the divider voltage changes.  In code, I have tuned it when the train is present, but not just the track alone.  It works pretty well. 

Could you elaborate on any observations/conclusions on using this vs. the traditional 153C pressure-plate contactor?

 

166-01

Attachments

Images (1)
  • 166-01

 

20141210_203050

 

 

 

 

It works pretty well.  The key is getting the range of values to trigger on sensitive enough to work for most situations.  For my layout that is on the floor, not tied down, and non flat floor, getting the sensor in location that works and have it stay there overtime is why it is not fully reliable.  We used the white snow cloth from Michael's to give a snow covered effect and also to cover various wires.  The power wires for the city buildings run under the track in this area, so the track is not firmly on the carpet.  I have the sensor positioned on top of a AC cord for it to be at a pressure point.  I probably could tape it to the track, but it works well enough where it is.

 

I have the resistor set as a voltage divider with a 1k resistor.  The pin is connected to the middle of the divider.  I experimented with a serial output of the reading to find out the static and active values.  I thought about having a external pot set the trigger point, but did not put it in.

 

Here is the code I use:

int resistorReadTrigger = 990;  // This is set at the top as a global variable.  990 is the current reading that does not trigger with static pressure of the track on the sensor.

 

Here is the pin read and return variable

boolean trainPassING()  // Sub routine
{
boolean passing = LOW; // sets the return variable to low as in Train not passing
int pressureRead = 0;

pressureRead = analogRead(triggerPin); // reads the analog input on the pin, returns ~700 to 1024

if (pressureRead < resistorReadTrigger) { // Does the train pass yes? If the reading is below the static trigger point
passing = HIGH;
}
return passing; // return state of train passing?
} // end train passing

 

 

Here is the main loop:

passState = trainPassING();

if (passState == HIGH)
{
nutOut();
delay(3000);
while (passState == HIGH) // keeps nutcracker out for passing train
{
delay(1000);

passStateCheck = trainPassING();
if (passStateCheck == LOW) // Checking for slow train
{
delay(slowTrainWait);
passStateCheck = trainPassING();

if (passStateCheck == LOW) // If still low, then set to false
{
delay(slowTrainWait);
passState = LOW;
}// end set to false
} // End checking for change or just slow train
} // end while

delay(1000);
nutIn();
} // end if

} // end trainPass

 

Attachments

Images (1)
  • 20141210_203050
Originally Posted by stan2004:
Originally Posted by Mr.Bill:

  • For the trigger, I used a pressure sensitive round resistor with a voltage divider.  When the train presses the resistor, the divider voltage changes.  In code, I have tuned it when the train is present, but not just the track alone.  It works pretty well. 

Could you elaborate on any observations/conclusions on using this vs. the traditional 153C pressure-plate contactor?

 

166-01

I forgot to address the traditional contactor question.  I tried it last year when I made it, but it did not seem to work well with MTH Real track.  I did not spend much time on it as I probably did not have the tension set right.  If the contactor was set correct and would trip as the train passes, then it would work.  You still would want to use it with a pull up/down resistor.  The code also would need to be "debounced" more than if a relay or the voltage divider was being used.  This is easy as waiting a few milli-seconds and taking another reading.  

 

Great project, looks like it turned out very well too. I have a couple of Arduino Uno's and the possibilities are endless, so endless I can't decide what to use them for? Been fiddling with them and they are a really neat device though, I just don't know enough about all the other electronics to make something like you have here. Thanks for posting.

 

Lee, as creative as you are, I think you could really get some good use from the Arduino's. You already know about the other electronic pieces or end devices needed to make things work like Mr. Bill has here. Although I'm not real good with the code, with a little study it isn't too bad to learn the basics. I think you would really like it.

Originally Posted by Lee Willis:

Interesting. Nice project.   I have wondered about Arduino and if it is worth getting involved with and learning in order to use it on projects.  

Lee,

Arduino is a pretty nifty system.  Back in the day in engineering school, projects like this were totally out of reach and required a bunch of individual chips or years of experience in microprocessors.  With Arduino, if you can think logical and type, solder, then you can make almost anything.  The community has developed many software libraries and example projects, add on boards and more, that you can practically not write much code at all to pull together a working project.  The Arduino starter kit sold at Adafruit has great mini projects that cover most of the needed items for simple projects.  If you want to get advanced and fancy, Arduino can still work for these.  Professor Chaos on this forum did a complex train layout control using RFID tags on the trains (identifier chips), sends DCS remote commands, controls switches and lights...  He sent me his project files, it is very advanced.   This little gateman is child's play in comparison.

 

  • I like the stuff from Adafruit best.  They have great teaching projects and code library's to make using things like servos easy as pie.  They also have weekly videos on many things, even have a show and tell series.  https://www.adafruit.com/ 
  • Sparkfun sells similar stuff, but I have found their examples harder to follow.   www.sparkfun.com
  • As for youtube tutorial, Jeremy Blum made some great starting with Arduino videos: https://www.youtube.com/user/sciguy14 

Mr. Bill, great idea and great post. This is the best of the hobby right here.

 

Of course, you could have written a bunch of demanding threads requesting Lionel to make this. OR better idea, you do it yourself.

 

And to those who feel intimidated by taking on such a project, my advice... start simple. There are loads of simple improvements and projects one can do to make your trains and layout distinctly yours. As your skills improve, you move up a notch.

 

YOUR skills may not be up (in your mind) to some of the projects you sometimes read about here on the forum. But you'll never get better until you get started. Kit bashing Plasticville or re-doing old beater trains is a great way to learn without risking goofing up on something you really value.

 

And of course, Mr. Bill here has pretty clearly outlined his project, so if you like it, bookmark it as SamM did.

 

Great idea Mr. Bill.

Last edited by brianel_k-lineguy
Originally Posted by Miken:
Very nice.  I like the idea of using the Arduino on train projects.  This is what I want to do:
 
 
Then I want the Arduino to communicate with the SER2 to control my trains.

Thanks for the link! I would like to also try that someday. Professor Chaos (maybe it was Prof Chaos?) a forum member here has gotten his layout automated, and I think he was also using Arduino. He has posted to some threads here, but I got lost on some of the details in the threads. I believe there were other members trying the same thing as well, not sure of their success rates?

RTR12,  

I would bet the automation success for DCS is pretty low the way the Chaos did it.  DCS is also not a open command system like TMCC.  TMCC engines could more easily be managed.  

 

The older conventional methods, especially DC power trains, were much easier to manage in block controls.  If you search on automation terms, that is all that is found.  It is a shame that DCS does not make it that simple.  The record back feature in DCS is good, but I have not found it to be good enough to leave trains for on track for an hour without needing some intervention.  I only have several engines and they loose or gain too much distance in each loop.  There is no way to have additional or less delay for a actions automatically.  Blocking systems in the DC days did this as trips were used to open and close blocks.

 

The new Lionel LCS track piece looks promising for adding the ability to do real controls, but it is too pricey to put in. At $100 a station, a large layout may take 10 of them or more to do full automation of routing; that is $1000 bucks.  Then only some of the engines are compatible.  It is too over priced to be adopted.  I guess for this I am with Brian, I guess I will just have to moan to Lionel and MTH about it or just make it myself. 

 

 

Originally Posted by Mr.Bill:

RTR12,  

I would bet the automation success for DCS is pretty low the way the Chaos did it.  DCS is also not a open command system like TMCC.  TMCC engines could more easily be managed.  

 

The older conventional methods, especially DC power trains, were much easier to manage in block controls.  If you search on automation terms, that is all that is found.  It is a shame that DCS does not make it that simple.  The record back feature in DCS is good, but I have not found it to be good enough to leave trains for on track for an hour without needing some intervention.  I only have several engines and they loose or gain too much distance in each loop.  There is no way to have additional or less delay for a actions automatically.  Blocking systems in the DC days did this as trips were used to open and close blocks.

 

The new Lionel LCS track piece looks promising for adding the ability to do real controls, but it is too pricey to put in. At $100 a station, a large layout may take 10 of them or more to do full automation of routing; that is $1000 bucks.  Then only some of the engines are compatible.  It is too over priced to be adopted.  I guess for this I am with Brian, I guess I will just have to moan to Lionel and MTH about it or just make it myself. 

 

 

I've learned a little more since reading the threads about the layout automation, maybe a re-look is in order one of these days? They did make it sound like it was easy for them to do. I have some Arduino stuff, but all I have done has mostly been with LED's and one or two other things. I did manage to make some LED's operate like traffic signals, but haven't tried any train detection or that type stuff.

 

I re-entered the hobby about 3 years ago and was seriously thinking about going conventional and doing some block control like forum member Dale H does. I find this very interesting as well. However, I couldn't resist the DCS and Legacy engines and controls, so I am all electronic command control.

 

I don't have a Lionel sensor track yet, but plan to get one. Those do sound very interesting as well. I agree with you about the price however. Lionel has stated they may release a sensor that is adaptable to track systems other than Fastrack. Would be nice if they also released a kit and got the price down where you could afford a few on your layout. I have diesels only, so the 10 sensor tracks you mention would be 2 new engines for me. Tough choice there. Haven't had time to look at Miken's link above, but that looked interesting and I plan to study it further soon.

Add Reply

Post
×
×
×
×
Link copied to your clipboard.
×
×