Friday, 25 August 2017

Getting Started with Kitronik MOVE Mini - Part 2

There's not much to say in part 2! Follow the Kitronik instructions in their booklet, avoid snapping any of the panels like I did but have a tube of Gorilla Glue available, just in case you do!


Finish the build and then fire up Bitty Controller from the wonderful Bitty Software and let the fun begin!



Getting Started with Kitronik MOVE Mini - Part 1

Those lovely people at Kitronik sent me one of their cool MOVE Mini kits to play with.

This morning I went through the initial steps to partially build the kit and test it. The kit is not fully assembled yet, but I do have the micro:bit connected to the PCB and the servos connected, with their wheels attached.



The Kitronik web site provides details of the code you need on your micro:bit if you want to control it from a smartphone using Bitty Controller. There's also a ready made hex file available from the Kitronik web site which you can download, if you just can't wait to get started.

Initially I had no success at all. I got no response from Bitty Controller and so had to back-track and troubleshoot.

The most important thing to do in this situation is to eliminate Bluetooth completely and check that the electrical connections between the kit's PCB, the micro:bit and the servos are all properly in place. In the Kitronik booklet, they provide guidance on testing the servos in Step 4. I implemented this code in MakeCode  but made one change, which was very useful. The code lets you start the servos running in either direction, by pressing micro:bit buttons A or B or make them stop by pressing A+B together. If these tests do not work, then you have a problem with the construction or electrical connections of your Kitronik kit. There's no point trying to control it over Bluetooth if this is the case and you need to track down the problem and fix it, perhaps disassembling and reassembling carefully, before trying the servo test again.

Watch this video to see the servo test in action:



The change I made to the servo test code was simply to display something on the micro:bit LED panel. The presence of the expected LED pattern confirmed that the micro:bit was receiving power from the batteries connected to the MOVE mini PCB. I'd definitely had problems with electrical connectivity earlier on, so this was a very useful change. Here's my code, from the JavaScript view of MakeCode, by the way.

basic.forever(() => {

})
input.onButtonPressed(Button.A, () => {
    pins.servoWritePin(AnalogPin.P1, 180)
    pins.servoWritePin(AnalogPin.P2, 180)
})
input.onButtonPressed(Button.B, () => {
    pins.servoWritePin(AnalogPin.P1, 0)
    pins.servoWritePin(AnalogPin.P2, 0)
})
input.onButtonPressed(Button.AB, () => {
    pins.servoWritePin(AnalogPin.P1, 90)
    pins.servoWritePin(AnalogPin.P2, 90)
})
basic.showIcon(IconNames.SmallDiamond)

There's a hex file compiled from this code available for download from the Bitty Software web site. Install it if you're having problems and check that micro:bit buttons A, B and A+B have the expected effect.

Once I'd sorted out connectivity glitches, I installed the ready made hex file for Bluetooth control which I'd downloaded from the Kitronik web site.

It didn't work.

It dawned on me that perhaps the hex file required me to pair my phone. Pairing is optional and whether you need to do it or not depends on the code from which your hex file was created. By default, MakeCode projects require you to pair.

Sure enough, this turned out to be the problem. Pairing requires a slight change to the usual procedure though, since you cannot access the reset button on the micro:bit when it's mounted on the kit PCB. Instead, switch off the kit PCB using its OFF/ON switch at the top,  hold down micro:bitbuttons A and B and then power the kit ON, keeping buttons A and B held down all the time until you see "PAIRING MODE!" scroll across the micro:bit display. Then use your phone's Settings/Bluetooth screen to select and pair (Android) or the nRF Connect application on iOS. See Bitty Software for videos demonstrating the basic procedure. Note though that you will not need to enter a 6 digit PIN. MakeCode specifies a simpler approach to Bluetooth pairing called "Just Works".

Here's a video showing me pairing with the micro:bit in my MOVE mini.


And here's my final test, involving Bluetooth and Bitty Controller!



Monday, 14 August 2017

Bitty Blue on Chromebook

A new version of free application Bitty Blue was made available for Chromebook yesterday. It's now available on iOS, Android and Chromebook.

Bitty Blue lets you play with the primary Bluetooth features of a BBC micro:bit and hopefully could form part of lessons and coding club activities, prompting the question "how does that work?" at every turn.

Chromebook seems a great platform and I understand that in some parts of the world it's the standard kit to be found in classrooms.

Teachers and STEM leaders.... hope you find this useful and fun.


Friday, 4 August 2017

Bitty Data Logger 2.4.0

Bitty Data Logger 2.4.0 was just released for both iOS and Android. It adds one new feature, namely the ability to trigger calibration of the digital compass in a connected BBC micro:bit, on demand.

Capturing and charting magnetometer data is just one of the great things you can do with Bitty Data Logger. Magnetometers need constant love and attention though, if you like your magnetometer data to be accurate. Accurate data can only be obtained if you calibrate the compass in the environment you intend to use it in. On the micro:bit, the calibration procedure involves you responding to a "DRAW A CIRCLE" prompt which appears on the LED display by rotation the micro:bit in space, causing an LED light to be lit all the way around the edge of the display. Once you've lit all the edge LEDs, a smiley face appears, indicating that the calibration procedure has completed.

You can now trigger the magnetometer calibration procedure over Bluetooth from within the Bitty Data Logger settings screen. You need to be running a suitable hex file on your micro:bit of course, but luckily there's just what you need available for download from http://www.bittysoftware.com

Oh and Bitty Data Logger is no longer free of charge. Sorry about that. See the previous blog post on Bitty Controller for the reasons behind this.