Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
130 lines (90 sloc) 4.74 KB

Using The Pi Hut's wireless controller with CamJam EduKit 3

Picture of controller from The Pi Hut

Get the EduKit

CamJam EduKit 3 is available from The Pi Hut (assuming they have stock!) Picture of CamJam EduKit 3

Get the controller

The controller is available from The Pi Hut and costs £14, making it comparable with other low-cost controllers.


I'm going to assume you're using a full-size Raspberry Pi. If you've got a Raspberry Pi Zero and want to use that for the robot instead, I recommend doing all your initial software installation and setting-up on the full-sized Pi first as the additional, normal USB ports make things a heck of a lot easier! You can then swap the SD card into your Pi Zero and it should all 'just work'.


First of all, take your CamJam EduKit 3 and build your robot.

Operating System

Write an SD card with the new Raspbian Stretch image from the Raspberry Pi website I recommend Etcher as the method for writing the image as it doesn't require you to unzip the image file before you write it to the SD card.

Set-up the operating system

Once you've written the SD card, put it back in the machine you used to write it. If you're on Windows ignore anything about needing to format the SD card.

On the "boot" partition, create a file called ssh. This will allow you to remotely connect to your Pi should you need to.

Also on the boot partition, create a file called wpa_supplicant.conf and put into it the following:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Replace MY_SSID with your wifi router's SSID and MY_PASSWORD with your wifi router's password. This will connect your Pi up to your network and allow you to install the extra software you need.

Check the network

Insert your SD card into your Raspberry Pi 3 and connect up a keyboard and monitor.

Plug in the Pi and boot it up.

With any luck, you'll be connected to your network.

Login to the Pi using username pi and password raspberry

Type ifconfig and check you've got an IP address on your wifi device.

Install Software

Type in the following commands to install the required software. Depending on whether you’re running Raspbian (full) or Raspbian Lite, some of it may already be installed.

sudo apt update
sudo apt install python3-pip

We’re going to be using GPIO Zero plus Tom Oinn (Approximate Engineering)’s input library to communicate between the controller and the motor controller. You can read the documentation for input here.

sudo apt install python3-gpiozero
sudo apt install python3-dev gcc
sudo pip3 install approxeng.input

This last command loads the library and enables the root (superuser) to run it, which we will need to auto-start the code later.

Now, grab the example script to run your CamJam EduKit 3 robot:



Plug in your Pi Hut controller’s USB dongle.

Turn on your Pi Hut controller by activating the switch on the underside.

Type in the following to test out the connection between the controller and the Pi:


You should see GPIO Zero being found followed by the controller being found. Press a few buttons on the controller to see the commands come through. Press the ‘Analog’ button to exit the script. (The script actually says use the HOME button, but the Analog button is that button!)

Run on boot

Now, we need to make the script start up when the Pi is turned on.

Edit the rc.local file by doing:

sudo nano /etc/rc.local

Before the exit 0 statement at the bottom, add the following:

/usr/bin/python3 /home/pi/ &

Make sure to add the & at the end!

Save the file and then shutdown your Pi:

sudo halt

Now, on the next reboot, the script should run. This means that now is the ideal time to detach the Pi from the keyboard and power supply and re-integrate it into your robot. You could also switch to a Pi Zero at this point. Don’t forget to move the USB dongle over to the Zero if you’re doing this!

You should find that the controller now controls your robot!