ControlBox RPi3A 20190830 172357 1000w


project overview

ControlBoxP4B 20200330 112522 800w


The controlBox project was started in July 2019 to make a stand-alone Raspberry Pi 'powered' device, that could easily control 'mechatronics' which used a stepper motor or a set or servo motors, without the user having to develop any code. The overall aim of the project was to allow younger children to 'make' things that moved, so that they could engage with the creative aspects of 'making', without getting bogged down in systems or programming.

The term 'mechatronics' is used to describe any type of assembly that might be a simple 2D cardboard cut-out representation of an animal, or a more complex 3D structure that could be 3D printed or that uses Lego blocks in various ways.

The first iteration of the design used:

  • a Raspberry PiZero as an overall controller, programmed with a combination of 'C' and Python code;
  • an I2C controlled PCA9685 PWM control board, to which up to 16 small, low-cost SG95 servo motors could be connected;
  • a GPIO controlled ULN2005 stepper motor control board, to which the low-cost 28BYJ-48 stepper motor is connected;
  • a number of small slide switches which could be set in different combinations in order to make the unit operate in different ways;
  • a small LCD screen that could be used to show the current 'state' of the unit; and
  • everything housed in a custom 3D printed enclosure

A second iteration of the design was quickly started in Aug'19 to upgrade the controller to a Raspberry Pi 3A+ since it was felt that the PiZero might be a little under-powered for what would be required as the project developed further - particularly as the software was to be further developed to provide a web interface and to also allow image taking activities to be carried out with a connected USB camera. A new 3D printed enclosure was therefore developed but without any substantial changes to the internal electronic components except for the substitution of the Raspberry Pi.

A third, more ambitious, design iteration was started in March'20 (with the physical build complete but further software development required) that upgrades the controller to a Raspberry Pi 4B and which involves the following additional changes and broadening of usage scope:

  • when connected to a screen and a keyboard/mouse set, the controlBox, as well being a mechatronic device controller, can be a general purpose computer since the Raspberry Pi 4B is powerful enough to run most everyday applications and with at least 2GB of memory will, for example, also run the new Raspberry Pi version of Scratch 3 which can run in stand-alone mode and has custom blocks for controlling objects;
  • use of the Raspberry Pi 4B, with its four USB ports, simplifies the use of a USB camera along with a USB flash drive that can be used to store captured images, as well as supporting a connected keyboard/mouse set if the controlBox is to be operated with a connected screen;
  • a new drive motor controller, the HG7881, has been included in the internal electronics so that two conventional drive motors can also be connected as controlled mechatronic devices;
  • a new 3D printed enclosure design has been developed to accommodate the Pi 4B with several ventilation openings to help with cooling since the Pi4 can run a lot hotter than previous lower powered Raspberry Pi models; and
  • the enclosure design also accommodates the new HG7881 module with two external drive motor connectors, and has had its height increased so that there is more room for all the internal wiring.

The images below show example builds for each of these three stages of the physical design evolution:

IMG 20200330 110652 800w ControlBox RPi3A 20190830 172454 1000w ControlBoxP4B 20200330 112532 800w
Raspberry Pi Zero 'powered' controlBox Raspberry Pi 3A+ 'powered' controlBox Raspberry Pi 4B 'powered' controlBox


A common software build for all three design controllers (still being continuously developed!), is being written in Python and 'C', and aims to provide the ability for new/different 'moving objects' to be added to the controlBox without any new programming so that users can focus upon the creative aspects of building their own new mechatronics. It should be noted however that, at present, the software only supports objects that 'move' using one of the movement devices, i.e. stepper, servo or drive motors, but a key aim of the onward software development is to be able to support generalised mechatronics that can be 'moved' by any combination of stepper, servo or drive motor.

Connected Servos 20190903 104157 1000w

To enable the design of whatever creative 'moving object' the user wants to build, a set of 3D printed components have been developed that allow any number of servos to assembled into a three dimensional array using wooden dowels as shown in the image on the right.

In addition a number of 3D printed custom Lego adaptors have been developed, as shown below, to allow stepper, servo and drive motors to be integrated into overall Lego builds.

These 'connection' components will be developed/extended further as the need arises and their use is illustrated in more detail in the worked example links below.

Lego Stepper Motor Adaptor01 Lego Stepper Motor Adaptor02 Lego Stepper Motor Adaptor04 Lego Stepper Motor Adaptor03
stepper motor vertical shaft Lego adaptor stepper motor horizontal shaft Lego adaptor stepper motor vertical shaft Lego adaptor stepper motor horizontal shaft Lego adaptor


Lego Adaptor Servo Connector01 Lego Adaptor Servo Connector02 Lego Adaptor Servo Connector03 ControlBoxP4B 20200324 113745 1000w ControlBoxP4B 20200330 105213 1000w
'connector' Lego adaptor 'connector' Lego adaptor with horizontal servo motor 'connector' Lego adaptor with vertical servo motor drive motor horizontal shaft
Lego adaptor
drive motor horizontal & vertical shaft
Lego adaptors




More detail descriptions of the three physical design builds:


Some 'moving object' demonstration examples:






Different types of 'making' projects: