Skip to main content

Controlling a junkbot with a Micro:bit


A new direction has been developed for the junkbot project (
http://junkbots.blogspot.co.uk/); previously Raspberry Pis have been used to control the junkbot’s movement (http://robotsandphysicalcomputing.blogspot.co.uk/2016/01/python-junkbot.html) – but what about the recently released Micro:Bits; can it be used to control a junkbot?

Matthew Hole, a student from Wrenn Academy, Northamptonshire ; has been investigating this idea whilst on a Nuffield Research Placement (http://www.nuffieldfoundation.org/nuffield-research-placements) working with Dr Scott Turner, University of Northampton. The project was to look into developing junkbots controlled using a Micro:bit and also to produce some materials for schools to use with or without outside assistance.






What is a Junkbot?
For this project, it is a moving ‘bot’ made from waste materials, combined with an electric motor and a programmable device (in this case a Micro:Bit) to control (or try) it. An example is shown above. More details on junkbots can be found at http://junkbots.blogspot.co.uk/


Approach used in the project.
A Micro:Bit was selected for two reasons. First, there was been a BBC supported project to give year 7 (or equivalent) students a Micro:bit (http://www.bbc.co.uk/programmes/articles/4hVG2Br1W1LKCmw8nSm9WnQ/the-bbc-micro-bit), so they are available in the schools. Secondly, Kitronik produce a motor driver board, and provide quite a bit of support for it, for the Micro:Bit (the latest version of the board can be found at https://www.kitronik.co.uk/5620-motor-driver-board-for-the-bbc-microbit-v2.html ). Using Micropython via the online editor https://www.microbit.co.uk to program the board and therefore the junkbot connected. The board with the Micro:Bit attached can be seen in the figure above carried on the junkbot.

An example piece of code is shown below:

from microbit import *

def startIt():
   pin8.write_digital(1)
   pin12.write_digital(0)
   pin0.write_digital(1)
   pin16.write_digital(0)    

def leftTurn(duration):
   pin8.write_digital(0)
   pin12.write_digital(1)
   sleep(duration)
   
def stopIt():
   pin8.write_digital(1)
   pin12.write_digital(1)
   sleep(2000)

while True:
   startIt()
   
   if button_a.is_pressed():
       leftTurn(100)
   
   if button_b.is_pressed():
       stopIt()



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


Related Links








All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.

If you would like to know more about the Junkbots project contact scott.turner@northampton.ac.uk

Comments

Popular posts from this blog

junkbots 3 - bring it all together

Junkbots session 3: Move the robot but now there are rocks in the way.  This is the last of three posts - Introduction and sequence - Loops and just having fun - This one: Making decisions and bringing it all together. What is the Junkbots project The Junkbots project has been running for a number of years as an initiative to bring sustainability, computing and engineering together by building bots out of junk; details of the project can be found at.  https://junkbots.blogspot.com/  . Junkbots is an extension of the Research into the teaching problem-solving going on at the University of Northampton please feel to visit  https://computingnorthampton.blogspot.com/2019/01/problem-solving-research-outputs-and.html  for more details.   What are we going to do? ·         Play with a Scratch robot on the screen! ·         Build on the routines from the previous session. ·    ...

Junkbot Raspberry Pi: 2 Raspberry Pi Junkbot in action

First video of a junkbot being controlled by a Raspberry Pi. The bot was developed by Hayden Tetley and Scott Turner. Hayden's time was paid  for through the Nuffield Research Placements  Scheme ( http://www.nuffieldfoundation.org/nuffield-research-placements ). Next post will provide further details on how this was done. If you would like to know more about the Junkbots project contact scott.turner@northampton.ac.uk

Junkbot Raspberry Pi: 1 ScratchGPIO

A development I have being wanting to develop for a while is the combine the Raspberry Pi with a Junkbot to add some control.  This the first of postings about these experiments. All the development will be around ScratchGPIO ( http://cymplecy.wordpress.com/scratchgpio/ ) so this posting will look into its use . Why ScratchGPIO? Short answer - simplicity. It is designed to look and work like Scratch ( http://scratch.mit.edu/ ) but allowing access to board that can drive motors. Installing ScratchGPIO? As a suggest use as lastest as possible version of the operating system as you can on your SD card. Initially we had trouble with missing Python files that was resolved when using an updated version of the operating system. In the LXTerminal Type in: sudo wget http://goo.gl/Pthh62 -O isgh5.sh then type in sudo bash isgh5.sh You should get to new icons for ScratchGPIO5 and ScratchGPIO5Plus Now use these instead of the Scratch that came with the operating...