Showing posts with label NODEMCU. Show all posts
Showing posts with label NODEMCU. Show all posts

2021/07/25

Arduino #27 AsyncWifimanager ElegantOTA ESP8266 (WiFi Password Mgnt + WiFi Firmware Update)

*** If you are using the ESP32, Please see this: ESP32

It would be great if every IoT device deployed with OTA capability with Wifimanager.  Then the IoT device would be able to change SSID & password without connecting the device to the computer to update SSID and password as well as FOTA at any time when you wanted.

In this tutorial, let’s combine ESPAsync_Wifimanager and AsyncElegantOTA into a code base to become a handy tool for future IoT projects! 

I have made WiFiManager & AsyncElegantOTA tutorial videos. If you don't know what they are and how they work for IoT projects, I strongly recommend you to watch these videos first.

This time, I used ESPAsync_WiFiManager library, it's because WiFiManager does not work with AsyncElegnatOTA together. We have to change to ESPAsync_WiFiManager.  The main reason for this is that AsnycWiFiManager is using Asynchronous technology. Which means it can accept connections from different sources at the same time. So, while WiFiManager is running on the device, the device can also be a FOTA server to allow firmware to be remotely updated!

        Watch these videos first, if haven't heard about these.

        GitHub Library:

        Sample code:


For those of you do not have the time to watch the entire video, here is the Video Timeline 00:00 Project introduction 00:16 Arduino libraries used in this project 00:29 Short Wifimanager briefing (Check out my previous video) 00:59 Short AsyncElegnatOTA briefing (Check out my previous video) 01:34 Tutorial begin 02:04 Copy ESPAsyncWifimanager sample code to your editor 02:44 Check AsyncElegantOTA sample code 02:50 Start to merge the two libraries 05:16 Setup your IoT AP name 05:58 Copy AsyncElegantOTA code & modify 06:20 Modify server variables 07:05 What does webServer.on do? 07:35 Upload sketch 08:11 Test AsyncWifimanager and setup SSID & Password 09:10 Access ESP32 from browser 09:44 Access ESP32 OTA page The End.

2021/07/10

ESP8266/ESP32 AsyncElegantOTA Wi-Fi OTA

It's always troublesome to update firmware for your IoT projects? Tried Arduino BasicOTA examples, but never get it to work? Then you must try AsyncElegantOTA! It's very easy to use and I've succeed the first time I try it. 



For those of you do not have time to watch it all, here is the video timeline for your quick reference.

Video Timeline:

00:13 Tutorial summary 00:53 What's OTA & Why 01:25 Tutorial begin 01:36 Install AsyncElegantOTA library 02:32 Download ESPAsyncWebServer & ESPAsyncTCP 02:57 Ensure Arduino board is capable of OTA 03:41 Where to place downloaded libraries 04:09 Open sample AsyncElegantOTA sketch 04:52 Upload sketch 05:05 Open serial monitor to see ESP8266 IP address 05:36 Access to ESP8266 from browser 06:10 Update ESP8266 firmware from browser 06:31 Where to find .bin file in VS Code 06:54 How to create .bin file in Arduino IDE 08:16 OTA update ESP8266 firmware 09:01 Next video tutorial - How to combine ESP8266 project with AsyncElegantOTA library


Library URL:

2019/03/31

Arduino - Better way to manage Wi-Fi SSID & Password


Have you met this problem before? You are making an fantastic Arduino IoT project. However, in the code, Wi-Fi SSID and Password were hard-coded and the only way to change these is to edit the code and re-upload the code to Arduino. At home, this is okay, since you Wi-Fi SSID and password will not change frequently.

Let’s say you bring this project to a friend place or a venue to demo. And you didn’t know the Wi-Fi SSID nor the password beforehand. Then, you need to bring your computer to change SSID and password and re-upload to Arduino. 

Is there a way to get rid this problem? Yes! The answer is use Arduino Wifimanager library.

Please see the video below to learn how to do this!


Interested in Arduino Voice Control Projects? Please checkout these tutorials below:
===========THE END==================

Arduino -  更方便的管理 Arduino Wi-Fi SSID & Password


你一定遇到過這個問題! 你正在製作一個夢幻般的Arduino物聯網專案。 但是,在代碼中,Wi-Fi SSID和密碼是直接寫入的,更改這些代碼的唯一方法是編輯程式碼並將它重新上傳到Arduino。 在家裡,這沒關係,因為這個Wi-Fi SSID和密碼不會變更


假設您將此項目帶到朋友的家裡或演示場所。 而且您事先並不知道Wi-Fi SSID和密碼。這時候,您就要使用到電腦更改SSID和密碼並重新上傳到Arduino, 是不是很麻煩呢? 。


有沒有辦法擺脫這個問題? 有的! 答案是使用Arduino Wifimanager程式庫。


請參閱下面的教學,了解如何執行此操作!

