Family Safety Monitor

by tekyinblack in Circuits > Arduino

913 Views, 9 Favorites, 0 Comments

Family Safety Monitor

IMG_6979 annotated.jpg
pub39.JPEG

Microcontrollers now have sufficient processing capability to interact with web based email services which opens up a wider range of high quality and reliable solutions which require little, if any, maintenance. This project was created to fit the needs of an elderly family member who didn't feel that the alternatives available to them were suitable.

This is a monitor to check whether a person is active in their home and raising an alert if that activity is not detected within a pre-determined period of time.

A scenario was to locate the monitor in a kitchen where the user is expected to appear regularly, and if the appearance doesn't occur, say because of illness or a fall, then others can be automatically alerted. The intention was to make use of free online email services, such as Gmail, so that running costs of the service are minimal.

In the original case, this was setup to raise an alert if the user wasn't detected within 24 hours, but the software can be configured via an SD card to behave differently.

The monitor is a simple IR detector, so no video or audio is recorded, and while a log is kept, it can be configured to be detailed or very basic to provide privacy. The microcontroller is the very versatile ESP32 from Espressif.

The alert is via an email to a list of addresses and can be configured in several ways to better suit the person being monitored.

It requires an active mains socket and Wi-Fi for internet connection but the idea can be re-envisaged in many different ways to suit the user.

Other emails can be sent on demand to test the operation and to verify that the unit is operating ok.

This design uses 3D printed parts to mount the various components.

In this form, the project uses mains electricity and the constructor will need to make internal connections to the mains powered system. If in any doubt as to the safety of doing this, consider configuring the unit to use a 5V USB PSU. The unit has been powered this way reliably for extended periods of time, the mains connection and enclosure have been used to encapsulate the solution in a single container.

The operations manual is attached here

Supplies

pub1.JPEG
pub39a.jpg
pub39b.jpg
pub40a.JPEG
pub40b.JPEG

Power supply adapter case

ESP32 WEMOS MINI microcontroller board

SDcard reader

Either

A 6W 6volt transformer, with 1000uF capacitor and small bridge rectifier with LM317 regulator

or

5V 5W AC/DC convertor - Vigortronix VTX-214-005-305 was used but something similar will be ok.


HC-SR501 IR detector

7333 3V3 regulator

4 x 220R resistors

1 x 1k resistor

1 x 10k resistor

2 x suitable switches for test emails and programming if required

Red/green LED

Green LED

Red LED

small piece of stripboard

3D printed parts

Overview of Construction

pub39d.jpg
pub39c.jpg

The unit is constructed around a DIY mains PSU case intended for creating specialised power supplies for electronics. The case houses the power supply for the unit, an IR detector, the ESP32 microcontroller, an SDcard reader and a small circuit board made from stripboard which supports various indicator LEDs as well as test and programming switches.

Inside the case, a 3D printed framework supports the secure installation and positioning of these parts.

Circuit Design

Family Monitor_bb.png

The circuit is based around the ESP32 microcontroller receiving input from the IR detector, a test switch and an SDcard, the microcontroller outputting monitor status to LEDs, connecting to wifi and of course, sending emails.

The SR04 IR detector is connected to the microcontroller via it's LED driver connection and will directly illuminate an LED when activated, as well as alerting the microcontroller to the status change. The SR04 has standard adjustments for the mode of operation required and detection timings. This is important to be adjusted for preference.

The microcontroller has two status LEDs driven by the ESP32. To save space on the front of the case, one of these is dual colour but two single colour LEDs could be used equally a well. The LEDs indicate power on, WiFi connectivity status, and a monitor status indicator for errors and operational status, off being normal status.

Two button switches are connected, one to signal to the microcontroller that a test email is to be sent, the other to be used in conjunction with the reset button to put the microcontroller into programmable status. This second one can be omitted if this will never happen in use. Not having this would free up space on the front of the case for another LED.

The SD card holder is connected to what are fairly standard pins on the ESP32 for this use.

The power supply for this version is a mains to 5V converter block, with a 3.3V regulator supplying the microcontroller. The next step shows an older supply design using a transformer.

In the case design, the mains and the circuitry are separated by a reasonable distance and a fuse is soldered in place and all wires insulated. However, as mentioned before, the unit could be powered by a separate power brick if required.

Downloads

Circuit Design - Mains Transformer

Dad Monitor_bb.png

This design is an alternative to the encapsulated 5V power supply using a transformer, bridge rectifier, capacitor and LM317 regulator. The rest of the design is unchanged. It's included here for completeness.

Software

The software for this project is the core of the solution and is intended to be implemented on the ESP32 microcontroller. It is available on github https://github.com/tekyinblack/FamilyMonitor

The software runs a simple state machine sampling the status of the IR detector and resetting a timer after several positive detections. Once the timer expires, when no detections have occurred, then the email engine is invoked to send the alert emails. The software also sends test emails, either on demand when pressing a button, or on a scheduled basis. If an alert email is sent, the next time the IR sensor is triggered a 'return' email is send to indicate that either the user or someone else is again active.

3D Printed Frame

Family Monitor IR Carrier.png
Family Monitor CPU holder.png
Family Monitor SD card holder.png
Family Monitor ACDC PSU cover.png
pub10.JPEG
pub9.JPEG
pub8.JPEG
pub7.JPEG
pub6.JPEG
pub4.JPEG

To mount the components inside the case, four pieces were designed on TinkerCAD to be made with a 3D printer. The following are the links to these designs

Family Monitor ACDC PSU cover

Family Monitor CPU holder

Family Monitor IR Carrier

Family Monitor SD card holder


The .stl files for these are attached

Soldering the Leads

pub17.JPEG
pub16.JPEG
pub14.JPEG
pub13.JPEG

Connections are a personal matter and here some are soldered directly with fine wire, and some are terminated with Dupont connectors for easier assembly/disassembly later

Make the Circuit Board

Untitled.png
pub14b.JPEG
pub15.JPEG
pub12.JPEG
pub11.JPEG

The circuits have been mounted on stripboard cut to fit the case with pcb pins for external connections located allong one edge. An example component layout is shown in one of the pictures.

Assemble the CPU and SDcard Reader

pub22.JPEG
pub23.JPEG
pub21.JPEG
pub19.JPEG
pub18.JPEG
pub20.JPEG

The 3d printed components have been designed to hold and position the IR sensor, microcontroller, SD card and circuit board inside the case.

Add the Circuit Board

pub24.JPEG

In this step, the various connections from PSU and IR sensor are made to the circuit board

Join the Parts Together

pub26.JPEG
pub30.JPEG
pub29.JPEG
pub25b.JPEG
pub28.JPEG
pub25.JPEG
pub31.JPEG
pub32.JPEG
pub33.JPEG
pub34.JPEG

These are pictures of what the assembled monitor module looks like, the 3D printed parts held together with two bolts.

Fit the Mains PSU

pub5.JPEG
pub2.JPEG
pub3.JPEG

If an internal PSU is being used, it can be connected now.

Drill the Outer Case

pub36.JPEG
pub37.JPEG
pub38.JPEG
IMG_7524 annotated.jpg
IMG_7523 annotated.jpg

The front of the case used has to be cut and drilled to accommodate external access to the buttons, LEDs and SD card reader. For the case used, it was found that removing one ventilation slat at the side was sufficient to give access to the SD card reader. The three LEDs and programming button were accessed via drilled holes on the front of the case. The IR sensor required a larger hole to be drilled in the front of the case after careful measurement of the particular sensor used and the case.

If required, a hole was also drilled in the side of the case to give access to the reset button on the microcontroller via a hole in the 3D printed part. Also a gap was made in the front ventilation grill to give access to the microcontroller USB port. This was found to be very useful for debugging but may not be if the unit is fully working.

A hole in the top of the case, intended for an output power cable, was repurposed for the test button.

Fitted Together

IMG_6979 - crop3.jpg

Not much to say about this, the cut and drilled case is fitted to the modules and fixed with the screws provided with the case.

Testing

IMG_6745.jpg

It is suggested that the operation of the unit is tested in breadboard form before the final unit is built. Testing the actual operation can be carried out at this stage to see if the solution is suitable for the circumstances.

Setup requires customisation of the SD card contents on github, examples here, and the creation of an email account for the monitor to use. Don't use your own private email account. Note, providers such as Google require special App passwords for this type of operation requiring a change in security levels. See the support article here for more details.

Experience

The monitor has been well tested now and performs it's function very well. It does need a bit of thought about where it's position, and mentioned earlier a kitchen is a good place, but it should be somewhere where it can 'see' and active person but not be triggered by other sources. Using IR indicator and a running a daily test report, part of the configuration, will help.

If providing this for someone else, do explain what it does and be aware of any privacy concerns.