Intro: Robot Using Raspberry Pi & Bridge Shield
The Bridge Shield is a board for students, hackers & researchers. You can use it along with a Pi or Arduino Uno to create cool DIY projects with ease. This will be an open source board and we are presently designing the second generation.
We are currently on Kickstarter and you can support us by backing us or sharing the below mention link with your friends and family
What does it have?
10 DOF IMU.
Temperature Sensor. Dual Bridge motor driver which can drive motors up to 1Amp.
8 channel Servo Motor Diver which works on I2C.
RTC with coin cell backup provision.
Open 5V-3.3V bidirectional voltage level converter.
Level Shifting for SPI, I2C, UART between Arduino Uno & Raspberry Pi.
Attiny85 micro-controller loaded with Arduino boot loader.
Header for ESP8266 Wi-Fi Module.
Header for HC-05 Bluetooth Module.IR Sensor for wireless remote control.
USB to UART Module.
Single input source of 12V which power Pi and Arduino Uno It has one variable voltage regulator of 3A, a 5V/3A voltage regulator and a 3.3V/1A voltage regulator.
Two cell Lithium Ion battery charger with led and signal pins to monitor battery charge status.
Intensity variable LED controlled through I2C.
Its mechanical construction makes it compatible with most of the stack able Arduino Uno and Raspberry Pi shields.
Note: The above are the specification of second generation
What have we made with it ?
We’ve built some pretty cool projects like
- A robot controlled via the internet
- Home automation to control anything that can go into an electrical outlet
- An IP Camera
- A battery backed Pi which could be a mobile computing solution
What can you do with it ?
By combining an arduino and raspberry pi you can make some amazing projects. It is up to you how you want to use our board – our main aim is that you have fun doing it. Some examples that we can think of are:
- To build an autonomous or a self-balancing robot
- Make your own drone (Use responsibly! Disclaimer: We are not responsible for your neighbor’s loss of privacy)
- Automate your home using our sensor array. Most of our sensors work on I2C and on board motor drivers will help you trigger actuators like servo, DC and stepper motor.
We have completed the first prototype and are presently testing it. We promise that you will be even more amazed by the second generation’s features. To know more on what we have done you can watch the videos on our website and YouTube channel.
In the following steps we will be showing you a simple way to use the Bridge Shield and make a remotely controlled (via the internet) robot and if you are still hungry for more we’ve added an optional part where we will show you how to do some basic home automation using the Bridge Shield and an ESP8266 wifi module.
So let’s get cooking people!!
Step 1: Step 1: Setting Up Raspberry Pi With Basic Software
List of ingredients:
- Bridge Shield or L293D Board
- A Raspberry Pi (with SD card and power system for initial setup)
- USB Camera/Pi Camera Module
- Robot Chassis with motor clamps, nut/bolts and peripherals.
- Two BO Motors
- Lithium Ion Battery (2-Cell ,Approximately 1000-2000mAh)
- Arduino UNO (optional)
- ESP8266 wifi module (optional)
- 1.3 inch OLED (optional)
First of all you will need to setup a webserver on your Raspberry Pi, along with PHP. I recommend reading this instructable
At this point I am assuming that you have followed the above instructable and know the basics of booting up a Pi, installing the OS, connecting the pi to a keyboard+ mouse+ monitor or enabling the SSH mode for remotely accessing the pi and enabling the pi camera.
Once you have done the above let’s begin with installing Apache. Apache is a complete webserver creation and management tool. It can perform robustly diverse functions that’s why it is very popular.
Now back to work, boot-up your pi and open the terminal (or an SSH connection) then type this command in the prompt
$sudo apt-get update
You will see a lot of instructions running on the display. Let it all end (you will know when you get the “$” with blinking prompt again).
Next we install apache and PHP using the following command in the same terminal
$sudo apt-get install apache2 php5 libapache2-mod-php5
It will ask you if you want install the packages with the following phrase displayed: "Do you want to continue", type "y" and hit Return / Enter.
Wait for the install to complete (this may take a while and you’ll know its done when you see the blinking prompt with just the “$” again).
If you now start a web browser on your computer, and type the IP address of your pi into the address bar, you should see a message which goes something like “Your website is working/running!!”.
Optionally you can also install an ftp server with the following commands
$sudo apt-get install vsftpd
Now that you have installed the FTP server you need to do a bit of configuration. See instructions below:
$sudo nano /etc/vsftpd.conf
(nano is a text editor built into the Raspbian OS. It helps to quickly edit or modify files from the terminal)
Scroll through the file and change the following lines:
anonymous_enable=YES Change To anonymous_enable=NO
And remove the “#” (uncomment) for the following two lines
#local_enable=YES Change To local_enable=YES
#write_enable=YES Change To write_enable=YES
At the end of the file add the following line of code:
To save and exit hit “Ctrl + x", then hit "y", then the Return / Enter.
You will now need to restart the FTP server for the changes to take effect – use the following command:
$sudo service vsftpd restart
Step 2: Step 2: Installing MPEG-STREAMER
Next we will install the MPEG-Streamer. Mpeg streamer is a one stop solution
to stream your camera video on internet (Credits: I referred this link to learn how to install it)
Open a terminal window and type the following command
$sudo apt-get install libjpeg8-dev
Once the install is complete type
$sudo apt-get install imagemagick
Next we need to do a bit of configuration. In the terminal type the following with an ENTER/RETURN after every line.
$svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg... mjpg-streamer
After it compiles you can run mjpeg-streamer by typing the following command
$ cd /home/pi/code/mjpg-streamer
$ ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -p 8080 -w ./www"
If you want to now view the stream open a web browser type the below in the web browser “http://[host-name or IP-address of the Pi]:8080”
You will be able to see the mjpg-streamer on the webpage with a small window showing the picture from your pi’s camera
It you want to directly see the video stream type the following url in your web-browser
“http://[host-name or IP-address of the Pi]:8080/?action=stream”
Step 3: Step 3: Programming the Pi and MPEG-streamer Interfacing
Next we will need to do a bit of programming for the Pi to interface smoothly between the Pi cam and the webpage. We will be passing some values to a python file from the PHP instructions to trigger the GPIO pins on the Pi (before you do this however, you will need to install WiringPi to make it work - please see the instructions to do this on their website).And I have used some part of this for the basic code development.
Once you have installed WiringPi all you need to do is place the below files
in the “/var/www/server/ “ folder
Next you need to edit a line in the control.html file. Use nano to do this:
$sudo nano /var/www/server/control.html
Look for “img src” and edit it to:
img src= http://[Pi ip address]:8080/?action=stream
Then just open web browser on your computer and type the below in the url.
http://[host-name or IP-address of the Pi]/server/control.html
Now, if you already have the mjpeg-server running you should be able to see
the video stream on the webpage
If you are not able to see a video then open a terminal and type the following:
$ ./mjpg_streamer -i "./input_uvc.so" -o"./output_http.so -p 8080 -w ./www"
Now you should be able to see all the buttons and video on the webpage. If you trigger the front back left or right button the GPIOs will turn on/off.
Step 4: Step 4: Hardware Connections (Pi and Bridge Shield) to Get Your Robot Up and Running:
We have used the bridge shield motor driver to connect to the raspberry pi instead of a separate motor driver. If you have a separate board or have made one then you can use pin numbers 4,17,22,23 from the raspberry pi GPIO header to connect to the motor driver pin numbers 2,7,15,10 .These connections have to be made as shown in pic
Finally, all of these have to be mounted onto a robot chassis (See picture to help you arrange the parts). Place the wifi dongle in the designated slot. Fix the bridge shield on the Pi and connect the two cell lithium ion battery to the bridge shield and your mechanical buddy is ready to roll!!
Step 5: Step 5: Program for Esp8266 and Arduino UNO (Optional)
If you want to play around with home automation and control nearby appliance using the wifi module you need to change the below two lines in the control.py file with ip address of ESP8266/port of ESP8266 wifi module. This can be done by opening a terminal and typing
$sudo nano /var/www/server/control.py
Make the following changes in this file:
TCP_IP =your wifi module ip address
TCP_PORT =your wifi module port address
You can upload the arduino code on your uno. To get your oled display up and running you need to install some libraries which you can find on adafruit website .Please note there are some port forwarding setting to be done on your router. I am presently using Netgear router and there is a port forwarding tab on its settings page where I enter the ip address of my wifi module along with the port I am accessing. You can check out port forwarding instructions for your router at the following link:
Step 6: Step 6: Hardware Connection for Arduino Uno and ESP8266 (Optional)
The wifi module I have used is ESP8266 which is connected to arduino UNO through UART. I have even added an OLED 1.3 inch display to check the esp8266 AT command and the trigger status of the relay. Note that Esp8266 Vcc and CH_PD should be connected to 3V3. This OLED is connected to arduino via I2C. The connections are shown in the scheme below.Please note that I have not used any level shifter in between UNO and ESP8266 and doing so will be at your own risk as ESP8266 is a 3V3 device .I recommend using a level shifter in between TX RX line.
Finally I want to thank you people for reading this and I hope you will make one your self and please note this is my first instruct able and I will be really happy if you can give me some feedback for improving .Thanks Again
Here is a link of our website
and my you tube channel
Please do visit us