Donkey Car

From Open Hardware Miniconf
Jump to: navigation, search

Before You Begin

There are several steps where it's possible to destroy the Raspberry Pi, the camera, or other expensive parts of the kit. Please don't rush! Read these instructions carefully, and check before making any soldered connections, attaching the camera, or attaching power.

WARNING: Do NOT connect or disconnect items such as the servo or speed controller while power is applied. During testing we accidentally destroyed several servos by doing this. Make sure everything is powered down before doing ANY work on the car.

WARNING: Please put your car "on blocks" (wheels off the ground) when testing for the first time or after major changes. The cars can runaway fast ... which would be unfortunate. Once you have confidence in your car's operation ... then put it on the ground

Parts Required

There are 4 major items included in your kit:

1. 1/16th scale RC car chassis, with a steering servo, a motor speed controller, and a NiMH battery.
2. Battery charger with AU/NZ adapter.
3. White rectangular laser-cut corflute base plate.
4. A bag of small parts.

The bag should contain:

* 1 x Raspberry Pi model 3
* 1 x Raspberry Pi camera and flex cable
* 1 x Donkey Car Hat for Raspberry Pi (in anti-static bag)
* 1 x Freetronics PR28V voltage regulator, already configured for 5V output (in anti-static bag)
* 1 x laser-cut corflute bracket
* 2 x blue laser-cut brackets
* 1 x 5mm 2-way screw terminal
* 4 x small cable ties
* 4 x plastic spacers
* 2 x 12-way header sockets
* 1 x 4-way pin header
* 2 x 3-way pin headers
* 2 x 1-way pin headers
* 2 x 10mm M3 bolts
* 2 x M3 nuts
* 1 x black rubber stopper


You will also be given a micro SD card and adapter separately, pre-loaded with Raspbian and the necessary software.

Prepare Raspberry Pi

Peel the rubber stopper off its backing and stick it on top of the HDMI port on the Raspberry Pi.

The stopper isn't quite high enough on its own, so also cut off part of the thin rubber from the backing and stick it on top to increase the thickness:


Fit the pair of 12-way pin sockets onto the Raspberry Pi header. Yes, we know the sockets are shorter than the header! It doesn't matter, because all the pins we care about are within the first 10 positions on the header. Make sure the sockets are all the way towards the end of the header:


The pair of pin sockets fit side by side:


Attach Parts To Donkey Car Hat

Sit the Donkey Car Hat on top of the Raspberry Pi, so that it mounts on the header sockets. Then solder all 24 joints, being careful not to bridge any pins together:


Carefully remove the hat from the Pi. Wiggle it gently straight up, so that you don't bend the pins on the Raspberry Pi header.

Next comes a tricky part!

Working on the top of the hat, place the 4-way and pair of 1-way pin headers into the holes for the voltage regulator module. The longer end of the pins should go down through the hat. This is normally considered "upside down" for header pins, but it works out better this way when attaching the module.

Sit the regulator module on top of the pins, so that they come up through the module. It will be a bit wobbly, so be careful moving it around.

Solder the pins to the regulator module on the top:


The pins will now be connected to the module, but not to the hat.

Turn the hat upside down so that the regulator module is resting on the bench. This should push it against the hat, so that you can solder the pins on from underneath.

When you've finished soldering the pins underneath, use side cutters to trim off the excess length of the pins.

WARNING: Make sure you cover the pins with your hand when you trim them. Otherwise they shoot off across the room and end up anywhere. Make sure they go in the bin, not end up on the floor!

Fit the pair of 3-way pin headers to the sections marked "Steering" and "Throttle". Make sure they have the long ends pointing UP, not down! The short end goes into the hat.

Holding these in place while you solder them from underneath can be difficult. They will tend to fall over at a strange angle, or fall out entirely.

You can use a blob of Blu-Tack to hold them while they are being soldered.


The last part to solder onto the hat is the 2-way screw terminal. Insert it from the top of the hat, with the openings facing towards the edge. Use Blu-Tack to hold it in place, turn the PCB over, and solder it from below.


The Donkey Car Hat is now ready. Put it aside and move on with the chassis.

Chassis Preparation

