 empowering creative people

Videos / Microbit - Natural Disaster Project - DIY Seismic Sensor

The Micro:bit has an accelerometer built right in. We can use this sensor to simulate an earthquake sensor. By adding the acceleration of the x and y-axis we can measure the total acceleration the board is undergoing. To make it into a seismic sensor it should be anchored to something immobile like a slab of concrete. We don’t want to wait for an earthquake to test our program so we left it loose.

Related Content

### Transcript

+

Hi, Steven here from Core Electronics, welcome back to our Natural Disasters Sensor Project using the Micro:Bit. In this section we're going to learn how to make a Seismic Sensor using a Micro:Bit with the onboard accelerometers.

So, what we're simulating here is a Seismic Sensor, something that would measure the shake of the earth and save and transmit that data back to our base station, so using the onboard accelerometer which is surprisingly sensitive on the Micro:Bit, we want to measure any movement in the X and Y direction of the board. So, as we're measuring the motion, we will plot it onto the board and we'll transmit that same data over to our receiving Micro:Bit where we can plot it on the computer in log our data. So what are the one of the things that we need to keep in mind when making a sizing sensor, is that typically when we tilt the board in one direction say the X axis, then that would be the negative direction and then the other direction would be the positive direction and the same for the Y axis but we want an absolute value of motion. So, we need to measure the absolute value of each, so we've returned always a positive number, so any combined motion so we'll add our X and Y axes together all the combined motion will be sent as a single number. Now if you wanted to go further with this project you could also consider the z axis, so up and down say if it was an actual earthquake the ground moves in waves, so the sensor would potentially move up and down as well there's quite a bit you could do with this if you wanted to take use time stamps that were effective you could put Micro:Bits in different places far apart and if there was an actual earthquake calculate the epicentre, to each one based on the different times but admittedly the likelihood of sensing an actual earthquake with a Micro:Bit is a little bit low, so unless you're in an area where there's lots of earthquakes, we'll may we may have stick with just simulating in an earthquake for now.

Let's look at our code, so it when we start up the Micro:Bit we're going to set our radio group to one, so it's on the same channel as all our other Micro:Bits we're set our power to maximum and when the board is powered up the text seismic will scroll across the LEDs, so we'll be able to know what the device is I've also put labels on the board, so I can tell but it's always good in case your sticker falls off, so we will constantly take readings from our accelerometers on the X and Y axis and add them together and as we can see we're using the math block absolute, so we're going to always have a positive number, absolute value of a number is the numbers distance from zero, so basically it just always returns a positive even if the number is negative 100, the absolute value would be 100 and we plot that value onto our graph, on top of the board have a value up to 1000 which is 1 gravity.

It's worth noting that there's a little bit of noticeable delay in the board, when you on the plot when you move the board the value that it's recording and sending over serial doesn't have the same delay as what's being plotted on the board, there's just a little bit of delay for the LEDs to react and you can notice even more of a slight delay when the values transmitted to our receiver but this isn't anything really to be too concerned about the values still coming across and you can use time stamps to accurately determine when those measurements were taken, so even if it takes a fraction of a second to be received on the other board the time stamp goes with it, so the time that it was measured is going to be correct.

So, that wraps up this section on making an Earthquake Sensor using a Micro:Bit, stick around in the next section we'll talk about a receiver, where we'll monitor and document all our data that we received it's received.