echo '' ;

Workshop : 20170807-Internet Of Things Using ESP8266

“Internet of things using ESP8266 Workshop”


“If you think that the internet has changed your life, think again. The IoT is about to change it all over again!” –

— Brendan O’Brien, Aria systems


Reviews

Karthikeyan

https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fkarthikeyan.kka.1111%2Fposts%2F1941846072763036%3A0&width=500


Workshop: Internet Of Things using ESP8266


ESP8266 is a popular Wi-Fi chip, and the Internet of Things (IoT) is one of the fastest-growing technologies. Therefore, we are organizing a technical workshop focused on IoT using ESP8266. In this workshop, you’ll gain knowledge about the basic concepts and features of IoT and learn to build projects using the ESP8266 NodeMCU platform.

Topics Covered:

  • Basic concepts and features of the Internet of Things
  • Building projects using the ESP8266 NodeMCU platform
  • Fundamental concepts of cloud computing
  • Sensor reading and data acquisition
  • Connecting ESP8266 to the Internet
  • Wireless interfaces
  • Controlling devices with Android phones
  • Using popular open platforms for managing sensor data
  • Triggering actuators remotely
  • Reading information on Android smartphones

Benefits:

  • Gain the ability to undertake IoT projects independently
  • Opportunity to assist others in learning about IoT

Workshop Details:

  • Duration: 7 hours per day
  • Refer to the attached image for further details.

Who Should Attend:
Anyone interested in learning about IoT and building projects with the ESP8266 chip.

Interested participants can join this workshop for a comprehensive learning experience.


Feel free to make any adjustments as needed!

Session-1 (Morning)

  • Overview of Internet of things.
  • Get started with ESP8266 and development board.
  • Basics interface : GPIO,Timer, File System, WiFi.
  • Basic Experiments : LED, RGB LED, Buzzer, Button, Relay.
  • Some More Experiments : PWM, WiFi, TCP, UDP, SNPT, RTC, MQTT.

Session-2 (Afternoon)

  • Real time Project 1 : Smart Device Control with monitor (Home Automation devices-Online/Offline).
  • Real Time Project 2 : Smart RGB Light  (Online/Offline).
  • Project 3 : Network Status Indicator.
  • Project 4 : Data Logger.

Goal

  • Workshop is to make the students skill full and efficient for Internet of things related concepts.
  • The students to do their final year projects by them-self.
  • Apply Internet of things application in your day-to-day.

Participation Prerequisites

To participate in the workshop, you will need the following:

  • A laptop – Windows(Latest) and at least one free USB port with internet connection.
  • A micro-USB cable with data lines that fits your USB port.
  • A Mobile with WiFi, Host-spot feature and internet connection.
  • A breadboard and arduino board with cable.(Optional)
  • You will need a install this software( I will give at workshop)
  • Keep on this below software’s
  • Please note that the workshop will be in mostly English (Local Language-Prefers).

Participation will  receive in additional, at the workshop!

  • Wi-Fi development board,
  • LED,
  • RGB LED,
  • Female-female connector cables,
  • Piezoelectric speaker,
  • Magnetic Reed Switch
  • Magnet
  • Certificate will provide end of the workshop to each participate,
  • End of the session we will provide all kind of workshop materials like PPT, documents, videos and source code.

Venue

Department of Electronics and Communication Engineering,

Mahendra Engineering College

Salem – Thiruchengode Highway,

Mahendhirapuri, Namakkal District,

Mallasamudram, Tamil Nadu, India-637503.


Registration

This event was held. you can’t register. contact Mr.Arun.


Payment Method

Note : You can pay the workshop fee by two ways – Online/Offline. One we received your payment you will get a message to your registered mobile and e-mail.

Online : Pay using Paytm

  • Pay workshop fee (money) to +918300026060 mobile number or scan QR code image
  • In Optional description  write “ArunEworld_Workshop_20170821” <space> “You_Name”  (Ex :  ArunEworld_Workshop_20170821 Raja)

Offline : Pay to Workshop organizer

Contact-Person: Mr.Giri.K , Assistant Professor, Mahendra College of Engineering,

Contact Number: +919003503908.



Contact Organizer

Mr. Giri. K (girik@mahendra.info, +919003503908)

Department of Electronics and Communication Engineering,

Mahendra Engineering College

Salem – Thiruchengode Highway,

Mahendhirapuri, Namakkal District,

Mallasamudram, Tamil Nadu, India-637503.


Photo Gallery


