Recently Viewed
Micro Logger for micro:bit
  Zoom
Micro Logger for micro:bitMicro Logger for micro:bitMicro Logger for micro:bit

Micro Logger for micro:bit

Our Price:  £24.00 

Available Now:  

10 in stock, immediate despatch

SKU:  PPMB00142
Part Number:  MB00142
Brand:  Proto-PIC


One of the many questions we get asked when it comes to micro:bit is 'how can I log the data from the XYZ sensor to a file', and here is the answer, our Micro logger for micro:BIT. While the micro:bit is easy to program, and with its support for a wide range of sensors, storing the readings from sensors has always been a bit of a challenge. This Micro logger provides a solution for this by storing the data on an SD card, in any customisable format you can program. The SD card can be removed for reading with a computer, or there is an FTDI header that can be used to dump the data to your computer using a terminal program, or your own custom software.

 

The Micro logger has an easy to use set of commands for formatting and saving your data, changing the settings of the logger, and dumping out the data to serial or erasing the datafile. There is also an onboard voltage regulator to take the power input from 5V on the USB or 5V - 12V on the barrel jack down to 3.3V for your micro:bit and sensors. There is a switch to change the input from the micro:bit to the FTDI header, allowing you to access & operate the logger from an FTDI breakout or another microcontroller, e.g. Arduino, this is a 3.3V device so you will need to use a logic level shifter if you use a 5V device. The 3.3V, GND and micro:bit pins have been broken out for you to add pin headers to, or solder wires directly to, allowing you to use sensors on breakout boards with standard jumper wires.

 

We had one of these logging the soil moisture in one of our plants here at Proto-PIC HQ using the code below, using the data to create a graph of moisture over time.

 

Here is the code :

 

from microbit import *
tick = Image("00000:"
             "00009:"
             "00090:"
             "90900:"
             "09000")
# Start serial output on pin 16 - this is the output to the Datalogger
uart.init(9600, tx = pin16)
# Give the connection time to setup
sleep(250);
# Turn Line Feed OFF - we want to concat our data
print("<{NLOFF}>")
while True:
    # Wire pin 1 to the +ve pin on the sensor
    # We only turn it on when required
    # This stops the current when we are not reading
    # makes the probe last a LOT longer
    display.show(tick)
    pin1.write_digital(1)
    sleep(500)
    reading = pin0.read_analog()
    pin1.write_digital(0)
    print("<moisture reading : ", end="")
    print(reading,end="")
    print(">")
    # Move to New Line
    print("<{NL}>")
    # Make sure the data has been written to the SD card
    print("<{FLUSH}>")
    display.clear()
    # Wait for 1 minute
    sleep(60000)

The logging of DATA is easy, just make sure it is in between < and >. Anything that does not have the will be ignored by the logger. COMMANDS are in between <{ and }>. Examples of these are below.

<12,34,56><{NL}> Would create :

12,34,56

with a new line after the 6, the<{NL}> is a command for New Line.

 

Commands :

{NL}                         Add New Line.

{NLON}                   Auto New Line after DATA on.

{NLOFF}                  Auto New Line after DATA off.

{FLUSH}                  Ensure the DATA buffer has been written.

{CLOSE}                  Ensure the DATA buffer has been written & close the file.

{DUMP}                  Write the data file out using the serial connection.

{ERASE}                  Delete the datafile.

{BAUDxxxx}          Change the BAUD rate of the serial connection, valid speeds :

                                    9600 (Default), 19200, 38400, 57600 and 115200

{STATUS}               Show the current Auto New Line status.

{VERSION}            Show the current firmware version.


Customer Reviews

Be the first to Write a Review for this item!