It's Raining! Message Me Via Facebook Messenger
by ductin in Circuits > Arduino
1639 Views, 3 Favorites, 0 Comments
It's Raining! Message Me Via Facebook Messenger
My place often has sudden rain. The weekend became worse when it was raining while the clothes were being exposed in the yard.
I have a version that uses rain sensors to report via SMS but it is quite expensive and ineffective. Especially when I'm passionate about reading instructable and surfing facebook. So I decided to release the rain version via Facebook Messenger.
Supplies
- Generic Rain Sensitive Sensor Module
- NodeMCU (or modules using esp chips)
-
5v power supply
Hardware
Connect the GPIO4 (D2) pin of NodeMCU to the D0 pin of the rain sensor (Yellow wire)
Connect 5V(Red wire) and GND (Black wire)pins of MCU to VCC and GND of rain sensor (Interestingly, I use 3V pins, the rain sensor module still works well)
In this example, I use NodeMCU, you can do the same with other ESP8266 modules But you may need to add usb to uart to connect esp8266 to your computer. Then you need to know how to bring it to code loading mode If you need a clearer tutorial on this issue, take a look at my other project <a href="https://www.instructables.com/id/Automobile-Toy-Revival-With-Esp8266/"> https://www.instructables.com/id/Automobile-Toy-R...</a>
Facebook Messenger
How does the Messenger Platform work?
When a person texts your business on Messenger, their message is sent to the Facebook server. The Facebook server then sends webhooks to your business server, where your Messenger App is hosted. Using the Send API, your app can respond to the person on Messenger. In this way, you can construct guided conversations to lead people through an automated flow or build an app to serve as a bridge between your agents and your business presence on Messenger. The Messenger Platform does not require any payment to use. It is meant for businesses to handle inquiries from their customers. Once you build your experience for your customers to interact with, you can then leverage Click-to-Messenger Ads to bring people to your experience.
My Project
Connect with me
- Open my bot at: https://m.me/KenhTayMay
- Chat "Hello" to retrieve an automatic message
Click the push button in the automatic message
Another message tells you a random string. Save the string to use for the next step
Software
INSTALL ARDUINO IDE
These are instructions from https://github.com/esp8266/arduino
Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager.
We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).
Install the current upstream Arduino IDE at the 1.8 level or later.
The current version is at the Arduino website.
Start Arduino and open Preferences window.
Enter http://arduino.esp8266.com/stable/package_esp8266... into Additional Board Manager URLsfield.
You can add multiple URLs, separating them with commas.
Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
UP MY CODE TO ESP8266
Download my code at github
https://github.com/kim7tin/rain_alert
Chage your key and your message
String key = "";<br>String message = "M%C6%B0a%20r%E1%BB%93i%20anh%20%C6%A1i%2C%20mau%20c%E1%BA%A5t%20qu%E1%BA%A7n%20%C3%A1o%20%C4%91i%20k%E1%BA%BBo%20v%E1%BB%A3%20m%E1%BA%AFng";
message is URL encode, you can convert your message to URL encode on here:
https://hs2t.com/itemized/url-encode-decode/
Change your wifi SSID and Password
WiFiMulti.addAP("KemShop-55LTT", "");
Up load your code to ESP8266
I believe this step is quite simple for you to do yourself
Bonus
This is a simple example of how to use esp8266 messaging to facebook messenger.
In addition to telling the rain, you can customize my bot to announce many other things as I am using it in my smart home system.
for more infomation, please view my video: