Introduction: Bomb Disposal Robot Simulation
In this project I am building a Bomb Disposal Robot conceptual model. I thought the idea of building a robot that can be sent into a totally dark room to retrieve an item like an explosive device and take it to a different location would be a good challenge. This robot will be controlled by a joystick. The robot will have lights and a video camera so the operator can control it with the joystick by looking at a computer display in a totally different location. This project is just a demonstration of the capability and not intended to retrieve any live ordinance.
This project will use the following technology
1. Bluetooth - the robot is controlled wirelessly with Bluetooth.
2. Wi-Fi - The video signal is broadcasted using Wi-Fi
3. Control - with the combination of the Wii controller and nunchuck we have motion control inputs, joystick, directional buttons and numerous push buttons to work with. We will use the Raspberry Pi to control this robot. We will program it with Python programming language using the CWiiD library and bluetooth library for the Wii controller.
4. PWM - Pulse width modulation is used to control the motor speeds and to control the camera servo.
5. Motor Drive Controller Board Module L298N Dual H Bridge - Used to control the robot motors
6. OWI-536 All Terrain 3-in-1 RC Robot Kit - ATR - robot used for track capabilities and grabber mechanism
Step 1: Videos of the Robot in Action
Notice how the view can be switched with the onboard camera from distant view to close up of the gripper.
Step 2: Parts Needed
Parts needed for this project
1. OWI-536 All Terrain 3-in-1 RC Robot Kit - ATR
2. Raspberry PI 5MP Camera Board Module
3. Camera Pan/Tilt Bracket with servos
4. Motor Drive Controller Board Module L298N Dual H Bridge -- Quantity 2 --
5. Raspberry Pi computer with Wi-Fi and Bluetooth dongles
6. 5 volt 1 amp power bank designed to charge cell phone
7. Wii remote and Nunchuck controller
8. 12 volt LED lights
9. 12 volt lead acid sealed battery
10. Raspberry Pi camera case
11. Extra long camera cable
Step 3: Let's Get Started
First we need the OWI-536 All Terrain 3-in-1 RC Robot Kit, I purchased one from Amazon for around $40. The robot comes in many pieces as shown in the first picture. The second picture shows the track motors and gearbox being assembled. The robot can transform into three different styles. I wanted the one with the grabbing mechanism.
Step 4: Add the Electronics Compartment
We need a place to put the 12 volt battery, the motor controllers, the Raspberry Pi and the 5 volt battery. I glued a mounting block on top of the robot and constructed a wooden cabinet that sits on this block and the fork lift arms on the back of the robot.
Step 5: Add Lights and Camera
Mount the two lights on the top cover. Put the camera in the case and mount it to the pan and tilt mount. I didn't use the pan servo, just the tilt. This is needed to see out front to know where you are going and then when you get close to the object you want to pick up you can look down for a good view of the gripper.
Step 6: Connect the Wiring
Each motor controller has two identical circuits so it can handle two things. One of the motor controllers is used for the track motors. The other motor controller is used for the gripper motor and the LED lighting. The motor controller uses an A and B input which you set high and low to run the motor forward, reverse or stop. I am using pulse width modulation (PWM) on the enable pins to control motor speed. The motors on the robot were designed to run at 3 volts. I am using 12 volts but I am turning it on and off very rapidly so the average voltage is much less.
List of all the GPIO pins from the python code
LeftMotorTrackA = 3
LeftMotorTrackB = 5
RightMotorTrackA = 7
RightMotorTrackB = 8
MotorGripperA = 10
MotorGripperB = 11
GripperLED = 12
CameraServo = 13
LeftMotorTrackEnable = 31
RightMotorTrackEnable = 33
GripperEnable = 35
Step 7: Setting Up the Raspberry Pi
We will use the Raspberry Pi to control this robot.
We will program it with Python programming language using the CWiiD library and bluetooth library for the Wii controller.
Start by plugging your Bluetooth USB dongle into your Pi and reboot it.
You can check the dongle by typing lsusb
pi@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
To make sure you have bluetooth installed run the following
sudo apt-get update
sudo apt-get install Bluetooth
install a Python library called CWiiD In order to get informations from the Wiimote through Bluetooth, we have to install a Python library called CWiiD, it is like a "driver" if you want. To install it, it is very simple, just type :
sudo apt-get install python-cwiid
You will need to set up your Raspberry Pi to communicate with Wi-Fi. There are many places on the internet that cover this. Just search on "Raspberry Pi wifi" and you will get plenty of instructions.
I ordered an extra long cable for the camera and hooked it up to the camera and the Raspberry Pi.
I used the camera streamer from Dawn Robotics at this location. I followed the instructions on that web page exactly, skipping the firmware update as suggested. This camera streamer allows you to view the camera video on any browser on the same Wi-Fi networker. I am using the Google Chrome browser with success.
Step 8: About the Code
Ok about the code:
1. First we will assign all the GPIO pins that will control the motor drivers
2. Next create functions for all possible motions of the gripper and track
3. Setup pulse width modulation (PWM) for the tracks, gripper and camera. This allows us to control the motor speeds and control the servo by changing the duty cycle of the pulse. Here is a very good article on PWM
4. Look for the Wii controller and connect to it.
5. The rest of the code is a big loop looking for input from the Wii controller and Nunchuck For more on Wii programming, here is an Instructable that shows the use of every button on the Wii that I used for reference.
Step 9: Autostart the Camera and the Python Code
When I want to use the robot, I would like to turn on the motor battery and turn on the computer battery and be ready to hook up to the Wii. You just push the 1 and 2 button on the Wii and wait for it to rumble, then you know it is connected. Here is how to set it up like that:
First open the /etc/rc.local file
sudo nano /etc/rc.local
Now that is open I insert the following line right ahead of #Print the IP address
python /home/pi/raspberry_pi_camera_streamer/build/raspberry_pi_camera_streamer &
python /home/pi/pythoncode/grabber_robot.py &
This will start the camera streamer and run Python and my program on startup
Here is the rc.local file
Step 10: Here Is the Final Package
Here is what it looks like in operation. The third photo is the view through the camera. I hope I have inspired someone to give this a try. Let me know what you think about the project.
We have a be nice policy.
Please be positive and constructive.