Category: Telemetry

Seismometer Project

A friend asked me if I had a seismometer. Nope. But I might be able to build one…

One approach would be to build a more traditional weight-and-spring kind of thing, but I thought I could do it more easily with a MEMS accelerometer. I had one laying around, so I decided to try it out.

I hooked up an LSM303DLH 6DOF accelerometer/magnetometer to an ESP-01 running an ESP8266 processor.

There are a few points of interest / investigation in this project:

  • What is the frequency response of this kind of accelerometer?
  • What are the frequencies of interest to this friend?
  • What sampling rates are possible for this device?
  • How to filter / smooth the raw data
  • Is calibration required?
  • How to present the data?

In this post, I’m just going to address one possibility for the last item. I will eventually log the data with timestamps into a file on a removable drive, but right now I want to see the data.

Cutting to the chase, here’s what it looks like. Click on it to see the chart move. (Whee!)

The web page is restricted to my home network, but you are welcome to the code.

Here’s a snapshot of the main Arduino program. The functions updateWebPage_root, updateWebSocket, and updateWebSocketArray are the ones you want to look at.

Apparatus to monitor the cycling of the hot tub pump

It’s working.

I may be having a problem with my hot tub pump – it’s running with shorter cycles than I remember it. That’s better for close temperature control, but worse for stress on the motor.
I had a problem with the pump’s computer unit once before – it was overheating and cycling more and more rapidly. So now I want to monitor it to see if its cycling is getting faster.

I can’t monitor it using a current sensor, since those ones I have are rated for 10A at 120V, while the motor unit uses 15A at 120V.

So I built a monitoring system – weather sealed a 1″ piezo disk, breadboarded a JFET amplifier for it, connected it to an ESP8266 microcontroller which I programmed to take readings at 480Hz, dot-product out the components at 60Hz and 120Hz (which for some reason is stronger) and send them via WiFi to my MQTT server, from which I scoop them with a Perl script to a log file (for now). I’ve determined the best discriminant between non-running and running with a z-score of 6.6+ from each, so I know it’s pretty good.
Now I can relax for a while while the data accumulates…

Data from the 60Hz and 120Hz dot-products:

7-Dec-2021 14:02:18: home/hot_tub_motor/a02/value/couplet -> 32.839 16.014
7-Dec-2021 14:02:24: home/hot_tub_motor/a02/value/couplet -> 29.103 16.061
7-Dec-2021 14:02:29: home/hot_tub_motor/a02/value/couplet -> 29.301 16.638
7-Dec-2021 14:02:35: home/hot_tub_motor/a02/value/couplet -> 32.062 17.769
7-Dec-2021 14:02:40: home/hot_tub_motor/a02/value/couplet -> 28.854 16.440
7-Dec-2021 14:02:45: home/hot_tub_motor/a02/value/couplet -> 33.069 16.328
7-Dec-2021 14:02:51: home/hot_tub_motor/a02/value/couplet -> 28.665 17.092
7-Dec-2021 14:02:56: home/hot_tub_motor/a02/value/couplet -> 28.019 18.892
7-Dec-2021 14:03:03: home/hot_tub_motor/a02/value/couplet -> 32.541 17.647
7-Dec-2021 14:03:07: home/hot_tub_motor/a02/value/couplet -> 29.323 16.411
7-Dec-2021 14:03:12: home/hot_tub_motor/a02/value/couplet -> 69.411 58.708
7-Dec-2021 14:03:17: home/hot_tub_motor/a02/value/couplet -> 38.942 56.288
7-Dec-2021 14:03:24: home/hot_tub_motor/a02/value/couplet -> 16.419 50.588
7-Dec-2021 14:03:32: home/hot_tub_motor/a02/value/couplet -> 25.903 59.193
7-Dec-2021 14:03:33: home/hot_tub_motor/a02/value/couplet -> 70.220 61.097
7-Dec-2021 14:03:40: home/hot_tub_motor/a02/value/couplet -> 60.011 61.728
7-Dec-2021 14:03:44: home/hot_tub_motor/a02/value/couplet -> 17.743 51.550
7-Dec-2021 14:03:49: home/hot_tub_motor/a02/value/couplet -> 37.571 57.612
7-Dec-2021 14:03:55: home/hot_tub_motor/a02/value/couplet -> 72.898 57.997
7-Dec-2021 14:04:00: home/hot_tub_motor/a02/value/couplet -> 23.630 55.861
7-Dec-2021 14:04:06: home/hot_tub_motor/a02/value/couplet -> 41.698 62.395
7-Dec-2021 14:04:11: home/hot_tub_motor/a02/value/couplet -> 56.960 59.568
7-Dec-2021 14:04:18: home/hot_tub_motor/a02/value/couplet -> 15.589 50.445
7-Dec-2021 14:04:22: home/hot_tub_motor/a02/value/couplet -> 71.046 62.314
7-Dec-2021 14:04:27: home/hot_tub_motor/a02/value/couplet -> 16.098 46.108
7-Dec-2021 14:04:32: home/hot_tub_motor/a02/value/couplet -> 70.857 61.175
7-Dec-2021 14:04:39: home/hot_tub_motor/a02/value/couplet -> 16.661 53.204
7-Dec-2021 14:04:45: home/hot_tub_motor/a02/value/couplet -> 73.267 63.262
7-Dec-2021 14:04:48: home/hot_tub_motor/a02/value/couplet -> 14.290 54.907
7-Dec-2021 14:04:54: home/hot_tub_motor/a02/value/couplet -> 70.185 61.067
7-Dec-2021 14:05:01: home/hot_tub_motor/a02/value/couplet -> 22.880 57.029
7-Dec-2021 14:05:06: home/hot_tub_motor/a02/value/couplet -> 51.657 55.721
7-Dec-2021 14:05:10: home/hot_tub_motor/a02/value/couplet -> 47.116 61.623

