Posts: 2
Registered: ‎04-02-2017

Sensor node network with Thunderboard Sense and MicroPython

I am a member of NUTS, the NTNU Student Test Satellite. The main goal is to create a CubeSat, a tiny satellite that piggybacks on the launch of a larger satellite.


Another goal of NUTS is trying to promote aerospace/STEM topics among other students. Last fall we participated in "Researchers Night" at NTNU, which is used to promote STEM education among high school students. A lot of institutes and organizations show up at Researchers Night with really flashy displays, such as flamethrowers or slightly violent chemical reactions.


At our disposal we had a vacuum chamber, a DC-motor, space-grade and regular solar panels, and several Thunderboard Senses. Showing off how marshmallows behave in vacuum, and how the DC motor behaves when connected to the different solar panels might be interesting enough in and of itself. However we decided to add some Thunderboards to spice it up a bit.

Using a budding implementation of MicroPython for Thunderboard Sense (which will be released soon), we brainstormed and programmed a small sensor network for our stand, simulating logging telemetry data from our satellite. The Thunderboards were utilized as follows:

  • Glued to the DC motor, transmitting gyroscope data from the IMU.
  • Inside the vacuum chamber transmitting pressure.
  • Transmitting the light-level with the light-sensor.
  • Sampling the sound-level with the microphone.
  • A master that could tune into transmissions from either of the other Thunderboards, logging the output to screen and also showing how much the slave deviated from "normal" status by using the  RGB LEDs.

I have embedded two video. The first one gives a short overview over the entire project, while the second shows the setup in action, logging data from the vacuum chamber.


Our stand was a great success! Robot Very Happy We got several people standing around for up to half an hour discussing intricacies of satellite development as well as giving us an opportunity to talk more about the satellite radio link.


At last I want to brag a bit about how neat this code turned out with MicroPython, and how MicroPython really was ideal for bringing up a project like this in such a short time.  The code for reading data from the IMU and transmitting it ended under 40 LOC.

from tbsense import *
from radio import *
from math import sqrt

rdio = Rail()
i = IMU(gyro_scale = IMU.GYRO_SCALE_2000DPS, gyro_bw = IMU.GYRO_BW_12100HZ)

def float_to_pkt(flt):
    integer = int(flt)
    decimal = round(flt, 3) - integer
    decimal = int(decimal*1000)
    ret = bytearray(6)
    ret[0] = (integer >> 24) & 0xFF
    ret[1] = (integer >> 16) & 0xFF
    ret[2] = (integer >> 8)  & 0xFF
    ret[3] = integer & 0xFF
    ret[4] = (decimal >> 8) & 0xFF
    ret[5] = decimal & 0xFF
    return ret

def loop():
    meas = i.gyro_measurement()
    meas = sqrt((meas[0]**2)+(meas[1]**2)+(meas[2]**2))
    pkt = float_to_pkt(meas)
def init():

while True:



<a href=""><font color="#000000"><font size="2">Super Star</font></font> </a> zhd
Posts: 5
Registered: ‎05-16-2017

Re: Sensor node network with Thunderboard Sense and MicroPython

What is the hardware for MicroPython?


Posts: 2
Registered: ‎04-02-2017

Re: Sensor node network with Thunderboard Sense and MicroPython

I used MicroPython on the Thunderboard Sense, which uses the EFR32 Mighty Gecko. However I am currently unable to release the binary or the code for that implementation, but it will be available in due time.


If you are just interested in testing out MicroPython I recommend you check out the official home page of MicroPython, where you can test it out live at this site. Note that this runs on a pyboard, which is based upon STM32.