Workshop full details and resource

Click this below link to see the syllabus, contents, videos and more, etc..


ESP32 Lua-RTOS – IDE Setup and Firmware Flash

Lua RTOS is an open-source real-time operating system (RTOS) designed to run Lua applications on microcontrollers and other embedded systems. It aims to provide a lightweight and efficient platform for developing embedded applications with Lua scripting capabilities.Here will discuss ESP32 Lua RTOS Flash Firmware tutorial.

Overall, Lua RTOS is a versatile and lightweight operating system that empowers developers to build embedded applications with Lua scripting capabilities. Its integration with popular microcontroller platforms and active community support make it a compelling choice for IoT and embedded systems development. We tested with EPSressif ESP-Wroom-32 Dev Board and ESP32 Core firmware with the ESPressif Flash tool.

Read more: ESP32 Lua-RTOS – IDE Setup and Firmware Flash

Overview of Lua RTOS

FeatureDescription
LanguageLua RTOS is built on Lua, a lightweight scripting language. Lua is known for its simplicity, ease of use, and flexibility, making it ideal for embedded systems development.
Real-Time Operating SystemLua RTOS provides a real-time operating system (RTOS) environment for embedded systems. It offers task scheduling, inter-task communication, and synchronization mechanisms.
Supported HardwareLua RTOS supports various microcontroller architectures, including ESP32, ESP8266, STM32, and others. It is highly portable and can be adapted to different hardware platforms.
MultitaskingLua RTOS enables multitasking, allowing multiple Lua scripts to run concurrently as separate tasks. Tasks can communicate and synchronize through message passing and semaphores.
File SystemLua RTOS includes a file system API for accessing files on external storage devices such as SD cards or SPI flash memory. It supports file operations like reading, writing, and listing.
NetworkingLua RTOS supports networking protocols such as TCP/IP, UDP, MQTT, and HTTP. It allows embedded devices to communicate over Ethernet, Wi-Fi, or other network interfaces.
Peripheral SupportLua RTOS provides APIs for interfacing with various peripherals such as GPIO, UART, SPI, I2C, ADC, DAC, and more. Developers can easily control and communicate with hardware components.
Development EnvironmentLua RTOS development can be done using lightweight text editors or integrated development environments (IDEs) with Lua support. It offers flexibility in choosing development tools.
CommunityLua RTOS has an active community of developers and users who contribute to its development, share knowledge, and provide support through forums, mailing lists, and social media.

This table summarizes the key features and characteristics of Lua RTOS, providing an overview of its capabilities and suitability for embedded systems development.

Setting up Lua RTOS

StepDescription
1. Obtain Lua RTOSDownload Lua RTOS from the official repository or source.
2. Install prerequisitesInstall any required dependencies, such as Git and GCC, according to Lua RTOS documentation.
3. Set up development environmentConfigure your development environment, including setting up a terminal and text editor.
4. Initialize project directoryCreate a new directory for your Lua RTOS project.
5. Write your Lua codeDevelop Lua scripts and application logic within the project directory.
6. Configure Lua RTOSCustomize Lua RTOS configuration files to match your project requirements.
7. Compile Lua RTOSUse the provided build system to compile Lua RTOS for your target hardware platform.
8. Flash Lua RTOSFlash the compiled Lua RTOS image to your target hardware using tools like esptool.py.
9. Test your applicationVerify the functionality of your Lua RTOS application on the target hardware platform.
10. Iterate and improveContinuously refine your Lua RTOS application based on testing feedback and requirements.

Firmware

Where to get Lua-RTOS firmware? (Pr-compiled binaries)


Flash Tool

The software and hardware resources required for downloading firmware to flash are
listed below.

  • Hardware:
    o 1 x module to which firmware is downloaded
    o 1 x PC (Windows 7 [64 bits], Windows 10)
  • Software:
    Download Tool: Flash Download Tool ESpressif Flash Download Tool,

This tool supports the following SOCs

  • ESP32 series
  • ESP8266 series
  • ESP32-S2 series
  • ESP32-C3 series
  • ESP32-S3 series
  • ESP32-C2 series
  • ESP32-C6 series
  • ESP32-H2 series

Steps to follow

Download the appropriate firmware for your ESP32 board from the provided link. Once you’ve downloaded the appropriate firmware, unzip the file anywhere on your machine. Similarly, download the Flash tool from the same link and unzip it. Next, open the flash tool designed for ESP32 and configure the following parameters:

  • Baud rate: 921600
  • Flash mode: “dio”
  • Flash frequency: “40m”

