Mini project: Controllable (sort of) junkbots

What is a Junkbot?
It is basically, an electric motor that is unbalanced, so that is shakes and makes junk (e.g. a drinks can, a plastic cup) move. An example is shown below. As this blog is Computing in Northamptonshire it might be interesting to add-in some control (well sort of).

Three approaches to control it will be considered here:
- via Raspberry Pi;
- via Micro:Bit;
- via Crumble Controller.

1. Raspberry Pi based

One way is to combine a Raspberry Pi with a Junkbot in combination with Python and Pimoroni's Explorer HAT PRO to control it. 

First step, before the Explorer HAT can be used the appropriate library needs to be installed via the Terminal and the instructions below

curl | bash

A simple bit of Python Code to control it is shown below.

import explorerhat
from time import sleep

def spin1(duration):

def spin2(duration):

2. Micro:bit
What about the recently released Micro:Bits, can it be used to control a junkbot?

2.1 Introduction
The project was to look into developing junk bots controlled using a Micro:Bit and also to produce some materials for schools to use with or without outside assistance.

2.2 Approach used in the project.
A Micro:Bit was selected for two reasons. 

An example piece of code is shown below. Press the buttons to spin the motor either anticlockwise or clockwise (depending on the wiring) and stop:

from microbit import *

def startIt():

def leftTurn(duration):
def stopIt():

while True:
   if button_a.is_pressed():
   if button_b.is_pressed():

2.3 Suggested Resource List
  • Small Electric Motor
  • Kitronik Motor Board
  • Battery Pack
  • BBC Micro:bit
  • Pens
  • Junk (Can or Bottle)
  • Wires
  • Tape
  • Scissors
  • Broken Propeller or un-balanced load
  • Screw Driver

3. Crumble

 The Crumble Controller, Redfern electronics, is an excellent board for this project; it is relatively cheap, it is programmable with it's own graphical language, and it has motor drivers built in. In the figure to the left the parts (apart from adhesive tape) used can be seen.

3.1. Wiring up
Using croc-clips ideally, but loops of wire if not, connect the battery to the controller and also the motors to the controller. Plug in the USB cable into the controller and the computer.

3.2. Running and Controlling
Make sure the Crumble software  ( is installed on the computer. 

An example is shown below that drives the motor forward and then backward repeatedly. You might need to change the percentage values based on experiment, for the motor used. 

4. Future Directions

  • In all three approaches, a further motor can be driven so adding a second motor is one development.
  • Playing with a less well-featured motor driver board for the Micro:Bit or Raspberry Pi approaches may bring the cost down further.

Related Links

All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon