I had the pleasure of presenting at the #exabytes17 conference in Bradford on 7 July 2017. Yvonne Walker and I discussed our CAS Microbit project, making lunch box buggies on an Iron Man Theme! The resources for the project are on the CAS community site (sign up for free to download them all!).
Making lunch box buggies with Iron Man body parts!
I was delighted to present the work from our CAS project Using micro-bits across the primary curriculum at the CAS Annual Conference on 17th June 2017. I presented with Yvonne Walker from CAS and demonstrated one of the buggies that we had made as well as letting delegates loose on some microbits.
A second Microbit to use as a radio control for the buggy.
On Friday, a very large box of Microbits arrived from Kitronik (via BCS who are distributing the Microbits for our CAS project). So I finally had a second Microbit to try out.
The first Microbit I had was a gift from Yvonne Walker at CAS, so I hadn’t one fresh out of the packet before. I was delighted to discover that once the supplied power pack was attached, the Microbit booted and ran an introductory code. The microbit ‘introduces’ itself and walks you through using the buttons and accelerometer (see Intro to the Microbit from Tech will save us). I will be able to use this for our first lesson using the Microbit, once we have also looked at the safety leaflet and thought about how to handle them safely. (You can re-instate the start-up code from the copy on Tech will save us).
Programming the remote control
Tech will save us has a nice tutorial and code to make a remote control for their buggy. I adapted this code as I had used a different command to control the motors. The remote control Microbit now uses the accelerometer to move the buggy forwards and backwards, pressing button A makes the buggy turn clockwise and button B makes it turn anticlockwise, pressing A+B stops the buggy. The code could do with some refinements as at the moment, it is a two man job to turn the buggy off! Holding down A+B continuously stops the buggy still, whilst someone else switches the power pack off. I’ve also lost the granularity of control I had before, so that going forwards and back for a set time, and turning clockwise and anticlockwise for a set time to effectively turn 90 degrees has been lost within the forever loop. So, any suggestions on how I can get that control back and/or how I can make A+B stop the buggy by one press would be really helpful! The code I have so far is shared below (for the PXT block editor).
We are building lunch box buggies controlled by Microbits as part of a CAS project. So far, I’ve built two versions of the buggy (one in Lego and one using Kitronik kit) and quickly written some very simple code to make it move forward.
I wanted to have some basic sections of code that our children could tinker with and then put together in a sequence to navigate the buggy around a given course.
As I understand it, the motor board has four pins that between them can control 2 motors. There are two wires from one motor to the motor board that connect to two pins (i.e.: motor 1 uses PIN12 and PIN8 and motor 2 uses PIN16 and PIN0).
Using the command ‘digital write pin12 to 1’ turns the electricity on to pin12 (on motor 1) and ‘digital write pin12 to 0’ turns the electricity off to pin12. So going forward when both button A+B are pressed looks like this:
I’ve tried the buggy on a few different surfaces at home as the wheels seem to slip sometimes, and the shape of the lunchbox, with slightly sloping sides causes the wheels to be a slight angle. All of this can make the turns slightly more or less than the 90 degree turn I want, but this is something we can debug with code and with the mechanical aspects with the children once we have the final buggies made.
The code I’ve written so far is published online in the PXT editor. Button A turns right (clockwise), Button B turns left (anticlockwise) and A+B makes the buggy go forward.
Using Microbit with Lego Mindstorms technic Lego in primary computing.
Like many schools we have equipment that was bought, well used by a couple of teachers and then they left, the focus on the curriculum changed and the equipment began to languish unloved and gather dust in a corner. We have several sets of Amusement Park Lego Mindstorms For schools (RCX1.0 controller, set number 9725) that haven’t been out of the box in at least the last three years (though the dust on the top of the boxes suggested and the fact that the sets were first released in 1998 leads me to suspect it may have been much longer!).
Whilst the Robolab software and the drivers can be made to work with Windows 10 (the original requirements were for Windows 95 – bless), I felt it was time to try something different.
The Lego motors are more powerful than the hobby motors we used from our buggy kit, but I kept the power pack (4×1.5V AA batteries) and the motorboard the same and hoped for the best!
I cut off one end of the Lego wire connectors, split and stripped back the wires and connected them to the motorboard.
I built a very simple frame and balanced the board, Microbit and power pack on top and switched it on and to my delight it worked!
So we will be sacrificing a set of Lego connectors but gaining a new set of resources at no cost to make more buggies. This will also allow us to offer two different ways of building buggies. Whilst the Lego one is perhaps more familiar, building the frame will be more of a challenge than using the lunch box and there is more physical dexterity and care needed to attach the wires to the motors when not using the Lego connectors.
So if you have some old technical Lego gathering dust dig it out and give it a go!