For flashing the firmware, use the following addresses:

  • Bootloader.WHITECAT-ESP32-N1.bin – Address: 0x1000
  • lua_rtos.WHITECAT-ESP32-N1.bin – Address: 0x10000
  • partitions_singleapp.WHITECAT-ESP32-N1.bin – Address: 0x8000

For flashing the file system, use:

  • spiff_image.WHITECAT-ESP32-N1.Bin

Once the flashing process is complete, you’re all set.

Note: Make sure to adjust the “esp-idf path” and “usb path” as per your requirements.


Connect to the Console

Connect any UART Serial Tool to your device and configure the following parameters:

  • Speed: 115200 bauds
  • Data bits: 8
  • Stop bits: 1
  • Parity: None
  • Terminal emulation: VT100

Ensure these settings are accurately configured for seamless communication between your devices.

after connecting esp32 to the PC you will see the following.

   /\       /\
  /  \_____/  \
/_____________\
W H I T E C A T

Lua RTOS beta 0.1 build 1479953238 Copyright (C) 2015 - 2017 whitecatboard.org
cpu ESP32 at 240 Mhz
spiffs0 start address at 0x180000, size 512 Kb
spiffs0 mounted
spi2 at pins sdi=012/sdo=013/sck=014/cs=015
sd0 is at spi2, pin cs=015
sd0 type II, size 1943552 kbytes, speed 15 Mhz
sd0a partition type 0b, sector 227, size 1943438 kbytes
fat init file system
fat0 mounted
redirecting console messages to file system ...

Lua RTOS beta 0.1 powered by Lua 5.3.4


Executing /system.lua ...
Executing /autorun.lua ...

/ >

ESP32 Lua RTOS Flash Firmware tutorial

Embedded Interface – PCF8574 and PCF8574A I/O Expender

In this article we are discussing Embedded Interface – PCF8574 and PCF8574A I/O Expender.

The PCF8574 device provides general-purpose remote I/O expansion for most micro controllers
families by way of the I2C interface [serial clock(SCL), serial data (SDA)]. 8-bit 2.5- to 5.5-V I2C/SMBus I/O expander with interrupt

The device features an 8-bit quasi-bidirectional I/O port (P0–P7), including latched outputs with high current drive capability for directly driving LEDs. Each quasi-bidirectional I/O can be used as an input or output without the use of a data-direction control signal. At power on, the I/Os are high. In this mode,
only a current source to VCC is active.

Read more… →

Embedded Interface – LCD HD44780

  • HD44780 compliant controllers 16×2 Character LCD is a very basic and low-cost LCD module that is commonly used in electronic products and projects.
  • 16×2 means it contains 2 rows that can display 16 characters.
  • Its other variants such as 16×1 and 16×4 are also available in the market.
  • In these displays, each character is displayed using 5×8 or 5×10 dot matrix.

Experiments

  • Change Cursor Location Based on Key Input

LCD4 Bit Mode Functions

void Lcd4_Clear()   {    Lcd4_Cmd(0x00);    Lcd4_Cmd(0x01);    }    // clear screen 0x01

void Lcd4_DisplayOFF_BlinkON_CursorON()        {    Lcd4_Cmd(0x00);    Lcd4_Cmd(0x0B);    }    // 0x0B

void Lcd4_DisplayON_BlinkOFF_CursorOFF()    {    Lcd4_Cmd(0x00);    Lcd4_Cmd(0x0C);    }    // 0x0C

void Lcd4_DisplayON_BlinkOFF_CursorON()     {    Lcd4_Cmd(0x00);    Lcd4_Cmd(0x0D);    }    // 0x0C

void Lcd4_DisplayON_BlinkON_CursorOFF() {    Lcd4_Cmd(0x00);    Lcd4_Cmd(0x0E);    }    // 0x0E

//void Lcd4_Shift_Left()                      {   Lcd4_Cmd(0x01); Lcd4_Cmd(0x08); }   //  0x18

//void Lcd4_Shift_Right()                     {   Lcd4_Cmd(0x01); Lcd4_Cmd(0x0C); }   //  0x1C

 

 

Next Topic