Use a Philips-head screwdriver to remove the 4 black screws holding the rear spoiler mount onto the chassis:


Fit the blue laser-cut bracket labelled "REAR" onto the chassis, using the original screws to go through the bracket and into the spoiler mount. Tighten the screws gently so you don't crack the bracket. It doesn't need to be very tight:


Put the 2 x 10mm M3 bolts through the chassis at the front and the blue laser-cut bracket labelled "FRONT":


Use the 2 x M3 nuts to secure the bracket. Once again, it doesn't need to be very tight. Just tight enough to stop it vibrating loose.


Fit the white base plate onto the blue mounting brackets. WARNING: The bracket can be fitted upside down. The correct orientation has the small indentation to the right, and the hole to the left:


Wrap the rubber bands around the mounting brackets to secure the base plate.

Examine the white laser-cut camera mounting bracket, which has slots cut through one side of the corflute so that the tabs can bend in one direction. Bend the tabs, and begin to slide them into the slots in the base plate:


Slide the camera mount forward so that the tabs clip into the slots:


When the mount is all the way forward, clip the rear tab down into the slot:


Mount Raspberry Pi On Chassis

Insert the 4 cable ties through the base plate. Start by going down through the slot, then back up through the round hole. When the cable ties are in position, drop a coloured plastic spacer onto the tail of each cable tie:


Place the Raspberry Pi onto the tail ends of the cable ties, so that it sits on the coloured plastic spacers. Close the cable ties, gently tighten them, and clip off the ends:


Mount Camera And Hat

Be VERY careful with this part. If you insert the camera ribbon cable backwards, it can destroy both the camera and the Raspberry Pi. It's also very easy to physically break the connector.

Start by threading the camera cable though the slot in the hat, so that it's oriented as shown below. The blue part of the cable is on the other side, and the metal fingers are on the close side:


The socket for the flex cable has a small black clip that rises up about 2mm from the connector. Very carefully raise it by prising it up from the ends. Don't break it off!

Then slide the flex cable into the connector. Check again that the blue side of the cable is against the black clip, as shown here. Then use your fingernail or a small screwdriver to gently click the black clip straight down into the connector. When it clicks down it will grip the flex cable and hold it tightly in place:


When you are confident that the camera cable is inserted correctly, slide the Donkey Car Hat down onto the Raspberry Pi header. It should sit neatly on the rubber stopper:


Feed the camera through the vertical slot in the camera mount, towards the front of the car. Bend it up and use the supplied double-sided tape to attach it to the top of the camera mount:


Attach Steering, Speed Control, and Power

Feed the pair of servo cables up through the hole in the base plate. The shorter cable is the throttle. The longer cable is steering.

Plug the connectors into the 3-way headers.

The black wire goes to the "G" (GND) pin.

The red wire goes to the "V" (VCC, or power) pin.

The white wire goes to the "S" (Signal) pin.


Insert the power cable with the ferruled end into the "+" screw terminal. You may need to loosen the screw first, to allow room for the ferrule to be inserted. Then tighten the screw down again. It doesn't need to be very tight: firm enough to hold the ferrule securely, but don't strip the screw!

There's nothing to insert in the "-" terminal. The board already has a GND connection through the speed controller (throttle) cable.


SD Card and Pre-Flight Check

Insert the SD card into the Raspberry Pi. The socket is hidden underneath the Pi, just near the handy indentation in the base plate. Amazing coincidence. Insert the card with the contacts up:


All the hardware is now complete. The battery should still be disconnected.

On the top of the chassis (under the base plate) is a small power switch. They're in different places on different cars, but mostly they are near the middle and located under the hole near the camera mount. It has small writing on it saying On and Off. Put it in the Off position.

Your Donkey Car is now ready to be started.


WARNING: There is no power control for the Raspberry Pi. The power switch controls the chassis (the steering servo and speed controller) but doesn't control the Pi. To control power to the Pi, you must connect and disconnect the battery. Don't leave the battery connected and leave the car, because the Pi will drain the battery all the way to dead flat if you're not paying attention.

More Information

The Donkey Car project is very well documented at We will step you through setup and training at the miniconf, but if you want to investigate further and learn more about it after the conference is over you can find a huge amount of information at the official Donkey Car site.