Raspberry Pi
raspberry pi
This project was to integrate the Raspberry Pi with a Cybot and allow it autonomously move about without crashing. It does crash, but that's part of the fun.

This project encompasses several components - first the video of what was achieved.

Portable 5v power supply.

Based on a Remote Control Car power pack of 8xAA NiCad batteries into a LM2596 DC-DC Step Down Adjustable Power Supply Module costing £1.41 on ebay. The output was adjusted to 5.2v and fed into the GPIO header. NB - This bypasses the built in fuses to protect the Raspberry Pi and should not be recommended.

Ultrasonic distance measuring.

The 5 'eyes' at 45 degree angles are HC-SR04 Ultrasonic Distance Measuring devices. Costing £7.99 for 5 on ebay. There are some issues using these devices. They miss narrow objects (like chair legs) and if the object is at an angle then the distance returned can be very wrong. Not to mention that linux is not a real time OS and can completely miss the timed echo.

PIR detector.

The white 'eye' at the front - not really used in this project. As the cybot is constantly moving then the detection pattern is constantly changing and triggering.

PCF8574A 8 bit expander.

To make the connections to the Raspberry Pi a little simpler, a switch, 2 bi-colour LEDs and the HC-SR04 trigger pins are connected via the I2C bus and 2 PCF8574A costing £1.24 from Farnell

Pi - Cybot communications

The Cybot has it's own power supply which is used to power it's motors. The 0v on the Cybot and the 0v on the Raspberry Pi are common.

Only the motor forward pins on the Cybot are connected to the Raspberry Pi - that way the H-bridge cannot get damaged by bad code turning forward and reverse on at the same time.

More information about the Cybot can be found here.

Please see this post in the Raspberry Pi forums for Pi / Cybot connection details.

Connection notes

The bi-coloured LEDs were only there to give me an indication of which motor was being driven - green go / red stop.

The HC-SR04 Ultrasonic Distance Measuring devices are fun things to play with. The PCF8574A could not be used to time the echo (and report the distance) but worked fine for sending the trigger.

The Cybot motors are driven from the Raspberry Pi and not the PCF8574A as by default the PCF8574A outputs are high which would turn on the motors.


All in Python, constantly checking the distance of the 5 Ultrasonic devices. If there is something within 50cm in front, or 40cm diagonally or 30cm to the sides - then calculate if there is more room on the left or right and turn that way.