Sure you can use an Anemometer that will give you precise readings about wind speed, but its way more fun to make one yourself!
Hi, Steven here from Core Electronics, in this tutorial we're going to be talking about how to make a Natural Disaster Sensor Project for the Micro:Bit. So, this is a four-part video and throughout the series, we'll show you how to make a Wind Sensor, a Temperature Sensor and a Seismic Sensor, that will all transmit their data back to a single base station connected to a computer, where you can plot your data and review everything that you record.
In this section though, we're going to talk to you about making a temperature sensor. So, every Micro:Bit has a Temperature Sensor built into the board but for this project, we're going to show you how to use an external sensor and we're going to use an LM 35 DZ, it's an analog temperature sensor, they're about as simple as they get. The one downside is that they take five volts and they don't deliver a reliable reading at under five volts, sometimes you might be alright. So we're going to use a breadboard power supply, this provides either five volts or 3.3 volts to the breadboard, so we have it available, so we're powering our temperature sensor off of five volts from one side of our breadboard and the output is going to the analog in of our Micro:Bit and we're also powering our Micro:Bit off of the same breadboard power supply just with three volts and we're going straight to our power and ground on the board and you may have noticed we're also using a SparkFun Micro:Bit breakout board, this gives you access to all the pins on the Micro:Bit, without it you can alligator clip effectively to just three analog inputs. So, you could alligator clip the Temperature Sensor without much trouble but if you use the breakout, then we could connect to five of these simultaneously and use the Temperature Sensor on the Micro:Bit at the same time if we wanted to. So, we could make an array of Temperature Sensors and record all that data.
So, let's look at our wiring diagram, as you can see our Micro:Bit connected to a breakout, we have our Micro:Bit powered off power directly from our breadboard power supply and our Temperature Sensor goes power and ground to the five volts and our data it goes to analog in zero. Now while we're here we should look at the inputs and outputs of the LM 35 DZ, it's important that you get the voltage in the ground right on it if your arm up backwards it gets hot fast, it'll probably let the smoke out. So, this diagram here that's on our tutorial page is if you're looking at the bottom. So, looking straight on to the wires which pin is which.
So, we look at our code we initialize our program by, setting our radio power to maximum, we set our radio group to one so all our Micro:Bit are on the same channel and we start with a powerup message of temp. So, we know this is a temperature device, so when I turn the power on, it scrolls temp across the LED array and we constantly take a reading from the temperature sensor and then plot that to the device and we send it over the radio to our Central Station. So, as we can see here, we have a bit of a formula to convert the analog reading from our LM 35, to a usable temperature. So, we first multiply our input by 100 and then we divide that by 1024, which is the maximum reading that we can get from the analog pin, so from 0 to 1000 to before and that gives us the increments of voltage that we want. Now if you want to find the formula yourself, to calculate temperature using an analog temperature sensor the base formula is available on the datasheet for the device and there's a link to it in our tutorial page and you can also add a resistor in line to gain even more increments and make your temperature sensor more sensitive. So, we plot our readings onto our LEDs and we transmit that same value over the door, a receiver.
That wraps up this section, on greeting a temperature sensor for our natural disaster sensor project for the Micro:Bit, stick around in the next section we'll talk about making a remote Seismic Sensor.