Coding for Conservation
Micro:bit program for tracking light and temperature in native bee hives
Used in combination with Sensor
About
Planet Bee Foundation is programming BBC Micro:bits with Microsoft’s Makecode in order to bring conservation efforts to student’s classrooms across America! This program, a WIP, is being designed in combination with a Sensor script, so there will be one Micro:bit on the native bee home collecting the datapoints (the “Sensor”), and another Micro:bit within its bluetooth range that stores the data away from the nest, so the user can safely retrieve it without disturbing the home (the “Logger”).
How to use
- Open this project in makecode following the edit this project below
- Download the hex file (bottom left corner)
- Put the file on your Micro:bit
- Must be used with Sensor on another Micro:bit
Once you have both Micro:bits set up, press “A+B” on your Logger chip. It sends the start signal to the sensor chip. You can leave them alone, and they will record until the logs are full. Right now, it is logging every 10 minutes, but that can be adjusted.
To adjust the logging time:
There are three points that need to be changed. (1) the watchdog timer, in seconds (2) the waits at the end of each script, in microseconds
- I have it set so the sensor restarts its cycle slightly faster than the logger to ensure it’s prepared and ready to send data before the Logger restarts its cycle.
- NOTE: If you make the logging time really quick, the chips are bound to get off cycle, as there are sometimes delays, and sometimes the messages are not received properly. I have set up error handling for that, but it is not perfect. Our project wants minimal logging.
To collect the data:
- Plug your Logger Micro:bit into a computer.
- Locate your Micro:bit drive.
- Open the “MY_DATA.HTM” file in your browser.
- Download the csv file.
- IF you left them on and cycling, and want to restart their cycles, press “A” on the Logger.
Use as Extension
This repository can be added as an extension in MakeCode.
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- search for https://github.com/kpowkitty/logger_ and import
Edit this project
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/kpowkitty/logger_ and click import