Bitty Controller 3.0.0
The Bitty Controller application was designed for maker projects involving the good old BBC micro:bit. But it's always been possible to use it with boards, micro-controllers and computers other than the micro:bit. And with the new release 3.0.0, using it with non-micro:bit devices just got even easier.The Dual D-Pad UI |
Bluetooth
Bitty Controller uses Bluetooth to communicate with remote devices. It sends information about what the user is doing (e.g. the top button in the right hand group was just pressed and then was released) over Bluetooth and in a defined format. The code on the other device has to receive, decode and react to this in whatever way you, the creator of the maker project, want. Maybe you'll want a wheel to start turning or maybe you want to flash an LED. Whatever the response to a user action should be, only you can decide and implement it in your code.Bluetooth Low Energy (LE), the type of Bluetooth used by the BBC micro:bit and other popular devices like Arduinos and the Raspberry Pi, takes an approach to defining remote interfaces using constructs called Services, Characteristics and Descriptors. The Bitty Software Beginner's Guide to Bluetooth LE describes this quite well, so I won't repeat it here. But the BBC micro:bit has its own set of services (etc), most designed by Martin Woolley (yours truly, in other words!) when he was involved in the micro:bit project a few years ago. A collection of services and the rules for using them is typically known as a Bluetooth 'profile', by the way. The micro:bit Bluetooth profile includes services which Bitty Controller uses for bidirectional communication with a micro:bit.
But what if you want to control a device that uses something other than a micro:bit?
The digital switches UI |
Imitating a micro:bit with the micro:bit Bluetooth profile
What's to stop a developer from implementing exactly those micro:bit services on another type of device? And would an application like Bitty Controller be able to tell it was communicating with something which had the same Bluetooth services as a micro:bit but was in fact not a micro:bit?The answer to the first question is....nothing.
The answer to the second question is.... no. Not if you do it right.
So, your first option for using Bitty Controller with something other than a micro:bit is to implement the required Bluetooth services on your chosen device type.
The analog touchpad controller UI |
The Bitty Software GitHub repositories
Bitty Software recently set up some repositories ("repos") on GitHub. Over coming months, we'll publish example code for various types of device, showing how to implement the BBC micro:bit profile on devices which are not micro:bits, so that you can use Bitty Controller and Bitty Data Logger with those devices. See https://github.com/bittysoftware/bitty_controller_device_code for what we have for Bitty Controller so far.The enhanced touchpad UI with cells for sensor data and a handy button |
Introduction the HM-10 style serial profile
Some maker boards do not have Bluetooth, themselves. So if you want Bluetooth, you have to connect an external Bluetooth module, a system on a chip, which allows your board to use Bluetooth. Usually such modules connect to your board's GPIO pins or similar.
There are numerous external Bluetooth modules available, with various designs. The HM-10 is a particularly simple and affordable one. It connects to GPIO pins and uses serial communication to pass data back and forth with the connected board. It's not easy to programme though, so rather than programme it to give it the Bluetooth services you need, instead it comes preprogrammed with one service, containing two characteristics. You use one characteristic to write data from the remote device to the device the HM-10 is connected to and the other allows the HM-10 connected device to transmit data over Bluetooth to the other device. It's like sending and receiving messages.
You can send and receive any type of data you like. You define what the format is in terms of messages and message layouts and your code has to formulate messages and receive and decode them (and then react to them).
Bitty Controller and the HM-10 style serial profile
Release 3.0.0 makes it possible for you to choose whether Bitty Controller should use the micro:bit Bluetooth profile or the HM-10 style serial profile.
New - Profile type selector in the Options screen |
And this, of course, means it's possible to use Bitty Controller with all sorts of remote devices!
Take Roger Wagner's Hyperduino, for example. This is a very cool piece of kit. The Hyperduino consists of a clever daughter board which makes some potentially complex connectivity and electronics scenarios a breeze to set up. It works with an Arduino Uno and for Bluetooth, uses a connected HM-10.
Roger Wagner's Hyperduino and a connected HM-10 Bluetooth module |
HM-10 and Bitty Controller Messages
Bitty Controller has defined a number of message types so that it can convey user interaction information via the HM-10 and can receive data, such as might have been acquired from sensors, from the board the HM-10 is connected to. All messages start with a single byte opcode, whose value defines the type of message. This is then followed by one or more other bytes, depending on the message type. We've published a template Arduino sketch which should make it easy to use Bitty Controller with Arduino-based maker projects. The README file includes details of the messages and their format. See https://github.com/bittysoftware/bitty_controller_device_code/tree/master/arduino/Arduino_with_HM10_serial_template
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.