Moving Holonomic Robot
Two file are needed to be able to move the Holonomic Robot. UART_pi_move.ino contains the state machine for UART communication with the Raspberry Pi Zero and it also has the code for generating the PWM signals for the three motors and setting their directions. The Arduino Software IDE could be used to flash the code to the Pro Mini. key_move_UART.py contains the controller to be able to move the robot with a keyboard from the Pi zero. The two files can be obtained from running the following command:
Arduino Pro Mini
The following pins are used on the Arduino Pro Mini:
Pins (3,9,10) - PWMs for Motors 1, 2, and 3. Pins (11,12,13) - Direction control (through a NOT gate) for Motors 1, 2, and 3. Pin RX1 - UART connected to TX from Pi (Note: 5V (Arduino) to 3V(Pi) voltage divider is needed to protect the Pi, since the Arduino RX1 is seen to be set to HIGH sometimes. Pin RAW - Unregulated voltage upto 12V (regulated to 5V using on board regulator). Pin GND - Ground for all the components
UART_pi_move.ino - UART communication is as follows:
Pi -> Mini Pro
- Send 1 or 2 or 3 [Wheel No.]
- Send 5 or 6 [Wheel Dir.]
- Send 0 - 255 [Duty cycle sent is converted from percent to be in range [0 - 255]]
- Repeat for number of wheels (i.e 3)
- Sending 1 and then 8 at anytime triggers ASM RESET
Raspberry Pi Zero
Not much setup is needed on the Pi Zero. The only connections needed are:
Pin 8 (UART0_TXD) - Connected to the Arduino Pro Mini through the 5V->3V voltage divider Pin 6 (GND) - Ground for all the components
The UART Rx was not needed since the Arduino doesn't have to send back any data, however it could be connected for debugging purposes.
key_move_UART.py - This program accepts keystrokes from the user to control the robot.
- (W,A,S,D) - Forward, Left, Backward, Right
- (N,M) - Rotate CCW, Rotate CW
- (J,L) - Circle CCW, Circle CW
- (K,Q) - Stop Moving, Quit Program
To run this file 'cd' to the directory you copied key_move_UART.py and run the command 'sudo python key_move_UART.py'