Jump to content
Electronics-Lab.com Community

Search the Community

Showing results for tags 'home automation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Electronics Forums
    • Projects Q/A
    • Datasheet/Parts requests
    • Electronic Projects Design/Ideas
    • Power Electronics
    • Service Manuals
    • Theory articles
    • Electronics chit chat
    • Microelectronics
    • Electronic Resources
  • Related to Electronics
    • Spice Simulation - PCB design
    • Inventive/New Ideas
    • Mechanical constructions/Hardware
    • Sell/Buy electronics - Job offer/requests
    • Components trade
    • High Voltage Stuff
    • Electronic Gadgets
  • General
    • Announcements
    • Feedback/Comments
    • General
  • Salvage Area

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Yahoo


Skype


Location


Interests

Found 7 results

  1. Had some time this weekend and a desire to create something new and interesting, so went ahead and created an Arduino/NodeMCU based indoor dial thermometer. This device displays the temperature in degree centigrade on a D-Shaped Gauge as well as on a 7-Segment display. In addition to that, it also saves the temperature and humidity readings in a MySQL DataBase hosted on a home based Raspberry Pi Server. The data is then displayed using the "Our Smart Home" app. Awards This project got featured on Cults3D and Instructables https://cults3d.com/en/3d-model/gadget/arduino-based-indoor-dial-thermometer https://www.instructables.com/NodeMCU-Based-3D-Printed-Indoor-Gauge-Thermometer/ Components Required For this project we need: 2 x TM1637 Display Modules 1 x DHT22 or DHT11 Module 1 x NodeMCU Microcontroller 1 x 28BYJ-48 Stepper Motor with ULN2003 Driver Board 1 x 10K Resistor A 3D Printer Copper Wire and Some Nuts & Bolts Circuit Diagram The circuit is very simple. Connect the ULN2003 driver board’s IN1, IN2, IN3 and IN4 to the NodeMCUs digital pins D0, D1, D2 and D3. Then connect the OUT Pin of the DHT22 to the D5 Pin of NodeMCU. After that connect the 2 x Display Modules to the microcontroller. We are going to use a Common Clock Pin D4 for both modules. Then connect the DIO of one of the modules to D6 (TEMP) and the other one to D7 (HUM) pins on the NodeMCU. Important: Please avoid using the boot config pins D3, D4, D8 and the RTC pin D0 for the displays. Now, on the D8 Pin we are going to connect the switch. This switch has a very important role in this circuit. This switch acts as the 'home' or the 'starting point' of the stepper motor. When the switch is open Pin D8 is connected to GND through the pull-down resistor and we read a LOW. When the switch is closed, Pin D8 connects to 3.3v pin of NodeMCU and we read a HIGH. When the 'temperature changes' or the 'device boots up', the pointer starts moving 'counterclockwise'. As soon as the pointer hits the home position, Pin D8 reads HIGH and the logic moves the pointer 'clockwise' to display the temperature on the gauge as read by the DHT22 module. The Code The code starts by including all the necessary libraries. Then it defines all the variables needed for setting up the WiFi connection. Next, it assigns a static IP address to the ESP8266 (if you want to use DHCP then go ahead and delete these three lines from the code). After that, it sets up the 2 x URLs that are needed for updating the heartbeat, temperature and humidity. String URLUpdateStatus = "http://192.168.0.7/Arduino/Weather/UpdateStatus.php"; String URLUpdateTemp = "http://192.168.0.7/Arduino/Weather/UpdateTemperature.php"; Before going ahead let's have a quick look at the 2 php files. The "UpdateStutus.php" file uses an UPDATE query to update the timestamp of the device sending the request to the current epoch time and hence updating the heartbeat. <?PHP try { $Token = $_GET["Token"]; $Location = $_GET["Location"]; include "ConnectionStringArduino.php"; // Create connection $sql = 'Update `Status` SET `DateTime`=\''.time().'\',`State`=\'1\' WHERE `Device`=\''.$Location.'\' AND `Token` = \''.$Token.'\';'; $result = $con->query( $sql ); if($result === FALSE) { die(mysqli_error());} mysqli_close($con); } catch (Exception $e) {} ?> The "UpdateTemperature.php" uses an INSERT query to add a new row to the database with the current values of Temperature and Humidity. <?PHP try { $Location = $_GET["Location"]; $TEMP = $_GET["TEMP"]; $HUM = $_GET["HUM"]; include "ConnectionStringArduino.php"; // Create connection $sql = "INSERT INTO `Weather` (`DateTime`,`Temperature`,`Humidity`,`Location`) VALUES ('".time()."','".$TEMP."','".$HUM."','".$Location."');"; $result = $con->query( $sql ); if($result === FALSE) { die(mysqli_error());} mysqli_close($con); } catch (Exception $e) {} ?> This is what is written to the database and can be displayed using Google Charts, in my case, I am using the "Our Smart Home" app to display the data using php and JavaScript. Currently I am only displaying the data from the Study room and the Peg Box. To know more about my award winning "Peg Box" project please have a look at my electronics tutorial no. 34 "Peg Box with Temperature and Humidity Monitor using NodeMCU" (https://youtu.be/elH331NXPsU). After that, I am defining all the variables required for reading and storing the value of temperature and humidity. Next, I am defining all the variables and setting up any additional symbols required for displaying temperature and humidity on the TM1637 Display Module. After that, I am defining the D8 pin of the NodeMCU as the reset switch pin. We will talk about this in detail in the following sections. Next, I am setting up the Steps Per Revolution of the stepper motor as 2038 and then initializing the stepper library through pins D0 to D3. const int stepsPerRevolution = 2038; // Change this to fit the number of steps per revolution of your motor Stepper myStepper(stepsPerRevolution, D0, D2, D1, D3);// Initialize the stepper library on pins D0 through D3 One thing to note: since I need both clockwise and counterclockwise movements, I have to initialize the pins in the order shown on screen. Then in the setup() section, first I am setting up the WiFi connection and then sending a heartbeat to the server. Then I am setting up the brightness of the 7-Segments to their max values followed by starting the dht module and finally setting the pin-mode of the switch to INPUT. void setup() { Serial.begin(115200); // Initialize the serial port /*********** Setup a WiFi connection ***********/ if (WiFi.config(local_IP, gateway, subnet)) { Serial.println("Static IP Configured"); } else { Serial.println("Static IP Configuration Failed"); }; WiFi.mode(WIFI_STA); WiFi.begin(WIFI_SSID, WIFI_PWD); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }; Serial.println("\nWiFi connected"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); SendIamAlive(); // Send the initial wakeup message to the server /**********************************************/ display_TMP.setBrightness(7); // Set the display brightness (0-7) display_HUM.setBrightness(7); // Set the display brightness (0-7) dht.begin(); // Setup the DHT sensor pinMode(SWITCH, INPUT); // Declare the switch pin as input }; Now, in the loop() section I am reading the temperature using the Read_Temp() function and then sending the Temperature and Humidity values every 30 minutes and heartbeat every minute to the home server. void loop() { /** Read the temp and humidity info from ther sensor and display it on the 7-segmnet and Gauge **/ Read_Temp(); /** Sending Humidity and temperature every 30 minutes **/ if((millis() - lastTime) > timerDelay){ Serial.println("Sending Temp and Humidity");SendTemperatureAndHumidity(); lastTime = millis(); }; /** Sending I am alive message every minute **/ if((millis() - StatusCounter) > 60000){ Serial.println("Sending Heartbeat"); SendIamAlive(); StatusCounter = millis(); }; }; Next, you see the definition of the SendIamAlive() and SendTemperatureAndHumidity() functions which utilizes the WiFiConnect() function to send the values using the previously discussed URLs. The Read_Temp() function reads the temperature and humidity and updates the 7-Segment displays and moves the pointer only if there is a change in the values. The Move_Needle() function first sends the pointer to the home position using the Return_Home() function and then looks through and moves the pointer to the correct position until the stepCout is = STEPS. The value of STEPS is calculated based on the "stepsPerRevolution" which we previously set it up as 2038. So, 2038 / 2 (for half circle) = 1019 Now by dividing 1019 by 180 degrees we get the steps required to display each degree centigrade. Now to display each degree centigrade we need 180/60 = 3 divisions. Since our gauge starts from -10 and not 0 we also have to add the first 10 blocks which is (5.661 * 10 * 3) to our calculation. int STEPS = (5.661 * 3 * TEMP) + 169.833; // 5.661 (step resolution) * 3 (steps to display each °C) * TEMP + 169.833 (5.661 * 10 * 3) = since it starts from -10 and not 0) That's it as easy as that. 3D Designing Lets have a quick look at the 3D model of the project. At the front, we have The Pointer, D-Shaped Dial, and the Temperature Scale on the dial. Down at the bottom we have the Enclosure that will house the microcontroller and all other electronics components in it. The enclosure has a Lid to keep the electronic components safe and sound. At the back, we have a pocket to hold the DHT22 Module, 3 x holes for the stepper motor, 2 x groves for the TM1637 Display Module and 2 x L-Shaped Brackets to hold the top Dial to the bottom Enclosure. 3D Printing Once the 3D models were sorted, it was time for me to fire up my 3D printing oven and start printing these 3D models. I used: - 1.75mm Cold White PLA Filament, and printed the models with - 0.2mm - with 0% infill - and with support. As we all know, 3D printing is the process that uses computer-aided design or CAD, to create objects layer by layer. 3D printing is not a new technology, it's been there since the 1980's, when Charles W. Hull invented the process and created the first 3D-printed part. Since then, the field of 3D printing has grown exponentially and holds countless possibilities. The 3D printing process fascinates me a lot and I sometimes love to sit near my printer and watch these layers getting printed. The entire printing process took a little over 5 hours to complete and this is the final result. Alright now, let's start gluing all the printed parts. I first superglued the L-Shaped Brackets to the dial followed by the pocket that will hold the DHT22 module. Then, I went ahead and screwed the bottom enclosure to the top section via the L-Shaped Brackets. Breadboard Demo Before adding the electronic bits to the 3D printed bits, let's do a quick test to make sure everything works as expected. So, this 7-Segment display is displaying the temperature and the other one is displaying the humidity. The needle is currently going round and round in circles as it has no idea where to stop. To stop the needle, and to send it the correct position on the gauge, I need to connect this red jumper cable connected to 3.3v to the D8 Pin of the NodeMCU. Once I short the cable, the needle changes its direction and moves clockwise to display the temperature value read from the DHT22 module. The temperature and humidity values are also sent to the 'Home Server' which are then displayed using the "Our Smart Home" app. Coloring Using Acrylic colors, I painted all the 3D printed parts of the project. Assembling Once the coloring is done, its now time for me to put all the electronic components together. First I screwed the stepper motor to the back of the dial. Then, I gently pushed the DHT22 Module into its pocket at the back of the dial. Now the interesting bit. As per our previous discussion, we are going to use a copper wire as a switch that will move the pointer to its correct position. The copper wire will be fed through these two holes from the back and will loop through this small pipe like structure in the front. A small cut will be made on the top exposed side of the copper wire. Now on the pointer, we need to add a small piece of copper wire. When this copper bit touches the two copper wires on the pipe, it will complete the circuit and will send a HIGH to the system. Next, I am hot gluing the two TM1637 7-Segment Display Modules to the back of the dial. Once done, it's pretty much just a matter of soldering all the sensors to the NodeMCU as per our circuit diagram. Final Demo So, this is how my final setup looks like. Once the device is turned on, the pointer moves counterclockwise until it touches the copper wires that acts like a switch. Upon touching the wires the pointer moves clockwise to display the temperature value read from the DHT22 module on the D-Shaped Gauge. The temperature and humidity values are also displayed using 7-Segment Displays. The values are also sent over WiFi to a Raspberry Pi Home Server and stored in a MySQL database. Using google charts, you can display the data using various different graph options. In my case, I am using the "Our Smart Home" app to display the data using php and JavaScript. Thanks for watching, please comment and let me know if there are any scopes of improvement. Thanks Thanks again for checking my post. I hope it helps you. If you want to support me subscribe to my YouTube Channel: https://www.youtube.com/user/tarantula3 Video: Watch Full Blog Post: Visit Thermometer STLs: Download Peg Box: Watch How To Wire A Pushbutton: View Stepper Motor Specs: View Support My Work BTC: 1Hrr83W2zu2hmDcmYqZMhgPQ71oLj5b7v5 LTC: LPh69qxUqaHKYuFPJVJsNQjpBHWK7hZ9TZ DOGE: DEU2Wz3TK95119HMNZv2kpU7PkWbGNs9K3 ETH: 0xD64fb51C74E0206cB6702aB922C765c68B97dCD4 BAT: 0x9D9E77cA360b53cD89cc01dC37A5314C0113FFc3 LBC: bZ8ANEJFsd2MNFfpoxBhtFNPboh7PmD7M2 COS: bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23 Memo: 572187879 BNB: 0xD64fb51C74E0206cB6702aB922C765c68B97dCD4 MATIC: 0xD64fb51C74E0206cB6702aB922C765c68B97dCD4 Thanks, ca gain in my next tutorial.
  2. In this tutorial, you will learn how to create a web server with ESP32 that can control an LED from any device connected to the same WiFi network. You will use the Arduino IDE to program the ESP32 and the web browser to access the web server. What You Need To follow this tutorial, you need the following components: An ESP32 development board A USB cable to connect the ESP32 to the computer The Arduino IDE installed on your computer The ESP32 add-on for the Arduino IDE 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. Also, check out this useful blog on PCBWay Plugin for KiCad from here. Using this plugin, you can directly order PCBs in just one click after completing your design in KiCad. How It Works The ESP32 will act as a web server that can serve HTML and CSS files to web clients (such as web browsers or smartphones). The web page will have a button that can send an HTTP request to the ESP32 to turn the LED on or off. The ESP32 will also handle the HTTP requests from the web clients and respond accordingly. For example, if the ESP32 receives a request to turn the LED on, it will set the GPIO pin connected to the LED to HIGH and send back a confirmation message. ESP32 Code The code for the ESP32 is also straightforward. You need to include the WiFi.h and ESPAsyncWebServer.h libraries, which are used to connect the ESP32 to the WiFi network and to create the web server. You also need to define the WiFi credentials, the GPIO pin for the LED, and the web server object. Then, you need to create a function to generate the HTML and CSS code for the web page, which will have a button to toggle the LED state. Next, you need to create a function to connect the ESP32 to the WiFi network and print the IP address to the serial monitor. You also need to create a function to handle the HTTP requests from the web clients and change the LED state accordingly. Finally, you need to initialize the LED pin, the WiFi connection, and the web server in the setup() function, and keep the web server running in the loop() function. The complete code is shown below: #include <WiFi.h> #include <ESPAsyncWebServer.h> // WiFi credentials #define WIFI_SSID "Your WiFi SSID" #define WIFI_PASSWORD "Your WiFi Password" // LED pin #define LED_PIN // Web server object AsyncWebServer server(80); // LED state int LED_state = LOW; // Function to generate the HTML and CSS code for the web page String getHTML() { String html = "<!DOCTYPE HTML>"; html += "<html>"; html += "<head>"; html += "<style>"; html += "body {background-color: #F0F0F0; font-family: Arial, Helvetica, sans-serif;}"; html += "h1 {color: #333333; text-align: center;}"; html += "button {width: 150px; height: 50px; font-size: 20px; margin: 10px;}"; html += "</style>"; html += "</head>"; html += "<body>"; html += "<h1>ESP32 Web Server</h1>"; html += "<p>LED state: <span style='color: red;'>"; if (LED_state == LOW) html += "OFF"; else html += "ON"; html += "</span></p>"; html += "<button onclick=\"window.location.href='/led/on'\">Turn ON</button>"; html += "<button onclick=\"window.location.href='/led/off'\">Turn OFF</button>"; html += "</body>"; html += "</html>"; return html; } // Function to connect to WiFi network void connectWiFi() { Serial.print("Connecting to WiFi..."); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } // Function to handle HTTP requests void handleRequest(AsyncWebServerRequest *request) { // Get the request path String path = request->url(); // Check if the request is to turn the LED on if (path == "/led/on") { // Set the LED pin to HIGH digitalWrite(LED_PIN, HIGH); // Update the LED state LED_state = HIGH; // Send a confirmation message request->send(200, "text/plain", "LED turned on"); } // Check if the request is to turn the LED off else if (path == "/led/off") { // Set the LED pin to LOW digitalWrite(LED_PIN, LOW); // Update the LED state LED_state = LOW; // Send a confirmation message request->send(200, "text/plain", "LED turned off"); } // Otherwise, send the web page else { // Get the HTML and CSS code String html = getHTML(); // Send the web page request->send(200, "text/html", html); } } void setup() { // Initialize the serial monitor Serial.begin(115200); // Initialize the LED pin pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, LED_state); // Connect to WiFi network connectWiFi(); // Start the web server server.onNotFound(handleRequest); server.begin(); } void loop() { // Nothing to do here } Testing the Web Server To test the web server, you need to upload the code to the ESP32 board and open the serial monitor. You should see the IP address of the ESP32, which is something like 192.168.1.8 Then, you need to open a web browser on your computer or smartphone and enter the IP address of the ESP32. You should see the web page with the button to control the LED. You can click the button to toggle the LED state and see the confirmation message on the web browser. Conclusion In this tutorial, you learned how to create a web server with ESP32 that can control an LED from any device connected to the same WiFi network. You learned how to use the WiFi.h and ESPAsyncWebServer.h libraries to connect the ESP32 to the WiFi network and to create the web server. You also learned how to generate the HTML and CSS code for the web page and how to handle the HTTP requests from the web clients. You can use this tutorial as a basis for your own projects that involve controlling GPIO pins or other devices with the ESP32 web server. You can also customize the web page design and functionality to suit your needs. I hope you enjoyed this tutorial and found it useful. If you have any questions or feedback, please let me know. 😊
  3. 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.
  4. Nowadays home automation is a trending topic among electronic enthusiasts and even the mass population. People are busy with their life challenges, so an electronic device should take care of the home instead! The majority of such devices need internet or Wi-Fi for connectivity or they don’t offer a user-friendly GUI, but I decided to design a standalone wireless monitoring/controlling unit that can be adjusted using a graphical and touch-controlled LCD display. The device consists of a panelboard and a mainboard that communicate using 315MHz (or 433MHz) ASK transceivers. The panel side is equipped with a high-quality 4.3” capacitive-touch Nextion Display. The user can monitor the live temperature values and define the action threshold (to activate/deactivate the heater or cooler), humidity (to activate/deactivate the humidifier or dehumidifier), and ambient light (to turn ON/OFF the lights). The mainboard is equipped with 4 Relays to activate/deactivate the aforementioned loads. To design the schematic and PCB, I used Altium Designer 23. The fast component search engine (octopart) allowed me to quickly consider components’ information and also generate the BOM. To get high-quality fabricated boards, I sent the Gerber files to PCBWay. I used the Arduino IDE to write the MCU code, so it is pretty easy to follow and understand. Designing a GUI using the Nextion tools was a pleasant experience that I will certainly follow for similar projects in the future. So let’s get started 🙂 Specifications Connectivity: Wireless ASK, 315MHz (or 433MHz) Parameters: Temperature, Humidity, Ambient Light Wireless Coverage: 100 to 200m (with Antennas) Display: 4.3” Graphical, Capacitive-Touch Input Voltage: 7.5 to 9V-DC (power adaptor connector) References article: https://www.pcbway.com/blog/technology/Wireless_Home_Automation_Control_and_Monitoring_Using_a_Nextion_HMI_Display_24d9be1d.html [1]: L7805: https://octopart.com/l7805cp-stmicroelectronics-526753?r=sp [2]: SMBJ5CA: https://octopart.com/rnd+smbj5ca-rnd+components-103950670?r=sp [3]: 78L05: https://octopart.com/ua78l05cpk-texas+instruments-525289?r=sp [4]: ATMega328: https://octopart.com/atmega328pb-anr-microchip-77760227?r=sp [5]: Si2302: https://octopart.com/si2302cds-t1-e3-vishay-44452855?r=sp [6]: LM1-5D: https://octopart.com/lm1-5d-rayex-53719411?r=sp [7]: Altium Designer: https://www.altium.com/yt/myvanitar [8]: Nextion Display: https://bit.ly/3dY30gw
  5. I love mining and I truly believe that blockchain and digital currencies will one day change the world. Cryptocurrency has played a significant role in my life and has made me a morning person, ha ha. Miners require 24 x 7 access to the Internet. Recently, I went on a short business trip and my router for some stupid reason stopped working. I lost complete access to my home network and my miners. When I returned from my trip, my only aim was to fix this issue by creating an "Internet Hardware Watchdog" that reboots the router whenever something silly happens to it. Note: If you do any work with "mains power" such as 120v or 240v AC power wiring, you should always use proper equipment and safety gears and determine whether you have adequate skill and experience or consult a Licensed Electrician. This project is not intended for use by children. The Logic Let me first explain the logic to you. In a nutshell, in this setup I am going to ping "www.google.com" and as soon as the ping drops I will reboot the router. To achieve this, the NoduMCU first connects to the WiFi network and then pings 8.8.8.8 (www.google.com). If it receives a successful ping, one out of the 3 blue LED patterns is displayed. If the ping fails, 5 more retries are given before rebooting the router. The reason I am NOT rebooting the router straightaway is to avoid false positive ping fail responses. However, once the "fail_count" counter becomes 5, NodeMCU turns off the router by pulling the armature of the relay module. The armature of the relay is held for 15 seconds before releasing it so that the router is properly power cycled. Once the armature is released, the system waits for a minute before sending the next ping request. This gives enough time to the router to successfully perform its POST activities. The above steps are then endlessly repeated in the loop section of the code. Components Required For this project we need: NodeMCU Stepdown Converter Relay Module 2 x Red LEDs 3 x Blue LEDs 100Ω Resistor Power Plug and a Power Socket Schematic Now, let's put the components together exactly the way I have shown in the schematic diagram. Be very careful while handling AC Main Power sockets and cables. The Stepdown Converter powers the NodeMCU and the Relay Module. LEDs are connected to the Digital pins of the microcontroller. The relay acts as a switch and switches on or off the router based on the ping response. Please make sure you check the pins of your relay module before hooking it up to the circuit. The Board So, this is how my board looks like in 2D and 3D. I basically have created a replica of the NodeMCU Prototyping Board which you can buy from AliExpress for about $4 to $6. Components Assembly Lets start by soldering the NodeMCU to the board. Since I care a lot about my Sensors and Microcontrollers, I am not going to solder them directly to the board. Instead I am soldering 'female pin headers' to the board which will house all the sensors and the microcontrollers in them. I initially thought of soldering the LEDs directly on the board however something clicked in my mind and I went ahead and soldered them on a separate perfboard and then soldered the perfboard to the NodeMCU development board. Well, this was totally unnecessary. Once the LEDs were in place, my next step was to solder the step-down-converter and the relay-module to the board. If you want to know how I created this relay module, please check out my tutorial no. 19 DIY Relay Module : https://www.youtube.com/watch?v=3n69b4sdDjk the video and the blog post links are in the description below. Next, I made a hole in the transparent box and glued the power socket into it. Well I created a bit of mess while gluing the socket and accidentally glued the box on to my dining table, silly me. I also drilled a hole at the back of this box, for the cable that will connect to the AC Main power supply. Pretty much that's it. Once again, I would like to warn you guys: If you do any work with the "main power" such as 110v or 240v AC, you should always use proper equipment and safety gears and determine whether you have adequate skill and experience or consult a Licensed Electrician. This project is not intended for use by children. To conclude the setup, I added a small skull inside the acrylic box. This skull has been sitting on my desk just collecting dust for over a year, ha ha. The Code Now, let's have a look at the code. You can download the code and other resources from the links provided in the description below. To Run the attached code you need to download and install the "ESP8266Ping" library. You can either download it from GitHub or from the link provided in the description below. Unzip and copy the archive to the Arduino's Library Folder and change the board type to ESP8266 in the Arduino IDE and select NodeMCU. The code starts by including all the libraries and variables on top. Then in the setup() section I have defined all the pin modes and have made a connection to the WiFi router. In the loop() section I am performing a ping test and based on the test result I am either blinking the blue LEDs or power cycling the router. Thanks Thanks again for checking my post. I hope it helps you. If you want to support me subscribe to my YouTube Channel: https://www.youtube.com/user/tarantula3 Blog Posts: Internet Hardware WatchDog : https://diy-projects4u.blogspot.com/2021/12/internet-hardware-watchdog.html DIY Relay Module : http://diy-projects4u.blogspot.com/2020/08/diy-relay-module.html Video: Internet Hardware WatchDog : DIY Relay Module : https://www.youtube.com/watch?v=3n69b4sdDjk Other Resources: Code: https://drive.google.com/file/d/1HyTUMUBDK0neO854XMl3dyy5ceoeTImw/view?usp=sharing ESP8266Ping Library : https://github.com/dancol90/ESP8266Ping.git ESP8266Ping Library : https://drive.google.com/file/d/1uFfY5wW7-oWRNjP_XaBj2IM189M1n1FK/view?usp=sharing Schema: https://drive.google.com/file/d/1gn2ZhMp5Uz4YDv5GjxgIq1rtzh-21Rwe/view?usp=sharing Gerber File: https://drive.google.com/file/d/1l0bszJ0AV7S9s-y9jTWGcw9MrWayVJxZ/view?usp=sharing Flowchart: https://drive.google.com/file/d/1CL3g0nT1IZfdL8MZqN_PB-mKC9k_JfWH/view?usp=sharing Support My Work: BTC: 1M1PdxVxSTPLoMK91XnvEPksVuAa4J4dDp LTC: MQFkVkWimYngMwp5SMuSbMP4ADStjysstm DOGE: DDe7Fws24zf7acZevoT8uERnmisiHwR5st ETH: 0x939aa4e13ecb4b46663c8017986abc0d204cde60 BAT: 0x939aa4e13ecb4b46663c8017986abc0d204cde60 LBC: bZ8ANEJFsd2MNFfpoxBhtFNPboh7PmD7M2 Thanks, ca again in my next tutorial.
  6. Has this ever happened to you? You come back from a romantic dinner date and when you open the shutter door of your garage you realize that you left the garage light ON. You spent few hours outside with your partner to impress her and all the time this light bulb was on. You immediately turn around and look at her face to see a silent anger on her face. Alright, enough of that. So, in this tutorial, I am going to turn on and off the garage light using a PIR sensor. When the sensor detects a moving object, it turns on the light bulb and when the moving object is gone, it turns it off. Lastly, I am going to make sure that light bulb only turn on during the night time (when its dark). Step 1: Logic In this project, I will be using a PIR sensor along with an LDR to turn on or off a light bulb using a Relay. The things I need to consider before designing the circuit are: - The bulb should only turn on when the room is dark and when a motion is detected. - The bulb should turn off after 30 seconds of the object leaving the sensors proximity. - Most important, we need to place the LDR in a place where it doesn't turn off the bulb as soon as it lights up. Step 2: Hardware For this tutorial we need: A General Purpose PCB 2 x HC-SR501 PIR Sensor 2 x 1N4148 Small Signal Fast Switching Diodes 1 x 1N4007 High Voltage, High Current Rated Diode to protect the micro-controller from voltage spikes 1 x LDR 1 x 10K Trimmer Potentiometer 2 x 470 Ohms Resistor 1 x 10K Resistor 1 x 1K Resistor 1 x 2N3906 General Purpose PNP Transistor 1 x 2N2222 General Purpose NPN Transistor 1 x 5V Relay 1 x LED to display the status 5 x Terminal Blocks 1 x 220V to 5V Buck Step Down Module Few Connecting Cables And General Soldering Equipments Step 3: Assembly Lets first connect the LDR and setup the light detection bit. As we all know we need to setup a voltage divider to use the LDR in a circuit, so, I am adding this 10K POT and 470ohms resistor to setup the voltage divider bit. By adjusting the resistance of the POT we can adjust the intensity of sunlight at which this circuit will operate. Now, lets install the PIR sensor. Connect the VCC to +5v and GND to ground. Then connect the 1N4148 diode to the OUT of the sensor. In this circuit, I am installing just one sensor however in the actual project I have used 2 sensors to capture a bit more than 180 degrees. So, to avoid the sensors from back-feeding each other we need to install a diode to the OUT pin of each sensor. If you want to capture motion at 360 degrees you may need 3 to 4 sensor and diode pair to achieve that. Now that we have the PIR sensor and the LDR in place we need to add the 'AND' functionality. To achieve this I am adding a general purpose PNP transistor. When a motion is detected 'and' when the sunlight is at a certain intensity (adjusted by the POT) current flows out of the transistor. Next, we need to amplify the current received from the collector of the PNP transistor and turn on and off the LED indicator and the Relay. A general purpose NPN transistor is used to achieve this. That's it all done. Step 4: What Have I Have Made So, this is what I have made. On my board components are pretty much soldered everywhere, but you may like to have them nicely installed to give it a bit more cleaner look. OK, so lets check out how this works. Step 5: Demo Alright, I have placed the board on this table to do a quick test. I haven't hooked up a light bulb to the circuit yet. However, the LED indicator should serve the purpose of this demonstration. So, now I am going to turn off the light and make the room dark. Let's see if the sensor picks up motion and lights up the LED. Tada, it works. Now, lets turn on the light of the room and see if the LED indicator turns off or not. Yessss, that works. OK, finally just want to make sure that the light bulb turns off after 30 seconds of me moving out of the sensors proximity. Boom, and that concludes the project. I can now install it on the ceiling and make my partner happy. Instead of having 2 to 3 PIR sensors you can use one and install it at the corner of the wall. However, that will require a fair bit of wiring either inside the roof or on the ceiling, which will be way more expensive and tedious than installing 3 sensors an d putting the device in the middle of the room. You can also swap the Arduino with a NodeMCU board and do a remote data logging to log the time when the sensor detected motion or when the light went on to record when people entered your garage and how long they stayed in there. Step 6: Areas of Applications of PIR Sensors This setup can be used to: * Automate All Outdoor Lights * Automate Lights of Basement, Garden or Covered Parking Areas * Automate Lift Lobby or Common Staircases Lights * Automate bedside or night lamp * Create a Smart Home Automation & Security System and more.. Step 7: Thanks Thanks again for watching this video! I hope it helps you. If you want to support me, you can subscribe to my channel and watch my other videos. Thanks, ca again in my next video.
  7. Are u looking for a way to connect the Arduino to the internet easily? Do you want to develop your IoT project quickly without much hassle? ARMA IoT might just be the thing for you! The simple and efficient Arduino shield is powered through a esp12f wifi module, which enables it to be connected to the wifi network. it also has an SD card slot for for extra data storage like its wired brethren the Ethernet Shield. The ARMA IoT goes a step further and provides an easy plug and play feature for most of the common devices such as sensors, motors, LCDs and relays. The ARMA IoT is a great place for beginners to start their IoT project, as it requires minimum time to setup the hardware all thanks to the plug and play feature. Even the programming is simplified through the help of apps such as Blynk, which provides easy feature of controlling the Arduino through your Android or iOS phone. Thingspeak an upcoming IoT platform is also supported by the shield. The ARMA IoT platform proves as a tool for aspiring beginners and also a prototyping tool for advanced users. IoT products can be developed much faster with the help of this board. Weather it is creating a simple IoT project such as blinking LEDs or controlling relays, or developing your own Home automation system, the ARMA IoT facilitates it all and things seem to happen rather quickly with all the features provided on the board. The wifi connection feature can provide fast communication between devices or two instances of ARMA itself, making it applicable for simple swarm robotics, wireless controllers etc. The applications can also be extended to simple robotics, Energy management systems and it does not stop there as it all depends upon the users creativity. To get started simple tutorials are provided on the YouTube page of ARMA IoT, the link below guides on the setup of Arduino and ARMA IoT with the help of Blynk app More tutorials and projects will be posted to help you make the most of the shield. Of Course there are also various DIY communities that can provide you with both support and inspiration for your upcoming IoT projects. thus ARMA is another simple board that has the ability to bind many devices together. The ARMA IoT is still undergoing a crowdfunding campaign in Indiegogo and is available for pre-order. https://www.indiegogo.com/projects/arma-iot-breakout-board-for-arduino#/
×
  • Create New...