Introduction: How to Radio Control DC Motors Cheaply
For the people who don't know what a "VEX" is. It is a company that sells robotic parts and kits. They sell a "VEX" transmitter and receiver on their site for $129.99 but you can get a "VEX" transmitter and receiver for about $20 on "Ebay" and many other places.
The "VEX" transmitter is a 6 channel FM transmitter with 2 joysticks that can go up & down and from side to side. On the backside of the transmitter there are 4 buttons which control channel 5 and channel 6. The transmitter controls can be set to tank-style or arcade-style. The transmitter has a host of other features.
This makes it a very cheap way to remote control servos. The only problem is that you can only control servos motors and you need to buy an expensive $149.99 "VEX" microcontroller just in order to do that. That is until now!
Step 1: How It All Works
This low cost ($14.95) "motor interface chip" can be bought at: http://robotics.scienceontheweb.net The chip can decode the signals from the "VEX" receiver to control up to 8 motor's H-bridges and 1 driver. It can also receive commands from another microcontroller chip to control the motors. This interface chip uses 3 output pins to control a motor's H-Bridge. Two pins to control the motor's direction and one pin to control the motor's speed by using P.W.M.
The chip uses the input from the two buttons on channel 5 to control the input from the "VEX" transmitter left joystick so that it can control 6 motors. The chip uses the input from the other 2 buttons on channel 6 to lock in the high or low output on pin 14 of the motor interface chip.
The motor interface chip has the following features. These features may not work since a receiver may pick up a signal from anywhere. We assume no responsible directly or indirectly from using these parts. WARNING! NEVER USE THE REMOTE ON A ROBOT THAT CAN CAUSE DAMAGE IF IT GOES OUT OF CONTROL. If your robot goes out of transmitter range; the motor interface chip may shut down the motors and give control to a microcontroller if your robot is using one. This may also be true if you turn your transmitter off.
The motor interface chip does not use a serial port to
communicate with other microcontrollers. This means you can use a very inexpensive microcontroller chip to be the brains of your robot.
Putting a low on pin 2 will cause all the motors to operate at half the power level when using the transmitter.
Step 2: How to Hook Up the VEX Reciever to the Interface Chip
Motors, relays and power supplies will cause radio interference; so pick a spot on your robot where the "VEX" reciever is far away from these things. I mounted mine on a 43 in. long mast that was attach to the robot's base.
The "VEX" reciever comes with a yellow cable. Plug the cable into the "VEX" reciever, the other end of the cable plugs into a telephone handset jack. You must buy the jack. Since I will not know the colors of the wires coming out of your jack; I will referent the yellow cable wires. If you look at the yellow cable you will see 4 wires which are yellow, green, red and white. The yellow wire gets wired to + 5 volts. The green wire is the signal and it gets wired to pin 6 on the interface chip. The red wire gets wired to ground. The white wire is not used.
You need to wire a 4.7 K pull up resistor from pin 6 on the Interface Chip to the + 5 volts. You will also want to wire a 2200 uf capacitor across the power wires close to the "VEX" reciever.
Pin 2 is an input pin. It must be wired and NOT left floating. It can be wired to + 5 volts or ground thru a 47 ohm resistor. It can also be wired to pin 14.
Option 1: pin 2 high will give the full range of power to the motors.
Option 2: pin 2 low will give half the range of power to the motors.
Option 3: pin 2 wired to pin 14. When channel 6 top button is pressed it gives the full range of power to the motors. When channel 6 bottom button is pressed it gives half the range of power to the motors.
Step 3: How to Hook Up a Microcontroller to the Interface Chip
Your microcontroller if you are using one can communicate
with the Interface Chip over 3 wires.
Pin 7 on the Interface Chip is the input for the data bit. When the pin is low it is a zero data bit. When the pin is high it is a one data bit. Your microcontroller must output the data bit before the clock pulse. The data bit must be at least 40 us long.
Pin 16 on the Interface Chip is the input for the clock bit. Your microcontroller must output a high pulse for at least .5 us.
Pin 5 on the Interface Chip is an output pin. When this pin goes high it is to let your microcontroller know that it is ready to receive the next command. This pin will go low if the Interface Chip is getting a signal from the "VEX" transmitter. This pin will also go low and stay low if there was a communication error between your microcontroller and the Interface Chip.
Pin 4 is an output pin. If there is a communication error between the Interface Chip and your microcontroller, this pin will go high and stay high . A reset must be done in order to clear this error.
Step 4: List of the Commands
There are 32 commands that the interface chip understands. All the commands are 3 bytes or 24 bits long. The format for the commands are as follows.
The 1st byte that is sent is always the command byte which is the left most number on the list below.
The 2nd byte sent may be a PWM byte. It is a number between 0 and 50. When a 0 is sent the P.W.M. pulse is low which means the motor will be off. When the number 50 is sent the P.W.M. pulse is high which means the motor will be on at full power. When the number 25 is sent the motor will run at about half power. As seen on the list sometimes the 2nd byte is just 0 which is being used just for a place holder. It has no affect on the motor.
The 3rd byte sent may be a PWM byte or an error checking number.
To order motor 1 to go at full speed and motor 2 to go at half speed forward, the command would be.
1 50 25
To order motor 7 to go backward at 10% power, the command would be.
16 5 16
1 Motor 1 & 2 forward, PWM #, PWM # (no error checking)
2 Motor 1 & 2 backward, PWM #, PWM # (no error checking)
3 Motor 1 forward, PWM #, 3
4 Motor 1 backward, PWM #, 4
5 Motor 2 forward, PWM #, 5
6 Motor 2 backward, PWM #, 6
7 Motor 3 forward, PWM #, 7
8 Motor 3 backward, PWM #, 8
9 Motor 4 forward, PWM #, 9
10 Motor 4 backward, PWM #, 10
11 Motor 5 forward, PWM #, 11
12 Motor 5 backward, PWM #, 12
13 Motor 6 forward, PWM #, 13
14 Motor 6 backward, PWM #, 14
15 Motor 7 forward, PWM #, 15
16 Motor 7 backward, PWM #, 16
17 Motor 8 forward, PWM #, 17
18 Motor 8 backward, PWM #, 18
19 All motors speed, PWM #, 19
20 Motor 1 & 2 speed, PWM #, PWM # (no error checking)
21 Motor 1 & 2 stop, X, 21 (pins low)
22 Motor 1 stop, 0, 22 (pins low)
23 Motor 2 stop, 0, 23 (pins low)
24 Motor 3 stop, 0, 24 (pins low)
25 Motor 4 stop, 0, 25 (pins low)
26 Motor 5 stop, 0, 26 (pins low)
27 Motor 6 stop, 0, 27 (pins low)
28 Motor 7 stop, 0, 28 (pins low)
29 Motor 8 stop, 0, 29 (pins low)
30 All motors stop, 0, 30 (pins low)
31 Pin 14 high, 0, 31
32 Pin 14 low, 0, 32
Step 5: Pin Summary
Pin 1 If it goes low it does a rest (MCLR)
Pin 2 If low it only gives one half of the output to the motors
Pin 6 "VEX" receiver
Pin 7 commands and data from another microcontroller
Pin 33 data interrupt
Pin 11 + 5 volts
Pin 32 + 5 volts
Pin 12 ground
Pin 31 ground
Pin 34 P.W.M. for motor 1
Pin 35 High when joystick 1 is left
Pin 36 High when joystick 1 is right
Pin 37 P.W.M. for motor 2
Pin 38 High when joystick 2 is up
Pin 15 High when joystick 2 is down
Pin 16 P.W.M. for motor 3
Pin 17 High when joystick 3 is up
Pin 18 High when joystick 3 is down
Pin 23 P.W.M. for motor 4
Pin 24 High when joystick 4 is left
Pin 25 High when joystick 4 is right
Pin 26 P.W.M. for motor 5
Pin 19 High when joystick 3 is up and top button 5 is press
Pin 20 High when joystick 3 is down and top button 5 is press
Pin 21 P.W.M. for motor 6
Pin 22 High when joystick 4 is left and top button 5 is press
Pin 27 High when joystick 4 is right and top button 5 is press
Pin 28 P.W.M. for motor 7
Pin 29 High when joystick 3 is up and bottom button 5 is press
Pin 30 High when joystick 3 is down and bottom button 5 is press
Pin 8 P.W.M. for motor 8
Pin 9 High when joystick 4 is left and bottom button 5 is press
Pin 10 High when joystick 4 is right and bottom button 5 is press
Pin 14 Stays high when top button 6 is press; goes low when bottom button 6 is press
Pin 5 Tells other microcontroller it can send the next command
Pin 4 Goes high if a command error has been detected
All the other pins are not being used. No need to put pull-ups on these pins.
We have a be nice policy.
Please be positive and constructive.