... | ... | @@ -45,77 +45,31 @@ void initWiFi() { |
|
|
|
|
|
> Include this function in your code to connect your ESP with the WiFi. This function must be placed outside and above the `setup()` function.
|
|
|
|
|
|
// Setup WiFi To own Network // Send Data from ESP32 over MQTT to PC with Node-red // Wokwi
|
|
|
### Monitoring the Connection
|
|
|
|
|
|
# Self-Learning Make the ESP32 an IoT-Device
|
|
|
> During operation, fluctuations in the WiFi signal strength can cause the connection between the network and the ESP32 to drop. To handle this behavior, define a function `wifiCheckConnection()`:
|
|
|
|
|
|
**Goal** The goal of this section is to send data cyclically (every 1 second) from the ESP32 to a public MQTT broker. Additionally, we aim to subscribe to the sent data packet from your PC and visualize it.
|
|
|
|
|
|
## Establishing WiFi Connection with the ESP32
|
|
|
|
|
|
There are numerous libraries available that help quickly establish a connection to your router. To develop a consistent solution during the workshop, we will use a specific library. The ESP32 has a built-in WiFi antenna. Using the WiFi.h library, a WiFi connection can be established in a few steps.
|
|
|
|
|
|
## Define your WiFi-Network
|
|
|
|
|
|
```C++
|
|
|
#include <WiFi.h>
|
|
|
|
|
|
const char *SSID = "BaristaBandwidth"; //This is the name of Your Router
|
|
|
const char *PWD = "oneEspressoPLEASE"; //This is the password of Your WiFi-Network
|
|
|
|
|
|
TimeHandle_t wifiReconnectTimer; //Never mind!
|
|
|
```
|
|
|
|
|
|
- The `SSID` refers to the name of the WiFi network you want to connect your ESP32 to.
|
|
|
- `PWD` is the password for the WiFi network.
|
|
|
|
|
|
> :bulb: :exclamation: By convention, CONSTANTS are written in uppercase letters.
|
|
|
|
|
|
## Connection with WiFi.begin()
|
|
|
|
|
|
To keep the code more organized, a function `wifiConnect()` is defined:
|
|
|
|
|
|
```C++
|
|
|
void initWiFi() {
|
|
|
WiFi.mode(WIFI_STA);
|
|
|
WiFi.begin(ssid, password);
|
|
|
Serial.print("Connecting to WiFi ..");
|
|
|
while (WiFi.status() != WL_CONNECTED) {
|
|
|
Serial.print('.');
|
|
|
delay(1000);
|
|
|
}
|
|
|
Serial.println(WiFi.localIP());
|
|
|
}
|
|
|
```
|
|
|
|
|
|
> :exclamation: :books: Include this function in your code to connect your ESP with the WiFi. This function must be placed outside and above the 'setup()' function
|
|
|
|
|
|
> :books: Rufen Sie diese Funktion `wifiConnect()` in der `setup()` Ihres Programmcodes auf! For the output to work on the serial monitor, you must also call the function `Serial.begin(115200)` in the `setup()`.
|
|
|
|
|
|
---
|
|
|
|
|
|
## Monitoring the Connection
|
|
|
|
|
|
During operation, fluctuations in the WiFi signal strength can cause the connection between the network and the ESP32 to drop. To handle this behavior, define a function wifiCheckConnection()
|
|
|
|
|
|
```C++
|
|
|
void wifiCheckConnection() {
|
|
|
if (WiFi.status() != WL_CONNECTED) {
|
|
|
wifiConnect();
|
|
|
}
|
|
|
yield(); //
|
|
|
yield();
|
|
|
}
|
|
|
```
|
|
|
|
|
|
## Complete Code
|
|
|
> With these code snippets we are able to establish a Wifi-Connection.
|
|
|
>
|
|
|
> :bulb:In out wokwi Simulation we have to change a few minor lines of Code to get the code running! But in the following Code we provide you a sample which will run for the real Hardware, which you can use as an template for other projects.
|
|
|
|
|
|
```C++
|
|
|
### Code-WiFi-Real ESP32
|
|
|
|
|
|
```
|
|
|
#include <WiFi.h>
|
|
|
|
|
|
const char* SSID = "iaAM_Manualworkstation_1";
|
|
|
const char* PWD = "iaAM_Manualworkstation_1_pw";
|
|
|
const char* SSID = "YourNetworkName"; //WIFI-name
|
|
|
const char* PWD = "YourNetworkPassword"; //WIFI-PWD
|
|
|
|
|
|
const unsigned long RECON_INTERVAL = 5000;
|
|
|
|
|
|
void wifiConnect() {
|
|
|
WiFi.begin(SSID, PWD);
|
... | ... | @@ -140,39 +94,42 @@ void wifiCheckConnection() { |
|
|
}
|
|
|
|
|
|
void setup() {
|
|
|
// put your setup code here, to run once:
|
|
|
Serial.begin(115200);
|
|
|
wifiConnect();
|
|
|
Serial.println("Hello, ESP32!");
|
|
|
}
|
|
|
|
|
|
void loop() {
|
|
|
// put your main code here, to run repeatedly:
|
|
|
wifiCheckConnection(); // Check connection status and reconnect if necessary
|
|
|
delay(10000); // Adjust delay as needed
|
|
|
}
|
|
|
```
|
|
|
|
|
|
This is one way to set up your WiFi connection. There are several ways to make your ESP an IoT device. If your simulated ESP32 is not connecting to the WiFi, you might be facing specific circumstances while using Wokwi. The simulation environment provides you with an access point (SSID and PWD) and can only connect to the internet via this AP if your PC has internet access. You can have a look into the documentation or simply replace one line of code:
|
|
|
### Simulation with WokiWi
|
|
|
|
|
|
> This is one way to set up your WiFi connection. There are several ways to make your ESP an IoT device. If your simulated ESP32 is not connecting to the WiFi, you might be facing specific circumstances while using Wokwi. The simulation environment provides you with an access point (SSID and PWD) and can only connect to the internet via this AP if your PC has internet access. You can look into the documentation or simply replace one line of code:
|
|
|
|
|
|
```C++
|
|
|
```
|
|
|
WiFi.begin("Wokwi-GUEST", "", 6);
|
|
|
//OR Change your Declaration
|
|
|
const char* SSID = "Wokwi-GUEST";
|
|
|
const char* PWD = "";
|
|
|
WiFi.begin(SSID,PWD,6);
|
|
|
```
|
|
|
|
|
|
> Now you should have an simulated ESP32 with established Wifi-Connection.
|
|
|
|
|
|
# Communication via MQTT
|
|
|
> Now your simulated ESP32 should have an established WiFi Connection. So run the script via pressing the Play-Button and check the Serial Monitor. It should show you the prompt: "Connected to Wokiw-GUEST" and the IP-Address.
|
|
|
|
|
|
In an industrial context, the MQTT protocol is often used for communication between entities. It allows for cleanly structured and efficiently distributed messages. If you are unfamiliar with MQTT, you can review some basics on our fundamentals page. At a minimum, you should understand the basic procedures and differences compared to, for example, REST, to comprehend the advantages of MQTT in practice. // Link zum MQTT-Page
|
|
|
### Communication via MQTT
|
|
|
|
|
|
# JSON
|
|
|
> In an industrial context, the MQTT protocol is often used for communication between entities. It allows for cleanly structured and efficiently distributed messages. If you are unfamiliar with MQTT, you can review some basics on our [fundamentals page](#). At a minimum, you should understand the basic procedures and differences compared to, for example, REST, to comprehend the advantages of MQTT in practice.
|
|
|
|
|
|
JSON is a format for representing data in a readable and easily understandable way, using an object-based structure.
|
|
|
### Data format as JSON-Object
|
|
|
|
|
|
:pushpin: Beispiel:
|
|
|
> JSON is a format for representing data in a readable and easily understandable way, using an object-based structure.
|
|
|
|
|
|
```JSON
|
|
|
{"fruitBasket": {
|
|
|
```
|
|
|
{
|
|
|
"fruitBasket": {
|
|
|
"name": "Victor",
|
|
|
"material": "PVC",
|
|
|
"emptyWeight": 200,
|
... | ... | @@ -184,126 +141,105 @@ JSON is a format for representing data in a readable and easily understandable w |
|
|
"isPoisonous": false
|
|
|
}
|
|
|
}
|
|
|
}}
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
> :bulb: The fruit basket named Victor is made of PVC and has an empty weight of 200 grams. The fruit basket Victor contains an apple, which has attributes such as weight, color, and isPoisonous, each with respective values.
|
|
|
|
|
|
This format allows users to bundle and transmit a certain amount of data in an organized and packaged manner.
|
|
|
|
|
|
## ArduinoJSON
|
|
|
|
|
|
ArduinoJson is a library that brings the JSON format to the Arduino level. With this library, we can easily define JSON objects in our code and prepare them for publishing data packets over MQTT. This enables us to distribute data in the cloud, turning our ESP32 into an IoT data source.
|
|
|
> :bulb: The fruit basket named Victor is made of PVC and has an empty weight of 200 grams. The fruit basket Victor contains an apple, which has attributes such as weight, color, and isPoisonous, each with respective values. This format allows users to bundle and transmit a certain amount of data in an organized and packaged manner.
|
|
|
|
|
|
## Implementing an Asynchronous MQTT Connection to a Public MQTT Broker
|
|
|
### Library for JSON
|
|
|
|
|
|
In most cases, we have a bidirectional data connection with our ESP32. It should not only send data to the cloud but also be able to react to incoming message packets. Therefore, we use an asynchronous MQTT library in 99% of cases. This library provides functions that are called whenever a new message appears on the subscribed topic. This structure requires a few minor changes to our existing code and the programmed WiFi structure.
|
|
|
> ArduinoJson is a library that brings the JSON format to the Arduino level. With this library, we can easily define JSON objects in our code and prepare them for publishing data packets over MQTT. This enables us to distribute data in the cloud, turning our ESP32 into an IoT data source.
|
|
|
|
|
|
To demonstrate how quickly and easily the ESP32 can connect to WiFi, we previously discussed a simplified WiFi program. Now, we will adapt this and test the communication using dummy data and a public broker. The MQTT broker can also be installed and started on a local PC, provided it is accessible over the network.
|
|
|
### Implementing the MQTT-Connection
|
|
|
|
|
|
## Adapting the Code
|
|
|
> Due to our simulation environment we going to use the PubSubClient Library, which is accessable in the wokwi-library-Manager
|
|
|
>
|
|
|
> Additionaly we are adding a function to build our Data-Object. Try to test the following Code and understand the System-Architecture und flow. Hint: chatgpt can help you with that.
|
|
|
>
|
|
|
> Hint: Add the neccessary Libraries in your simulation-project via the library-manager
|
|
|
|
|
|
```C++
|
|
|
```
|
|
|
#include <Arduino.h>
|
|
|
#include <ArduinoJson.h>
|
|
|
#include <AsyncMqttClient.h>
|
|
|
#include "WiFi.h"
|
|
|
#include <PubSubClient.h>
|
|
|
#include <WiFi.h>
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
// WIFI
|
|
|
//-------------------------------------------------------------------------
|
|
|
#define WIFI_SSID "Wokwi-GUEST"
|
|
|
#define WIFI_PASSWORD ""
|
|
|
TimerHandle_t wifiReconnectTimer;
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
// MQTT
|
|
|
//-------------------------------------------------------------------------
|
|
|
#define MQTT_HOST "test.mosquitto.org"
|
|
|
#define MQTT_PORT 1883
|
|
|
const char* ID = "ThisisMyVisibleonBroker";
|
|
|
TimerHandle_t mqttReconnectTimer;
|
|
|
AsyncMqttClient mqttClient;
|
|
|
|
|
|
// Create WiFi and PubSubClient objects
|
|
|
WiFiClient wifiClient;
|
|
|
PubSubClient mqttClient(wifiClient);
|
|
|
|
|
|
unsigned long previousMillis = 0;
|
|
|
const long interval = 1000; // 1 second interval
|
|
|
|
|
|
void connectToWifi() {
|
|
|
Serial.println("Connecting to Wi-Fi...");
|
|
|
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
|
|
while (WiFi.status() != WL_CONNECTED) {
|
|
|
delay(500);
|
|
|
Serial.print(".");
|
|
|
}
|
|
|
void connectToMqtt(){
|
|
|
mqttClient.connect();
|
|
|
Serial.println();
|
|
|
Serial.print("Connected to Wi-Fi with IP: ");
|
|
|
Serial.println(WiFi.localIP());
|
|
|
}
|
|
|
|
|
|
void onMqttConnect(bool sessionPresent) {
|
|
|
Serial.println("Connected to MQTT.");
|
|
|
//uint16_t packetIdSub = mqttClient.subscribe("test/lol", 2);
|
|
|
void connectToMqtt() {
|
|
|
while (!mqttClient.connected()) {
|
|
|
Serial.println("Connecting to MQTT...");
|
|
|
if (mqttClient.connect(ID)) {
|
|
|
Serial.println("Connected to MQTT");
|
|
|
} else {
|
|
|
Serial.print("Failed to connect to MQTT, state: ");
|
|
|
Serial.println(mqttClient.state());
|
|
|
delay(2000);
|
|
|
}
|
|
|
|
|
|
void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
|
|
|
Serial.println("Disconnected from MQTT.");
|
|
|
|
|
|
if (WiFi.isConnected()) {
|
|
|
xTimerStart(mqttReconnectTimer, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void onMqttSubscribe(uint16_t packetId, uint8_t qos) {
|
|
|
Serial.println("Subscribe acknowledged.");
|
|
|
Serial.print(" packetId: ");
|
|
|
Serial.println(packetId);
|
|
|
Serial.print(" qos: ");
|
|
|
Serial.println(qos);
|
|
|
}
|
|
|
void setup() {
|
|
|
Serial.begin(115200);
|
|
|
|
|
|
void onMqttUnsubscribe(uint16_t packetId) {
|
|
|
Serial.println("Unsubscribe acknowledged.");
|
|
|
Serial.print(" packetId: ");
|
|
|
Serial.println(packetId);
|
|
|
}
|
|
|
// Setup MQTT server
|
|
|
mqttClient.setServer(MQTT_HOST, MQTT_PORT);
|
|
|
|
|
|
void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total) {
|
|
|
Serial.println("Publish received.");
|
|
|
Serial.print(" topic: ");
|
|
|
Serial.println(topic);
|
|
|
Serial.print(" qos: ");
|
|
|
Serial.println(properties.qos);
|
|
|
Serial.print(" dup: ");
|
|
|
Serial.println(properties.dup);
|
|
|
Serial.print(" retain: ");
|
|
|
Serial.println(properties.retain);
|
|
|
Serial.print(" len: ");
|
|
|
Serial.println(len);
|
|
|
Serial.print(" index: ");
|
|
|
Serial.println(index);
|
|
|
Serial.print(" total: ");
|
|
|
Serial.println(total);
|
|
|
}
|
|
|
// Connect to WiFi
|
|
|
connectToWifi();
|
|
|
|
|
|
void onMqttPublish(uint16_t packetId) {
|
|
|
Serial.println("Publish acknowledged.");
|
|
|
Serial.print(" packetId: ");
|
|
|
Serial.println(packetId);
|
|
|
// Connect to MQTT
|
|
|
connectToMqtt();
|
|
|
}
|
|
|
void connectToWifi() {
|
|
|
Serial.println("Connecting to Wi-Fi...");
|
|
|
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
|
|
|
|
|
void loop() {
|
|
|
// Ensure the client is connected
|
|
|
if (!mqttClient.connected()) {
|
|
|
connectToMqtt();
|
|
|
}
|
|
|
|
|
|
// Handle MQTT client loop
|
|
|
mqttClient.loop();
|
|
|
|
|
|
void WiFiEvent(WiFiEvent_t event) {
|
|
|
Serial.printf("[WiFi-event] event: %d\n", event);
|
|
|
switch(event) {
|
|
|
case SYSTEM_EVENT_STA_GOT_IP:
|
|
|
Serial.println("WiFi connected");
|
|
|
Serial.println("IP address: ");
|
|
|
Serial.println(WiFi.localIP());
|
|
|
connectToMqtt();
|
|
|
break;
|
|
|
case SYSTEM_EVENT_STA_DISCONNECTED:
|
|
|
Serial.println("WiFi lost connection");
|
|
|
xTimerStop(mqttReconnectTimer, 0); // ensure we don't reconnect to MQTT while reconnecting to Wi-Fi
|
|
|
xTimerStart(wifiReconnectTimer, 0);
|
|
|
break;
|
|
|
// Publish message every 1 second
|
|
|
unsigned long currentMillis = millis();
|
|
|
if (currentMillis - previousMillis >= interval) {
|
|
|
previousMillis = currentMillis;
|
|
|
publishMsgBasket();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
//Creating JSON-Object!
|
|
|
//-------------------------------------------------------------------------
|
|
|
String set_fruitbasketMsg() {
|
|
|
// Create a JSON document
|
|
|
StaticJsonDocument<200> jsonDoc;
|
... | ... | @@ -340,95 +276,6 @@ String set_fruitbasketMsg() { |
|
|
return jsonString;
|
|
|
}
|
|
|
|
|
|
void PublishMsgBasket(){
|
|
|
String msg;
|
|
|
msg = set_fruitbasketMsg();
|
|
|
String topic = "MYfancyTopic/Dummy/Data/Basket";
|
|
|
mqttClient.publish((char*)topic.c_str(),0,true,(char*)msg.c_str());
|
|
|
}
|
|
|
|
|
|
|
|
|
unsigned long previousMillis = 0;
|
|
|
const long interval = 1000; // 1 second interval
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
Serial.begin(115200);
|
|
|
mqttReconnectTimer = xTimerCreate("mqttTimer", pdMS_TO_TICKS(2000), pdFALSE, (void*)0, reinterpret_cast<TimerCallbackFunction_t>(connectToMqtt));
|
|
|
wifiReconnectTimer = xTimerCreate("wifiTimer", pdMS_TO_TICKS(2000), pdFALSE, (void*)0, reinterpret_cast<TimerCallbackFunction_t>(connectToWifi));
|
|
|
|
|
|
WiFi.onEvent(WiFiEvent);
|
|
|
|
|
|
mqttClient.onConnect(onMqttConnect);
|
|
|
mqttClient.onDisconnect(onMqttDisconnect);
|
|
|
mqttClient.onSubscribe(onMqttSubscribe);
|
|
|
mqttClient.onUnsubscribe(onMqttUnsubscribe);
|
|
|
mqttClient.onMessage(onMqttMessage);
|
|
|
mqttClient.onPublish(onMqttPublish);
|
|
|
mqttClient.setServer(MQTT_HOST, MQTT_PORT);
|
|
|
|
|
|
connectToWifi();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
void loop(){
|
|
|
unsigned long currentMillis = millis();
|
|
|
if (currentMillis - previousMillis >= interval) {
|
|
|
previousMillis = currentMillis;
|
|
|
publishMsgBasket();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
Maybe you have to include ArdionoJson.h to your Library in wokwi.
|
|
|
|
|
|
Go to Library Manager-\> press the + button -\> type "ArduinoJson" and add it.
|
|
|
|
|
|
You will Probaly get an error Msg for the AsyncMqttClient library. Without the premium version of wokwi we have to include a similiar library.
|
|
|
|
|
|
Go to Library Manager-\> press the + button -\> type "PubSubClient" and add it.
|
|
|
|
|
|
Now that we use a different library we need some adjustments!
|
|
|
|
|
|
So we will review the code together:
|
|
|
|
|
|
1. WIFI and MQTT Setup
|
|
|
|
|
|
```
|
|
|
#include <WiFi.h> #include <PubSubClient.h>WiFiClient wifiClient; PubSubClient mqttClient(wifiClient);
|
|
|
```
|
|
|
|
|
|
```
|
|
|
void connectToWifi() { Serial.println("Connecting to Wi-Fi..."); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(); Serial.print("Connected to Wi-Fi with IP: "); Serial.println(WiFi.localIP()); }void connectToMqtt() { while (!mqttClient.connected()) { Serial.println("Connecting to MQTT..."); if (mqttClient.connect(ID)) { Serial.println("Connected to MQTT"); } else { Serial.print("Failed to connect to MQTT, state: "); Serial.println(mqttClient.state()); delay(2000); } } }
|
|
|
```
|
|
|
|
|
|
```
|
|
|
void setup() { Serial.begin(115200);// Setup MQTT server mqttClient.setServer(MQTT_HOST, MQTT_PORT);// Connect to WiFi connectToWifi();// Connect to MQTT connectToMqtt(); }
|
|
|
```
|
|
|
|
|
|
```
|
|
|
void loop() {
|
|
|
// Ensure the client is connected
|
|
|
if (!mqttClient.connected()) {
|
|
|
connectToMqtt();
|
|
|
}
|
|
|
|
|
|
// Handle MQTT client loop
|
|
|
mqttClient.loop();
|
|
|
|
|
|
// Publish message every 1 second
|
|
|
unsigned long currentMillis = millis();
|
|
|
if (currentMillis - previousMillis >= interval) {
|
|
|
previousMillis = currentMillis;
|
|
|
publishMsgBasket();
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
```
|
|
|
void publishMsgBasket() {
|
|
|
String msg = set_fruitbasketMsg();
|
|
|
String topic = "MYfancyTopic/Dummy/Data/Basket";
|
... | ... | @@ -436,50 +283,26 @@ void publishMsgBasket() { |
|
|
}
|
|
|
```
|
|
|
|
|
|
Now the ESP32 should send the data packet every 1000ms (1 second) to the MQTT broker via your router. To verify this, you can use sniffer tools to subscribe to the topic or even monitor the entire broker (i.e., all topics). Here, we will show you our favorite tool, which allows you to do many additional things.
|
|
|
|
|
|
### Verifying the MQTT Communication
|
|
|
|
|
|
There are various sniffer tools available that can be used to subscribe to a specific topic or even listen to all topics on the broker. We recommend using our preferred tool, Node-Red, which provides a wide range of functionalities and features for visualizing and managing your MQTT communications.
|
|
|
|
|
|
Node-Red can help you ensure that the data is being sent correctly and received as expected. It also allows you to create complex workflows and visualizations for your IoT data.
|
|
|
|
|
|
Make sure to explore Node-Red and other available tools to enhance your understanding and capability in handling MQTT communications effectively.
|
|
|
|
|
|
Node-Red
|
|
|
|
|
|
After the installation of Node-red we´re going to start the programm via the Commandline.
|
|
|
|
|
|
To Do that search for cmd on your pc and start the terminal.
|
|
|
|
|
|
Just enter node-red and hit enter.
|
|
|
|
|
|
After that node-red is running on your pc.
|
|
|
|
|
|
Now go to your browser enter [localhost:1880](http://localhost:1880) and hit enter.
|
|
|
|
|
|
Now your ready to Evaluate your ESP32 DSataCommunication.
|
|
|
|
|
|
On the left side you should see the Dropdownmenu network. Inside of it the should be an mqtt in Block.
|
|
|
|
|
|
Drag and drop it on your emtpy flowpanel.
|
|
|
|
|
|
Now we gonna configure the broker and topic we want to subscribe to.
|
|
|
|
|
|
Server: test.mosquitto.org Port: 1883 Protocoll MQTT V3.1.1
|
|
|
|
|
|
Now add a debug-Node und Connect the to blocks.
|
|
|
|
|
|
After that you can deploy your flow and check the Communication.
|
|
|
> Now the ESP32 should send the data packet every 1000ms (1 second) to the MQTT broker via your router. To verify this, you can use sniffer tools to subscribe to the topic or even monitor the entire broker (i.e., all topics). Here, we will show you our favorite tool, which allows you to do many additional things in an userfriendly No-Code/Low-Code Environment!
|
|
|
|
|
|
We now build an esp32 DataSource for getting data to the cloud. This should be a basic implementation we can use in our pratical Session. If you have not a single glue what happend in manner of systemarchitecture und embedded System programming. Use our tutorial parse it chatgpt and request a detailed explanation. In our Experience in the last couple of years this can really help unterstanding this kind of Projects without any previous knowledge.
|
|
|
### Node-Red
|
|
|
|
|
|
We are now a point you should got deep enough into out IoT-World to handle low-Cost Data Aquisitoin.
|
|
|
> After the installation of Node-Red, start the program via the Command Line Interface (CLI). To do this, search for "cmd" on your PC and start the terminal. Enter `node-red` and hit enter. After that, Node-Red is running on your PC. Now go to your browser, enter `localhost:1880`, and hit enter. Now you are ready to evaluate your ESP32 data communication.
|
|
|
|
|
|
Everything else will be done in the practical session. Nevertheless at the end of the virtual course we gonna provide you the Task for out summerschool. Of Course you can explore additoinal neccessary programing on your own if you dont feel comforable.
|
|
|
### Steps in Node-Red
|
|
|
|
|
|
Practise in Programming is always the key. Maybe you wanna add some ledstrips or displays or button to your now developed simulation.
|
|
|
> * On the left side, you should see the dropdown menu "network." Inside it, there should be an "mqtt in" block. Drag and drop it onto your empty flow panel.
|
|
|
> * Configure the broker and topic you want to subscribe to:
|
|
|
> * Server: `test.mosquitto.org`
|
|
|
> * Port: `1883`
|
|
|
> * Protocol: `MQTT V3.1.1`
|
|
|
> * Add a debug node and connect the two blocks.
|
|
|
> * Deploy your flow and check the communication.
|
|
|
>
|
|
|
> We have now built an ESP32 data source for sending data to the cloud. This should be a basic implementation we can use in our practical session. If you do not fully understand the system architecture and embedded system programming, use our tutorial and parse it with ChatGPT to request a detailed explanation. In our experience over the last couple of years, this can really help understand this kind of project without any previous knowledge.
|
|
|
>
|
|
|
> We are now at a point where you should have a deep enough understanding of our IoT-World to handle low-cost data acquisition. Everything else will be done in the practical session. Nevertheless, at the end of the virtual course, we will provide you with the task for our summer school. Of course, you can explore additional necessary programming on your own if you do not feel comfortable. Practice in programming is always the key. Maybe you want to add some LED strips, displays, or buttons to your now developed simulation.
|
|
|
|
|
|
Another Part is the DeepLearning Topic.
|
|
|
### Next Part: Deep Learning
|
|
|
|
|
|
Link DeepLearning |
|
|
\ No newline at end of file |
|
|
> Explore the topics of Deep-Learning here. |
|
|
\ No newline at end of file |