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 using the Micro:Bits.
So, the aim of this project is to use multiple Micro:Bits and use the onboard radio that they have, to transmit remotely our sensor data to a single base station receiving Micro:Bit and from there we'll log and document the data we collect. So, in this section of the video I'm going to talk to you about a wind sensor, so we'll make a wind sensor out of a hobby motor and read it with a Micro:Bit and transmit that data to our central base station. So, we can use a pre-built anemometer to measure wind value, it would return a calibrated voltage for however fast the wind blowing but for this project, we thought it'd be a little bit more likely the sort of thing that you'd run into the classroom.
To build a wind speed sensor yourself we just used paper rolls and some craft sticks and a hobby motor and whenever you spin a motor backwards it generates a small amount of electricity, so in a little motor like this there's no danger of generating too much voltage for the board to handle, so we can just wire it up backwards basically or wire it up correctly the ground wire from the motor, goes to the ground on the Micro:Bit and the positive line from the motor, goes to one of the analog inputs and from there we measure the voltage that the motors generated when it spins. Now there are some obvious disadvantages to this kind of design, if you spin the motor the other direction, so the motors spinning counter-clockwise, then it doesn't generate any voltage that you can measure, and it's not calibrated. So it is possible to create a design of an anemometer, where it will spin the same direction no matter what direction the winds coming from and you can also calibrate this like a real sensor by blowing like speed of wind on it, maybe holding out of a car window while someone else drives down the road and measuring what the voltage is at different known data points and then you could plot your data and create a formula to make your measurements accurate, but for this project I figured that if it's spinning really fast and returning a high value, then we know it's really windy.
So, when the motor spins the readings taken from the motor and plotted on the LEDs on the Micro:Bit, so let's look at the code. When we start up the Micro:Bit we're using a radio to communicate one of the good things to do is set our radio power. So for this project right now, we don't need the radio power to be very high at all but you can set it to as high as seven, so that's maximum power, so I went ahead on all these parts set them the maximum broadcast power, just to be sure that we get a strong signal across and I set the radio group to one so all the Micro:Bits are listening on the same channel and then when we start up the board, the text wind scrolls across so we can identify the board for what code it has on it. Now we have two forever loops here because they are running in parallel or close to it the analog read, we take from pin 2 and we plot that on the LEDs of up to 200, which is a number that arbitrary and number that I picked and unexpected to ever reach 200. So that seemed like a good maximum for our graph and we also send the value out with the text string wind and the analog value read off of p2 and we pause for five seconds afterwards, so I didn't feel like it was necessary to send constant five times the second data over the radio to our receiver for the wind speed, when wind speeds not something that really changes that rapidly, so we're sending it once every five seconds, so we don't bog down our receiver with lots of different info over the same radio channel.
So that wraps up this section on making a Wind Sensor for our Natural Disaster Sensor Project, it could be a fun creation experiment to make a Wind Sensor of your own design and hobby motors are a good option it's a kind of a DIY sensor. So, stick around, in the next section we'll talk about making a Temperature Sensor.