Thursday, February 14, 2019

The Beginner's Guide to Bluetooth

I sometimes get asked for recommendations on things to read which will help people learn about the basics of Bluetooth, particularly as it relates to the BBC micro:bit. To that end, I've written a "beginner's guide" and released it today. Hope it helps!

http://www.bittysoftware.com/Bluetooth_le_intro.html


Sunday, February 3, 2019

Bitty Blue 1.2 - Message Display

Bitty Blue has a new feature called Message Display. It's a very simple idea but one which has a lot of potential. You can now send a text message over Bluetooth to Bitty Blue and it will be displayed. From the user interface, you can change the font size, the background and text colours and you can decide whether the text should be scrolled or not. If scrolling is switched off, sending more text from the micro:bit will replace the current text. If scrolling is enabled, new text will be appended to the current text.

So what might you use this for?

You could use your smartphone or tablet as a graphical console for monitoring your micro:bit code. You could display messages when something significant happens (but checkout Bitty Event Monitoring in BittyWeb for that as well) or display some kind of internal data like the angle a servo has been rotated to. You could even use the feature to help you track down problems in your micro:bit code but sending messages containing the value of an important variable at points in your code!

Sending text involves using the Bluetooth UART service so you must make sure that service has been included in your code, usually from an "on start" block. Then all you need to do from a MakeCode project is use the "bluetooth uart write string" block to send your text. Here's an example.


And here's what you see on your phone when (in this example), button A has been pressed.



Simples :-)

Monday, January 21, 2019

Thermal Pollution Monitoring with Bitty Blue

Thermal pollution is an environmental issue that we don't hear a lot about. It involves the artificially induced, rapid changing of the ambient temperature of the sea, lakes or rivers and it's a serious problem which can have a devastating affect on fish and other organisms as they succumb to thermal shock.

The most common source of thermal pollution is industry. Power plants and factories which dump heated waste water directly into the sea can cause a rapid increase in water temperature and the death of aquatic life.

I didn't know anything about thermal pollution until a few months ago. In fact, I'd never heard of it and I'd like to share with you how it is that I came to learn about the subject, all thanks to two  schoolgirls, Nouf and Mawwadah who live in Saudi Arabia.

Nouf and Mawwadah contacted me by Twitter, asking for some guidance on how to approach a school project involving micro:bit. Their teacher had asked them to think about thermal pollution and how technology might help prevent it and to build a working solution.

The project idea goes like this; imagine the waste water pipes from every factory by the sea were fitted with special devices which could monitor their temperature. If the temperature got too hot or too cold, risking thermal shock, the device could inform a computer system wirelessly, raising the alarm that the factory was breaking the law and causing thermal pollution.

Nouf had seen a YouTube video of one of the Bitty Software smartphone applications, Bitty Blue and knew it had the ability to act as a temperature monitor, with a suitably programmed micro:bit measuring the temperature using its built-in sensor and sending information to the Bitty Blue application. Depending on the information received from the micro:bit, Bitty Blue would display an image and some text indicating whether the micro:bit was telling it that the temperature was OK, too cold or too hot.

Nouf and Mawwadah talked with me using Twitter instant messages and I explained how Bluetooth, one of the most commonly used wireless communication technologies was an important ingredient in the solution. They were quite new to programming and so I did my best to act as a tutor. We talked about the basic logic, the programming concept of an "event", how "events" can be used to trigger Bluetooth communication with the Bitty Blue application and what the transmitted messages would need to contain. With a little guidance and a few more Twitter conversations, Nouf and Mawaddah were able to use MakeCode to create a micro:bit project which did exactly what it needed to. It looped, measuring the temperature every second or so and then sent a Bluetooth message containing a number which meant "OK" (0), "Too Cold" (1) or "Too Hot" (2).

We had covered a lot of information in a short time, and Nouf came up with the idea of sitting down with her sister and explaining the code to her as a way of making sure she understood everything. A great idea and of course in professional programming, walking someone else through your code is something which is commonly done.

So what happened next? Late last year, Nouf made contact again and told me that their school project had been a success. Another friend, Heeba had built a (very impressive) model factory, complete with a pipe which could carry hot water and a pool into which water could flow. With a micro:bit fixed to the pipe, they were able to fully test the idea and demonstrate that their concept worked and worked very well. It sounds like the project was a result of excellent team work, with everyone contributing something important.

Best of all, the team shared a video of her project being demonstrated in class. With permission, I added some captions and published it on YouTube.

If I was a teacher at this school I would award an A+ for this project without hesitation! It's brilliant. I have to say I'd also award Nouf and Mawaddah an A+ for showing such initiative and determination in tracking me down and asking questions in the way that she did.  :-)

Here's the video of the team's project.


p.s. BittyWeb, the web-based micro:bit project system from Bitty Software contains an application called Bitty Event Monitor. It's like the Bitty Blue temperature monitor application except that you can use it to monitor *anything* your micro:bit can measure with or without additional components like sensors attached to it. CO2, humidity, atmospheric pressure, vibration... you name it, you can build a fantastic school project with it.

Information about Bitty Blue can be found here: http://www.bittysoftware.com/apps/bitty_blue.html and a tutorial which explains how to creat the code for temperature monitoring is here: http://www.bittysoftware.com/tutorials/alarm_makecode.html

Sunday, January 13, 2019

Roger Wagner's MakerBit and Robo:Bunny

Roger Wagner's MakerBit is an impressive board for micro:bit projects with tons of very well thought through connectivity options, all of which are plug and play, leaving my soldering iron looking sad and neglected on its shelf!

You can buy MakerBit in several forms. As a standalone product, there are two variants. I used the MakerBit R which has additional features for robotics projects compared to the standard MakerBit. You can also get MakerBit in various kits with a wealth of additional components included for you to use in your maker projects.

You can of course invent your own projects, but MakerBit comes with several activity ideas to get you started. They're really well documented and I opted to follow the one for making a "smart car".

Interestingly, there's no chassis provided for the smart car project. Instead, you're encouraged to improvise and reuse a handy cardboard box, perhaps the one your MakerBit came in! I really like this idea. Anything which encourages kids to consider reuse and recycling is good in my book.

I built a "robot bunny" with interchangeable stick on face and programmed the micro:bit so I could control it from either the D-Pad UI or the touchpad UI of Bitty Controller.

My micro:bit code is available for you to use or adapt for your own Bitty Controller projects, as you see fit. See http://www.bittysoftware.com/tutorials.html#controller

MakerBit is highly recommended. I expect I'll be using it for other projects in the future, not just bunny related ones!

Here's a video to close this post with. Enjoy!

Tuesday, January 1, 2019

Bitty Controller 2.2.0

A new version of Bitty Controller was released today. A great start to 2019!

The new version offers a 5th user interface variant which is designed to let you drive a machine of some sort *and* control ancillary features of the machine like LEDs and servos. From the options screen you can enable up to 12 buttons and give each a short text label. These buttons will then appear either side of the main touchpad control.

Pressing a button sends a Bluetooth event with ID=9016 and a value equal to the button number in the range 1 - 12 inclusive.

I transformed a GiggleBot into my very own robot dog and used the new UI to take it for a spin. At times... literally. As you'll see, it's very evident from the enthusiastically wagging tail that robodog is a happy dog :-)


Full source code for a MakeCode project is available from the Bitty Software web site as well as a ready made hex file.

Go on! Have a giggle with Bitty Controller and GiggleBot!

Tuesday, December 18, 2018

No more DRAW A CIRCLE

Bitty Data Logger users will probably have played with the micro:bit's magnetometer (AKA digital compass) at some point, as will many other micro:bit users, with or without the involvement of Bluetooth.

The magnetometer needs to be calibrated in the environment in which it is to be used, for accurate data to be acquired from it. Originally, simply including the MakeCode "Bluetooth magnetometer service" block was enough to both make the magnetometer data available over Bluetooth *and* initiate the calibration procedure automatically when the micro:bit code started. If you've seen this happen, you'll know that the old procedure starts with the text "DRAW A CIRCLE" scrolling across the micro:bit screen. A single LED then appears and by rotating the microbit with its edge facing upwards, you light each LED on the outer edge of the display. Once a complete "circle" has been drawn, calibration is complete and your micro:bit will continue starting up.

Here's a very simple MakeCode project that could be used with Bitty Data Logger to log magnetometer data:



Things changed in the latest release of the micro:bit firmware (known as the DAL). Now, calibration does not happen automatically. To calibrate your micro:bit's magnetometer you must now explicitly request this in code. There's a block available for just this purpose so you could, for example initiate magnetometer calibration when button A is pressed, like this:


This change may affect Bitty Data Logger users. Magnetometer data will not stream into the micro:bit, even with the right code on the micro:bit until you have calibrated it. Luckily it's possible to initiate calibration from within the Settings screen of Bitty Data Logger:


That's it! Happy data logging!

Saturday, December 15, 2018

GiggleBot and Bitty Controller

GiggleBot is a wheeled "bot" from Dexter Industries which you control with a BBC micro:bit.



There are quite a few bots available for micro:bit enthusiasts now, but this one does have a certain je ne sais qoi. Perhaps it's the integral line following and light level sensors or maybe it's the neopixels mounted on its surface. Or maybe it's the expansion possibilities, with multiple points to connect external sensors and dedicated connectors for up to two servos. Or perhaps its the slot through which you can drop a marker pen so that your GiggleBot can draw as you drive. Either way, GiggleBot is full featured, full of potential for some very exciting educational projects and on the whole, tres, tres cool. Oui. Le GiggleBot, c'est bon (with apologies to French speakers everywhere!).

It's also a tough little bot. I drove mine right off the top of a table and it landing with a sickening "crunch" on a hard, wooden floor. Not a problem. GiggleBot shrugged off the impact and got right back to work.

And giggling GiggleBots, Batman! GiggleBot has the best name too :-)

But enough of my thoughts on GiggleBot, already. What's this?

GiggleBot and Bitty Controller work together!


"Really? Oh wow!" I hear you say! Well, yes kind reader, it is indeed true. With the right code on your micro:bit, you can use the GiggleBot's I2C interface to take full control, driving your GiggleBot from your phone using the Bitty Controller app or web browser using BittyWeb. You can also collect sensor data and display it on Bitty Controller's enhanced touchpad controller UI.

C'est magnifique! And it really is :-)


Here's a video demonstration for your viewing pleasure.



You'll find code and information about using Bitty Controller with a GiggleBot right here.

And more information on GiggleBot itself at https://www.gigglebot.io/


The Beginner's Guide to Bluetooth