We are collecting all this great data from remote (but not too remote) sensors and sending it out hoping someone will listen. Now its time to make the receiver.

Transcript

Hi, Steven here from Core Electronics, welcome back to the final video of our Natural Disaster Sensor Project using the Micro:Bit, in this section we'll learn about making our receiver that will receive all the data being transmitted from our three Micro:Bit sensors; we have the Wind Sensor, will have a Temperature Sensor and we have a Seismic Sensor all that data will be sent to our receiver board, where we can log it on the computer or plot our results or even export it to a CSV, so let's start by taking a look at what the board does.

 

So right now we have it in temperature monitoring mode and it's plotted on the board itself, the same what's being measured by our temperature sensing board and that's being transmitted over the radio onto the board itself now, these have a range of about 70 meters, so not to necessary to transmit it over this sort of distance but we could potentially put this somewhere far away and still be receiving this signal, if we change our mode pressing a button, will set it to our Seismic Sensor which is this sensor here, so any earthquakes or motion under the board is transmitted to our receiving board where it's plotted and if we change the mode again, then we change it to our wind sensor. Now our wind sensor it's not very windy in here so we'll have to simulate it, so our Wind Sensor transmission comes through every six seconds, so we spin the sensor we see a measurement come through on the board and it's been plotted on the board so let's look at our code that we're using.

 

So, even though we can only display the data from one source at a time, on the LEDs of the board itself that data is coming through and being recorded over the serial monitor constantly from all sources, so let's take a look at what we did to program the device, first of all we, on start we set our radio group to one we initialize a variable mode and text to zero and we'll explain those in just a minute and we start out by the string temp because that's the mode that we start up in, so when we push button A we changed the mode that's being displayed on the board, so we first set our mode to three, so it's not showing anything for the moment and then we change our text mode up or down to be the mode that we're in and then we set our mode to the same thing as text so mode determines what the what's being plotted and text determines what text is going to be scrolled, so we need to turn mode off so to speak for a moment, so it's not trying to plot over are subscribing texts.

 

So as our values come in we plot them on our LEDs determined by which mode we're set in, so constantly we're looking to receive radio signals so we do that with the on radio received block and because we sent a text string and a value we want to receive a name and value, so the radio received block recognizes that there's going to be a string and then a numeric value afterwards and it saves them as two different variables. So we whenever we receive a signal we're going to write the running time to the serial, so we can log the time that the signals were received and then we have some logic here to determine what source each of the values are coming from, so if the string is equal to seismic or temperature then it will save the value that's behind it as seismic or temperature or wind respectively and then write it to serial. So, we'll be able to see it.

 

So one of the great things about using MakeCode for Windows, the Windows app is that we can see our live data being collected by the device on a serial monitor, so while we're connected over USB we have this option to show data device and this is years whenever you have any plot or a serial right commands in your code. So as we can see here, as our data is coming in that'll slowly appear and create more graphs that we can see, but our first of all we have our seismic data, so as I move my remote seismic sensor the data is being transmitted across to our receiver where it's currently being plotted and it's showing up here in our scrolling bar graph, the readings that I'm getting in real time off of our seismic sensor and you notice that when I'm setting it down its stopping it 160, that's because it's not perfectly centred. So, if the device was closer to centre than it would be a number closer to zero. Our next graph is our running time which is just the time increasing, in milliseconds since the receiver was powered on. We then have our wind readings which come across every six seconds again, so we'd have to wait till we can get a reading off of our wind sensor, so once appeared we've gotten 26 or 22 transmitted across and our bar graph has gone up to 22 and now it's transmitted again and gone back to 1 and then finally we have our temperature values which are coming across as 20 degrees.

 

So, one of the cool things about plotting onto all our data with in MakeCode is that we can then export it to a CSV. So at the top of our screen we have this export data link and if we click that it will export all of our data into a CSV file with headings for each data source, so we'd have a column for seismic, one for running time and wind and temperature respectively and you could use that data, that raw data to really do some good analysing on it say remove the errors from your seismic sensor or compared the times that your temperature changed and whatnot.

 

So that wraps up this tutorial on creating a Natural Disaster Sensor Project using the Micro:Bit and remote sensors, thanks for watching.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.