Today, after about one year of its launch, the Raspberry Pi is considered to be a hit choice for DIY (Do It Yourself) electronic projects due to its strong processing capacity and open source, user-friendly peripheral driver libraries. This system-on-a-chip (SoC) uses 32 bit 700 MHz ARM CPU with a GPU, 256MB of RAM, and an SD card as a hard drive. The device comes with two USB ports, Ethernet and audio, as well as HDMI (High-Definition Multimedia Interface) at 1080p. With such special characteristics, price and size, the Raspberry Pi is widely used in educational and commercial applications.The Raspberry Pi coupled with Arduino provides functionalities of a PC, the communication and multimedia tools of the web, the capability to interact with the environment of a microcontroller, and the ease of transportability of mobile devices.
In order to explore the versatility of Raspberry Pi, let us learn how to make a wireless rover with it. In this project, Arduino will be used for the connection and control of the motors. The Raspberry Pi will act as an interface between an iPad or iPhone and Arduino, telling it what to do by sending data from the device.
Materials Required
- Arduino Uno
- Raspberry Pi
- Wi-Fi dongle
- Motors
- Motor shield
- 3 battery packs
- Connectors
- Hot glue
- Chassis with two levels
Powering the Arduino
The bottom level of the bot chassis will be used for holding battery packs. The Arduino is powered by connecting the two batteries in series and connecting them to the Arduino via DC adapter. An important connection that should not be missed is placing a switch between the connection of batteries and the Arduino to control the power when required.
Setting up the Motors
Connect the motors to the ports labeled M1 and M2 on the motor shield. The connectors are concealed at the bottom level of the chassis along with the batteries to give the robot a tidy look. Place the Arduino on the top level of the chassis and wire the motors.
Testing the Motors
Once the motors have been set up, test the code for speeds and delays. Connect the Arduino with your computer. This can be done with the help of a USB connector. Make sure that the Arduino IDE software is installed on the computer and the Adafruit motor library is installed on Arduino IDE. Paste the code (code can be obtained from here) into the software, save, and compile it. Upload the program to the Arduino, and then test and edit the code as per your requirement. In order to avoid crashing the robot into the obstacles while testing, use the switch connected between the batteries and the Arduino.
Powering the Raspberry Pi
Power the Raspberry Pi by connecting 4 AA batteries to the RaspberryPi’s GPIO power (PWR) and ground (GRND) pins.
Setting up the Remote Connection
Set up a wireless connection with the Raspberry Pi and router so that you can log into the Pi using a SSH. Secure Shell (SSH) is a secure method of logging onto a remote computer. If the Raspberry Pi is connected to the Internet, then this can be a handy way of operating it from another device.
Install the SSH service on your Pi. SSH uses port 22 to connect to a remote device. To connect to the Raspberry Pi, its IP address will be required. Moreover, SSH requires a username and password to login, which are by default ‘Pi’ and ‘Raspberry’ respectively. Once SSH connection is successful, open remote communication on port 7777 by typing the following command:
sudo iptables -A INPUT -p tcp –dport 7777 -j ACCEPT
Connect the Raspberry Pi and Arduino via USB cable.
Download connect.py(code can be obtained from here), enter its directory, and open it with the command given below. The code handles the incoming Telnet connection to your Pi.This tells the Pi to connect to Arduino, which is specified by /dev/ttyACM0.
python connect.py -p /dev/ttyACM0 -b 9600
You can now start off by opening ‘Putty’ on your computer or an ‘eTelnet app’ on your iPhone to communicate to the Raspberry Pi. This can be done by typing Pi’s IP address and selecting connection through port 7777. Username ‘Pi’ and password ‘Raspberry’ will be required.
If the connection is successful, the following message will appear:
‘ROVER by GREG’
Now you can control your rover with your iPad or PC.
Reference:
“ArdiPi” The Wireless Arduino and Raspberry Pi Rover by Greg0reo
http://www.instructables.com/id/ArdiPi-The-Wireless-Arduino-and-Raspberry-Pi-Rov/?ALLSTEPS