Search the Community
Showing results for tags 'motorized switch'.
Found 1 result
Phoxtane posted a topic in LEGO Train TechI finally have good pictures of the demonstrator model for my take on a cheap no-modification-required switch track motor. Have a look! The key that makes this work is that the servo acts on a slider, which pushes on the little spring-loaded switch point piece, rather than forcing the lever mechanism back and forth. As such, it takes very little force to change the switch from open to closed and vice versa. I'm using two of the 1x1x1 corner panels to trap the servo horn so that it pushes the slider back and forth, while a 2x2 corner tile pushes the point piece backwards and forwards. The actual switch lever needs to be in the 'open' position to allow the point piece to move back and forth properly; otherwise, the switch will stay closed even when the servo releases the point piece. I'm using an Arduino Uno, but you could use any Arduino or compatible clone as long as you get the pins hooked up right. It's a lucky coincidence that the servo is the size it is; two of the 1x2x3 panels form a nice enclosure that keeps it from moving about too much. It's important to get the older style that don't have the reinforcing ridges on the edges, as otherwise it won't fit. I used a small piece of paper folded on itself a couple of times to keep the servo wedged in tightly. I imagine you could use some of those 1x2 bricks with the vertical groove in them to help hide the servo cabling, but I didn't bother since this is only a demonstrator. Here's a better view of the setup without the track in the way. My servos came with a pack of three differently-shaped horns to put on them - I'm using the shortest one available to me (mine was 19.5mm long with six small holes in it and was the only one with one 'arm' on it). I also have not permanently attached it with the screws that also came in the package, mainly for the purposes of testing. Lastly, here's a picture of the support structure I built up to keep everything in place. I also made an LDD file of the structure as well as the slider mechanism and servo holder so that you can build your own! http://bricksafe.com/files/Phoxtane/digital-model-files/servoswitchtrack.lxf The hard part of this built is not the mechanism, but setting up the servo as well as the Arduino controller. If anyone is interested, I can do a more in-depth post on how these servos work and how to use them, but the basics go something like this: Attach the servo to the Arduino using the diagram on this page: https://www.arduino.cc/en/Tutorial/Sweep Test your servo to make sure it's working using the example code on that page (the servo should slowly move back and forth between its endpoints) Center the servo at 90 degrees - http://www.allbot.eu/build/allbot-arduino/centering-a-servo/ - this puts the servo at a known position for use in our mechanism Place the small one-arm servo horn onto the servo spline so that it's pointing across the servo body, not away from it. This allows the servo to reach the little pocket we've built and actuate the slider. This is the tricky part; you have to play around with the Arduino code to calibrate your servo for its switch track. These servos are mass-produced as cheaply as possible, so the actual physical position of the horn at the 0 and 180 degree endpoints will vary somewhat from unit to unit. For my servo, the two positions the servo should move to for a closed and an open switch are about 83 degrees and 113 degrees, respectively. The corner tile should barely touch the point piece when open, and should keep the point piece tight against the outside track piece without the servo struggling or forcing itself out of position. I made some minor improvements to this code for my demonstrator - the servo doesn't sweep between positions, but jumps between them, so it's faster to actuate. I also have the Arduino disconnecting the servo in between movements so it doesn't 'hum' while waiting to move to the next position. General improvements to this model would include building the mechanism out of DBG and black for the servo holder, as well as tidying up the wiring to the servo. The servo horns stand out quite a bit color-wise, but since they're nylon, they could easily be dyed black to match the servo housing, and the silver-colored screws that come with the servo horns could be touched up with some paint or nail polish to turn them black as well. The only downside to this mechanism is that you can't run a train backwards through the straight part of the switch when it's closed, since the point piece can't move out of the way. Since this is already being controlled by a microcontroller, it wouldn't be difficult at all to add some sort of sensor that would open the switch when a train is approaching it from the wrong side. As for overall cost, beyond the price for the pieces needed to build this barebones mechanism (I had all of the pieces in my collection): I bought a ten-pack of these servos for $2 apiece, and if you don't already have one, a small Arduino starter kit can be found online for $25. The Arduino Uno has six analog pins, so it can potentially control up to six servos at once. If you're starting out from scratch, the total cost for six motorized switches would end up being around $37 - which is much cheaper than the ~$125 it would take to build this out of genuine Lego parts (one battery box, six M-motors, three IR receivers, three IR remotes), and it doesn't take any PF channels.