Embedded Interface 7 Segment (Add Soon)
Embedded Interface ADC (Add Soon)
Embedded Interface Button (Add Soon)
Embedded Interface EEPROM (Add Soon)
Embedded Interface LCD (Add Soon)
Embedded Interface LCD HD44780 (Add Soon)
Embedded Interface LED
Embedded Interface MCP23017
Embedded Interface Motor (Add Soon)
Embedded Interface PCF8574 and PCF8574A
Embedded Interface RTC (Add Soon)
Embedded Interface Switch
Embedded Interface Touch Kypad
Embedded Interface RGB LED (Add Soon)

Embedded Protocol – UART

UART (Universal Asynchronous Receiver/Transmitter) is a standard communication protocol used for serial communication between devices. It’s commonly employed in embedded systems for communication between microcontrollers, sensors, and other peripheral devices.

In the context of embedded systems, UART is often used as a hardware communication protocol, enabling devices to transmit and receive data serially. The UART communication involves two pins: TX (transmit) and RX (receive).

  • It’s is full-duplex communication
  • UART contains a shift register
  • which is the fundamental method of conversion between serial and parallel forms.

  • Type of Communication: Asynchronous (No clock).
  • Rule: The transmitter and receiver should same baud rate. Data format and transmission speed are configurable.
  • UART Uses serial communication over a computer or peripheral device serial port. (Electronics Devices).
Read more… →

Embedded Protocol – SPI Communication

SPI is an abbreviation for Serial Peripheral Interface, which stands for Synchronous Serial Communication Interface. It is utilized for short-distance communication and was developed by Motorola in 1980, later becoming a de facto standard. SPI communication operates in full-duplex mode. It is also sometimes referred to as the Four-Wire Serial Bus (FWSB), distinguishing it from Three, Two, and One Wire Serial Bus protocols. The four-wire protocol includes SCL, SS, MISO, and MOSI. SPI operates as a single master protocol.

Read more… →

Embedded Protocol – MQTT

Message Queue Telemetry Transport (ISO/IEC PRF 20922), or MQTT, is a lightweight protocol designed for machine-to-machine (M2M) device communication using a Publish/Subscribe pattern. It was developed by Message Queue Telemetry Transport (ISO/IEC PRF 20922) and Lightweight protocol for (M2M) device communication using  Publish/Subscribe. It was Developed By  Andy Stanford-Clark (IBM) and Arlen Nipper (Eurotech; now Cirrus Link) in 1999. Unlike HTTP, which follows a request/response paradigm, It utilizes a publish/subscribe architecture. The central communication point in It is the Broker. It is available for implementation in C, C++, JavaScript, Lua, Python, and soon in C#.


Client functions

FieldDescription
HostAddress of the MQTT broker.
PortDefault: 1883.
ClientIDUnique client identifier.
UsernameUTF-8 encoded string for authentication.
PasswordClient’s password if flag set.
Keep AliveDuration client stays connected (seconds).
SSLIndicates SSL/TLS encryption usage.
Clean SessionIf set, session clears subscriptions and messages.
Last-will TopicTopic for “Last Will” message on disconnect.
Last-will QoSQuality of Service for “Last Will”.
Last-will RetainRetain status for “Last Will” message.
Last-will MessageContent of “Last Will” in case of disconnection.
TopicMessage destination hierarchy.
+ Plush signSingle-level wildcard in subscriptions.
# Hash SignMultilevel wildcard in subscriptions.
Publish QoSQuality of Service levels:
QoS(0) – At most once
QoS(1) – At least once
QoS(2) – Exactly once
RetainMessage retention by broker.
SubscriptionsList of subscribed topics.
MessagePayload data transmitted.
BrokerServer distributing messages.
ClientDevice or app connected to broker.
Quality of ServiceMessage delivery guarantee.
Retained MessagesBroker-stored messages for new subscribers.
Persistent SessionBroker-maintained session after client disconnects.
Last will and Testament and SYS topicClient’s “Last Will” message and system topics interaction.

PHP MQTT


Web Apps


WordPress Plugin

DIOT SCADA with MQTT By Ecava

Image Source

DIOT which stands for Decoupled IOT, has its SCADA functionalities decoupled into Host and Node for flexibility and scalability that catered for IoT era. This plugin functions as the SCADA Host to work with your device or system, which will be treated as SCADA Node. You just need to enter the broker/server into the configuration. You may then subscribe to the desired topic with a shortcode to display in any desired web page or post. [diot topic="building/floor/device/sensor"] Or, if you have a JSON content, you may add dollar sign as JSON root: [diot topic="building/floor/device/sensor$json.data"]. The content will be updated dynamically when the device publish any data. You may also choose to display your realtime data in trending chart. Check out Ecava DIOT online demo to see how easy things can be done now! For more see here : https://wordpress.org/plugins/ecava-diot-scada/

