In this Instructable you will learn how to set a communication channel between your Computer and An Arduino based robot. The robot we use here uses a Differential Steering mechanism to move around. I am using a Relay based motor driver instead of MOSFET based ones to reduce the cost of the Robot. By using Relay based motor driver I am giving up the ability of speed control, and there will only be two modes - 'full speed state' or 'off state'.
I am using a 6 cell Lithium Polymer battery having a total capacity of 25.2V at full charged and 22.2V at base charged. I am using a Li-Po battery because of its high current drain capacity for long periods. The motors we used are metal geared Jhonson motors rated to rotate at 100 R.P.M at 12V input voltage. I used 4 of these motors and mounted rubber wheels for better traction.
The communication takes place between 2 Arduino boards via RF channel setup by 433 MHz RF modules(Receiver and Transmitter). The Transmitter module of 433 MHz RF module is attached to the transmitter Arduino, the transmitter Arduino is connected to Computer via a USB Data cable for Serial communication between Computer and the Transmitter Arduino. The receiver Arduino is mounted with 433 MHz RF receiver module and houses all the connections to the motor driver and power supply making it a standalone Arduino. The computer sends serial data to transmitter Arduino which then transmits data via RF Channel to Receiver Arduino, which then responds accordingly!
- Relay motor Control module/ 4 Relay module
- Li-po battery
- Arduino x 2
- jumper wires
- RF 433 MHz Tx and Rx modules
- metal geared motors x 4
- wheels x 4
Step 1: Initialising Python Script
To Execute the Python Script we need to install Pygame library.You need pip(package installer for python) to install Pygame library.If you don't have pip installed in your system, install pip from here.
After pip is installed successfully run command in terminal or cmd "pip install pygame" or "sudo pip install pygame", this will install Pygame library to your system.
Final step to run the script just type in the following command in your terminal or CMD "python Python_script_transmitter.py".
Step 2: Installing Radiohead Library
In our project we are using RF 433 MHz modules for communication so we are using Radiohead library to carry out the communication operations. The steps for installing Radiohead library are mentioned below:
- Download Radiohead Library from here.
- Extract the zip file and move the 'Radiohead' folder to Documents/Arduino/Libraries folder.
- After copying the files restart your Arduino IDE for the library to function.
Step 3: Transmitter Module Connections
The connections for the Transmitter module are mentioned below:
- The Arduino remains connected via USB cable to the laptop/PC running the python script at all times.
- connect +5v terminal of Arduino to the Vcc terminal of RF_TX(transmitter) module.
- connect Gnd terminal of Arduino to the Gnd Terminal of RF_TX(transmitter) module.
- connect D11 terminal of Arduino to the Data terminal of RF_TX(transmitter) module.
- connect the antenna terminal of RF_TX(transmitter) module to an Antenna.(this connection is OPTIONAL)
Step 4: Receiver Module Connections
The connections for the Receiver Arduino are mentioned below:
- The receiver arduino is standalone, so it is powered by an external 9V battery.
- connect +5v terminal of arduino to the Vcc terminal of the RF_RX(receiver) module.
- connect Gnd terminal of the arduino to the Gnd terminal of the RF_RX(receiver) module.
- connect the D11 terminal of the arduino to the Data terminal of the RF_RX(receiver) module.
- connect the antenna terminal of RF_RX(receiver) to an Antenna.(this connection is OPTIONAL).
- connections for the Motor Driver
- connect the D2 terminal of the Arduino to Motor 1 A terminal of Motor Driver.
- connect the D3 terminal of the Arduino to Motor 1 B terminal of Motor Driver.
- connect the D4 terminal of the Arduino to Motor 2 A terminal of Motor Driver.
- connect the D5 terminal of the Arduino to Motor 2 B terminal of Motor Driver.
- connect the Motor Driver ext_supply terminal to +9V terminal of the battery.connect the Motor Driver Gnd terminal to the Gnd terminal of the battery.