This is a two-part series on a new Junkbots project. In last part building the junkbot itself was discussed. In the this part controlling the junkbot via Crumble is discussed.
So build the junkbot as discussed in the previous blog post.
Disconnect the battery connection (the connections on the motor can stay as they are). Connect the USB cable to the Crumble. To the right of the USB connect there are two connections marked + and -. Connect a Red wire to the + connection and the other end to the red wire of the battery pack. Connect a black wire to the – connection and the other end to the black wire of the battery pack.
Stage 2: Connect the Egg!
On the Crumble, on the right-side there are two motor connections connect the Motor to these connections. Don’t worry about which of the motors wires is need you swap them ar3age 6: Programming it – Making the bot moves.
Start the Crumble software. Drag from the left the Program start, motor, and wait blocks. Now join the up start block at the top and the motor block next and the wait block last.
Your code should look like this.
Click on the stop within the motor block. It should change to forward. Now you are ready to make it move. Press the green arrow and with the battery pack on, it soud (hopefully )keeop moving.
If you put a second motor block after the wait blck with the stop inthe boSck. It su.If you put a second motor block after the wait block with the stop in the block. It such more.
-Drag a do-until block in (found in the control menu).
-Go to variable menu and add a new variable, I have used t, select the block marked let=, and drag a t into the blank space.
-Drag an increase block onto the screen and drag a t into the blank space.
Go to the operator menu and drag onto the screen an = block, go back to variables menu and drag a t into the first space on the = block and click on the second space on the block and type in 5.
Now for the challenge put all these together to copy what is shown below. Now, put the egg-bot on the paper, with the pen lids off, it should draw.
This is a two-part series on a new Junkbots project. In this part building the junkbot itself is discussed. In the second part controlling the junkbot via Crumble is discussed. The work was first shown at Mozilla Festival 29th October 2017.
Put the vibrating motor into the Egg with the motor electrical connections sticking out the bottom larger half of the egg. Make sure the unbalanced load is free to move – this is bit that causes the vibrations needed to move the egg. The motor can be held in place by sticky-tack or strong tape, or glue (when using glue this is done under adult supervision only).
Stage 2: Sticking the pens on.
This is the trickiest bit. The easiest way to do is cut a strip of tape. Place two pens onto the tape ensuring the pens are the same length from the tape to the nib and the distance between the pens on the tape are far enough apart to place the egg between them.
If you are using three pens, the third pen should be placed so that all three form a triangle with equal sides, that means the egg can stand-up on a piece of paper on the pen nibs, without anything supporting it.
If you are using four pens, the other two pens should be placed so that all four form a square with equal sides, that means the egg can stand-up on a piece of paper on the pen nibs, without anything supporting it.
Stage 3: Add the battery pack and go.
Using two wires connecting the battery, to the motors. Remove the nibs and set the bot off. It is hopefully vibrating and shaking and scribbling lines on the paper.
In this post a Crumble controller from Redfern Electronics is used. The crumble controller 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. 1. Building the body. Tape three pens (with their lids on) on to the drinks can - making a tripod arrangement. Add (tape it on usually) a motor with something on the axle to unbalanced the motor; I use broken toy propellors but mis-shapen blu-tak; clothes pegs could be used. 2. 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. Running and Controlling Make sure the Crumble software (http://redfernelectronics.co.uk/crumble/) is installed on the computer. An example is shown below that drives the motor forward and then backward repeatly. You might need to change the percentage values based on experiment, for the motor used. In the video below the junkbot is shown in action.
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. Twitter @scottturneruon
If you would like to know more about the Junkbots project contact scott.turner@northampton.ac.uk
Guest Blogger Nathaniel Roberts, Nuffield Research Placement Student working at the University of Northampton. Nuffield Research Placement scheme provides students in their first year of a post16 course to work with STEM professionals http://www.nuffieldfoundation.org/nuffield-research-placements.
Toilet Roll Junkbot
Nathaniel Roberts
Cut a slit in a toilet roll.
Cut another toilet roll in half, then arrange the pieces in a T.
Feed the bottom of the T into the slit, and tape together.
Cut two lines into the edge, and do the same on the opposite side of the circle. Copy this for the other side of the tube.
These geared motors from the Camjam EduKit 3 should fit into those gaps.
Stick a battery pack to the back, and use crocodile clips to wire it all up to a crumble. The battery pack can connect to the + and - on either side at the top of the crumble, and the motors connect to the + and - of their respective sides of the crumble.
This example code would make the junkbot move forward for a second, turn either left or right, then move forward for another second before stopping.
The back of the bot was extremely heavy (with all the batteries). The front wasn’t heavy enough to grip most surfaces very well so the wheels would often spin without the bot moving. Also, the toilet rolls were only just strong enough for the job. After a few uses, especially around the motors, they started bending. Eventually, the motors ended up 'wonky' despite attempts at fixing 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. Twitter @scottturneruon
If you would like to know more about the Junkbots project contact scott.turner@northampton.ac.uk
Three approaches to control it will be considered here: - via Raspberry Pi; - via Micro:Bit -via Crumble controller 1. Raspberry Pi based
In this Raspberry Pi based Junkbot design a combination of Python and Pimoroni's Explorer HAT PRO are used 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()
2. Micro:bit
what about the recently released Micro:Bits; can it be used to control a junkbot?
Lastly a Crumble controller from Redfern Electronics is used. The crumble controller 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 (http://redfernelectronics.co.uk/crumble/) is installed on the computer. An example is shown below that drives the motor forward and then backward repeatly. You might need to change the percentage values based on experiment, for the motor used. In the video below the junkbot is shown in action.