Image Source

WP-MQTT By Roy Tanck

Setting up Tthis is easy. Simply supply your MQTT broker’s details and configure which WordPress events should trigger messages. “MQTT is a machine-to-machine (M2M)/”Internet of Things” connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport.” (from mqtt.org) A number of events are predefined. Simply check the right checkbox and fill in the message’s subject and text.

  • Pageview
  • User login
  • Failed user login
  • Post published
  • Page published
  • New comment

Other events can be added using the “custom events” section. This allows you to use any WordPress hook (actions and filters) to trigger messages.

Image Source


Android App

Check this below name in Play-store

  • Dashboard
  • IOT Manager
  • IOT

Broker Service Supporter

The following list of brokers may be used online or locally also giving free and paid service

Adafruit IO (Online – Free)

  • Website : Adafruit IO
  • Adafruit supporting online free service.
  • You can use adafruit client libraries to Python, Node JS, Rubby and Arduino. see the client libraries section).
  • The following details are to connect a client to Adafruit IO.
    • Host : io.adafruit.com
    • Port : 1883 or 8883
    • Username : Your adafruit account username
    • Password : Your adafruit IO Key

CloudMQTT (Online -Free and Paid)

  • Website :
  • CloudMQTT
  • Online – Free Plans : Cute Cat and
  • Paid Plans : Keen Kola, Loud Leopard, Power Pug)
  • Using Amazon Web Service
  • Type : mosquitto

HiveMQ (Online -Free and Paid)

Connect to Public Broker

  • Dashboard
    • Broker: broker.hivemq.com
    • TCP Port: 1883
    • Websocket Port: 8000
  • Web socket Client : http://www.hivemq.com/demos/websocket-client/
    • Broker: broker.mqttdashboard.com
    • TCP Port: 1883
    • Websocket Port: 8000

Setup local instance

m2m

Free public broker service

  • q.m2m.io
    • Broker: q.m2m.io
    • Port: 1883.
    • Application : Facebook messenger

Mosquitto  (Local and Online free)

Eclipse Mosquitto™ is an open source v3.1/v3.1.1 Broker.

Free public Service

  • iot.eclipse.org
    • Broker: iot.eclipse.org
    • Port: 1883, 80(WebScoket), 443 (WebSockets+SSl)
  • mosquitto
    • Broker : test.mosquitto.org
    • Port:
      • 1883 : MQTT, unencrypted
      • 8883 : MQTT, encrypted
      • 8884 : MQTT, encrypted, client certificate required
      • 8080 : MQTT over WebSockets, unencrypted
      • 8081 : MQTT over WebSockets, encrypted
      • 80(WebScoket), 443 (WebSockets+SSl)

rabbitMQ

  • https://www.rabbitmq.com/
  • Install on windows

Free public broker service

  • dev.rabbitmq.com
    • Broker: dev.rabbitmq.com
    • Port: 1883,

SimpleML

  • Free MQTT service to evaluate Machine Learning models, documentation

Free public broker service

  • simpleml
    • Broker: mqtt.simpleml.com
    • Port : 1883 (MQTT), 8883 (MQTT +SSl), 80(REST), 80(WebSockets), 5683 (CoAP)

Other free public broker service

  • dioty.co
    • Broker : dioty
    • Port : 1883 (MQTT), 8883 (MQTT +SSl), 80(REST), 8080(WebSockets), 8880 (WebSocket +SSL)
  • swifitch.cz
    • Broker :mqtt.swifitch.cz
    • Port : 1883 (MQTT)

Interview Questions


Reference


Embedded Protocol – COAP

COAP, or Constrained Application Protocol, a specialized web transfer protocol, is designed for constrained devices and low-power, low-bandwidth networks commonly found in Internet of Things (IoT) and Machine-to-Machine (M2M) applications. CoAP is an application layer protocol similar to HTTP but optimized for constrained environments.

Read more: Embedded Protocol – COAP

This, designed to be simple and lightweight, is ideal for resource-constrained devices, operating over UDP instead of TCP to reduce complexity. It supports request/response interactions like HTTP and offers features such as multicast support and resource discovery. CoAP facilitates efficient communication between constrained devices and web servers, fostering the development of scalable IoT solutions.

Getting Started with Terminal by Br@y tool

  • Terminal is a simple serial port(COM) terminal emulation program
  • Used for communication with different devices (Modem, routers, embedded uC systems, GSM Phones. GPS Modules)
  • Very useful debugging tool for serial communication applications
