Hybrid Rover - Cloud Controlled Robot
by Satyavrat in Circuits > Raspberry Pi
1371 Views, 6 Favorites, 0 Comments
Hybrid Rover - Cloud Controlled Robot
I've always been very interested in using the IoT paradigm to actuate real robots that can move. And trust me, it's a really wonderful feeling when you press a button somewhere in the world, and a robot moves somewhere else. However, I've always used a PC or Laptop to control these robots, so it's never quite been a standalone system. I did use an Android phone once, but even that was connected to a third party cloud service.
This one however, is built ground up. From hardware connections to socket based firmware, all of it is custom built for this robot. You're free to modify any of the code, and I'd really be interested in what you make of it, but do it at your own risk! (That's not to say that your robot will explode if you change the code.) This robot uses a Raspberry Pi 1 model B base, an old one, to control a motor driver circuit connected to two DC motors to move the robot to and fro. The Raspberry Pi receives signals from an Intel Edison which is interfaced to TI's Educational Booster pack Mk II. The user gives an input using either the Booster Pack's joystick or the inbuilt accelerometer, depending on the state of a digital GPIO. The Edison and Raspberry Pi communicate over TCP/IP sockets, so the results are real time.
Required Materials
You'll require the following components for this project
Hardware components:
- Intel Edison×1
- Raspberry Pi 1 Model B×1
- TI LaunchPad BOOSTXL-EDUMKII Educational BoosterPack MK II×1
- 8 volt battery×1Linear Regulator (7805)×1
- Texas Instruments Dual H-Bridge motor drivers L293D×1
- DC motor (generic)×2
- Adafruit USB WiFi (802.11b/g/n) Module with Antenna for Raspberry Pi×1
- Jumper wires (generic)×16
Hardware
One of the more aesthetically important elements of this project is the chassis. After days of breaking my nails between Legos, I've finally made this chassis for the robot and controller using the Lego Mindstorms kit. The robot chassis has a battery bay, two motor harnesses integrated to the spine to offer more rigidity, a Raspberry Pi pseudo case, and finally, literally like a cherry on top, the motor driver circuit harness.
I've found this method of prototyping to be very effective over stuff like cardboard or wood.
Software
The robot and the controller each has a Python script to be uploaded to it, which I have configured to run at startup as firmware using a shell script for Raspberry Pi, but I won't go into it in detail. Google shall guide you.
- The robot firmware follows the following routine
- Initialize TCP server on Raspberry Pi on selected Port
- Listen for incoming messages
- Accept connections and receive data
- Parse received data as an integer
- According to received data, move the robot motors.
- The robot can move in the following directions
- Forward
- Reverse
- Left Turn
- Right Turn
- Right Tank Turn
- Left Tank Turn
- The controller firmware follows the following steps
- Initialize Analog and Digital Inputs
- Check value of selection pin
- If selection pin value is ground, switch to accelerometer control
- Accelermeter values are read
- Value is selected to robot depending on tilt of the accelerometer on the X and Y axes.
- Value is parsed as a string payload
- Payload is sent to Raspberry Pi
- If selection pin value is supply voltage, switch to joystick control
- Joystick values are read
- Value is selected to robot depending on tilt of the joystick on the horizontal and vertical axes.
- Value is parsed as a string payload
- Payload is sent to Raspberry Pi
Connections
Connections for Raspberry Pi are as follows
- Pin 12 - L293D Input 1
- Pin 16 - L293D Input 2
- Pin 18 - L293D Input 3
- Pin 22 - L293D Input 4
- 5V - 7805 Output
- GND - GND
Connections for Edison and Booster Pack are as follows - Analog 0 - Joystick Horizontal
- Analog 1 - Joystick Vertical
- Analog 2 - Accelerometer X axis
- Analog 3 - Accelerometer Y axis
- Digital 3 - Button/ Switch
- 5V - 5V
- GND - GND
Downloads
Powering and Startup
I've powered the Raspberry Pi using a rechargable 8v Battery with a voltage regulator, and the Edison using a standard Power Bank.
If you have configured both scripts to run on startup, you don't have to do anything but power the board up, but if you haven't, follow the following procedure.
- Ensure that supply voltage is 5 Volts
- Connect supply to Raspberry Pi
- SSH into Raspberry Pi
- Open Terminal
- Navigate to folder where Python script is stored
- Run Python script
- Do the same for the Intel Edison.
- Once this setup has been tested on local networks, configure your router to forward the Raspberry Pi's TCP port to the external internet. The procedure varies for every router model, so please check on your router's support page or manual.
- Once you have, check your Raspberry Pi's global IP and note it down.
- In both of your codes, change the Raspberry Pi IP to its global IP.
- Now, you can control the robot from anywhere in the world!