Skip to main content

Raspberry Pi - Python Junkbot using ExplorerHat Pro



Junkbots (http://junkbots.blogspot.co.uk/) are based around using  materials such as drink's cans, broken propellors and motors to produce something that moves by vibration. Previous designs be found at:



The latest tweak to the Raspberry Pi based Junkbot design is to use the combination of Python and Pimoroni's Explorer HAT PRO to control it. Explorer HAT Pro is a good choice, it can control two motors with a library provided to simplify the programming. For this the Junkbot was the one shown above: a drinks can, pen, LEGO bits, motor and broken propellor.

Before the Explorer HAT can be used the library needs to be installed via the Terminal and the instructions below

curl get.pimoroni.com/explorerhat | bash

Python code to control the junkbot is shown below.


import explorerhat
from time import sleep

def spin1(duration):
    explorerhat.motor.one.forward(100)
    sleep(duration)
    explorerhat.motor.one.stop()

def spin2(duration):
    explorerhat.motor.one.backward(100)
    sleep(duration)
    explorerhat.motor.one.stop()

spin1(1)
spin2(1)

Essentially the code spins the junkbot one way and then the other.

If you do use or modify please leave a comment, I would love to see what others do with it.




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 videos - Hayley's work

A collection of videos from Hayley Stevenson's junkbots work including insect-like robots And here is what it drew: Taken from:  http://junkbots-hayleystevenson.blogspot.com/2011_07_01_archive.html Taken from:  http://junkbots-hayleystevenson.blogspot.com/2011/08/day-9-fan-racer-comes-to-life.html Junkbots and lego robots combined:  taken from:  http://junkbots-hayleystevenson.blogspot.com/2011/08/day-18-my-last-day.html   Here is the video summarising her work: Taken from:  http://junkbots-hayleystevenson.blogspot.com/2011/08/update-video-montage.html