The hot tub motor started up at 14:03:12.

Data discriminated into “off” and “on”:

About to subscribe to topic 'home/hot_tub_motor/a02/status'
7-Dec-2021 14:42:21: home/hot_tub_motor/a02/status -> 0
7-Dec-2021 14:52:23: home/hot_tub_motor/a02/status -> 1
7-Dec-2021 15:03:02: home/hot_tub_motor/a02/status -> 0

I’m not sure why the vibration is at 120Hz and not at 60Hz. I’ll have to think about AC motors and how they operate now.

Yay! Another investigation!

Watchdog watchdog

Well. It’s been a while. Here’s what’s new:

I monitor my heating system (temperatures, zone activation) with an Arduino, and relay the values to my home monitoring system through an ESP-01 / ESP8266. The Arduino occasionally hangs up.

I have tried to fix this by checking the power supply for good clean power; by making it reboot itself every 24 hours; by enabling the ATmega328’s watchdog timer. It still hangs up.

When it is running, it flashes an LED connected to the standard pin 13 of the Arduino. I recalled seeing that a 555 timer could be used as a missing-pulse detector. This would trigger if the 1Hz flashing stops. Cool. The missing pulse detector takes its output low during pulse starvation, and takes it high during the happy times when the pulses continue. I needed to take that prolonged low value and turn it into a one-shot pulse to drop and resume the power to the Arduino, and a second 555 could be configured as a one-shot to create this pulse. I had to add a capacitor in between to prevent continuous retriggering of the second 555, which would keep the power off to the Arduino.

The circuit “1” in the schematic illustrates this setup.

I happened to have a 556 handy, which comprises the functionality of two 555 timers. The equivalent simpler circuit is “2” in the schematic.

But, duh. I’m really more of a programmer at heart. And I had some ATtiny85 chips around. So I created an Arduino program to embody all the above functionality in a much simpler circuit – “3” in the schematic.

Note: in the code and the schematic the name ATmega refers to the (processor on the) Arduino board.

Watchdog_watchdog_sch

And I put it all onto a very small solderless breadboard. Since I needed regulated 5V to feed all the components, I put standard voltage regulation onto the breadboard as well.

The Arduino program was very simple:


/*
  Watchdog_watchdog
  
  One of my Arduinos, the one that monitors temperatures and zone activations 
  in my heating system, occasionally hangs up. This despite the fact that I'm
  using the ATmega watchdog to automatically reset it if it hangs. Dunno why. 
  The power seems good and stable. I've tried replacing the ATmega chip.

  I've decided to kill a flea with a cannon. The ATmega blinks an LED at 1Hz
  to indicate that it's still alive - I call this a throbber. The ATtiny will 
  monitor the throbber and if it stops, it will power-cycle the ATmega.
  Hah.

  The MOSFET in question will be a p-channel MOSFET configured on the high side
  of the power to the ATmega; when its gate is pulled low, it allows power to 
  flow to the ATmega. The specific MOSFET I'm using is a 5LP01SP, which is a 
  p-channel device whose pins are 1=source, 2=drain, 3=gate.
  
*/

#define pdThrobber_in 3
#define pdMOSFET      4

const unsigned long resetAfter_ms = 2000UL;
unsigned long lastThrobAt_ms = 0UL;


void setup() {
  pinMode ( pdThrobber_in, INPUT );
  pinMode ( pdMOSFET, OUTPUT );
}

void loop() {
  static int throbberStatePrevious = 0;
  int throbberState = digitalRead ( pdThrobber_in );
  if ( throbberState != throbberStatePrevious ) {
    lastThrobAt_ms = millis();
    throbberStatePrevious = throbberState;
  }
  if ( ( millis() - lastThrobAt_ms ) > resetAfter_ms ) {
    // BOOM. Cause a reset
    digitalWrite ( pdMOSFET, 1 );  // turns off ATmega
    delay ( 500 );
    digitalWrite ( pdMOSFET, 0 );
    delay ( 5000 );  // time enough to let the ATmega boot up
    lastThrobAt_ms = millis();  // reset the watchdog
  }
}

Teensy, touch sensing, and ESP8266 – via MQTT and Raspberry Pi

Whee!

I have a demo/development setup on a small breadboard which powers an ESP-01 ( the small, cheap, 8-pin breakout board for an ESP8266 chip ). In addition to being a programming board, it has 3v3 voltage regulation, a pot, a temperature sensor, a simple LED, and a WS2812 3-color LED. I have the installed ESP8266 running a program to subscribe to an MQTT broker and light the LEDs according to publications on a certain topic.

[Read More...]