Read more… →

Embedded Protocol – I2C

 I²C (Inter-Integrated Circuit) is a bi-directional two wires and serial data transmission communication protocol developed by  Philips (Now NXP Semiconductor) in 1982. I2C is a Half-duplex communication protocol  – (I2c can’t send and receive same time in the bus-data line). Multi-master can communicate with multi-salve. (Note: Communication is restricted between two masters; however, a single master can communicate with either a single slave or multiple slaves.) I2C is a Level Triggering. A device that sends data onto the bus is defined as a transmitter, and a device receiving data is defined as a receiver.

The bus must be controlled by a master device, responsible for generating the Start and Stop conditions. In contrast, certain devices such as LCDs, EEPROMs, and RTCs function as slaves. It’s important to note that both master and slave devices can operate as either transmitters or receivers. However, the master device plays a pivotal role in determining which mode is activated.

Read more… →

ESP32 Mongoose OS – Basic Examples

This article is about ESP32 Mongoose OS – Basic Examples, Let’s go through a basic example of using UART (Universal Asynchronous Receiver-Transmitter), Button and blinking an LED using an ESP32 by Mongoose OS.

Mongoose OS is an open-source IoT operating system designed for low-power, connected microcontrollers. Below is a basic example to get you started with Mongoose OS on an ESP32. This example demonstrates how to create a simple firmware that blinks an LED.

This is a basic example to help you get started with Mongoose OS on an ESP32. It blinks an LED using the GPIO capabilities provided by Mongoose OS. From here, you can explore additional features and libraries provided by Mongoose OS to build more sophisticated IoT applications. Refer to the Mongoose OS documentation for detailed information and advanced usage.

Setup Required

  • PC
  • UART Terminal (Putty, Visual Studio Serial Terminal, DockLight)
  • LEDs

UART Serial

Print words, string, text, symbols

print('------------****************----------------');
print('ArunEworld');

ESP32 Mongoose OS – Basic Examples of UART Communication

// https://github.com/cesanta/mongoose-os/blob/master/fw/examples/mjs_uart/init.js
// Load Mongoose OS API
load('api_timer.js');
load('api_uart.js');
load('api_sys.js');

// Uart number used for this example
let uartNo = 1;
// Accumulated Rx data, will be echoed back to Tx
let rxAcc = "";

let value = false;

// Configure UART at 115200 baud
UART.setConfig(uartNo, {
  baudRate: 115200,
  esp32: {
    gpio: {
      rx: 16,
      tx: 17,
    },
  },
});

// Set dispatcher callback, it will be called whenver new Rx data or space in
// the Tx buffer becomes available
UART.setDispatcher(uartNo, function(uartNo, ud) {
  let ra = UART.readAvail(uartNo);
  if (ra > 0) {
    // Received new data: print it immediately to the console, and also
    // accumulate in the "rxAcc" variable which will be echoed back to UART later
    let data = UART.read(uartNo);
    print("Received UART data:", data);
    rxAcc += data;
  }
}, null);

// Enable Rx
UART.setRxEnabled(uartNo, true);

// Send UART data every second
Timer.set(1000 /* milliseconds */, true /* repeat */, function() {
  value = !value;
  UART.write(
    uartNo,
    "Hello UART! "
      + (value ? 'Tick' : 'Tock')
      + " uptime: " + JSON.stringify(Sys.uptime())
      + " RAM: " + JSON.stringify(Sys.free_ram())
      + (rxAcc.length > 0 ? (" Rx: " + rxAcc) : "")
      + "\n"
  );
  rxAcc = "";
}, null);

GPIO Module

Read more… →

ESP32 ArduinoCore Interface – Wi-Fi

The ESP32 ArduinoCore interface for Wi-Fi provides a straightforward and flexible way to enable Wi-Fi connectivity in projects developed using the ESP32 microcontroller platform with the Arduino IDE. With this interface, developers can easily incorporate Wi-Fi functionality into their projects, enabling devices to connect to wireless networks, access the internet, and communicate with other devices over Wi-Fi.

