Basics: Project 081i ESP8266 ESP-01 module, Reed switch with IFTTT


Basics: Project 081i

Project name: ESP8266 ESP-01 module, Reed switch with IFTTT

Tags: Arduino, ESP8266 ESP-01 module, ESP, ESP8266, WI FI module, ESP-01, IFTTT

Attachments: sketch

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1. Arduino IDE ( you can download it from here  )

2. ESP8266 ESP-01 WI FI module 1pc

esp-01

3. Jumper cables

jumper cables

4.Resistor 10 KOhm 1 pc

RESISTOR 10 KOHM

5. Breadboard 1pc

breadboard

6. Reed switch (magnetic door switch) 1 pc

magnetic reed switch, door sensor

7. USB to TTL serial converter 1 pc

esp-01
esp-01

8.USB mini cable 1 pc (optional)

esp-01

9. Any voltage regulator LD1117V33, AMS1117 3.3 V or 78R33 (to get 3.3V) or  1 pc

General

We will learn how to use ESP8266 ESP-01 WiFi module and Reed switch with IFTTT.

IFTTT is the free way to get all your apps and devices talking to each other. It’s the free service which stands for “If This Then That”. You can make apps work together. For example when you send a request to IFTTT, it triggers a recipe that sends you an email alert.

Understanding the reed switch

You can read more about it here.

Understanding the USB to TTL converter

You can read more about them here.

Understanding the ESP8266 WI FI module

You can read more about it here.

Signals and connections of the ESP8266 ESP-01 WI FI module

TXD (TX, TXO or UTXD) – transmit pin. Connected to Arduino Uno pin 1.

RXD (RX, RXI or URXD) – receive pin. Connected to Arduino Uno pin 0.

VCC (3V3 or 3.3V)- power supply pin (3-3.6V). Connected to 3.3V DC 1A and more external power supply. The current required for the ESP-01 during Wi-Fi operation vary from 250mA to 750mA.

RST (RESET) – reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.

CH_PD (CHIP_EN or EN) – Chip enable. Keep it on high (3.3V) for normal operation.

GND – Ground. Connected to Arduino board GND pin

GPIO0, GPIO2 (IO0, IO2) – General Purpose Input Output pins. GPIO0 also controls the module mode (programming or normal operation). In our case (normal operation), it shall be connected to 3.3V (high). GPIO2 is not used in this example.

Wiring

esp-01

Step by Step instruction

1.Programming (uploading sketch) to ESP8266 ESP-01 module

You can read more about it here.

2. Adding ESP8266 platform to Arduino IDE

The Arduino environment has to be set up to make it compatible with the ESP8266 ESP-12E module. We are using PC with Windows 7 OS.Download and install the Arduino IDE. You can download it here 

Open Arduino IDE. 

Open the Preferences window from the Arduino IDE. Go to File -> Preferences.

esp-01

Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field and click the “OK” button. If you already have a URL in there, and want to keep it, you can separate multiple URLs by placing a comma between them. (Arduino 1.6.5 added an expanded text box, separate links in here by line.)

esp-01

Open Boards manager. Go to Tools -> Board -> Boards Manager…

esp-01

There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. or scroll down to the ESP8266 entry (usually at the bottom). Select the ESP8266 entry. When you click it an install option will appear. Select the latest version and click install

esp-01

The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other reasonably large, compiled binaries, so it may take a few minutes to download and install (the archived file is ~110MB). Once the installation has completed, an Arduino-blue “INSTALLED” will appear next to the entry.

esp-01
esp-01

Choose your ESP8266 board. Go to Tools -> Board -> Generic ESP8266 Module

esp-01

You will see Generic ESP8266 Module on the bottom of the Serial Monitor window.

3. Making IFTTT Account

1.Go ifttt.com website and click on Sign Up button in top right corner of the page.

IFTTT

2.You can sign up with Apple, Facebook, Google or use password to sign up.

IFTTT

3.Type your email and password to make account and click on Sign up button.

IFTTT

4.Click on Skip button.

IFTTT

5. Click on Icon button.

IFTTT

6.Select Create from the pop-up menu.

IFTTT

7.Click on +This.

IFTTT

8. Choose a service. Type Webhooks and click on Webhooks blue square.

IFTTT

9.Click on Connect button.

ifttt

10. Choose trigger – click on receive web request.

ifttt

11. Type the event name – for example, front_door_opened and click on Create trigger button.

ifttt

12. Click on +That.

ifttt

13. Choose action service. Type email and click o n Email blue square.

ifttt

14. Click on Connect button.

ifttt

15. Type your email address and click on Send PIN button.

ifttt

16.You will get PIN on your email address. Write it down as you will need it later.

ifttt

17. Type your PIN and click on Connect button.

ifttt

18.Choose action. Click on send me an email.

ifttt

19. In complete action fields modify text as shown below. Click on Create action button.

20. Type the name of applet and click on Finish button.

ifttt
ifttt

21. Go to https://ifttt.com/maker_webhooks and open the Settings tab.

ifttt

22. Copy your secret key to a safe place (you will need it later in this project). In our example secret key is: bHqghGuQv0nZhfaBKSVZ-v

ifttt

23. Let’s test if your request is working properly. Replace YOUR_API_KEY from the following URL: https://maker.ifttt.com/trigger/front_door_opened/with/key/YOUR_API_KEY

With your API KEY: https://maker.ifttt.com/trigger/front_door_opened/with/key/bHqghGuQv0nZhfaBKSVZ-v

Open your URL with your API KEY in your browser. You should see something similar:

ifttt

24.Go to your email client and you will see the new email.

ifttt

4. Uploading sketch to ESP8266 ESP-12E development board

1.Do wiring.

2.Open Arduino IDE.

3.Plug your USB to TTL converter with DTR Pin or without DTR Pin or ESP01 programmer UART into your PC USB port.

4.Choose your ESP8266 board. Go to Tools -> Board -> Generic ESP8266 Module

5.Select the correct com port.

6.Modify (with your SSID, password, IFTTT secret key), verify and upload the sketch to your ESP8266 ESP-01 module. AT commands will not work after that. You need to Flash the firmware to enable them again.

7.You will get the email to your inbox when the door status will change – open or close (we have reed switch attached to GPIO 2).

Summary

We learnt  how to use ESP8266 ESP-01 WiFi module and Reed switch with IFTTT.

Libraries:

  • ESP8266WiFi library included in Arduino IDE.

Project resources:

  • See attachments on the begining of this project description

AcoptexCom

Leave a Reply

Your email address will not be published.