Introduction: Wireless Call Button System Using ESP-NOW

About: I like tinkering and experimenting, mostly with microcontrollers and 3D printing.

This project was inspired by a 6-day hospital stay last year. My amazing caretakers made sure I always had access to a handheld device (attached to long cable) that had a TV remote and buttons for the room lights and calling the nurse's station when I needed help. After returning home, I spent a lot of time recuperating in a recliner. Although I had a TV remote, I no longer had a Call Button, so I decided to make my own--but I wanted it to be wireless, portable and battery-operated.

This Call Button system takes advantage of the ESP-NOW communication technology used by Espressif in its ESP8266 and ESP32 family of microcontrollers (ESP-NOW User Guide). This technology allows for direct wireless communication between two or more ESP microcontrollers without the need to communicate over a WiFi network. Consequently, response speed is quick (within milliseconds) and is not affected by network congestion or proximity to WiFi routers. It also works over relatively long distances outdoors or between indoor locations separated by walls or floors.

This Instructable describes how to make a Call Button system consisting of two handheld devices that are referred to here as the "Caller" and the "Base." When the person who needs help presses the button on the Caller, it sends a signal to the Base, turning on a flashing red light and intermittent buzzer. The Base automatically sends back a confirmation signal that turns on a steady red light on the Caller to confirm receipt of the caller's request for help. When the caretaker/helper presses the button on the Base, the flashing light and buzzer stop and a signal is sent to the Caller, turning off its red light and briefly flashing a green light to tell the caller that the caretaker/helper is presumably on their way to help.

The circuit for each box uses the ubiquitous ESP8266 microcontroller board. ESP-NOW technology requires that program sketches specify the MAC addresses for each board, ensuring that signals sent by one box are received and acknowledged only by the other box, and not by other ESP boards in the vicinity. Both circuits are powered by rechargeable 3.7 V li-ion batteries (14500) attached to a TP4056 lithium battery charging board. Since ESP-NOW technology does not require connecting to WiFi routers, this approach minimizes current surges that would otherwise reduce battery life.

This project involves soldering and 3D printing. It also assumes a general familiarity with using the Arduino IDE for uploading program sketches to microcontrollers.

Supplies

The supplies for this project are listed below. The picture only shows components needed for the Base Box; an identical set of components is needed for the Caller Box, minus the buzzer module.

  1. D1 Mini ESP8266-12F with male headers* x 2 (~$2.67 each)
  2. SPDT panel mount slide switch x 2 (~$0.08 each)
  3. 14500 Lithium Ion Battery x 2 (~$3.13 each)
  4. Battery holder (AA size) x 2 (~$0.60 each)
  5. Lithium Battery Charging Board TP4056 5V 1A x 2 (~$0.78 each)
  6. 3K OHM 1% 1/8W 0805 SMD resistor x 2 (~$0.10 each)
  7. 5V 1A Micro USB Wall Charger (~$8.99)
  8. SPST Pushbutton (NO) x 2 (~$0.50 each)
  9. WS2812B 5050SMD Addressable RGB NeoPixel 5V DC x 2 (~$0.17 each)
  10. Buzzer (~$1.80) [only used for Base Box]
  11. Breadboard jumper wires (~$0.50)
  12. Six (6) 2/56 x 3/8 machine screws & nuts
  13. Wire, solder, heat shrink, hot glue sticks
  14. PLA filament for 3D printer (any color)

*Optional alternatives to D1 Mini ESP8266: A DIY ESP8266 Board can be used instead of the D1 mini board listed above. Also, if needed, the operating range of the system can be extended by using ESP8266 boards with internal (or external) antennae attached to the ESP8266 boards via IPEX connecters. Two such options are suggested below: (i) a DIY board using the ESP8266-07 module, or (ii) a D1 Mini Pro.

Step 1: Tools

