Using the micro:bit radio to send and receive sensor data

Wednesday, 16 November 2016

In this blog post I’m going to demonstrate the micro:bits radio capability. Have you ever wanted to know how cold your fridge is? Well I thought it would be interesting to find out so we took the following parts and got tinkering!

We then got to the programming, we did this in python and I use mu for the coding. You can download the code here.

The transmitter:bit

In this code we read the voltage from the TMP36 and convert this into the temperature then display it on the LED display and if a micro pixel is attached to this unit it will also change the colour depending on the temperature. We then switch on the radio and send the temperature as a string to any listening micro:bits then switch the radio off.

The receiver:bit

In this code we set up the micro:pixel then switch on the radio, once we've done this we listen for a signal and then take the string we receive and convert it to a float. Once we have that we do a little maths to increase the scale. We then display the temperature on the LED matrix and change the colour of the micro:bit depending on the temperature.





Hook up guide:

First up slide one of the micro:bits into your micro:pixel.

Next up connect the larger capacity LiPo to the micro:bit.

We then connect up the TMP36 up to the other micro:bit 3V to VCC, GND to GND and Pin1 to TMP.

Finally we plug in the small LiPo into this micro:bit and you're all done!

In action video:

Cant see the video? Click Here to view on our YouTube Information channel


Proto-PIC - UK Distributor of Sparkfun, Arduino, Adafruit, BBC Micro Bit electrical componentsProto-PIC ; UK Distributor of Sparkfun, Arduino, Adafruit, BBC Micro Bit electrical components