Skip to content

Example for Modbus RTU, Modbus TCP/IP, MQTT run in ESP32 Canopus board

Notifications You must be signed in to change notification settings

NamNamIoT/ESP32_CANOPUS

Repository files navigation

ESP32_Canopus Module Quick Start Guide

✌️✌️ Welcome! ✌️✌️

Hi, im Namnam 🕴🏼.
Please contact me if you need to develop ioT products.

kuem0912 84969809444

Information ESP32_Canopus board

🕵🏻‍♀️Version 1.0

Object Detail conponent Note
Power MC34063A 5-35VDC
Ethernet LAN8720A (RJ45: HR911105A) -
RS485 SP485EE Serial2, auto DERE
I2C - SDA = IO33, SCL = IO4
Led blue - PIN IO15
Led yellow - PIN IO2
Button - PIN IO36
ESP32 ESP32 WROOM 32D -
Case Plastic Mount dinrail

🧑🏻‍🔧 Hardware Setup

-Cable USB type C for power and upload code.
-Power 5-24VDC.
There's really no need because we used 5V power via type C cable.
Both type C cable and power supply via terminal can be connected at the same time.
-Cable ethernet, Use for ethernet demos.

🧑🏼‍💻 Software Setup

+Install IDE arduino. Follow this, skip if you done.

⚠️ WARNING: Install in Document folder.

image
+Install driver CH340. Follow this, skip if you done.
+Install ESP32 in manager board:

  • Down load this folder: hardware
  • Extract at ...\Documents\Arduino. Ex my computer: C:\Users\NamPC\Documents\Arduino
  • Go to ...\Documents\Arduino\hardware\espressif\esp32\tools
  • Click get and gen:
    ESP32 install
  • Check it in IDE:
    image

At here , you are ready 👌 to execute the sample code for the ESP32_CANOPUS board

⚠️ WARNING: Prepare yourself a cup of coffee ☕☕☕, because the next is a fascinating journey with Canopus board 🤪.

You will be stronger after working through the next 12 examples.

Read modbus slave via TCP/IP
Serve master RTU
Serve master TCP/IP
Auto switch WiFi-Ethernet
Auto switch many WiFi in list
Push value modbus to MQTT
On/off led via MQTT
FOTA - update firmware via Internet with FTP
WATCHDOG timmer
Deep sleep

Blink

#define LED_YELLOW 2 //Pin led color yellow is IO2
void setup() {
  // initialize digital pin LED_YELLOW as an output.
  pinMode(LED_YELLOW, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_YELLOW, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_YELLOW, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

You can find it in examples: Download

Modbus_Slave

You can find it in examples: Download

3. Read modbus slave via TCP/IP

You can find it in examples: Download

4. Serve master RTU (board is slave)

You can find it in examples: Download

5. Serve master TCP/IP (board is slave)

You can find it in examples: Download

6. Auto switch WiFi-Ethernet

You can find it in examples: Download

7. Auto switch many WiFi in list

You can find it in examples: Download

8. Push value modbus to MQTT

You can find it in examples: Download

9. On/off led via MQTT

You can find it in examples: Download

10. FOTA - update firmware via Internet with FTP

You can find it in examples: Download

11. WATCHDOG timmer

You can find it in examples: Download

12. Deep sleep

You can find it in examples: Download