The tools I used are listed below. Any 3D printer should work.

  1. wire cutter
  2. wire stripper
  3. needle nose pliers
  4. hot glue gun
  5. soldering iron
  6. 3D printer

Step 2: Print 3D Parts

The printed parts are shown in the pictures.

  1. Base Box (PLA): The enclosure for the system Base circuit was printed without supports at a 0.25 mm layer height (20% infill).
  2. Caller Box (PLA): The enclosure for the system Caller circuit was printed without supports at a 0.25 mm layer height (20% infill). This box is identical to the Base Box, except there are no buzzer mounting holes.
  3. Box Lids (PLA) x 2: The snap-fit lids were printed without supports at a 0.25 mm layer height (20% infill). The same lid is used for both boxes.

All items were designed using Fusion 360. The three STL files can be downloaded using the links below.

Step 3: Solder Wires

The wiring diagram for each circuit is the same, except for the addition of the buzzer to the Base box circuit. The legend distinguishes between connections that are soldered (squares), connections in which a wire with a female crimp pin connector is attached to a straight header pin on the ESP8266 board (arrows covered by a perpendicular rectangle), and connections that are hardwired to the component (circles: battery holder, buzzer). The ESP8266 pin numbers beginning with "D" refer to the D1 Mini and D1 Mini Pro boards; the numbers in parentheses refer to pin numbers on DIY ESP8266 boards.

  1. First, make sure the TP4056 charger modules will fit completely inside the rectangular boxes at the left inside ends of each enclosure. The chargers should rest flat in the boxes, with the micro USB socket accessible through the rectangular hole on the enclosure side. File the vertical pegs and/or the inside end of the TP4056 boards as needed to create a snug fit.
  2. Before continuing, because the default charging current of the TP4056 board (1A) is higher than the current rating of the 14500 li-ion battery (800 mA), I strongly recommend replacing resistor R3 on the TP4056 board with a higher value. For example, if R3 is replaced with a 3K resistor, the charging current will be reduced to 400 mA, which is half of the battery's current rating. Find other possible resistor values on the TP4056 board data sheet. To see a YouTube video on how to replace the R3 resistor, click here.
  3. For the Base Box only: Mount the buzzer to the outside front of the box using 2/56 machine screws and nuts. Insert the buzzer's red and black wires into the box through the hole below the buzzer.
  4. For each circuit, prepare the following wires, making each about 3 inches long (see picture):
  5. 3 red wires (no connectors); strip the insulation and tin the wire on both ends of each wire.
  6. 3 black wires (no connectors); strip the insulation and tin the wire on both ends of each wire.
  7. 4 or 5 wires with a female crimp pin on one end; strip the insulation and tin the wire on the other end. You can make these by cutting 8-in female-to-female jumper wires in half or, if a crimp tool and crimp pins are available, you can make your own. Cover the crimp pins with heat shrink to prevent shorting.
  8. Solder the red (#1) and black (#2) wires from the battery holder to the B+ and B- solder pads (respectively) on the TP4056 charger board.
  9. Solder red (#3) and black (#4) wires (no connector) to the OUT+ and OUT- solder pads (respectively) on the TP4056 charger board.
  10. Solder a red (#5) wire (no connector) to the NO solder lug on the slide switch.
  11. Solder the free end of red wire #3 to the common lug on the slide switch.
  12. Solder the following wires to the solder pads on the back of the NeoPixel:
  13. a red wire (#6) with no connector to the + solder pad.
  14. a black wire (#7) with no connector to the - solder pad.
  15. a wire (#8) with a female crimp pin on the other end to the Din solder pad.
  16. Solder the following wires to the solder lugs on the pushbutton:
  17. a black wire (#9) with no connector.
  18. a wire (#10) with a female crimp pin on the other end.
  19. Twist together and solder the free ends of wire #'s 5, 6 and 11; cover the connection with heat shrink.
  20. Twist together and solder the free ends of wire #'s 4, 7, 9, 12 and 13; cover the connection with heat shrink.
  21. Base circuit only: Solder the free end of a wire with a female crimp pin on the other end to the free end of the red wire (#14) attached to the buzzer and cover the connection with heat shrink; alternatively, use a crimp tool to attach a female crimp pin to the end of the red wire from the buzzer and cover the pin with heat shrink.

Step 4: Mount Components on Boxes

  1. From the inside of the enclosure, place the NeoPixel into the rectangular hole on the front side of the enclosure. Cover the back of the NeoPixel and surrounding plastic with hot glue and allow the glue to set, thereby holding the NeoPixel in place.
  2. Apply hot glue to the bottom of the CallBox near the front side of the enclosure. Press and hold the battery holder (with 14500 battery inserted) on top of the glue until it sets.
  3. Apply hot glue to the bottom of the small rectangular box on the left inside end of each enclosure. Press and hold the TP4056 charger board on top of the glue until it sets.
  4. Apply hot glue to the solder connections and the vertical plastic pin on the inside end of the charger board.
  5. Mount the slide switch on the inside of the enclosure above the charger using 2/56 machine screws and nuts.
  6. Mount the pushbutton through the hole on the side opposite the slide switch.

Step 5: Setup Arduino IDE

In addition to downloading the Arduino IDE 2.2.1 to your computer, you will need to install the files for controlling ESP8266 boards (using the IDE's Boards Manager) and the Adafruit NeoPixel library (using the IDE's Library Manager).

  1. Download/Install the Arduino IDE: HERE and install on your computer (Windows or Mac OS).
  2. Install the ESP8266 Boards Manager: Open the IDE and click on the Boards Manager icon (just below the folder icon in the left column). Search for and INSTALL ESP8266 Boards (3.0.2).
  3. Install the Adafruit NeoPixel Library: Open the IDE and click on the Library Installer icon (just below the Boards Manager icon). Search for "Adafruit NeoPixel" and INSTALL when you find the current version of the library.

Step 6: Get MAC Addresses for ESP8266 Modules

Before loading the Call Button System program sketches, you'll need to get the unique MAC addresses for the Caller and Base ESP8266 boards.

  1. Download the "GetMacAddress.ino" sketch (below) to your computer. Then, open the file using the Arduino IDE. The first time you try to open the .ino file, the IDE will ask you to put this sketch in a folder, which you should do.
  2. Connect the ESP8266 board to your computer with a USB cable.
  3. Select Board and Port: From the IDE's Menu Bar, click the downward caret next to "Select Board" to open the dropdown menu. Then click "Select other board and port...". Search for and select the name of your ESP board and the appropriate USB port. Click OK when finished.
  4. Verify the sketch to check for errors: Click the "Verify" icon in the IDE Menu Bar. The IDE will then attempt to compile the sketch, which should result in no error messages. Correct any errors before continuing.
  5. Upload sketch from your computer to the ESP8266: Click on the "Upload" icon in the IDE Menu Bar. The IDE will compile the sketch again and upload the compiled code to the ESP8266.
  6. Open the Serial Monitor by clicking on its icon in the upper right corner of the IDE window. Make sure the baud setting is 115200 (lower right corner of IDE window).
  7. Press the Reset button on the ESP8266. The Serial Monitor will immediately display six (6) 2-digit hexadecimal numbers separated by colons. This is the board's MAC address. Save these numbers for Step 7.
  8. Repeat Steps 2-7 for your other ESP board.


Step 7: Edit and Upload ESP8266 Program Sketches

The next step involves editing the Caller and Base program sketches so they contain the correct MAC addresses for your ESP boards (from Step 6)

  1. Download the CallButton_Caller and CallButton_BASE sketches (below) to your computer.
  2. Edit Sketch Line 12 in each sketch, using the the MAC addresses saved from Step 7. The Caller sketch must contain the MAC address for the Base board and BASE sketch must contain the MAC address for the Caller board. The hexadecimal numbers recorded in Step 7 should replace the last two digits of the consecutive list items defined in Line 12. Remember to SAVE the edited files.
  3. Connect the ESP8266 board to your computer with a USB cable.
  4. Select Board and Port.
  5. Verify the sketch to check for errors.
  6. Upload sketch from your computer to the ESP8266.
  7. Repeat Steps 2-6 for your other ESP board.

Step 8: Attach Wires to ESP8266 and Test

The last step before testing the system is to connect the free ends of wires with female connectors to the appropriate straight header pins on the ESP8266 boards. The picture shows this for a D1 Mini Pro board in the Caller box.

  • Make sure the slider switch is in the OFF position.
  • If using an internal antenna, attach it to the IPEX connector on the ESP8266 board.
  • Attach the female connectors to the straight header pins on the ESP8266 as follows (see diagram in Step 3): Wire #11 -> ESP Vin; Wire #12 -> ESP GND; Wire #10 -> ESP-D1 (GPIO5)[button]; Wire #8 -> ESP-D6 (GPIO12)[NeoPixel]; Wire #14 -> ESP-D7 (GPIO13)[buzzer].
  • Tape the antenna to the inside of the box lid and attach the snap-fit lid to the box.
  • Repeat the previous steps for the other board.

To test the boxes, use the slide switch to turn on power to the Base. The Base Neopixel should flash green several times as it sends a signal to the Caller. After a short delay, the NeoPixel will change to a steady yellow, indicating that the Caller circuit is not active (i.e., either it is turned off or the battery needs to be charged). If you then use the slide switch to turn on power to the Caller, it will attempt to send a signal to the Base. When the Caller's signal is received, the Base will begin buzzing and its Neopixel will flash red. The Base will then send a signal back to the Caller to confirm receipt of the Caller's signal. When the Caller receives that confirmation, its Neopixel will flash red several times before turning a steady red. Pressing the button on the Base will turn off its buzzer and Neopixel, and send a confirmation signal back to the Caller. When the Caller receives that signal, its NeoPixel will flash green several times and go off. Successful completion of this power-on sequence indicates that the Call Button System is operational.

The normal operation of the system is as follows: When the Caller button is pushed, it sends a signal to the Base. If the Base is powered-up and within range, it will buzz and flash red. The Base will also send a confirmation signal to the Caller. If the Caller is powered-up and within range, it will initially flash red and then turn a steady red, indicating that the Base has received the call for help. When the caretaker/helper presses the button on the Base, the flashing light and buzzer stop and a signal is sent to the Caller, turning off its red light and briefly flashing a green light to tell the caller that the caretaker/helper is presumably on their way to help. A steady yellow light on either box indicates that the other box is out of range or powered off, possibly because the battery is drained.

Step 9: Final Thoughts

This Call Button System works quite well between any two rooms in my apartment (~1400 sq ft on one level) when using internal antennae, even when there are one or more walls between the Caller and Base. The Base also responded to the Caller when I tested it down a long hallway (~200 ft) with no obstructions between the Caller and Base. Given a measured current draw of about 80 mA for each circuit, a fully charged 800 mAh 14500 battery should last about 8 h before it needs to be recharged.

ESP-NOW technology will allow expansion of this system to include multiple Caller boxes and/or Base boxes in the same system. Those who are interested in this possibility should consult the excellent ESP-NOW tutorials found on the Random Nerd Tutorials website, which provided invaluable assistance to me in the development of this project.

Finally, it's always a good idea to get advance buy-in from the person who is expected to monitor the Base box. In my case, by the time I finally had a good working version of this system, that person told me that she thought it would be of greater benefit to my recovery for me to get up out of my recliner and do it myself.

WARNING: Do not use this Call System in isolation in situations where emergency medical assistance might be needed. This system is not meant to replace devices that directly link to emergency medical service providers or 911 emergency dispatchers.

Anything Goes Contest

Participated in the
Anything Goes Contest