Dagu Rover 5 Controller
This is another great project to highlight some of the features of the PiXi-200. This project allows the Raspberry Pi to control a Rover 5 chassis using only the Dagu 4-channel motor driver. It uses a combination of PWM outputs and digital I/O to control motor speed & direction plus it has plenty more I/O to drive LEDs, lamps, servos, interface to a numeric keypad and a 2-line LCD display to allow you to program the Rover 5.
For the motor speed control, the PiXi-200 can provide four separate PWM outputs on the GPIO2 port. The PWM can be directed to any port but in this case we’re using 4 low-current open-collector outputs on GPIO2 because it’s 5V (there’s an on-board pull-up to 5V) which nicely interfaces to the motor driver board. For the direction control we opted to use four high-current open-drain outputs on GPIO2 with an external pull-up to 5V soldered on the back of the motor driver board. Why? Well these outputs were not used for anything else and the were next to the low-current PWM outputs going to the motor so it made some sense. Plus it leaves the other I/O on the PiXi-200 to be used for other things…
For the motor positional / rotary speed encoders we used eight 3.3v I/O inputs on GPIO2 to sense the position of the rotary encoder outputs. The FPGA on the PiXi-200 was modified to include a dedicated rotary encoder decoder to save processing these inputs in the Raspberry Pi. The FPGA provides a 16-bit up-down counter for each wheel that allows the speed, distance travelled & direction of travel to be calculated.
We then added an LCD display using GPIO3 and a 3x4 matrix keypad to allow us to program the movements of the Rover 5.
We also added a piezo sounder driven by a spare low-current open-collector output on GPIO2 so the Rover 5 could make some noise. A programmable tone-generator designed into the FPGA controls the frequency of the piezo sounder’s output.
And with some I/O to spare we added a few LEDs to the front of the Rover 5, including two super-bright white-light LEDs and row of high-efficiency red LEDs which the FPGA can drive with all sorts of patterns… Why? It just seemed like a fun thing to do at the time…
Summary of PiXi-200 functions used in this project:
GPIO1 (24 x 3.3v digital I/O):
8 x I/O used for inputs from the rotary encoders on the four wheels;
7 x I/O used for the four outputs & three inputs needed for a 3x4 button matrix keypad;
8 x I/O used for LEDs mounted on the front of the Rover 5;
1 x I/O spare;
GPIO2 (16 x open-collector / open-drain outputs):
4 x low-current outputs used to independently control the speed of each of four motors;
4 x high-current outputs used to control the direction of each of the four motors (uses a pull-up fitted to the back of the motor driver board);
2 x high-current outputs used to drive two white-light LED ‘head lamps’ fitted to the front of the Rover 5;
1 x low-current output used to drive a piezo sounder using a tone generator designed into the FPGA;
1 x high-current output used to drive a relay to turn on the motor power to the motor driver board;
1 spare high-current output;
3 spare low-current outputs;
Note: 2 spare low-current outputs on the GPIO2 interface could be used as servo controls for a pan/tilt small camera platform capable of carrying the Raspberry Pi Camera Module.
Incidentally, this may be of interest to anyone using the Raspberry Pi Camera Module - We were able to source a longer (FFC) cable for the Raspberry Pi Camera Module from Samtec. Samtec’s FJ-15-R-18.00-4 and FJ-15-R-12.00-4 provide 18” and 12” compatible cables that allowed us to mount the camera on a servo-controlled pan/tilt platform and integrate this onto the Rover 5.
GPIO3 (16 x 5v I/O):
8 x I/O used as the 8-bit data interface for the 2x16 LCD display;
3 x I/O used as the 3-bit control interface for the 2x16 LCD display;
On-board potentiometer controls the contrast on the LCD display;
5 x I/O spare;
1 x I2C port spare;
2 x ADC inputs connected to two proximity / distance sensors for object / obstacle sensing.
6 x ADC input spare;
4 x DAC outputs spare;
10 differential or 20 single-ended I/O plus SPI & I2C are all spare;
Accelerometer & Gyroscope used for motion detection, impact detection etc.;
Magnetometer used as electronic compass for basic navigation;
RS232 Serial Interface:
Could be used as a more advanced programming interface for the Rover 5 than the on-board keypad & LCD provides.
Please see the photos’s in the PiXi-200 gallery for some pictures of the Rover-5 project.
Got any thoughts about this project or want some advice? Feel free to email us at email@example.com.