A few blog entries ago, I wrote about problems with helping other people with their computers. (Most of the problems were due to the software and not the people.) This turned into a discussion about automating the monitoring of the elderly and making a minimal “Are you okay?” system. My solution uses a very simple script to monitor their computer for signs of activity since they all use their computers fairly regularly. If they change their habits and miss a check-in window, then it triggers an alert.
While monitoring the computer is a good start, it’s still not ideal. Recently I’ve been evaluating miniature embedded systems and homemade IoT devices for simple automation tasks. These included Raspberry Pi miniature computers as well as Arduino embedded controllers. In the comments to my blog entry, Matt and Jon suggested that I look at the ESP32. It’s the same concept as an Arduino, but it has built-in WiFi and bluetooth. (Now I just needed a reason to try it out.)
One of my friends has an elderly parent who lives alone. While this person regularly uses the computer, my friend is concerned about his father falling and going unnoticed for hours. We worked out an inexpensive solution: a network-based motion sensor. (Woo hoo! A reason for getting an ESP32 and a guinea pig for testing!) Here’s the idea: we will place 2 of these wifi motion sensors in my friend’s elderly parent’s home. They are going to be located near the kitchen and the main hallway. These are areas that he walks by often. As a motion sensor, it will be triggered each time his father goes to the kitchen, walks to the bathroom, TV room, bedroom, etc. (“Or you could just call me. I like it when you call.” Nope — remote wireless sensors!)
An Arduino costs about $15 USD but needs a network adapter that costs another $15. In contrast, I purchased my first three ESP32 controllers for about $6 USD each (three CPUs plus development boards for $22 total). Unfortunately, I had to return them because each was faulty. Here’s the link to the item at Amazon. However, I do not recommend these. While the development boards are fine, each ESP32 had the same problem: bad ground.
The ESP32 (ESP32-WROOM-32, 38-pin) has three ground pins (in black).
Good ground. The ground pin in the top right (opposite corner from 5V) is good. Use it for everything.
Bad ground. The ground pin on the left (6 pins from the bottom) is bad. With the power off, I hooked a meter from good-ground to bad-ground. It does have connectivity, but there’s a slight delay as the resistance drops to zero. This suggests that there’s a capacitor or inductor or something sitting in front of the ground pin. When power is first applied, this pin has zero connectivity for a few microseconds.
I noticed that the device wasn’t running the program when power was supplied over USB. I had to press the reset button before the program would run. Other people came up with complicated workarounds (using capacitors and resistors) that effectively press the restart button a moment after power is applied.
Another person noticed that, if you want to use external power, then you need to use good-ground and not bad-ground. Otherwise, it won’t boot. I took his idea and tested it: If you jumper good-ground to bad-ground, then it boots properly when power is applied over USB. As a power source, the integrated USB port appears to be hooked to bad-ground. Don’t use bad-ground.
Ugly ground. The third ground pin is on the right, 7 pins from the top. According to my meter, this pin has zero connectivity. At all. It’s a floating ground pin. At best, it won’t work for you. And depending on your electronics, you might end up not having it work, frying something, or causing a fire. Do not use!
If the developers can’t get ground right, then who knows what else is wrong with the hardware. I returned it.
I want to emphasize that not every ESP32 has this problem. This appears to be a bad batch. (Most likely, someone bought up a bunch of known-bad chips and tried to sell them for cheap on Amazon.) However, this experience is bad enough to scare me away from anything with this form factor. Fortunately, there are lots of other options.
A couple of my friends suggested that I look at the M5Stamp-S3 from a company called M5Stack. This is a postage-stamp size ESP32 controller with built-in WiFi and bluetooth. It also has a built-in multi-color LED. And best of all, the version that I got had all the pins already soldered in, so I can plug-and-play without soldering. (I didn’t get it from M5Stack because they use a Chinese credit card processor who is associated with fraud and potentially unsafe. Instead, I paid $0.50 more and got it from DigiKey. And since the price for shipping didn’t increase with quantity, I ordered three of them.)
This is a device that I can definitely recommend. It was simple to hook up to the sensor rig that I had originally created for the ESP32. (The pins are in different places, so be sure to redo the wiring.)
I configured the M5Stamp as a controller for a wireless motion sensor. For the sensor, I used a tiny microwave doppler radar switch. While it uses microwave frequencies, it’s so low power that you won’t fry anyone. The microwaves go through wood, drywall, doors, etc. The only things that really stop it are metal and water. Humans are basically large bags of water and create a strong microwave reflection. As you walk past the sensor, it triggers for 2 seconds.
The thing that I like about this sensor is that you don’t have to drill a hole in the wall. Just mount it on the wall near an electrical outlet. It has a range of over 9 feet (3 meters). However, I’m currently seeing brief flashes of activity when there shouldn’t be any. (Either there’s a ghost in my house that is triggering the motion sensor, or there’s a little chatter in the electronics.) I probably just need a little shielding or to filter the chatter in software. But I think this is really close to being ready. (Maybe another 1-2 weeks.)
Here’s the first attempt at the box:
The orange block is the M5Stamp.
The M5Stamp is plugged into an 11×5 mini breadboard.
The breadboard is sitting on top of a piece of cardboard with aluminum tape on one side. The aluminum tape blocks any RF noise from bothering the motion sensor and the cardboard prevents the metal tape from shorting out the electronics on the sensor.
Under the aluminum and cardboard is the motion sensor. (Just the pins are peeking out the top.)
The electronics are mounted in a box. I have a piece of foam (not shown) that keeps everything from moving around. (The box is much larger than needed because it was originally designed for the ESP32-WROOM, which is a much larger controller chip. The next version will be smaller.)
The entire thing plugs into a USB cable and power plug.
When it’s done, it will just need to be plugged in and hung on the wall at about ankle level. (You can’t see it in this photo, but there’s a hook hole for a nail at the top of the box.) It can easily be hidden out of view.
My program for the M5Stamp does a few things:
It connects to the WiFi network.
It watches the motion sensor.
When there is any activity, the on-board LED turns on. No activity turns the LED off.
I track when the sensor was triggered and maintain a delay of 20 seconds for the motion event. This way, small chattering is ignored until there is at least 20 seconds of inactivity.
At the start of each motion event, it uses the WiFi to contact a reporting web page. It only reports that activity was seen near the sensor.
Now, if there isn’t activity for a few hours, then either (A) the person isn’t home (check their iPhone and friend tracker), (B) the person is asleep (check the clock and don’t panic at night), or (C) the person has fallen and needs help. Moreover, it’s more reliable than waiting for the person to use their computer and trigger any proof-of-life script. It’s also non-intrusive; while we know there is movement in the house, we don’t know what he’s doing or where he’s going. (It’s not like putting a camera in every room in the house.)
Using a wireless motion sensor is a great solution if you don’t have pets. However, dogs and cats will trigger the sensor. I mentioned this to a friend of mine and he loved the idea for his elderly dog! He currently uses multiple PIR (passive infrared) sensors to alert him when the dog walks around at night. (If he doesn’t get up when the dog gets up, there’s going to be a messy accident.) A single WiFi motion sensor would cover the entire area without being as directional as a PIR.
Another friend of mine lives with a parent who has dementia. He’s planning on tracking every external door of the house, “just in case she makes another escape attempt.” (It sounds funny, but it’s really a serious problem.)
After I finish the first version, I’m planning on making a second one for myself. It’s going to monitor the front door because UPS, FedEx, Amazon, and the postal service have all decided to never ring the doorbell. They walk up, drop off packages, and run away. I’m usually in the house. If I’m near the door, I might hear the thump of a box and realize there’s a package. I do have a camera by the door, but it can take up to 60 seconds before my phone beeps. (The notification is great if I’m next to my phone, but often my phone is in a different part of the house.)
The next wireless monitor will watch the front of the house. If anyone approaches the doorstep, it will let me know immediately. I’m also going to have a second sensor inside the doorway. This way, someone walking out of the house will trigger the inside sensor first, allowing me to know when someone is leaving and not trigger the doorbell. In contrast, someone walking up to the door first will trigger the door sensor. And since it’s microwave, I don’t have to worry about drilling a hole in the wall or mounting something outside in a weather-resistant case.
With these inexpensive and customized IoT systems, I might end up with a smarter home that works the way I want it to work — and at a fraction of the price of a mass-produced solution.