"Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better"
A more functional train microcontroller… Power is coming from a 12V wall transformer which powers both the Arduino (at 5V), and the shield(at 12V). The shield provides pulse-width modulated DC to the rails. The microcontroller is programmed to control direction, maximum speed, and rate of change. I am using a momentary toggle switch with center off to increase or decrease speed. The computer is reading the current settings from the controller over a USB connection. Hitting the reset button automatically stops the train.
Holy smokes. That was easy. In one evening I soldered the kit and had my model train doing the “PWM-boogie”. Thanks to Lady Ada for making it possible for wantabe hacks like me to do cool stuff! [and] Added a toggle switch and more code, and now it is a functional train controller. I can set the max speed and max rate of change to simulate a real engine while keeping is easy enough for my 7yo daughter to run. All I need is some positional sensing and I can do some auto reversing, ect. I’m amazed how easy you made this for us! Many thanks Lady Ada!
It has the latest arduino and Ladyada motorshield. There are three pair of LED – green and two red. Red ones are closer to each other and lower – when you walk close, his eyes follow you. There are two stepper motors supposed to lift his arms, but they do not work very good. The morots are from CD drive, and are not powerful enough (they try hard though), or may be motor shield does not yield enough power? There is vibrating motor from toy frontloader. With 12V it vibrates way to fast – you cannot really see it on a video, you can just hear the noise, but when you come close, and it suddenly start vibrating – that’s spooky The ghost, just like a bat, relies on ultrasonic distance sensor…
I had recently purchased a pair of 5V stepper motors and a motor driver shield from the fine folks at adafruit industries which seemed perfect for spinning the knobs. The question was how to connect the steppers to the knobs. As it happens I had also just bought a gear set from American Science & Surplus on a lark and they fit perfectly on the Etch A Sketch shafts and the stepper shafts. So I simply needed a way to line up the steppers over the knob gears.
There are few problems you’ll encounter in life that can’t be resolved with the judicious application of a laser beam. I drew up a set of parts in Corel Draw and popped in to TechShop to cut them out of acrylic with their Epilog laser cutter.
I cut most of the parts out of clear acrylic except for the side guides which you can see in blue acrylic. The side guides hold the Etch A Sketch in place so it doesn’t move around laterally.
Here’s the finished, working ToyBot. ToyBot is made from a cheap RC toy car. I took out the radio electronics and put in an Arduino microcontroller and an Adafruit Motor Shield motor controller and some sensors. ToyBot drives around the floor looking for light (or for shade, if it’s too hot). When it finds a good spot it stops and goes to sleep. It wakes up when the light or temperature changes, and resumes driving.
2 connections for 5V ‘hobby’ servos connected to the Arduino’s high-resolution dedicated timer – no jitter!
4 H-Bridges: L293D chipset provides 0.6A per bridge (1.2A peak) with thermal shutdown protection, internal kickback protection diodes. Can run motors on 4.5VDC to 36VDC.
Up to 4 bi-directional DC motors with individual 8-bit speed selection (so, about 0.5% resolution)
Up to 2 stepper motors (unipolar or bipolar) with single coil, double coil or interleaved stepping.
Pull down resistors keep motors disabled during power-up
Big terminal block connectors to easily hook up wires (10-22AWG) and power
Arduino reset button brought up top (Diecimila/Duemilanove only)
2-pin terminal block and jumper to connect external power, for seperate logic/motor supplies
Tested compatible with Diecimila/Duemilanove (NG is next!)
Download the easy-to-use Arduino software library, check out the examples and you’re ready to go!
No more USB cable, messing with power and timing values. Arduino + MotorShield + ScrewShield + train + hall effect sensor + two magnets = fairly precise stopping.
I used a spare Motor port on the Motor Shield to directly drive a 6 Volt Relay that fires the “Pyro ” electronics – this was a pretty neat trick for the shield to do this (meant less electronics to drive relay).
Arduino is a great starting point for electronics, and with a motor shield it can also be a nice tidy platform for robotics and mechatronics. Here is a design for a full-featured motor shield that will be able to power many simple to medium-complexity projects.
2 connections for 5V ‘hobby’ servos with high-resolution dedicated timer – no jitter!
Up to 4 bi-directional DC motors with individual 8-bit speed selection (so, about 0.5% resolution)
Up to 2 stepper motors (unipolar or bipolar) with single coil, double coil or interleaved stepping.
4 H-Bridges: L293D chipset provides 0.6A per bridge (1.2A peak) with thermal shutdown protection, 4.5V to 36V
Pull down resistors keep motors disabled during power-up
Big terminal block connectors to easily hook up wires (10-22AWG) and power
Arduino reset button brought up top (Diecimila only)
2-pin terminal block to connect external power, for seperate logic/motor supplies