Rpibot – About Learning Robotics

This is a simple and cheap mobile robot platform designed for learning and extending. I explained my concept and also my problems I solved.

I am an embedded software engineer in a German automotive company. I started this project as a learning platform for embedded systems. The project was cancelled early but I enjoyed it so much that I continued in my free time. This is the result…

I had following requirements:

  • Simple hardware (focus is the software)
  • Cheap hardware (about 100€)
  • Expandable (some options are already part of the description)
  • Supply voltage for all components from single 5V source (powerbank)

There was not really a goal apart of learning. The platform can be used for learning, surveillance, robotic contests, …

It is not a beginner tutorial. You need some basic knowledge about:

  • Programming (Python)
  • Basic electronics (to connect modules together by the right voltage)
  • Basic control theory (PID)

Finally you will probably face problems as I did. With some curiosity and endurance, you will go through the project and solve the challenges. My code is as simple as possible and the critical code lines are commented to give hints.

The complete source code and files are available here: https://github.com/makerobotics/RPIbot



  • 1x Plywood board (A4 size, 4 mm thick)
  • 3x M4 x 80 Screw and nut
  • 2x Gear motors with secondary output shaft for encoder. Wheels.
  • 1x Free wheel
  • 1x Pan and tilt camera mounting (optional)


  • 1x Raspberry Pi Zero with header and camera
  • 1x PCA 9685 servo control
  • 2x Optical encoder wheel and circuit
  • 1x Female jumper wires
  • 1x USB powerbank
  • 1x DRV8833 dual motor driver
  • 2x Micro servos SG90 for camera pan and tilt (optional)
  • 1x MPU9250 IMU (optional)
  • 1x HC-SR04 ultrasonic distance sensor (optional)
  • 1x perforated board and soldering wire, headers, …

Step 1: Build the Chassis

I am not a good mechanic designer. Also the projects goal is not spending too much time in the chassis. Anyway I defined following requirements:

  • Cheap materials
  • Fast assembly and disassembly
  • Expandable (e.g. space for added sensors)
  • Light materials to save energy for the electronics

An easy and cheap chassis can be made of plywood. It is easy to machine with a fretsaw and a hand drill. You can glue small wooden parts to create the holdings for sensors and motors.

Think about the replacement of defect components or the electric debugging. The main parts should be fixed by screws to be replaceable. A hot glue gun may be simple, but probably not the best way to build a chassis… I needed a lot of time to think about an easy concept to disassemble the parts easily. 3D printing is a good alternative, but can be quite expensive or time consuming.

The free wheel is finally very light and easy to mount. The alternatives were all heavy or full of friction (i tried a couple of them before finding the final one).I only had to cut a wooden spacer to level the tail free wheel after mounting the main wheels.

Wheel properties (for software calculations)

Circumference: 21,5 cm
Pulses: 20 pulses/rev.
Resolution: 1,075 cm (finally 1 pulse is about 1 cm, which is easy for software calculations)

Step 2: Electronics and Wiring

The project is using different modules as shown on the diagram.

The Raspberry Pi Zero is the main controller. It is reading the sensors and controlling the motors by a PWM signal. It is connected to a remote PC by wifi.

The DRV8833 is a dual motor H-bridge. It is providing the sufficient current to the motors (which the Raspberry Pi can’t do as the outputs can only deliver some mA).

The optical encoder are providing a square shaped signal each time the light is going through the encoder wheels. We will use the HW interrupts of the Raspberry Pi to get the information each time the signal is toggling.

The pca9695 is a servo control board. It is communicating by an I2C serial bus. This board is providing the PWM signals and supply voltage which are controlling the servos for pan and tilt of the cam.

The MPU9265 is a 3-axis acceleration, 3-axis angular rotation speed, and 3-axis magnetic flux sensor. We will use it mainly to get the compass heading.

The different modules are all connected together by jumper wire. A breadboard is acting as a dispatcher and provides supply voltages (5V and 3.3V) and grounds. The connections are all described in the connection table (see attachment). Connecting 5V to a 3.3V input will probably destroy your chip. Take care and check all your wiring twice before supplying (here specially the encoder have to be considered). You should measure the main supply voltages on the dispatch board with a multimeter before connecting all the boards. The modules were fixed by nylon screws into the chassis. Also here I was happy to have them fixed but also removable in case of malfunction.

The only soldering was finally the motors and the breadboard and headers. To be honest, I like the jumper wires but they can lead to loose connection. In some situations, some software monitorings may support you in analyzing the connections.

Source: Rpibot – About Learning Robotics

Scroll to Top