myDAQ Student Projects

Showing results for 
Search instead for 
Did you mean: 

myQuakeAlert: 60 Seconds to Safety

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.


myDAQ Application.PNG


System Summary:

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:


  • SENSORS = accelerometers
  • DAQ AND SIGNAL CONDITIONING = myDAQ + breakout board + cabling
  • APPLICATION SOFTWARE = LabVIEW + DAQmx Driver Software + Twitter API






The Hardware:

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.



The Software:

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.

Control Snapshot.PNG




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 –” needs to verify are the Consumer Key and Consumer Secret shown below on the Front Panel and Block Diagram respectively.



Secret info.PNGUPdate twitter details.PNG




The following case is the “Send Tweet” case, which uses the “Post” 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.


Tweet inpit.PNGCapture send tweet.PNG



The myDAQ Application Twitter Developer account, which you develop yourself, then remotely broadcasts the alert.


Link to the myQuake_Alert Twitter Developer Account 



Steps to Reproduce:

  1. Download the required API through VI Package Manager and create your own Twitter Developer Account using the Twitter API for LabVIEW.
  2. Acquire (and keep safe) your own unique Consumer Key and Consumer Secret to access your Twitter account through LabVIEW.
  3. Download attached code, which is still in development before being made into an application.
  4. Add/remove from code as you wish to remove the motor control and/or add in your own frequency limit checks in the acquisition (middle) loop.
    • This will depend on whether or not you have simulation hardware like the myQuake shaker. 
    • This project is also available in simulation mode (myDAQ1) which uses a MAX task to simulate the shaker and accelerometer acquisition.
  5. Input your own Access Key and Access Secret into the string controls (keep password display on for extra security).
  6. Input your own Tweet to accompany the current date and time stamps.


Future Development:

The main requirements for developing this project further are as follows:

  • Creating a fully scalable, networked system
  • Introducing wireless capabilities
  • Turning an idea into a widely-usable product

 I welcome anyone's input into this development, please feel free to get in touch.


Sarah Flanagan

Applications Engineer

National Instruments

Member Sneha3599


We are interested on this project so please can u share the components description of this project so that we get some more information about this project....