Skip to main content

IOT DISPENSER

#handsanitizer #covid #masker #dirumahaja #coronavirus #sanitizer #handsanitizermurah #corona #staysafe #handsanitizers #stayathome #stayhome #maskerkain #jualhandsanitizer #socialdistancing #facemask #skincare #viruscorona #washyourhands #handgel #handsanitizerspray #newnormal #maskersensi #disinfectant #handsanitizergel #ml #antiseptic #virus #antiseptik #iot #technology #internetofthings #ai #tech #arduino #raspberrypi #robotics #automation #engineering #artificialintelligence #innovation #electronics #programming #bigdata #machinelearning #smarthome #datascience #cybersecurity #security #coding #blockchain #b #business #arduinoproject #python #electrical #arduinouno #robot #bhfyp



Corona virus (Covid 19) is spreading all around the world. Hence it's very important to keep our hands sanitized. Here is the simple project to build an electronic hand sanitizer that can be operated using smartphone via bluetooth. IoT projects have gained immense popularity due to their ability to leverage the power of interconnected devices and data to create innovative solutions across various domains. IoT projects involve integrating sensors, actuators, and communication technologies to enable the seamless exchange of data between physical devices and the internet. These projects range from simple DIY experiments to complex industrial applications, each offering unique opportunities to transform our lives and improve efficiency. Whether it's creating a smart home automation system, monitoring environmental conditions, optimizing energy usage, or developing intelligent transportation systems, applications of IoT open up a world of possibilities for innovation and connectivity. By harnessing the potential of IoT, we can build intelligent and interconnected systems that revolutionize industries, enhance daily life, and pave the way for a more efficient and sustainable future. In this project we will be using nodemcu to as a controller for the project.



 




Circuit diagram:




Code: 




DESCRIPTION :

Arduino code:

  1. #include <ESP8266WiFi.h>

  2. #include <Servo.h>

  3. Servo servo;

  4. //Static IP address configuration

  5. IPAddress staticIP(192, 168, 225, 81); //ESP static ip

  6. IPAddress gateway(192, 168, 225, 1);   //IP Address of your WiFi Router (Gateway)

  7. IPAddress subnet(255, 255, 255, 0);  //Subnet mask


  8. //Define wifi configuration

  9. const char* ssid = "YOUR_SSID";

  10. const char* password = "YOUR_WIFI_PASSWORD";


  11. // Create an instance of the server

  12. WiFiServer server(80);


  13. void setup() { 

  14.   Serial.begin(9600);

  15.  

  16. // prepare GPIO 4

  17.    servo.attach(4);

  18.     

  19.   //Motor in home position

  20.   servo.write(90);

  21.   servo.detach();

  22.   delay(100);

  23.   

  24.   // Connect to WiFi network

  25.   Serial.println();

  26.   Serial.println();

  27.   Serial.print("Connecting to ");

  28.   Serial.println(ssid);

  29.   

  30.   WiFi.begin(ssid, password);

  31.   //Configuring Static IP

  32.   WiFi.config(staticIP,gateway,subnet);

  33.   while (WiFi.status() != WL_CONNECTED) {

  34.     delay(500);

  35.     Serial.print(".");

  36.   }

  37.   Serial.println("");

  38.   Serial.println("WiFi connected");

  39.   

  40.   // Start the server

  41.   server.begin();

  42.   Serial.println("Server started");


  43.   // Print the IP address

  44.   Serial.println(WiFi.localIP());

  45. }


  46. void loop() {

  47.   // Check if a client has connected

  48.   WiFiClient client = server.available();

  49.   if (!client) {

  50.     return;

  51.   }

  52.   

  53.   // Wait until the client sends some data

  54.  // Serial.println("new client");

  55.   while(!client.available()){

  56.     delay(1);

  57.   }

  58.   

  59.   // Read the first line of the request

  60.   String req = client.readStringUntil('\r');

  61.   //Serial.println(req);

  62.   //Serial.println("req");

  63.   client.flush();

  64.   

  65.   // Match the request

  66.   int val;

  67.   if (req.indexOf("/gpio/0") != -1)

  68.     val = 0;

  69.   else if (req.indexOf("/gpio/1") != -1)

  70.     val = 1;

  71.    else if(req.indexOf("ON1") != -1)

  72.   {

  73.       servo.attach(4); // No . 4 is GPIO 4 means servo is attached to pin D2 of NODE MCU.

  74.       

  75.       servo.write(140);

  76.       delay(1000);

  77.       servo.write(90);

  78.       

  79.       delay(300);

  80.       servo.detach();


  81.    }

  82. //   else if(req.indexOf("OFF1") != -1)

  83. //  {

  84. //      digitalWrite(D0, HIGH);

  85. //  }


  86.   else {

  87.     client.stop();

  88.     return;

  89.   }

  90.   client.flush();


  91.   // Prepare the response

  92.   String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nGPIO is now ";

  93.   s += (val)?"high":"low";

  94.   s += "</html>\n";


  95.   // Send the response to the client

  96.   //client.print(s);

  97.   delay(1);

  98.   Serial.println("Client disconnected");


  99.   // The client will actually be disconnected 

  100.   // when the function returns and 'client' object is destroyed

  101. }








