Alert Button
This device sends a notification if someone pushes the alert button.
There are various commercial products that do this, but some rely on call centre services and some have expensive subscription costs.
My design is intended to send a high priority notification via a mobile app plus an email as backup.
Supplies
- ESP-M3 8285 module U2
- HT7333-A SMD 3.3V low dropout regulator U1
- A09T N-Channel SMD Mosfet transistor X 2 Q1, Q3
- A19T P-Channel SMD Mosfet transistor Q2
- 220K SMD (1206) resistor R3 (224)
- 100K SMD (1206) resistor R2 (104)
- 10K SMD (1206) resistor R1 (103)
- 100R SMD (1206) resistor R4 (101)
- 220uF SMD (3528) (Size B) Tantalum Polarised Capacitor 6.3V working (227J) C3
- 100uF SMD (3216) (Size A) Tantalum Polarised Capacitor 6.3V working (107J) C1
- 10uF SMD (3216) (Size A) Tantalum Polarised Capacitor 10V working (106A) C2
- 1A SMD fuse (resettable) 6V working (H) F1
- 7525 type SMD beeper size 7.5 x 7.5 x H2.5mm 2-4V working
- Tactile push-button switch (through hole type) 12mm square
- Matching plastic button for the tactile button switch
- 5mm (oval) super-bright Green LED (through hole type)
- LIPO cell type 601220 3.7V 100mAh (Protected type)
- JST-PH 2-way connector socket 2mm type (for LIPO cell)
- 6-way 2.54mm pin header strip (for the ESP-M3 module)
- 6-way 2.54mm round-pin socket (cut from a strip) (for programming the module)
- M2 screws X 8
- Small custom two-layer PCB (28 x 28mm)
- PLA filament for 3D printed case
I designed the PCB layout using KiCad and had it manufactured by JLCPCB
The PCB Gerbers zip file is available via the project on my website.
Most of the parts were from Aliexpress and a few from Ebay.
Schematic & How It Works
Note
This project uses small surface mount components, a LIPO cell and charger and is not easy to build or initially configure.
How It Works
When the button is pressed, an ESP8285 (ESP-M3) module powers-on, connects to Wi-Fi and sends a "Blynk" event. On successful operation it flashes the LED, plays a tune and then turns off again.
Blynk sends a high priority notification to the designated mobile running the Blynk app. This notification sound has to be acknowledged in order to silence it.
In addition it sends an email as a backup in case there is any problem with app notifications.
I eventually chose Blynk after initially trying IFTTT to perform the task. The issues I had with IFTTT were:
- Some unreliability receiving notifications with the phone in standby. This may have been related to my phone or OS - but various adjustments failed to resolve it.
- IFTTT recently, without notice made 'webhooks' a "premium" plan feature!
The disadvantage of Blynk is they also sometimes change policies, plans and pricing. At the time of writing, this project works with their free plan.
Why use the ESP8285 (ESP-M3) module?
The ESP-M3 module specification is very similar to the original ESP8286 (ESP-01) module.
The main difference is its physical dimensions, availability of port pins and the fact that it was supplied without soldered header pins made it easier to make a low-profile compact design.
Power consumption
For power efficiency, two Mosfet transistors control a low dropout 3.3V regulator for the module. When not in use, it turns itself completely off to conserve the 100mA LIPO Cell. This should allow it to work for several months between charges.
The HT7333-A low dropout regulator requires Tantalum polarised capacitors C1, C2 & C3 to ensure it works correctly. The high value of C3 also smooths the supply to the Wi-Fi module to prevent it crashing when it briefly draws a very high current.
Downloads
Construction - Fit the Small SMD Parts First
Fit the SMD parts using a very fine tip soldering iron and a magnifying glass.
First the transistors, regulator then resistors, fuse and capacitors (ensure correct polarity for C1 - C3).
(Capacitors C1 to C3 must be Tantalum Polarised type! )
It takes a lot of patience! It is made slightly easier by applying solder to one PCB pad, then position a part using tweezers while melting the solder to one leg only.
This allows it to be re-positioned easily if needed, then solder the other leg(s).
Fit the Rest of the Parts
Solder the 6-way round pin programming socket.
Solder the 6-way header pins to the module then solder it to the pcb.
Trim excess from the header pins (wear protective glasses as the sharp ends will fly out).
Solder 3 lengths of thin tinned copper wire between the 3 connections on the right of the module and the pcb and trim them.
Fit the push-button on the underside, as level as possible onto the pcb.
Then do the power socket (check it is the correct way round) .
The Beeper is soldered on the underside next (with the arrow pointing towards the board edge).
Lastly the Green LED is fitted on the underside with the cathode (shortest lead or flat side) nearest the mounting hole.
Clean the PCB with spray flux remover and check all component joints with a magnifying glass.
The Battery
Do not connect the LIPO battery until the module has been programmed!
I used a type 601220 100mAh 3.7V LIPO cell which measures about 22 x 12 x 6 mm
The battery PCB appears to have a DW01-P LIPO protection IC and an FS8205 dual Mosfet IC. This should provide it with protection against over charging, discharging and overcurrent.
DO NOT USE A LIPO CELL WITHOUT A PROTECTION CIRCUIT.
This LIPO cell specifications recommend standard charging at around 20mA or rapid charge @100mA until the voltage reaches 4.2V
Some commercial LIPO chargers may provide too high current and rely only on the cell's protection circuit to limit it!
I have designed a 21mA charger for it - see my charger project.
Software for the ESP8285
I wrote the software using Arduino IDE
You need to edit it to insert your Wi-Fi ssid and password.
Also, edit the first 3 lines with your:
BLYNK_TEMPLATE_ID
BLYNK_TEMPLATE_NAME
BLYNK_AUTH_TOKEN
(See the Blynk Setup section below for details).
Select the board type in Arduino IDE to "Generic ESP8285 Module"
If that board type isn't available - you need to add this additional boards manager URL to the Arduino IDE settings section:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
An additional library: "Blynk" version 1.3.2 or later by Volodymyr Shymanskyy must be installed in the IDE to handle the Blynk requests.
Downloads
Programming the Module
The ESP8285 module can be programmed using an ESP01 ESP8266 programmer together with an adapter cable.
The adapter cable consists of a male Dupont 2x4 way plug to fit into the ESP01 programmer socket wired to a 6 way male round-pin header to plug into the programming socket on the pcb.
Blynk Setup
Blynk is complicated to setup initially - I will try to describe the setup process.
- Setup an account with Blynk (Use the "START FREE" option and create an account)
- Create a template - give it a name e.g. "Button"
- Select hardware: ESP8266
- Select connection type: Wi-Fi then add a description (optional)
- Now add a Device - give it a name - (this can be any name or the same name as your template)
Now you have a template with an associated device - if you click on the template, it should show the device.
- Click on the device and a dashboard appears. Click on "Device Info" and a black box shows the config info needed for the BLYNK_TEMPLATE_ID, BLYNK_TEMPLATE_NAME and BLYNK_AUTH_TOKEN to be pasted into the Arduino code.
A Datastream can be added to the template to show the voltage regulator output voltage whenever the button is pressed.
(If the regulator output voltage drops below 3.3V the battery needs recharging)
Add the Datastream with the following settings:
- Name: Regulator Voltage
- Alias (same name)
- Color (whatever)
- PIN: V0
- Data Type: Double
- Units: V
- Is Raw: False
- Min: 0 Max: 5
Now select the Web Dashboard and edit it.
Add a "Gauge" and configure it to use the Datastream for the Regulator Voltage.
Next, we need to set-up some notifications....
On the Dashboard click on the "Events & Notifications" tab and then click the green "Edit" Button.
Now click the Green "+Add New Event" button.
On the config screen General Tab, give the event a name e.g. Button Press
Then in the Event Code box type button_press and select the type as Critical.
Fill in the optional description box with "Button pressed"
Then enable the switch for "Show event in Notifications section of mobile app" and "Send event to Timeline"
Now click on the Notifications Tab
Click the Enable Notifications switch and it then shows all the notification options.
Click on "E-MAIL TO" and select "Device Owner" and do the same for "PUSH NOTIFICATIONS TO"
Enable the switches for "Deliver push notifications as alerts" and "Enable notifications management"
Then click the green "Save & Apply" Button to save it.
Next, setup a notification for the low voltage warning.
As above, add a new event, name it voltage_low and the event code is also voltage_low
Select the type as "Warning"
Then on the Notifications tab, enable notifications and select ""PUSH NOTIFICATIONS TO" "Device Owner"
Then click the green "Save & Apply" Button to save it.
The Blynk App
- Install the Android or IOS Blynk app on your phone and login.
- Enable Developer mode if not already enabled, by tapping on "my profile" then enable "developer zone"
- Tap on the spanner icon to enter developer zone
- You should see the Button template - tap it to go into the app widget config screen.
- Tap on "+" and add a gauge
- Select the Battery Voltage datastream.
Next, go into the app settings and check that "Devices" are set to on.
- Select "Critical notifications" which opens another screen
- Make sure critical notifications are set to ON
- Set "Ignore background restrictions" to ON
- You can also select a sound for the critical notifications
3D Printed Case
I designed a case using Tinkercad.
The Bezel is attached using super-glue. It is there to help prevent the button being pressed accidentally.
The PCB is fitted using 4 M2 screws.
The Battery just rests above the pcb and can be held in place by tape if needed.
Fit the back panel using 4 M2 screws.
To Do
- The code does not use SSL encryption to connect to Blynk. It could be improved by replacing the text:
"BlynkSimpleEsp8266.h" to "BlynkSimpleEsp8266_SSL.h" to use the SSL library for encryption.
- Since creating this project, I found an alternative to using Blynk for notifications. A simpler solution would be to use Pushover.
Pushover is much easier to use for this type of notification and I may update the project software to use it instead.