micro:bit Controlled Crane
We recently spent a weekend in Cambridge for the Raspberry Pi 5th birthday party, and one of the things that we took along with us was our Makerspace CPC Raspberry Pi controlled crane. This proved to be a massive hit with our fellow Pi party attendees.
Because our crane went down so well, we thought it would be fun to have another crane; but this time we wanted it to be controlled by a BBC micro:bit. However, as with our Raspberry Pi controlled crane, which uses bluetooth to communicate between the controller and the crane, we still wanted our crane to be truly remote controlled, so we decided to try and make use of the radio feature of the micro:bit.
For our crane we have taken a remote controlled model crane, and removed the hand held remote control unit that came with it.
Based on experience from our first crane project, rather than simply cutting the wire to the remote control unit, we took the remote control unit apart so that we could snip the individual motor wires. This would save us from having to strip the outer sheaving of the wire. To take the remote control unit apart we had to cut off the 2 joysticks, and remove 4 screws from the underside of the remote control (1 in each corner of the underside of the unit). The screw for the battery compartment cover did not require to be removed.
Inside the remote control unit we then needed to remove 3 more screws (1 holding the circuit board in place, and 1 in each of the 2 joysticks) in order to expose the reverse side of the circuit board to which the individual motor wires were soldered.
Having removed these 3 screws, the circuit board could then be removed from the inside of the remote control unit.
The four motor wires soldered to the circuit board were then snipped as close to the board as possible, following which we stripped each wire to about 1cm. The cores of each of these wires consist of about 3 or 4 strands of very fine copper, so these are quite delicate, so having stripped each wire we then twisted and tinned the end of the wires with a small amount of solder.
Motor Driver Board
The next stage of the project was to connect the 4 individual motor wires to a motor control board. Because we are using the BBC micro:bit for this project, we used the Kitronik motor driver board, since this allows control of 2 motors. The red and white wires control the motor which raises and lowers the crane hook, and the blue and yellow wires control the motor that rotates the crane boom.
In order to power the motors, it is also necessary to wire up a means of supplying power to the motor driver board. For this, we used a 2.1 x 5.5mm socket to screw terminal connector, and 2 lengths of wire cut to about 15mm from a paper clip, to connect between the terminal connector and the micro:bit motor driver board.
The motor controller board itself is controlled by a 5v plug in adaptor power supply.
As previously mentioned, we wanted to make use of the radio feature of the BBC micro:bit to communicate between the micro:bit that was being used for the remote control and the micro:bit that controlled the crane motors. This meant writing 2 different programs; one for the remote controller, and one for the motor controller.
The code for our micro:bit crane is written using Micro Python, and can be found in our BBC micro:bit github repository. Our crane code for the micro:bit consists of 2 Micro Python files. One of the files (microbit-crane_server.py) is for the micro:bit that is directly connected to the crane, and the other file (microbit-crane_client.py) is for the micro:bit that will be used as the remote control unit.