2021/09/04

VSCODE Arduino Can't select programmer

I've made a video tutorial on how to use Arduino + VSCODE for a better coding environment.

One of YouTube visitor asked why he can't select Arduino Programmer. 13:53 in the video
I did a bit experiment and found out that for ESP8266 & EPS32, you can't select Arduino Programmer. I'm not sure if this is a bug or Arduino extension intended. I then plugged a Arduino Nano, then the programmer shown correctly.

Here is how to solve the problem, if you are use ESP8266 or ESP32:
On the left hand side, click "arduino.json" to edit the file.

Add this line: "programmer":"arduino:avrisp", 

Example:
{
    "sketch": "ESP32-Robot-car\\ESP32-Robot-car.ino",
    "configuration": "CPUFreq=240,FlashMode=qio,FlashFreq=80",
    "board": "esp32:esp32:esp32cam",
    "port": "COM3",
    "programmer": "arduino:avrisp",
    "output": "../build"
}

Then this config the programmer for your boards. Hope this helped!

The End.



VSCODE + Arduino - 無法選擇 Programmer: AVISP

上方的VSCODE + Arduino 影片教學是之前的作的.  有網友詢問, 為何在 13:53 秒左右, 
影片中的 Select Programmer 時, 清單確是空的?

我後來試了發現 ESP8266/ESP32-S 真的不會出現 programmer list, 但是你改用 Nano, Mini Pro應該就會出現了. 

解決方法:
在左手邊的 arduino.json 自行加入 "programmer":"arduino:avrisp", 
範例:
{
    "sketch": "ESP32-Robot-car\\ESP32-Robot-car.ino",
    "configuration": "CPUFreq=240,FlashMode=qio,FlashFreq=80",
    "board": "esp32:esp32:esp32cam",
    "port": "COM3",
    "programmer": "arduino:avrisp",
    "output": "../build"
}

這樣子你就不用選擇 Arduino Programmer 了! 希望這樣能夠解決這個問題. 

2021/08/08

Arduino - How to use U8g2 library to show graphic & UTF8 characters for monochrome displays

In order to use the newly purchased 0.96" OLED SD1306 display, I studied the u8g2 library and made this video to share with you on how to use U8g2 library with monochrome display. In the video, I also included a section on how to use the free 5000+ traditional Chinese font created by Mr. Yang. The file is free for anyone to use. Really appreciated what he did for Arduino community! For those who do not have time to watch the entire video , here is the video timeline.

Video Timeline:

00:22 Install u8g2 01:04 Open PrintUTF8 example 02:00 Define display used 02:23 Explain display naming rules 04:13 Uncomment the line selected 04:33 Explain the code 04:42 enableUTF8Print() for symbol and Chinese 05:14 u8g2 supported font list 06:23 display location setCursor(X,Y) 07:05 Upload the sketch & show characters 07:23 Can't overwrite characters! 08:08 Char overwrite solution 08:37 OledOverlayPrint() function 09:06 Use OledOverlayPrint() in code 10:08 Use Open Iconic Fonts 11:29 Display cloud symbol 11:52 \u with number to show cloud 13:02 Change fonts for different lines 14:34 Download 5000+ Chinese font 15:11 Install 5000+Chinese font 15:39 Test missing fonts again 16:42 Reminder of memory usage 17:45 End of tutorial

References:

U8g2 library: https://github.com/olikraus/u8g2 U8g2 plain font: https://github.com/olikraus/u8g2/wiki... U8g2 setCursor command: https://github.com/olikraus/u8g2/wiki... U8g2 iconic font: https://github.com/olikraus/u8g2/wiki... How to make your own font: https://blog.jmaker.com.tw/chinese_oled/ MQTT & IoT Integration FB group: https://www.facebook.com/groups/36360... Download 5000+ Chinese font: https://drive.google.com/drive/folder...

 END

------------------------------------------------------------------------------------------------------------------------------------------------

2021/07/25

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.

AsyncWifimanager ElegantOTA ESP32 (WiFi Password Mgnt. + WiFi Firmware Update)

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

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/11

Android control color RGB LED (Revised for ESP32)

ESP32 Source code on the bottom of this article! 

See the original complete project tutorial here: Android RGB LED Arduino Controller




In September 2014, I created this project with Arduino Mini Pro Mini and Android APP loved by so many readers!  There are more than 100,000 App downloads by now!  Since then, quite of few readers asked me how to change the sketch to be used on ESP32 with built-in Bluetooth.  Here it is!! 😀


Be aware that LED PWM pins used on ESP32 were completely different, since Arduino Mini Pro and ESP32 have different architectures. 

For ESP32, I used following pins:

  • Pin 13 = Red
  • Pin 12 = Green
  • Pin 14 = Blue
Caution: ESP32 does not allow to use pin 6, 7, 8, 9, 10, 11 or it will crash and reboot. I tried...😂


Also, there is no analogWrite() function in ESP32, so I need to change analogWrite() to ledcWrite() with 
  • Channel definition for PWM
    • R channel = 0
    • G channel = 1
    • B channel = 2
  • Setup PWM frequency: 5000
  • Setup PWM resolution: 8 (8bit = 255 colors)
Then I need to setup LED with:
  • ledcSetup( channel, frequency, resolution)
And then attach LED pins to channel
  • ledcAttachPin(Pin, channel)
Then write to LED pins with
  • ledcWrite( channel, value for resolution(0~255));


END