micro:bit Monday - enviro:bit

Do you like science and recording data using sensors? Well enviro:bit will interest you this Monday!

So what is it?



enviro:bit from Pimoroni is an add on for the BBC micro:bit that enables the micro:bit to be used to record data via a number of sensors.

Sensors? As in Star Trek?

Well no, but we do have some more 21st century sensors to play with...

  • BME280 temperature, pressure, and humidity sensor
  • TCS3472 light and colour sensor
  • MEMS microphone



So we can measure temperature, air pressure and humidity (handy with the blazing summer we are experiencing in the UK right now.) We can detect colours and measure light, and we can detect sound using the MEMS microphone. All of these sensors mean we can use this board for citizen science, and school science projects!

So how can I use it?

enviro:bit can be used with Make Code (block editor) and Micro Python and it is extremely easy to use, so lets build a quick project to control the micro:bit using the power of clapping!

For this project we shall use the microbit.org block editor

Attach the enviro:bit



Attaching the enviro:bit is easy, it has a slot for the micro:bit to slide into. Now connect your micro:bit to your computer and it will appear as a USB flash drive. For now, leave it as is.

Install the package



To use the enviro:bit board with the micro:bit, first we need to install the enviro:bit package. In the top right of the MakeCode editor is a cog, click on it and select Add Package... then in the new pop up window search for enviro:bit and then click on it to install.

Write the code



To start the code we use the forever loop to store a conditional test called if, else this is found in the Logic blocks.



Then we go to the Enviro:bit blocks and select the block that will wait for 1000ms (1 second) and when it "hears" a clap it will return True.



When the enviro:bit hears a clap, we want the screen to be happy! So from Basic blocks we use the Show Icon block.



But when it hears no clap, our micro:bit is sad :(

That's all the code, name the file as something cool, and download it to your computer. When ready, copy the downloaded .hex file to your micro:bit using the File Manager. This will trigger the micro:bit to flash the code and then reboot with a rather sad face. So now clap your hands and make the micro:bit happy.

Ok where can I buy one?

Head over to Pimoroni (UK) and grab one for £20.