XinaBox produces a range of 70+ modular xChips, which includes cores/CPUs, sensors, power, communication, output, and storage, using a connectivity standard without wires, soldering, breadboards or hardware knowledge.
The xChip CW01(ESP82666 Core) is a Wi-Fi module, that enables its users to send/receive data to/from cloud anywhere.
The xChip BM01 is designed to interface with the micro:bit single board computer. This provides an interface to support the XinaBox xChips ecosystem, adding support for many additional sensors etc.
The BBC micro:bit (MB) is a handheld, programmable micro-computer that can be used for all sorts of cool creations, from robots to musical instruments – the possibilities are endless.
By the end of this guide you will be able to build a “Panic button” device. The device consists of a central gateway MB and multiple client MBs. Client MBs have two buttons: one Red, one Green. Whenever, any button is pressed on client MB, it then sends message to gateway MB over radio. The gateway then sends text message to the specified mobile number using Ubidots.
The workflow for the red button functionality is summarised below:
- Clicking the Red button results in a text message being sent to a pre-specified number.
- The user is required to press the Green button at least once every hour to indicate that they are OK. If not pressed a text message is sent to the mobile phone indicating that something may be wrong.
● 1x BM01 - micro:bit Bridge
● 1x CW01 – Wi-Fi Core (ESP8266/ESP-12F)
● 1x IP01 - USB Programming Interface (FT232R)
● 1x XC10 - 10-Pack xBus Connectors
● 2x micro:bit (at-least)
● (Optional) Foam board
● (Optional) Color paper
● (Optional) Hot-glue gun
1. Flashing Code
2. Hardware Setup
3. (Optional)Adding foam buttons to the original buttons
4. Integrating Ubidots SMS/Email Event
1. Flash the supplied CW01.bin firmware to the CW01 using XinaBox Uploader
- Connect the IP01 and the CW01 together using one of the uBus connectors.
- Connect the IP01 to your laptop using the USB plug
- Open the XinaBox Uploader.
- Inside the XinaBox uploader navigate to the CW01.bin file then click FLASH
2. Flash MBClient.py to the Client micro:bit(s)
- Use one of the Python editors available for micro:bit, which can be found on the micro:bit Foundation's website.
3. Flash MBGateway.py to the Gateway micro:bit
You will need to make some 2 edits to the MBGateway.py code. You will need to enter the username and password of the Wi-fi connection you are using, as well as the Default Token from Ubidots. To find where to make these edits go through the code and look for the comments prefixed # EDIT GUIDELINES
In addition, in the code we have called the gateway micro:bit "PANIC". This name is also used in Ubidots (see section 4 below). You can change this if you like, but if you do make sure you change it everywhere in MBGateway.py and also in Ubidots.
The process of editing this code and connecting to Ubidots is covered in a lot more detail in this how-to guide.
The micro:bit Gateway:
Connect your micro:bit, CW01, BM01 and IP01 together using the XC10 xBus connectors. You may connect it as shown in the diagram below. Please see this guide on how to assemble xChips generally.
Then connect IP01 to a power source (e.g. a PC or Power bank) to provide enough power to work.
After the gateway is Powered On the micro:bit a Tick should show up (then disappear) on the micro:bit LEDs 3 times consecutively, indicating that the gateway is connected to Ubidots. If you don't see the ticks, or if a cross is displayed (even just briefly), the gateway should be restarted.
If all has gone well the gateway is now ready to use.
We will now adapt the client micro:bit(s). You can just use the micro:bit buttons, but the idea is to provide a stark visual cue to someone such that in a moment of confusion they are inclined to act in a certain way. Having a large red button to press will help this. We've used a simple but effective method:
1. Cut the foamboard into appropriate button size and shape
2. Paste color paper of required color onto the cut foam pieces
Attach each foam piece to the micro:bit client’s button:
Attach the battery pack (the 2x AAA one that comes with the micro:bit) to the MB. Click any of the button to create device on Ubidots.
When you press the button the client MB displays 'a' or 'b'. At that point it sends a message to the gateway MB telling it which button has been pressed. If the gateway receives and interprets the message correctly it will briefly display a Happy face.
To configure the Ubidots IoT platform follow the instructions here
Inside Ubidots we are going to set up an Event: we will tell Ubidots what to do when the user clicks the red button:
1. Go to Ubidots Event. Select your Device 'PANIC', Variable 'help'. Select value form drop-down and set it to "1":
IMPORTANT NOTE: Send SMS event may not work for different UI/Account types. As an alternative you could instead use Send e-mail.
IMPORTANT NOTE: Ubidots charges 20 credits per event, while Email is charged 1 credit per event (although there is no charge for sending emails from a free 30-day trial account).
2. Enter your Phone number/Email address. Enter the message to be sent:
The functionality for the green button is similar. Instead of triggering an SMS, though, it resets a timer inside Ubidots. If that timer reaches zero the SMS is triggered.
Press the red button, the message is received within few seconds.
In this project we have built a “Panic button” device with XinaBox and micro:bit. The device sends text message to the mobile phone when a Red button is pressed, calling for help. The project is useful for patients, especially for those who are patient of mild Alzheimer's disease.