Features and Capabilities

  1. Access Point (AP) Mode: The ESP32 can act as an access point, allowing other devices to connect to it and access resources or services hosted by the ESP32.
  2. Station (STA) Mode: The ESP32 can connect to existing Wi-Fi networks as a client, enabling devices to access the internet or communicate with other networked devices.
  3. Soft Access Point (SoftAP) Mode: This mode enables the ESP32 to simultaneously act as both an access point and a station, allowing it to connect to an existing Wi-Fi network while also providing Wi-Fi access to other devices.
  4. Wi-Fi Protected Setup (WPS): The ESP32 supports WPS, a method for easily configuring Wi-Fi network security settings without needing to enter a password manually.
  5. Advanced Configuration Options: The interface provides access to advanced configuration options for fine-tuning Wi-Fi settings, such as specifying static IP addresses, setting up captive portals, and configuring Wi-Fi sleep modes to optimize power consumption.
  6. Event Handling: Developers can implement event handlers to respond to Wi-Fi-related events, such as successful connections, disconnections, or errors, allowing for more robust and responsive Wi-Fi functionality.
  7. Security Features: The ESP32 ArduinoCore interface supports various Wi-Fi security protocols, including WPA and WPA2, to ensure secure communication over Wi-Fi networks.

Overall, the ESP32 ArduinoCore interface for Wi-Fi simplifies the process of adding Wi-Fi connectivity to ESP32-based projects, making it easier for developers to create IoT devices, home automation systems, and other wireless applications.

Scan WiFi

Note: You can use Arduino example code instead of the below code because both are the same  (File > Example > WiFi> WiFiScan)

/* https://aruneworld.com/embedded/espressif/esp32
 * Tested By  : Arun(20170429)
 * Example Name : AEW_WiFi_Scan.ino
 *  This sketch demonstrates how to scan WiFi networks.
 *  The API is almost the same as with the WiFi Shield library,
 *  the most obvious difference being the different file you need to include:
 */
#include "WiFi.h"

void setup()
{
    Serial.begin(115200);

    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    Serial.println("Setup done");
}

void loop()
{
    Serial.println("scan start");

    // WiFi.scanNetworks will return the number of networks found
    int n = WiFi.scanNetworks();
    Serial.println("scan done");
    if (n == 0) {
        Serial.println("no networks found");
    } else {
        Serial.print(n);
        Serial.println(" networks found");
        for (int i = 0; i < n; ++i) {
            // Print SSID and RSSI for each network found
            Serial.print(i + 1);
            Serial.print(": ");
            Serial.print(WiFi.SSID(i));
            Serial.print(" (");
            Serial.print(WiFi.RSSI(i));
            Serial.print(")");
            Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
            delay(10);
        }
    }
    Serial.println("");

    // Wait a bit before scanning again
    delay(5000);
}

Serial Terminal Output

scan start
scan done
5 networks found
1: ArunEworld (-34)*
2: Exuber_365 (-59)*
3: Bangalore Police (-66)*
4: Tagos-2.4 (-80)*
5: RRL_Internet (-93)*

Code Explanation

Certainly! Here’s the code with explanations provided as snippets:

#include "WiFi.h"

This line includes the WiFi library necessary for working with WiFi on the ESP32.

void setup()
{
    Serial.begin(115200);

    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    Serial.println("Setup done");
}

In the setup() function:

  • The code initializes serial communication at a baud rate of 115200.
  • The WiFi mode is set to station mode (WIFI_STA) and any previous connection is disconnected using WiFi.disconnect().
  • The code adds a delay of 100 milliseconds.
  • The code prints “Setup done” to the serial monitor.
void loop()
{
    Serial.println("scan start");

    int n = WiFi.scanNetworks();
    Serial.println("scan done");

    if (n == 0) {
        Serial.println("no networks found");
    } else {
        Serial.print(n);
        Serial.println(" networks found");
        for (int i = 0; i < n; ++i) {
            Serial.print(i + 1);
            Serial.print(": ");
            Serial.print(WiFi.SSID(i));
            Serial.print(" (");
            Serial.print(WiFi.RSSI(i));
            Serial.print(")");
            Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
            delay(10);
        }
    }

    Serial.println("");

    delay(5000);
}

In the loop() function:

  • The code begins by printing “scan start” to the serial monitor.
  • Next, the ESP32 scans for nearby WiFi networks using the WiFi.scanNetworks() function, storing the number of networks found in variable n.
  • After completing the scan, the code prints “scan done” to the serial monitor.
  • The code prints the number of networks found when it detects networks, followed by details of each network, including index, SSID (network name), RSSI (signal strength), and encryption type.
  • If no networks are found (when n == 0), the message “no networks found” is printed.
  • When networks are found, the code prints the number of networks found, followed by details of each network, including index, SSID (network name), RSSI (signal strength), and encryption type.
  • Finally, the code adds a delay of 5 seconds before initiating the next scan.

