myQuakeAlert: 60 Seconds to Safety
From the moment that the initial surface waves of a dangerous earthquake are felt, we have generally 30-60 seconds until the most damaging of these surface waves propagate. My project uses the NI myQuake longitudinal shaker setup to simulate what are known as “Love waves”, detect a certain theoretically “dangerous” frequency level using accelerometers, and then use social media to broadcast the alert. The twitter API allows this alert to reach more people, quicker. With the focus being on young people constantly in touch with social media, this mechanism could literally save lives.
Why I chose this Project:
I wanted to create something that was relevant to the real world struggles that people face and I have always been touched by the devastating effects of natural disasters such as Earthquakes. Unfortunately, these are things that simply cannot be prevented; no one can defy the forces of Nature. However, what we can do is accelerate the mechanisms to help the citizens of the world deal with such disasters.
A Bit About the Developer:
My name is Sarah Flanagan, I am studying Mechanical Engineering with Aeronautics at Brunel University London, and I am currently spending my placement year as an intern in the Applications Engineering department at National Instruments. Working on my intern maker project has been a fantastic learning experience and has enabled me to develop my LabVIEW skills. I chose this project because I wanted to address a real-world issue, and learn how to tackle a challenge faced by many people. In addition, I wanted to learn more about network communication using custom APIs. More specifically, how LabVIEW can interface with social media.
The idea of this project is to harness an instantaneous response to an event, and broadcast that response to a potentially wide audience. In this case, the event will be the detection of a vibration, and the broadcasting is done using social media. It is important to note, that this is by no means a finished product, but rather a proof of concept that is in development to become a successfully usable system.
The eventual product would have wireless network communication, and remote vibration detection, and wide-scale usability. However, for the time being, we are keeping the data acquisition local and PC-based, using DAQmx Driver software and the Twitter API. We are also simulating the vibration of earthquake surface waves using a longitudinal shaker, as it’s fair to say an earthquake is a little hard to trigger!
The main components in this project are:
EMULATING THE REAL-WORLD PHENOMENON = myQuake shaker
The myQuake shaker itself is manufactured by Pitsco Education, and is part of an NI “minisystem” that is designed to work seamlessly with LabVIEW. ***Available for purchase here?***
The glass moveable top piece is periodically … by an attached stepper motor. The power lines to the stepper motor enable for motor control through one of the analogue output (AO) channels on the myDAQ.
As well as the myDAQ’s AO channel, the project also uses its two Analogue Input (AI) channels, and an Audio Output.
The two AI channels are used for the two accelerometer data acquisition tasks, and the Audio Output is used to sound an alarm from a speaker attached to the myDAQ itself.
As mentioned previously, the main software components to develop this application are LabVIEW, and then within LabVIEW, the use of the DAQmx Driver software and the Twitter API.
For the sake of exercising both parallel and sequential threads (processes), a combination of an Events-Based Producer-Consumer architecture and a Queued Message Handler (QMH) architecture was used.
The events-based state machine in the top loop is present because of the user interaction part of the project. That is, the drive (%) and frequency (Hz) of the shaker’s stepper motor can be manually altered by controls on the front panel.
Of course, if this was to become a usable product, this section of the code would be completely removed, because we would not need to control any sort of shaker, we would simply be waiting for a useful response to the accelerometer’s acquisition.
The acquisition itself is taken care of by the DAQmx functionality, and the acquired data is then queued with some enum data in the middle loop to then send to the bottom loop. Queueing the data ensures no data packet loss, and ensures “dangerous” frequency levels would always be picked up. Based on whether a dangerous frequency is detected (for demonstration purposes in this project, it always is!) the bottom loop responds accordingly.
Firstly, there are a few different cases which exhibit the use of the Twitter API. The “Update Twitter Details” case is the case that must execute first, as it is the case that handles the authentication of the alphanumeric key and secret inputted to access the Twitter Developer account. The two codes that the “Twitter Open – Desktop.vi” needs to verify are the Consumer Key and Consumer Secret shown below on the Front Panel and Block Diagram respectively.
The following case is the “Send Tweet” case, which uses the “Post Tweet.vi” to Tweet based on a string input, shown below again on both the Front Panel and Block Diagram. Added to the String control is the current date and time for alert purposes.
The myDAQ Application Twitter Developer account, which you develop yourself, then remotely broadcasts the alert.
Steps to Reproduce:
The main requirements for developing this project further are as follows:
I welcome anyone's input into this development, please feel free to get in touch.