ESP8266 Projects

Peter Jennings

AB6WM - West Coast

Pyrolectric Infrared Infant Motion Sensing

W is a 15 month old infant with Spastic Quadriplegia caused by brain damage due to lack of oxygen at birth. As a result of this his brain has very little control over his limbs and other bodily functions. Physical therapy is being used to improve muscle tone and to teach him to make some controlled motions. At this time, it is unknown how much control he will have as he matures. More information about spastic quadriplegia.

There are two objectives to this project. The first is to use the motion sensor to monitor the baby's motion to obtain a base line of movement data when the infant is awake and asleep. This information could be used to trigger an alarm when the infant wakes, for instance. Longer term logging of the data in a cloud database can be useful to assess development or detect changes in behaviour.

The second objective is to create a feedback system to encourage intentional movement by providing feedback in the form of recorded voice encouragement when the infant moves in a particular way, such as to one side or the other of the crib. Or makes repeated movements in a particular place, which could be used to summon assistance.

Sensing Movement

The Kemet SS Pyroelectric Infrared Sensor Modules detect infrared rays emitted by the human body. Changes in the infrared signature reflect movement of a body in front of the sensor. Various lenses and collimators can be used to modify the detection pattern.

The Kemet sensors come as a bare sensor module (PL-N823) or as a "plug and sense" module with lenses and a comparator circuit with a digital output (SS-430 modules). Additional layers of resin and 3D printed lenses can affect the operation of the sensor to achieve desired goals.

Data Logging

The ESP-12E is a cheap ($2.50) single board solution for WiFi connected IoT devices. No additional hardware is required to connect the Kemet sensor to the internet.

The sensor is powered from the 5 volt USB power connection. GPIO input D2 is connected to the sensor output (0 to 3.3V). The onboard LEDs are used to monitor the sensor and WiFi activity.

Sensing and WiFi connectivity

The Arduino IDE was used to program the ESP-12E board for this project. To replicate this project, install the Arduino system on the ESP-12E following Electromania's instructible then download and compile the Kemet_Logger.ino sketch.

The sketch sets up an interrupt to monitor the D2 input pin for a rising signal - the output of the SS-430 sensor module.

The number of detections is counted for a 10 second period. If the count is greater than zero, the 10 second count is forwarded to the host system over the WiFi and internet connection by the LogValue function. One LED tracks the D2 input (sensor output), the other LED flashes while the board is connecting to WiFi and lights while data is being uploaded.

A simple php logging program captures the count data and logs it to a file identified by the sensor ID. This captured data can be analysed with graphing and display capabilities or used to trigger IFTTT alarms and controls as desired.

Kemet SS-430 Sensitivity

The Kemet SS-430 sensors are extremely sensitive. For practical use, it is necessary to insert a layer of plastic or some other semi-transparent material between the sensor and the target object. A 3D printer was used to experiment with different thicknesses of PLA and the use of a collimating channel to direct the detection target area.

The prints can be downloaded as STL or OBJ files, or remixed and modified on the Tinkercad site: Kemet SS-430 Lens and Kemet SS-430 Open. These modules press fit perfectly over the sensor module and are handy for experimentation.

Even with maximum shielding of the module, it was discovered that ambient temperature changes and random air currents in the room will trigger the digital output of the sensor module. Care needs to be taken to eliminate false positives if using the sensor in an "alarm" mode.

A 2mm layer of PLA is sufficient to limit background motion detection resulting in a reliable touch button sensor which could be used in future for signalling. This could be useful for interfaces where the patient has little or no ability to control mechanical pressure, but can manipulate their hand to touch the sensor.

For this project, a 1.2mm layer of white translucent PLA over the sensor polyethylene lens proved to be a sweet spot for detecting and logging motion.

Logging Module

A 3D printed cover for the breadboard encloses the ESP-12E. The sensor module with 3D printed lens slots into the enclosure and can be angled to aim the target area. Double sided tape is used to attach the unit to the top edge of the crib, out of reach from the infant for now.

Data is currently being collected and used to determine the base levels which indicate sleeping, awake, and active (perhaps requiring immediate attention). Once a suitable algorithm is determined, the host program can then be enhanced to send SMS messages or trigger alarms using IFTTT webhooks.

Motion to Speech

ISD1820 Voice Recording and Playback Modules can be used to record and play back speech from the infant's mother or another familiar voice.

These modules are easily interfaced with the ESP-12E board and can be used to trigger one or more recorded feedback messages based on motion activity, either in a particular part of the crib or of a given intensity and duration.

The expectation is that this kind of feedback can be used to teach the infant to move in a self-directed manner to trigger feedback. At this point, the infant's mental capabilities are unknown and not understood.

The infant is also unable to make sounds, so it is hoped that this tool will enable progress to be achieved which will eventually result in communications capabilities.

The project is ongoing and expected to last for many years.

Makers Building Assistive Devices

This project is supported by the Tetra Society of North America, volunteer makers building innovative solutions for people with physical disabilities to overcome environmental barriers, providing greater independence, quality of life, and inclusion. and the March of Dimes Designability Program, offering custom-built solutio​​​​​​​​​​​​​​​​​​​​​​ns and modifications to the everyday challenges that can be faced by people living with mobility issues.

This project was entered in the Kemet Electronics Corporation Make Sense of our Proximity Sensor contest.


More Links


Buy me a beer? Donations to support this web site are gratefully accepted. You can use PayPal, credit card, or bitcoin. No amount is too small.