These snippets provide an overview of how the code initializes WiFi and continuously scans for nearby networks, printing details to the serial monitor.

ESP32 ArduinoCore Project – WiFi Web Server LED Blink

This article is a continuation of the series on the ESP32 ArduinoCore Project using the ESP32 Dev board and carries the discussion on WiFi Web Server LED Blink. This series aims to provide easy and practical examples that anyone can understand. In our previous tutorial, we saw how to use the inbuilt code to toggle the onboard LED. This is the ESP32 LED Blinky in Wifi Webserver In this tutorial

A simple web server that lets you blink an LED via the web.

Wifi Web Server Info

  • This code will print the IP address of your WiFi Module (ESP32) (once connected) to the Serial monitor.
  • From that IP Address, you can open that address in a web browser to turn on and off the LED on pin-5.
  • If the IP address of your ESP32 is 192.168.1.143:
    • http://192.168.1.143/H turns the LED on
    • http://192.168.1.143/L turns it off
  • This example is written for a network using WPA encryption.
  • For WEP or WPA, change the Wifi.begin() call accordingly.

Read more… →

ESP32 ArduinoCore Interface – Basic Example

When programming the ESP32 using the Arduino IDE, you typically use the ESP32 Arduino core, which provides a set of libraries and APIs to facilitate development. In this tutorial, we can discuss ESP32 ArduinoCore Interface Basic Example of Serial, GPIO, Timer, etc

Explore the fundamental features of the ESP32 microcontroller through an introductory example utilizing the ArduinoCore interface. This tutorial covers Serial communication, GPIO configuration for digital input and output, and Timer usage for precise timing operations. Ideal for beginners and hobbyists, this basic example demonstrates how to implement essential functionalities such as blinking an LED, reading button inputs, and handling timer interrupts, providing a solid foundation for further exploration and development with the ESP32 platform.”

Read more… →

ESP32 Lua-RTOS Module – PIO

The PIO (Programmable Input/Output) module in the ESP32 Lua-RTOS is a versatile feature that allows users to configure and control the GPIO pins of the ESP32 microcontroller dynamically. It provides an interface for performing various operations such as digital input, digital output, and pulse-width modulation (PWM) generation, among others.

Functionalities and Capabilities

  1. Digital Input/Output: The PIO module allows users to configure GPIO pins as digital inputs or outputs. Digital inputs can be used to read the state of external sensors or switches, while digital outputs can drive external devices such as LEDs, relays, or motors.
  2. Interrupt Handling: It supports interrupt handling on GPIO pins, allowing users to trigger actions based on changes in pin states. This feature is useful for implementing event-driven applications where real-time responses to external events are required.
  3. Pull-up/Pull-down Resistors: The PIO module enables users to enable or disable the internal pull-up or pull-down resistors on GPIO pins, ensuring stable and reliable signal readings.
  4. Pulse-Width Modulation (PWM): It provides support for generating PWM signals on GPIO pins, allowing users to control the intensity of analog devices such as LEDs, motors, or servos.
  5. Pin Configuration: Users can dynamically configure the functionality and characteristics of GPIO pins using the PIO module, including setting pin modes (input/output), configuring interrupt triggers, and adjusting PWM parameters.
  6. Low-Level Access: The PIO module offers low-level access to GPIO pins, allowing users to directly manipulate pin states and registers for advanced control and customization.
  7. Resource Management: It provides mechanisms for managing GPIO pin resources efficiently, preventing conflicts and ensuring proper allocation of resources across different tasks or modules.

Overall, the PIO module in the ESP32 Lua-RTOS enhances the flexibility and versatility of the ESP32 microcontroller, enabling users to implement a wide range of GPIO-based applications with ease and efficiency. Whether for simple digital I/O tasks or more complex PWM generation and interrupt handling, the PIO module offers powerful capabilities for interacting with external devices and sensors in Lua-RTOS projects.

Read more… →

ESP32 – Board Types

The ESP32 is a versatile microcontroller with a variety of development boards available. Different ESP32 various board types have different features, pin configurations, and capabilities.

When working with an ESP32 board, make sure to select the appropriate board type in the Arduino IDE or the other platform you are using. This ensures that the correct pin configurations and settings are applied during programming. The availability of features can vary between different boards, so it’s essential to choose a board that aligns with the requirements of your project.

Read more… →