若你對Arduino語音控制有興趣? 請參考以下教學:
===========本文結束==================



2019/01/06

Voice control with Google home and Arduino (2/3)

Continue from Part 1

This is the part 2 of the "Voice control with Arduino and Google Home Mini" tutorial. This section primarily explain how to setup the Adafruit MQTT and IFTTT related services.

This is the demo of this tutorial:


Step 1: Adafruit IO setup 

Watch this video to see how I setup the Adafruit IO MQTT for this tutorial. This video has English Closed Captions, if you needed it.






  • If you would like learn more about MQTT, please visit Adafruit website to see it's great tutorials. Highly recommended for anyone not familiar with this technology to read. 

AIO Key

  • AIO Key is your personal key that allows your Arduino ESP8226 to talk to Adafruit IO MQTT server. Keep it safe and not to share with others. 
  • Log in to your account and Click "AIO Key" on the left menu.
  • Write down the AIO Key (You will need this in Arduino to connect to Adafruit) See below:
  • Click on the "View AIO Key" button to see your AIO Key (shown below)








Write down the AIO Key for Arduino ESP2886 coding use later. 

Step 2: Setup IFTTT Applet

  • IFTTT is stands of "If This Than That". If you were not familiar with IFTTT, you could checkout more information from these resources:
    1. What's IFTTT?
    2. How to setup IFTTT?
  • Here is how I setup my IFTTT Applet for this tutorial. This video has English Closed Captions, if you needed it.

Step 3: Check Adafruit and IFTTT setup

  • Turn on Google Home Mini and say "Turn on light one".
  • Install IFTTT App on your smartphone, if you used a smartphone rather than a Google Home.
  • Google assistant should reply "Sure, light one on".
  • From the Adafruit feeds page, you should see the data showing up there immediately reflecting the message you sent; in red square below.
  • Then, your setup is successful!

The 2nd part is completed. In the next section, I will show you all the physical setup and the Arduino codes to make this project work.


Troubleshooting:


Until then, see you next time!

Continue to read: Part 3 Arduino 程式解說 (coming soon)


2019/01/01

Voice control with Google Home and Arduino (1/3)

Preface

After received my Google Home Mini from Walmart, my family and I are really enjoyed and satisfied with the voice features and sound quality. Voice control lighting is always on my Arduino DIY list. After I received all the components, I went ahead and made this project during my X'mas holiday. The Google Home Mini I bought came with a Chromecast in a Smart TV kit package at price of USD$45 during holiday sales. What a bargain! 

* Photo from Walmart

Here are the URL links about this tutorial, totaling 3 sections:


Goal

Simply say "Ok Google, turn Light One On or Off" to Google Home Mini and it does the job!  I intended to add "One" there, so I might have the 2nd or 3rd lights that I could control in...hope not in the distant future. :)

See the demo below:


How does it work?

Programming Steps to show you the working flow

  1. Your voice command send to IFTTT through Google Home Mini 
  2. IFTTT Applets engage Google assistance service and inteprete the voice command into text and send to Adfruit.IO MQTT service
  3. MQTT service received the message(from Google home to IFTTT) and based on the Adafruit "Feeds" setting to store the received message on the MQTT server.
  4. Adruino ESP8266 at home was programmed to subscribe new message from Adafruit. As soon as the Adafruit MQTT server has updated message, Adafruit server push the message back to Arduino ESP8226.
  5. ESP8226 recevie the message and act accordingly to either trigger the relay module.
  6. If the messae is "ON" then, ESP8226 turn on light by swith relay module on. Otherwise, the message is "OFF", then trun off light by swith relay module off.

!!EXTRA CAUTION!!

SAFETY is first priority! This project involves 110V AC which it is quite dangerous if not handled carefully! Please turn the main power source off before all the AC related connections. Double and triple check for short and correct connections before turn back on AC! I'm just to show you how I made this project and not responsible for anything happened to you or your family and properties in case if there is an accident. 

Components Needed

  • NODEMCU ESP8226 * 1
  • 10A 110v/250v AC Relay * 1
  • Wall plug outlet * 1
  • Wires for Arduino connection * 4 or 5
  • Wires for Wall plug connection * 3

Schematic 

I drew this illustration below to show you how did I connected all components together.



Connections:

  • ESP8226 D7 to Relay IN
  • ESP8226 GDN to Relay GDN
  • ESP8226 3.3V to Relay VCC
  • Relay NC(Normally Close) to AC Plug outlet top end (refer to above illustration)
  • Relay C(Common) to AC 110V 
  • AC Plug outlet bottom end to AC 110V GND
  • AC Plug ground (not used in this project, my old house does not have this)
That's all for this section. Next time, I will show you how to setup Adafruit and IFTTT. They are the most important parts of this project. Until next time, see you!

Please Continue to read: Setting software - Part 2 of this tutorial