loading

In this step by step guide we'll take you through customising a toy crane so that it can be controlled with a BBC micro:bit, using the Kitronik Motor Driver Board for the BBC micro:bit and the BBC micro:bit's built-in accelerometer to detect tilt and turn motions.

Using the accelerometer in the BBC micro:bit to detect in which direction it is being tilted (x or y axis) we can feed that information back to the motors within the crane. If the BBC micro:bit is held flat with the LEDs facing upwards it will read X and Y as zero: X and Y become larger or smaller (negative), depending on in which direction it is tilted.

Learn how to:

  • Code the BBC micro:bit to control a crane via the built-in accelerometer.
  • Convert a toy crane into a BBC micro:bit controlled crane.

Parts List:

To customise the crane you will need the following electronic components:

For the casing options for the controller you can either use our laser cut template:

Or alternatively for an off the shelf solution:

You will also require the following equipment:

Step 1: Build the Crane

Build the toy crane as described in the instructions that are supplied with it.

Step 2: Remove the Controller

Remove the supplier controller by cutting the cable. Do this near to the controller to leave as much cable as possible.

Step 3: Prepare the Wires

Strip away a section of the black insulation and then strip the insulation off the end of each of the four internal wires, leaving the copper internal wire exposed.

Step 4: Connect the Wires

Connect the blue and yellow wire to the ‘Motor 1’ input on the Kitronik Motor Driver board and the red and white wire into the ‘Motor 2’ input.

Step 5: Connect the Power

Insert the batteries into the battery holder and connect it to the power terminal on the Motor Driver Board for the BBC micro:bit. The battery pack has an on/off switch to turn on the power.

Step 6: Write the Code

Program a BBC micro:bit with the crane control program. You can download the code from this address: https://www.microbit.co.uk/dzlocb.

Now, let’s try the code out! Press compile* and after a few moments the code should appear as a download in your browser. If you plug your BBC micro:bit into a USB port it will show up as a storage device. Simply drag and drop the .hex file you just downloaded onto the BBC micro:bit. The file might not show up on the BBC micro:bit in the file explorer but it is there! Once the file has been transferred (the light on the BBC micro:bit will stop blinking rapidly) remove the BBC micro:bit from your computer.

Step 7: Test the Code

Insert your coded BBC micro:bit into the connector on the Kitronik Motor Driver board and tilt the Motor Driver Board to try it out!

Step 8: Casing (Optional)

We housed our BBC micro:bit in a simple laser cut case but there are many suitable casing options or it could be used without one at all. You can download a zipped copy of the .dxf files here.

Step 9: Customise an Existing Enclosure

In this example we used a Hammond Blue Translucent Box 193mm x 113mm x 61mm as a case.

Simply drill 5 holes in the box (4 in the side of the box for mounting the Motor Driver Board for the BBC micro:bit on to the side of the box) and one hole for inserting the wire from the crane. Mark the five holes using a whiteboard pen on the outside of the box so you know where to drill. Make sure the hole for the wire is on a different side of the box than to where you are mounting the Motor Driver Board for the BBC micro:bit.

Next, push the wire through the hole you have made in the middle of the box so you can screw the wires into the Motor Driver Board for the BBC micro:bit.

Mount the Motor Driver Board for the BBC micro:bit on the side of the box using 8mm Plastic Spacers and 6mm M3 Machine Screws.

Connect the battery box, and plug in the BBC micro:bit and away you go!

About This Instructable

910views

6favorites

License:

More by kitronik:BBC micro:bit Controlled Crane Make a sewable Halloween LED badge How to add sewable LEDs to Easter Bunny Ears 
Add instructable to: