The BeagleBot
How to make your own Beaglebone black bot that you can control over WiFi.
So I've just done a project with the Beaglebone Black and I've managed to make a little robot car that can be controlled via WiFi from any browser on the same network.
Sounds cool, and it kind of is, but there's a lot that can be improved and changed. If any of you guys do improve it or add anything to it then please please please let me know even if it doesn't quite work, then maybe we can help you get it to work.
But first we need to build Bob (Yes, I named it)
The Steps:
- 1. Get stuff (easy):
- 2. Build the chassis (very easy)
- 3. Soldering the Prototyping Board for the power connections (You WILL need some basic electronics knowledge and some previous soldering experience for this bit)
- 4. Installing the packages on the Beaglebone (easy)
- 5. Get the webserver running (fairly easy)
- 6. Get the python script running (easy)
- 7. Auto run the scripts we need running (easy)
- 8. Assembling Bob (very easy, but can be fiddly)
- 9. Power (very easy)
- 10. GO!! (fun)
1. Get stuff (easy):
Stuff we need (there's quite a bit)
Where to buy | Farnell Order Code | quantity | product |
cpc.farnell.com | HK01209 | 1 | ROBOT KIT CHASSIS |
uk.farnell.com | 24222282422228 | 1 | BBONE-BLACK-4G |
uk.farnell.com | 24379812437981 | 1 | WIFI DONGLE |
uk.farnell.com | 16506851650685 | 2 | BATTERY HOLDER, LEADED, 4 X AA |
uk.farnell.com | 23452572345257 | 1 | Alkaline AA Batteries (any will do, get rechargeable if you prefer) |
uk.farnell.com | 20753662075366 | 2 | Continuous rotation servos |
uk.farnell.com | 12677511267751 | 1 | PCB, RAW, 100X160 |
uk.farnell.com | 15646821564682 | 1 | Step-Down Voltage Regulator |
uk.farnell.com | 24746752474675 | 1 | Prototyping Board |
uk.farnell.com | 94510809451080 | 1 | 100 µf radial capacitor |
uk.farnell.com | 94511299451129 | 1 | 1000 µf radial capacitor |
uk.farnell.com | 95650519565051 | 1 | Diode |
uk.farnell.com | 12095461209546 | 1 | 100µH inductor |
You will also need.....
- Soldering station (Soldering iron, heat mat, solder, and whatever PPE you need)
- A bit of wire (some capable of taking up to 5V at 3A, and some thinner gauge just for controlling servos etc)
- A few male to male and male to female jumper wires may also come in handy
- pliers thin nosed
- screwdriver (flat or philips)
- super glue (be careful) or double sided tape
- a bit of foam (or another way to hold the BBB and batteries in place and allow them to be removed)
- duct tape or another way to attach the Beaglebone flap to the chassis
- A sharp craft/Stanley knife (Be VERY careful when using this, get someone to help if you're not confident. And mind your fingers)
2. Build the chassis (very easy)
Get all the chassis stuff out, we're just using the main base platform, ball bearing at the back, and the wheels.
Use the bolts provided to screw the ball bearing wheel to the back of the chassis making sure the bolts go down so that they stick out the bottom and not stick out the top, or else we won't be able to fit our batteries in correctly.
Super glue/stick/attach the servos to the bottom of the chassis like the picture below
Then route the wires to the top. You may need to enlarge the hole to get the connectors through.....
Next we need to cut the flap for the Beaglebone Black to rest on. Measure out however big you want it (making sure the Beaglebone fits onto it with spare room for the foam) then score the PCB board down the line you want it to break, be very careful and use a cutting rule if possible. Keep scoring from both sides until almost through the board then carefully snap the board. If you don't have a cutting rule or you are not too confident with a craft/Stanley knife then use a hacksaw or similar.
Carefully stick the flap to the front of the chassis to create a hinge. that allows the flap to lift up and down so we can access the batteries later.
Now we can cut out the foam to fit the Beaglebone Black and the Batteries. Measure and outline the Beaglebone onto the foam then cut out the shape to make a Beaglebone sized hole in the foam then cut around the hole so all you're left with is an outline of foam which we can stick onto the flap.
Now repeat for the batteries.
Now we can stick/glue the foam onto the flap and chassis. Make sure the Beaglebone foam holder goes on the top of the flap and the battery holder goes right at the back of the chassis.
3. Soldering the Prototyping Board for the power connections (You WILL need some basic electronics knowledge and some previous soldering experience for this bit)
This bit is probably the hardest bit of the project because it's very fiddly and requires you to have at least a basic understanding of electronics.
Firstly get your protoboard and score it then snap it in half, then score and snap in half again the other way to get a quarter (scoring down the holes makes it easier to snap). This quarter is the bit we're going to use.
Now by carefully following the circuit diagram below solder all the components in place.
The batteries need soldering in series.
On the DC jack the inner pin is positive and the outer metal shell is ground. Check you have the correct wires the correct way round before soldering or else you will blow your Beaglebone!
Also make sure the capacitor and diode polarisation is correct.
ONCE SOLDERED INSERT THE BATTERIES AND CHECK THE VOLTAGE WITH A MULTIMETER. The voltage MUST NOT be above 5V.
After checking the voltage insert the DC jack into the Beaglebone and wait for it to boot. Once successfully boot shut it down. Congratulations you now have a working battery powered Beaglebone.
4. Installing the packages on the Beaglebone (easy)
This bit is easy peasy.
Plug in and boot the Beaglebone.
Make sure you have internet connection either through Ethernet or WiFi.
Now install everything we need.
In the command terminal type the following lines.
sudo apt-get update sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus -y --force-yes --fix-missing sudo pip install Adafruit_BBIO sudo apt-get install apache2 php5 libapache2-mod-php5 -y --force-install --fix-missing systemctl disable cloud9.service systemctl disable gateone.service systemctl disable bonescript.service systemctl disable bonescript.socket systemctl disable bonescript-autorun.service systemctl disableavahi-daemon.service systemctl disable gdm.service systemctl disable mpd.service
5. Get the webserver running (fairly easy)
Now we need to get the webserver running.
First extract the .zip folder with the files in it onto a memory stick.
Insert the memory stick into the Beaglebone and reboot it.
In the terminal copy the files onto the board
sudo cp -R /media/<path_to_memory_stick>/www/* /var/www/ sudo chmod -R www-data:www-data /var/www
Now let's check that Apache is running on the correct port (port 80)
Use whichever editor you prefer, but here I'm using nano to make it simpler for beginner users
sudo nano /etc/apache2/ports.conf
Find the line related to listening ports, and make sure it is referring to port 80, change it if needed.
then press ctrl+x then y then enter to save the file.
then type
sudo service apache2 restart
to restart apache with the new settings
now we need to get the Beaglebone to connect to the wifi network.
6. Get the python script running (easy)
For this all we need to do is make sure the script is executable and make sure python can run it fine
in the terminal type
sudo chmod a+x /var/www/*.py python2.7 /var/www/move_php.py
You should hopefully see the words
"Move_php script running..."
on your screen if it is worki
press Ctrl+C to stop python
7. Auto run the scripts we need running (easy)
For this we are going to use crontab, it is a service that runs in the background and is used to automate the running of tasks, exactly what we need.
In the terminal type
sudo crontab -e
In the crontab window add to the bottom the following lines
@reboot sudo service apache2 start @reboot sudo python2.7 /var/www/move_php.py &
Notice the & sign at the end of the second line. This is very important, as it tells python to run in the background. If you do not include this then python will run in the foreground and prevent the boot sequence from continuing.
Now when we reboot apache2 should auto start and the python script should also run in the background. You can check this by rebooting your Beaglebone then in the terminal typing
ps -e | grep python
this should return a process I.D. for the python script running in the background
8. Assembling Bob (very easy, but can be fiddly)
This bit is very easy but can be a bit annoying to get perfect.
Place the Beaglebone in the foam holder on the flap, and the batteries in the foam holder at the back of the main chassis.
Route all the wires in a neat fashion to where the Beaglebone is on top of the flap.
Follow the picture in the zip file named BeagleBot_connections.png to connect everything (except the power) up to the correct pins, you may need to use jumper wires. If you don't have any jumper wires then you can simply cut the wires the connectors off of the wires you can't connect, strip them twist them and tin them, then you can insert them into the header on the BeagleBone.
Once everything is plugged in, tuck away/neaten up any wires hanging around the place until it looks neat and tidy. It might be a good idea to use electrical tape to hold wires down and out the way. At all costs prevent short-circuits.
9. Power (very easy)
Once your BeagleBot is ready to go, plug in the power and wait for it to boot. If you have not set up a static I.P from your router then you will need to connect to the Beaglebone during boot either by ssh over the wifi or via a serial cable to get the I.P. address.
Once you have the I.P address and your board is fully powered and not tethered to anything via a wire you are ready to go!
10. GO!! (fun)
Open up a browser window on any PC/phone/tablet that is connected to the same network as the BeagleBot and enter http://<I.P. of your BeagleBot>/move.php into the address bar.
Once the page is loaded tap the buttons to send your BeagleBot on its way.