John asked a question about how to control motors from an MSP430, so I thought I’d make a post about it. This is a post-in-progress, since I’m at home looking after my baby boy and he won’t let me write much continuously. If you have suggestions to where it should be improved, let me know and I’ll add stuff.
First choose motor type. If you use modified servos, you can just connect them to your microcontroller (MCU) and upload the right code. If you use plain DC motors you need a motor driver chip or board, such as the L298. You probably want geared DC motors, since they aren’t as fast as non-geared ones. Connect the driver to your MCU and upload the right code. The speed of the motors is controlled using pulse-width-modulation.
Software-wise you can either choose Arduino (or the MSP430-equivalent called Energia) or go for the C-approach. C is more difficult, but maybe more powerful. Arduino/Energia works great for many robots and I used this for several years before I moved to C as a programming platform.
Read on if you’re interested. More details and instructions below.
Here is a laser cut rover I’ve made, using the LCD-button-board as the controller. The motors are cheap, modified Hobbyking servos. It’s a very simple build, and it is programmable using the keys on the LCD-board. The LCD-board has connectors for two servos and one sensor, giving access to two IO (one of which is P1.6, an analog input, required for the IR sensor).
The software is programmed using Energia, which is an Arduino-clone for MSP430.
The firmware used on the video is here and you also need the LCD library for the board, which is here. If you think this is interesting you may also want to look at one of my other, even simpler builds, which requires less components.
If you’d like to make one yourself, you can do it without the laser-cut kit also. You can just get a 3-cell battery box as on the picture and use double-sided tape to glue the servos on top of it, and the board on top of the servos. Use something round (CDs?) as the wheels. Will work fine. But make sure you use 3 NiMH batteries (1.2 V each, 3.6 V in total), since this will give a good voltage you can feed directly to the servos and to the MSP430/LCD without breaking anything. If you use 3 Alkaline batteries, you need a regulator for the MSP430/LCD.
If you want a laser-cut kit, I can make one for you. Send me a message and I’ll add it to the store.
I’m trying to make a low-cost robot kit, and part of this should really be a low cost Infrared Proximity sensor. Here’s the schematics. Ignore the photo-sensors on the right. They are for if you don’t want an IR sensor and you just want to sense the difference between light/dark on two sides of the bot.
It works, but not for very long distances. I’m using it for sensing for example 10 cm, which is fine for a robot.
There seem to have been some formatting issues with my biped arduino code. You can download it directly from this file instead. Put it into arduino (it has a c-extension, but is an Arduino sketch really).
Here’s a simple biped I’ve printed using my Makerbot. It’s printed in clear PLA, which I think looks quite nice. The design is rather poor, but it walks ok. This one here runs with a standard radio control, but I’ve tried it with Arduino and Launchpad MSP430 also. Maybe I’ll fix it up to look a bit better.
It uses 4 cheap servos from Hobbyking, and a cheap remote from Hobbyking. You can easily build this robot with wooden sticks or similar, without a 3D printer. There are several examples on Youtube of this. This version is not as complex as my other biped, but this one is much simpler to build (and control). It uses a 2 cell LiPo battery and an ESC to convert down to 5V for the receiver and servos.
2 x wheels. I 3D printed mine, but you can make these from many other things
2 x light sensitive resistors (LDR). < 1 USD each.
A battery pack with 3 rechargeable AA NiMH batteries, totalling 3.6 volts (Don’t use alkaline!)
The source code is available here (Google login required).
Program the Launchpad, connect one servo to pin P1.0, one to P1.1. Connect the two resistors in series with VCC and GND in each and, and connect the middle point of them to P1.5. Then connect the power to the servos and to the VCC/GND of the Launchpad. Add a power switch for convenience. 3 x NiMH AA make 3.6 Volt which is fine for the Launchpad. If you use Alkaline batteries, the voltage may be too high, and Alkalines aren’t very good for robots anyway.
Servos have three connectors. The darkest on one side is ground and connects to ground (-) on the battery and ground on the launchpad. The middle is power and connects to the battery (+) and VCC on the launchpad. The third one (sometimes white or some other light colour) is the signal, connecting to P1.0 and P1.1 as mentioned above. You need to modify the servos for full rotation. This involves connecting it to a signal that centers it (90 degrees), opening it up, removing the gears, soldering the stick that goes into the potentiometer so that it won’t rotate any more, making the hole of the outer gear bigger, so it won’t stick to the pin but rotate freely, putting the gears back together. There are many videos on youtube for this, and it’s done in 5 minutes. It gives you a simple controllable gear motor at a low price.
This robot can be modified for example to a line (black tape) following robot, quite easily.
To assemble the robot, use for example double sided tape. Start with the battery holder on the bottom. Then tape the servos onto this. Then tape the Launchpad onto the servos. Done.
There’s this kid who wants to control a tank from his standard remote control, but it’s been difficult to find the right parts at the right price, so I made a component for him.
It’s basically a motor controller, powered by an MSP430 that takes PWM input from a standard remote control’s receiver. It can drive back and forward. It’s based on the cheap value line MSP430 that comes with the Launchpad.
It receives the two PWM signals from a standard RF receiver, takes the time of the PWM pulse the receiver sends (typically to a servo), calculates whether it should be moving the motor forward or backward, generates two new PWM signals and control signals for a cheap motor controller called L293D to drive the two motors of the tank. It can go backward and forward. I’ve made code examples that uses two sticks, one for each motor, and one that has a more traditional left, right, forward, backward control. The MSP430 code is posted below. Feel free to use the code as you wish. Give me credit if appropriate.