Using a second Microbit as a remote control for the lunch box buggy

A second Microbit to use as a radio control for the buggy.

Advertisements

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.

First boot

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).

Microbit lunch box buggy coding

IMG_4973
lunch box buggy

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).

IMG_4975
motor boards and pins
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:

forward

After some tinkering and with lots of help from my beloved Husband (who knows his way round Linux and other command line code) and the lovely Lorraine Underwood, we found we could add a comment to label this section of code as ‘forward’ (go to the JavaScript and add a line at the top with ‘// forward’, then back into blocks and the little blue question mark at the top left appears with a comment. We then worked out that by having one motor run forwards the other run backwards, we could turn the buggy in a circle. The tricky part was working how to make it stop, however, once we worked out that once a pin was turned on, it didn’t turn off until set back to 0, we realised that adding a pause then setting the pin back to 0 would run the motor for a set amount of time. After that it was a case of trying different amounts of time to get a quarter turn. Eventually we discovered 1200 ms was about the right amount of time!

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.


 

 

CAS North Leicester Primary Hub meeting 28 September 2016 eSafety

Penny Patterson shares her wisdom on how to ensure your school meets the new Safeguarding requirement for online safety.

This term we decided to focus on something that many schools will be covering at this time of year, eSafety. The changes to Keeping Children Safe in Education that came into force on 5 September 2016 included more explicit duties for safeguarding with regard to online activities. We were very fortunate to have Penny Patterson (Senior Inspector Quality Assurance with responsibility for Safeguarding, Havering School Improvement Service) present by Skype for our meeting. She went well beyond the call of duty, when after discovering the M25 was closed, she had to divert and deliver the presentation using her phone from her car whilst parked at a garden centre!

Her slides highlight the new requirements succinctly and she has kindly agreed to share them:

penny-slide1
Full presentation available for download

 

Safeguarding-and-online-safety ppt file

One of the more alarming aspects of her talk was a discussion around sexting, which most of us had felt wouldn’t be an issue we would need to deal with in Primary schools. However, Penny has dealt with two cases involving children in early years and warned us to be aware of the difficulties of dealing with such cases. Unfortunately the strict legal definition of sexting includes the taking and sharing of indecent images, and if children take photographs of what is under their clothes, this can constitute sexting. Fortunately, UKIS have issued guidance on how to proceed if this happens in your school, and how it can be dealt with in a sensible and proportionate way.

Teachers were keen to know how to deal with parents on social media who were not being good role models to their children. Penny advised that they should consider if the children were involved, named or harmed by the online conversations and if they were, then to deal with this as we would with any other safeguarding incident.

We noted with interest the addition of a category of abuse of neglect for parents whose excessive use electronic devices as ‘babysitters’ and for parents who may be ignoring a child through the excessive use of technology themselves (watching their phone instead of their child crossing the road for example).

Finally, Penny gave us some good advice to make sure that we had checked that the filtering and monitoring systems we were using fulfilled the criteria recommended by the DfE (see : Guide for education settings and filtering providers about establishing ‘appropriate levels’ of filtering and monitoring)

The next meetings of the CAS North Leicester Primary hub will take place in March and May 2017. Book your free tickets online.