Loading... Please wait...

Questions?

Need help with any of our products or services?

Please, get in touch

Our Newsletter


Creating a Dawn Robotics SD Card

These instructions describe all of the steps we go through to set up a Dawn Robotics SD Card. This SD card contains Raspbian with software installed on it to support a Raspberry Pi robot, and also to support the Pi Co-op Arduino add-on board we sell. If you want to get up and running quickly, then you can just download a complete version of the SD card image here. Please Note: If you use our SD card image, please remember to expand it after installation by running

sudo raspi-config

 

and choose the ‘Expand Filesystem’ option.

Alternatively you can buy a pre-installed SD card from us here. For people who want to build their SD card image from scratch however, or who want to customise it for their own Raspberry Pi robot, hopefully this set of notes will be a good guide to show you what we’ve done.

Set up a Basic SD Card

The SD card is built around the 2nd February 2015 Raspbian image from the Raspberry Pi Foundation which can be found here. Download the Raspbian image and copy it to an SD card using the instructions here.

Once the image is copied to the SD card, boot up the Raspberry Pi and run

sudo raspi-config

In the configuration program, enable the camera, enable boot to desktop, and expand the disk image to fill the SD card.

Reboot the Pi and then update the Raspberry Pi's firmware by using the following commands

sudo apt-get update 
sudo apt-get install rpi-update 
sudo rpi-update

Then reboot the Pi once more.

Configure the Pi as a WiFi Access Point

We setup the Pi to run as a WiFi access point so that it's easy to connect to the Pi from a smartphone or tablet when using the SD card to control a robot. This is done by following the excellent Adafruit WiFi access point tutorial which can be found here, with one small exception. The exception is that we've created a custom version of hostapd which will work rtl871xdrv driver used by AdaFruit, and the more standard nl80211 driver.

The source for our version of hostapd can be found here. Install by running the following commands

sudo apt-get install libnl-dev
cd ~
git clone https://bitbucket.org/DawnRobotics/wpa-realtek.git cd wpa-realtek/hostapd make

sudo cp /usr/sbin/hostapd /usr/sbin/hostapd.ORIG
sudo cp hostapd /usr/sbin/hostapd

Now change the driver line in /etc/hostapd/hostapd.conf to read

driver=auto 
 

Setup Camera Streaming

In order to allow images from the Raspberry Pi camera to be streamed over the network, we install a small program called raspberry_pi_camera_streamer. This program is installed by running the following commands.

sudo apt-get install gcc build-essential cmake vlc
cd ~
git
clone https://bitbucket.org/DawnRobotics/raspberry_pi_camera_streamer.git cd raspberry_pi_camera_streamer mkdir build cd build cmake ../ make sudo make install

Install Dawn Robotics’ Software

These next steps set up the Pi so that it will work with our Arduino add-on board, the Pi Co-op, and also so that it runs our robot control web server on start up.

Install the following packages using apt-get

sudo apt-get install python-pip python-dev python-serial arduino

Install the Tornado web framework and the Ino Arduino tools using

sudo pip install tornado ino

Install SockJS

cd ~
git clone https://github.com/mrjoes/sockjs-tornado.git cd sockjs-tornado sudo python setup.py install

Set up the Pi to work with the Pi Co-op

cd ~
git clone https://bitbucket.org/DawnRobotics/pi_co-op.git cd pi_co-op sudo python setup_pi_co-op.py install

Get the scripts for the robot web server, by installing our Pi camera robot software

cd ~
git clone https://DawnRobotics@bitbucket.org/DawnRobotics/raspberry_pi_camera_bot.git

Install the robot web server so that it starts up when the Raspberry Pi boots

cd raspberry_pi_camera_bot
sudo cp init.d/robot_web_server /etc/init.d/robot_web_server
sudo chmod a+x /etc/init.d/robot_web_server
sudo update-rc.d robot_web_server defaults

Also add the following line to the file /etc/rc.local (before exit 0) to make the WiFi connection as robust as possible.

python /home/pi/raspberry_pi_camera_bot/keep_wifi_alive.py &

Finally, reboot your Pi and enjoy. :)

Optional - Installing py_websockets_bot on the Raspberry Pi

This will allow you to run control scripts that use the py_websockets_bot library, on the robot itself. Run the following commands to install the libraries dependencies

sudo apt-get update
sudo apt-get install python-opencv

then

cd ~
git clone https://bitbucket.org/DawnRobotics/py_websockets_bot.git
cd py_websockets_bot sudo python setup.py install