A simple light sensing application with micro:bit radio and serial.
Tested on a MAC, using Python 2.7.11 and serial version 3.2.1.
The description of this application is in my blog article Micro:bit and the Internet of Things.
For this application, we need two micro:bits and a laptop. Our application has three parts:
- Sensing: One micro:bit will act as the sensing device, and will send its light measurements to a second micro:bit using its radio.
- Communications gateway: The second micro:bit is the gateway and sends what it receives to the laptop over the serial.
- Analytics and visualization: To show the incoming measurements the laptop runs a visualization scripts.
Prerequisite: Python installed.
- Install microbit-LightSensorSender.hex into the sensing micro:bit.
- Install microbit-LightSensorReceiver.hex into the gateway micro:bit.
- Make sure you leave the gateway micro:bit connected to your laptop (you would have needed to connect them to download the code into micro:bits).
- Download serialPlot.py and run. If the gateway micro:bit is not connected via serial, this script will give an error. Otherwise, it brings up a dynamic graph.
- Turn on the sensing micro:bit if you have not, and experiment with the set-up under different lighting conditions.
An example of how things should look like is here: Youtube video