Read sensor data without internet

I am starting in the world of programming and I would love to turn on an LED when the sensor exceeds the limit, what I have seen is that I need a library for the sensors, however I cannot find it.

Does anyone know how to get that data and print it?


Hello Flomp, welcome to our community!

I think @scaron has realized something similar in the past, he could provide very useful insight on what you want to create. I think he used something like this: RPi: Building a ShakeMeter with Raspberry Shake and Node-Red • T³ Alliance

Live data transmission can be obtained by configuring the Shake UDP service (information on our manual, here: Raspberry Shake Data Producer UDP Port Output — Instructions on Setting Up Your Raspberry Shake) that will allow you to read real-time data from your instrument even if it is not connected to the internet.

Well, I was able to print the data of each channel from the RS4D, however what I want to do is make that data be as the final data of STA/LTA, as RSUDP does, however I don’t know how to convert the data of the channels.

import socket as s
with open('/opt/settings/sys/ip.txt', 'r') as file:
    host =

port = 8888                             # Port to bind to
sock = s.socket(s.AF_INET, s.SOCK_DGRAM | s.SO_REUSEADDR)
sock.bind((host, port))
print "Waiting for data on Port:", port
while 1:                                # loop forever
    data, addr = sock.recvfrom(1024)    # wait to receive data
    print data

Hello Flomp,

As Stormchaser mentioned I do have led lights. They are all virtual LEDs, however. The Led’s light when a certain value is reached on each of the accelerometers. I have a gauge displaying the current values from the geophone. The code is based on the Node-Red code Stormchaser mentioned from T3 Alliance using the udp output of the Shake.

Here is the thread where I posted some questions and progress: UDP output (datacast) Counts too high?

The thread above has an older version of the gauge. Here is an image of the current version



Thank you for your input Steve, and your new gauges are looking really good!

You can use these two pages on our manual to remove the response of the instrument and to convert the raw counts coming from the Shake to metric units.

There are complete, albeit basic, working Python codes in there, so you can adapt them to suit your needs.

hello scaron
I have followed your project and also tried to do the same, only that I had problems when trying to follow the tutorials, and installing node-red in RS4D has been a headache.

A little before posting here, I tried the same thing to do the calculation, I see that it uses the and files, however the code also confused me a lot.

Could you help me a little in the part you did about the part you commented on the matrices and your calculation, please?

In node-red I already did the dashboard thing, with the gauge, but it gives me quite high values.


1 Like

Hi Flomp,

I am not sure what matrices calculations you are referring to. I will attach my node-red flow. Maybe you can take look and see the calculations I used. The EHZ potion is the part to look at.

notered.txt (38.3 KB)

Hopefully, some of this helps.



Good evening scaron, thank you very much for the info, to a certain extent it did help me.
In the end, what I will try is to change the digital lights to activate the GPIOs of the raspberry, even so I have another detail, I would also love to send an audio, do you think you can help me with that?, maybe in a more local way, maybe some programming so that it can be executed from the raspberry, do you have an email so I can communicate with you and give you more details?

1 Like

Is there also a node-red flow available for the RS&BOOM? I like to extend that existing flow with the infrasound monitor. Does somebody have some examples?

1 Like

welcome to the community @Shakestation

Please see here for example flows: Teacher’s guide and tools for the classroom — Instructions on Setting Up Your Raspberry Shake


1 Like

I just did a node-red workflow for the RS&BOOM also integrated with Amazon Alexa voice announcements if an earthquake is occuring.
node-red-RSBOOM.txt (20.4 KB)

Does somebody knowing the exact calculation of m/s to magnitude? On the swich I added some example values for testing.


Thank you for sharing your NodeRED flow chart and code with the community!

Well, you can try to get an estimation using the old Richter magnitude formulae, of which you can find a collection here: Richter magnitude scale - Wikipedia

This methodology has been now replaced with the analysis of the moment magnitude. More info here: Moment magnitude scale - Wikipedia