Description:

Most of the code is commented. Some of the important points to highlight

  1. In this code we need to change the gateway according to our network.

  2. Simple method - (For windows) 

    1. Open command prompt - type “ipconfig”

    2. Look for “default gateway”. A set of four numbers will be displayed. In my case its 192.168.xxx.1

    3. Note this “xxx” number, goto line in the code where “staticIP” is defined and replace the 3rd number  with this number you just found.   

    4. Ex: default gateway is 192. 169. 255 .1

So in my code  -

IPAddress staticIP (192, 168, 225, 81); //ESP static ip

IPAddress gateway (192, 168, 225, 1);


  1. Next step is changing SSID and password

    1. Replace  YOUR_SSID in this line - const char* ssid = "YOUR_SSID" with your wifi name.

    2. Replace YOUR_WIFI_PASSWORD in the line const char* password = "YOUR_WIFI_PASSWORD"; with your wifi password


ANDROID APP SETTINGS:


  1. To test the project , open the android app “LINK HERE” , type IP address of the device and same gateway .

  2. Now type “ON1” keyword into send section and hit send.

In the receive section of the app you will be able to see the response from the arduino device.



Project arrangement:


Android app : Link to app store






Comments

Popular posts from this blog

TOUCH PLATE BASED DOOR BELL

Title:  Touch plate based door bell  Circuit:  Components: IC 555 Resistors: 1 M, 100k, 330 ohms Transistor: BC547  PN2222A Capacitor: 10n 1 Copper plate : as touch plate. A 6v battery An LED / Ic UM66 Description: This is the simple circuit for touch plate based security system. In this project what basically done is, circuit detects stray voltages produced by mains voltage and electrostatic built  up in the room.If sufficient static voltage is detected by the plate then chip will charge up. Transistor BC 547 or PN2222A is used basically to increase the sensitivity.In place of led just connect IC um 66(melody IC). Applications: In homes, of course. This can be specially used in places like hospitals, when patients need to call doctor by himself.

Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️

Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️ Interfacing Load Cell with Raspberry Pi 3 (via HX711) ⚖️ A load cell is a transducer that converts force (weight) into an electrical signal. The HX711 is a precision 24-bit analog-to-digital converter (ADC) designed for weigh scales. Today we’ll connect a load cell to Raspberry Pi 3 using the HX711 module. πŸ§ͺ πŸ”§ Components Required Component Quantity Raspberry Pi 3 1 Load Cell 1 HX711 Module 1 Jumper Wires 6 Breadboard (optional) 1 πŸ”Œ Pin Connections HX711 Pin Raspberry Pi Pin Pin Number VCC 5V Pin 2 GND Ground Pin 6 DT GPIO 5 Pin 29 SCK GPIO 6 Pin 31 Figure: Load Cell connected to Raspberry Pi 3 via HX711 πŸ’» Python Code from hx711 import HX711 import RPi.GPIO as GPIO import time hx = HX711(dout_pin=5, pd_sck_pin=6) hx.set_reading_format("MSB", "MSB") hx.set_reference_unit(1) hx.reset()...

Interfacing Sound Sensor with Raspberry Pi 3

πŸ”Ή Overview The KY-037 is a high-sensitivity sound detection sensor that can detect noise levels in the environment. It provides both analog and digital outputs. In this tutorial, we’ll interface the digital output of KY-037 with Raspberry Pi 3 Model B+ (without using an ADC like MCP3008) and detect sound events.