Update!: You can now buy AlaMode at Seeedstudios
Here’s an example of using the AlaMode with the Raspberry Pi.
We had a great time demoing the AlaMode at MakerFaire. We got invited to demo in the MakerShed, because …. Surprise! MakerShed is going to carry AlaMode!
For this demo, I took an adafruit motorshield and used it to modulate the power to a 9V Lego train track.
- Photo by Brian Kronz
The Arduino code is pretty simple, using Serial.read to interpret single characters as commands for controlling the motor shield. “f” means forward, “b” means back, “s” means stop. 1-9 sets the speed. You’ll also need to install the AFMotor library.
Program the aalegotrain.ino sketch from here: https://github.com/wyolum/alamode/tree/master/examples/train_demo
You can either do this with an FTDI cable on another computer, or directly with the Arduino IDE on the Raspberry Pi.
The ala-modey part of this is to use the AlaMode to do the controlling motor bit. The Raspberry Pi will control the train through a web interface.
Install lighttpd on the Pi (sudo apt-get install lighttpd) and put the web files from the example into /var/www.
- photo by Drew Fustini
It’s a little slow because it’s a simple CGI script (spins up a whole process with each request.) A python script interprets button presses on the web page, and uses pyserial to send the characters to AlaMode.
Drew Fustini of Element 14 did a great blog post on our demo.
Here’s a video he posted:
[youtube]http://www.youtube.com/watch?fv=y-9g_mfdFhc[/youtube]
If you have any questions, join the conversation at the Wyolum forums.