top of page

Search Results

163 results found with an empty search

  • Node MCU based COVID-19 INDIA Live tracker

    In this tutorial, ESP8266 12E V1 board which is based on the ESP8266 Wifi module to get data from the worldometers.info/coronavirus/country/india/ via ThingSpeak API using thingHTTP. We used an 0.96" OLED display for making a dashboard for all the real time data are “Corona Virus” Image in Frame 1 “Covid-19 india” Text in Frame 2 “Cases” which had an outcome in Frame 3 ‘Deaths” which had an outcome in Frame 4 ‘Recovered “ Dischared cases which had an outcome in Frame 5 “Text” Text in Frame 6 Circuit Diagram Components Required 0.96 OLED 4wire Module - 1no Node MCU ESP8266 12E Dev Module- 1 no Installing Library To install the library navigate to the Sketch > Include Library > Manage Libraries… Wait for Library Manager to download libraries index and update list of installed libraries. Download SSD1306Wire.h Library , we need to use this library for SSD1306 OLED display After installing the required libraries, copy the following code to your Arduino IDE. Demo: Subscribe

  • Egg Incubator using DHT11and Bluetooth for Android app.

    Incubating eggs is a fun, 21-day project that can be successful with careful attention and a few special pieces of equipment. With care, vigilance and planning, you will be able to hatch baby chicks that grow up to become part of your backyard flock. Hatching eggs at home can be a fun project for those looking to grow their backyard flocks. Incubating chicken eggs is a 21-day process and requires an egg incubator to help control temperature, humidity and egg turning. A step-by-step guide to hatching eggs: For hatching to occur, the eggs must be fertile. Prior to incubation, a fertilized egg can be stored for a maximum of 7 days in a cool room kept at a steady 55-60 degrees Fahrenheit (not in the refrigerator – it’s too cold!). Once the fertilized eggs are placed in the warm incubator, they may develop over the course of 21 days, with the proper incubator set-up and care. How to set up the egg incubator Fertile eggs can be hatched by using an egg incubator. An incubator is an enclosed structure with a fan and heater to keep eggs warm during the 21-day incubation period. Here developed using an incubator with some automatic features, such as egg turning (which is critical to chick development and to keep the chick from sticking to the inside surface of the shell) and a circulation fan to facilitate even heat distribution. Temperature and humidity inside the incubator are critical factors for successfully hatching eggs. Suggested guidelines are as follows: Optimum temperature: 38 degrees Celsius. Temperature range: 37-39 degrees Celsius Don’t let temperature drop below 37 degrees Celsius Do not allow temps of 40 degrees Celsius to last more than a few hours Double-check the incubator’s thermometer with a medical thermometer placed nearby to ensure the gauge is working properly. Relative humidity, day 1-17: 50-55 percent Equivalent to a wet bulb temperature of 29-30 degrees Celsius. Keep water channels in the incubator full to facilitate proper humidity Relative humidity, day 18-21: On day 18, raise the relative humidity to 70 percent Use a hygrometer to ensure humidity levels are correct throughout the incubation period Only open the incubator when necessary – doing so can let heat and humidity escape and can affect the success of the hatch. Increase ventilation as embryos grow bigger, especially from days 18-21. Keep in mind these are recommendations for hatching chicken eggs Days 7-10: Candling eggs Towards the middle of the incubation period at 7 to 10 days, eggs can be candled to determine if the embryos are growing properly. If you notice broken or leaking eggs, remove them from the incubator as they are not likely to be viable and may contaminate the incubator. After candling, return eggs to the incubator and return to the day 1-24 turning schedule. Day 1-18: Turning the eggs After setting the eggs, the incubation process begins. An important part of this process is turning, or rotating, the eggs. Days 18-21: Pre-hatching By day 18, the embryo has developed into a chick and will take up most of the space in the egg. The chick is preparing to hatch. You can do a few things to best help the baby chick prepare: Stop egg-turning at day 18 with the larger end of the egg facing up. At this point, the chick will position itself for hatching inside the egg. Maintain a temperature of 38 degrees Celsius but increase humidity to 70 percent. Day 21: Baby chicks start hatching Chicks will typically hatch at day 21. If the fertilized eggs were cooled prior to incubation, the process might take a little longer. If you are at day 21 with no hatch, give the eggs a few more days. Circuit Diagram: For Programmed ardunio Uno & Price: https://www.dofbot.com/product-page/egg-incubator-using-dht11-bluetooth-and-android-app Component Required: 1. Arduino UNO R3 2. LCD 20x4 3. Bluetooth HC-05 4. Push Button - 4 nos 5.Dip switch 2 6. relay 230V/10a - 2 nos 7. Fan - 2nos 8. Servo 9. DHT11 10.LED 11. Buzzer Connections: The SW1 dip switch 1 selector in 5V position is Temperature Cursor selection and DIP switch GND position for Humidity Cursor selection, after selecting the mode the Push button S3 & S4 for Low value setting increment & Decrement, Push button S1 & S2 for High value setting increment & Decrement for Temperature or Humidity depends on the SW1 dip position. The SW1 dip switch 2 Position in 5V is Egg Tray Turn on Position and Dip switch GND position is Egg tray Turn Off position. The Tray Rotation is made for every one hour and is start initially from position 0° to 90° after a minute and start to rotation mode. First Position from 90°,135°,90°,45° repeatedly for every one hour for each angle position. Timer function After the 21 days the times comes to day = 0, H = 0, M =0, S = 0 and then Buzzer alert. Installing Libraries Easy button : you need to Download and install the Easy button library. Dht11: you need to Download and install the Easy button library. LiquidCrystal_I2C.h : you need to Download and install the LiquidCrystal_I2C library. Subscribe and Download code. Arduino code: //Define and adding library #include #include // #include LiquidCrystal_I2C lcd(0x27,20,4); #include // #include Servo myservo; // create servo object to control a servo int pos; // variable to store the servo position // eeprom value byte eeprom_value; // timer for sensor and delay long last_read_from_sensor = 0; const long sensor_read_delay = 1000; // sensor pin #define DHT_PIN A0 // sensor setup dht DHT; // maximum and minimum const int TempMin = 15; const int TempMax = 50; const int HumiMin = 20; const int HumiMax = 99; //Set to humidity/temp const int THsetbutton = 7; const int Traybutton = 2; int Eggtray = 12; int Buzzer = 11; // first value const int LowRange_UPButton = 3; const int LowRange_DownButton = 4; int T1setpoint = 25; const int eeprom_address_TempLowValue = 0; int H1setpoint = 40; const int eeprom_address_HumiLowValue = 2; // second value const int HighRange_UPButton = 5; const int HighRange_DownButton = 6; int T2setpoint = 32; const int eeprom_address_TempHighValue = 1; int H2setpoint = 80; const int eeprom_address_HumiHighValue = 3; // outputs const int Heater = 8; //int heaterstatus; const int Humidifier = 9; //int humudifierstatus; int S = 59; // downcount seconds int M = 59; // downcount minutes int H = 23; // downcount hours int day = 21; // downcount day // buttons setup EasyButton button_first_up(LowRange_UPButton); EasyButton button_first_down(LowRange_DownButton); EasyButton button_second_up(HighRange_UPButton); EasyButton button_second_down(HighRange_DownButton); ////////////////////////////// // temperature setup double current_temperature; double current_humidity; // byte angle[] = { B00000, B00000, B00100, B00100, B00100, B11111, B00000, B00000 }; byte Humidity[] = { B00100, B00100, B01010, B01010, B10001, B10001, B01010, B00100 }; byte Thermometer[8] { B00100, B01010, B01010, B01110, B01110, B11111, B11111, B01110 }; byte Indicator[8] = { //icon for sun 0b00000, 0b00100, 0b10101, 0b01110, 0b11111, 0b01110, 0b10101, 0b00100 }; byte Rarrow[] = { B00000, B00000, B00100, B00010, B11111, B00010, B00100, B00000 }; byte Larrow[] = { B00000, B00000, B00100, B01000, B11111, B01000, B00100, B00000 }; byte to[] = { B00000, B00000, B11100, B01000, B01000, B01011, B01011, B00000 }; void setup() { // write boot message on lcd lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); // write boot message on lcd lcd.begin(20, 4); // set the two outputs as high pinMode(THsetbutton, INPUT); pinMode(Traybutton, INPUT); pinMode(Eggtray, OUTPUT); pinMode(Buzzer, OUTPUT); pinMode(Heater, OUTPUT); digitalWrite(Heater, LOW); pinMode(Humidifier, OUTPUT); digitalWrite(Humidifier, LOW); myservo.attach(10); // attaches the servo on pin 9 to the servo object // initialize serial Serial.begin(9600); //////////////////////////////////////////////// // load first value from eeprom eeprom_value = EEPROM.read(eeprom_address_TempLowValue); if(eeprom_value != 255) { T1setpoint = eeprom_value; } // load second value from eeprom eeprom_value = EEPROM.read(eeprom_address_TempHighValue); if(eeprom_value != 255) { T2setpoint = eeprom_value; } void loop() { // read buttons button_first_up.update(); button_first_down.update(); button_second_up.update(); button_second_down.update(); int buttonState = digitalRead(Traybutton); //read the state of the button input if (buttonState == HIGH) { //pressing the button will produce a LOW state 0V digitalWrite(Eggtray,HIGH); //the led with turn on { lcd.setCursor(0,2); lcd.print("EGG TURN:ON "); } } else{ digitalWrite(Eggtray,LOW); //the led with turn off lcd.setCursor(0,2); lcd.print("EGG TURN:OFF"); } lcd.createChar(0, angle); lcd.setCursor(15,2); lcd.write(0); /////////// lcd.createChar(1, Thermometer); lcd.setCursor(18,0); lcd.write(1); lcd.createChar(2, Humidity); lcd.setCursor(18,1); lcd.write(2); // increase value if it is high, if it is less than the maximum value, and the first value is less than // the second one and also similar that all code apply for Humidification if(button_first_up.IsPushed() && T1setpoint < TempMax && T1setpoint < (T2setpoint - 1)) { // increase first_value if(digitalRead(THsetbutton) == HIGH) T1setpoint++; // write on eeprom EEPROM.write(eeprom_address_TempLowValue, T1setpoint); } // decrease value if it is high and if the value is more than the minimum value if(button_first_down.IsPushed() && T1setpoint > TempMin) { // decrease first_value if(digitalRead(THsetbutton) == HIGH) T1setpoint--; // write on eeprom EEPROM.write(eeprom_address_TempLowValue, T1setpoint); } // increase value if it is high and if it is less than the maximum value if(button_second_up.IsPushed() == HIGH && T2setpoint < TempMax) { // increase second_value if(digitalRead(THsetbutton) == HIGH) T2setpoint++; // write on eeprom EEPROM.write(eeprom_address_TempHighValue, T2setpoint); } // decrease value if it is high, if the value is more than the minimum value and if the first value is less than the second one if(button_second_down.IsPushed() && T2setpoint > TempMin && T1setpoint < (T2setpoint - 1)) { // decrease second_value if(digitalRead(THsetbutton) == HIGH) T2setpoint--; // write on eeprom EEPROM.write(eeprom_address_TempHighValue, T2setpoint); } ///////////////////////////////////////////////////////////////////////////// // sampling of temperature and humidity after delay if((millis() - last_read_from_sensor) > sensor_read_delay) { // read the temperature int chk = DHT.read11(DHT_PIN); switch (chk) { case DHTLIB_OK: current_temperature = DHT.temperature; current_humidity = DHT.humidity; // turn outputs on/off according to logic if(current_temperature <= T1setpoint) { // full speed digitalWrite(Heater, HIGH); lcd.createChar(3, Indicator); lcd.setCursor(19,0); lcd.write(3); } else if(current_temperature > T1setpoint && current_temperature < T2setpoint) { // half speed digitalWrite(Heater, HIGH); lcd.createChar(3, Indicator); lcd.setCursor(19,0); lcd.write(3); } else { // off digitalWrite(Heater, LOW); lcd.setCursor(19,0); lcd.print(" "); } ///////////////////////////////////////// ////// if(current_humidity <= H1setpoint) { // full speed digitalWrite(Humidifier, HIGH); lcd.createChar(3, Indicator); lcd.setCursor(19,1); lcd.write(3); } else if(current_humidity > H1setpoint && current_humidity < H2setpoint) { digitalWrite(Humidifier, HIGH); lcd.createChar(3, Indicator); lcd.setCursor(19,1); lcd.write(3); } else { digitalWrite(Humidifier, LOW); lcd.setCursor(19,1); lcd.print(" "); } break; case DHTLIB_ERROR_CHECKSUM: break; case DHTLIB_ERROR_TIMEOUT: break; default: break; } // set the last read as now... last_read_from_sensor = millis(); } ////////////////////////////////////////// /////////////////////////////////////// lcd.setCursor(0, 0); lcd.print("T:"); lcd.print(DHT.temperature); lcd.print((char)223); lcd.print("C"); // lcd.print(" "); lcd.setCursor(10,0); lcd.print(T1setpoint); lcd.print((char)223); lcd.print("-"); lcd.print(T2setpoint); lcd.print((char)223); //lcd.print(""); lcd.setCursor(0, 1); lcd.print("H:"); lcd.print(DHT.humidity); lcd.print("%"); // lcd.print(" "); lcd.setCursor(10,1); lcd.print(H1setpoint); lcd.print("%"); lcd.print("-"); lcd.print(H2setpoint); lcd.print("%"); // lcd.print(""); // lcd.print(Humidifier);); ///////////////////////////////////////// //TIMER S--; delay(1000); if(S<0) { M--; S=59; } if(M<0) { H--; M=59; } if (H < 0) { H = 23; day--; } //////////////////////////////////// ///////////////////////////////// if (day>1 && H == 23 && M == 59 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } //////////////// if (day>1 && H == 22 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 44; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 21 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 20 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 134; pos += 1) { myservo.write(pos); delay(15); } } /////////////////////// if (day>1 && H == 19 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 18 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 44; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 17 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 16 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 134; pos += 1) { myservo.write(pos); delay(15); } } /////////////////////// if (day>1 && H == 15 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 14 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 44; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 13 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 12 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 134; pos += 1) { myservo.write(pos); delay(15); } } /////////////////////// if (day>1 && H == 11 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 10 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 44; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 9 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 8 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 44; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 7 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 6 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 134; pos += 1) { myservo.write(pos); delay(15); } } /////////////////////// if (day>1 && H == 5 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 4 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 44; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 3 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 2 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 134; pos += 1) { myservo.write(pos); delay(15); } } /////////////////////// if (day>1 && H == 1 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 89; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } /////////////////////// if (day>1 && H == 0 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH)) { for (pos = 0; pos <= 44; pos += 1) { myservo.write(pos); delay(15); } lcd.setCursor(19,2); lcd.print(" "); } if (day>0 && H == 0 && M == 0 && S == 0) { // Timer completed digitalWrite(Buzzer, HIGH); } else { // Buzzer off digitalWrite(Buzzer, LOW); } /////////////////////// lcd.setCursor(0,3); lcd.print("Day:"); lcd.print(day); lcd.setCursor(9,3); lcd.print(":"); lcd.setCursor(12,3); lcd.print(":"); lcd.setCursor(16,3); lcd.print("LEFT"); //////////// if(H<0) { H=23; M=59; S=59; } if(M>9) { lcd.setCursor(10,3); lcd.print(M); } else { lcd.setCursor(10,3); lcd.print("0"); lcd.setCursor(11,3); lcd.print(M); lcd.setCursor(12,3); lcd.print(":"); } if(S>9) { lcd.setCursor(13,3); lcd.print(S); } else { lcd.setCursor(13,3); lcd.print("0"); lcd.setCursor(14,3); lcd.print(S); lcd.setCursor(15,3); lcd.print(" "); } if(H>9) { lcd.setCursor(7,3); lcd.print (H); } else { lcd.setCursor(7,3); lcd.print("0"); lcd.setCursor(8,3); lcd.print(H); lcd.setCursor(9,3); lcd.print(":"); } lcd.setCursor(16,2); lcd.print(pos); lcd.print((char)223); Serial.print(DHT.temperature); Serial.print("|"); Serial.print(DHT.humidity); Serial.print("|"); Serial.print(T1setpoint); Serial.print("|"); Serial.print(T2setpoint); Serial.print("|"); Serial.print(H1setpoint); Serial.print("|"); Serial.print(H2setpoint); Serial.print("|"); Serial.print(pos); //Serial.print("°"); Serial.print("|"); Serial.print(digitalRead(Heater)); Serial.print("|"); Serial.print(digitalRead(Humidifier)); Serial.print("|"); Serial.print(digitalRead(Eggtray)); Serial.print("\n"); } Android application: App Download: https://drive.google.com/file/d/1Jr72x9Pygm5_FnRp8wPG4ldM4gaRqXn0/view?usp=sharing

  • Water Level Monitoring

    Level Monitoring and Control with dry Pump run protection using Ultrasonic Sensor and Android Application via bluetooth HC-05. One of the major problems faced by most of the countries is the issue of water scarcity in the world. The scarcity is mainly due to the wastage of the water. There is a need to control the water wastage to save the environment and water resources. Water level monitoring system is one of the techniques to address the control of water wastage. It observes the level of water and provides the information to the registered users through wireless. In view of this, Bluetooth module based Water Level Monitoring system is an innovative idea that will inform the users about the level of liquid and will prevent it from overflowing. The water level monitoring system is a automatic process to detect and indicate the level of water in the reservoirs, overhead tank or any other storage containers, etc. All the householders are storing the water in overhead tanks by using the motor pumps. When the water is stored in the tank, no one can identify the level of water and also, no one can know when the water tank will be filled. So, there is an overflow of water in the tank, which results wastage of energy and water. To resolve this type of problems by using implementation of water level monitors and control systems using wireless technology which will transmit the information to the smart phone and indicate the level of water in the overhead tanks. And also to design a contactless water level indicator and controller using ultrasonic sensor with DRY PUMP RUN PROTECTION. For Programmed ardunio Uno & Price: https://www.dofbot.com/product-page/water-level-monitoring-and-control-using-bluetooth-android-app Circuit Diagram: HC-SR04 ultrasonic sensor The HC-SR04 ultrasonic module is a module that can provide non-contact measurement within the range of 2cm to 400cm with ranging accuracy that can reach 3mm. It works on the principle of echolocation. The ultrasonic sensor as a trigger and an echo pin. The arduino provides a high signal of 10microseconds to this pin. After the HC-SR04 is triggered, it sends out eight 40Khz sound waves to the surface of the water. On getting to the surface of the water, the wave is echoed back to the sensor and the arduino reads the echo pin to determine time spent between triggering and receiving of the echo. Since we know that the speed of sound is around 340m/s then we can calculate the distance using; Distance = (time/2)*speed of sound To determine the level of the water in the tank we must know the total length of the tank. It is this value that will enable us calibrate the tank.Here introduced a push button, this is used to measure the Tank height at the time of installation of this Circuit. This can further used if you wish to replace the water tank with a new one. Gap between Ultrasonic and Max water level adjusted in Arduino code. Buzzer, this is used to notify when the sump tank is empty. Sump Water level sensor, which are dipped in to the Sump Water Tank or Use non-contact sensor for Pump suction line, And Analog pin present on the Arduino Nano will be used to sense the presence of water. LCD 20x4 line display. This unit will display the Water Level in percentage, Pump status, tank Height and Sump tank status.. Conditions: If Water level below 20% then Pump will start Running and If Water level above 100% then Pump will stopped. if Pump running and Sump tank empty then Pump will stopped. if Pump stopped and Sump tank empty then Pump will stopped. Tank water level monitored in Android Mobile using app. Subscribe and Download code. Arduino Code: #include LiquidCrystal_I2C lcd(0x27,20,4); #include #define TRIGGER_PIN 6 #define ECHO_PIN 7 #define MAX_DISTANCE 500 // Maximum sensor distance is rated at 400-500cm. NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); #define MOTORPIN 8 // Pump relay #define BUZZER 9 float val; #include int addr = 0; int addr2 = 1; int flag; byte readval; #define buttonPin 10 int buttonState = 0; float TankHeight, WaterLevelMAX, GapbwSonar, SonarReading, ActualReading, Temp; int percentage; int DRYSensorPin = A0; int DRYsensorValue = 0; void setup() { Serial.begin(9600); lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); lcd.begin(20, 4); // set up the LCD's number of columns and rows: pinMode(MOTORPIN,OUTPUT);// Relay pin as output pin digitalWrite(MOTORPIN,LOW); //Turn off the relay pinMode(BUZZER,OUTPUT);// Buzzer pin as output pin digitalWrite(BUZZER,LOW); //Turn off the Buzzer lcd.setCursor(0,0); lcd.print("SMART WATER LEVEL "); lcd.setCursor(0,1); lcd.print("CONTROL SYSTEM "); lcd.setCursor(0,2); lcd.print("USING ULTRASONIC "); lcd.setCursor(0,3); lcd.print("AND ANDROID APP "); delay(2000); lcd.clear(); lcd.setCursor(0,0); lcd.print("Starting ARDUINO, "); lcd.setCursor(0,1); lcd.print("Press SCAN Button to"); lcd.setCursor(0,2); lcd.print("Change Tank Height "); lcd.setCursor(0,3); lcd.print("If Required "); delay(2000); // delay(1000); lcd.clear(); lcd.setCursor(0,0); lcd.print("Confirm Tank Must be"); lcd.setCursor(0,1); lcd.print("Empty to Set Tank "); lcd.setCursor(0,2); lcd.print("Height using Sonar "); delay(2000); lcd.clear(); lcd.setCursor(0,0); lcd.print("Now Scan to Change "); lcd.setCursor(0,1); lcd.print("Tank Height to New "); delay(2000); lcd.clear(); lcd.setCursor(0,0); lcd.print("Long Press Button..."); for (int i=0; i<=5; i++) { lcd.setCursor(0,1); lcd.print(" Hold : "); lcd.print(5-i); lcd.print(" Seconds "); buttonState = digitalRead(buttonPin); if (buttonState == HIGH) { TankHeight =sonar.ping_cm(); EEPROM.write(addr, TankHeight); } delay(1000); } {TankHeight= EEPROM.read(addr); lcd.clear(); lcd.setCursor(0,0); lcd.print("Tank New Height Set@"); lcd.setCursor(0,1); lcd.print(" "); lcd.print(TankHeight); lcd.print("cm "); lcd.setCursor(0,2); lcd.print("Cheers "); lcd.setCursor(0,3); lcd.print("WELCOME to SMART "); delay(2000); lcd.clear(); lcd.setCursor(0,2); lcd.print("TANK HEIGHT: "); lcd.setCursor(12,2); lcd.print(TankHeight); lcd.print("cm "); WaterLevelMAX=0.9*TankHeight; // 10CM GAP BETWEEN MAX WATER LEVEL TO SONAR FIX GapbwSonar=TankHeight-WaterLevelMAX;} } void loop() { delay(300); SonarReading=sonar.ping_cm(); DRYsensorValue=analogRead(DRYSensorPin); //Serial.println(DRYsensorValue); Temp= SonarReading-GapbwSonar; ActualReading= WaterLevelMAX-Temp; percentage=(ActualReading/WaterLevelMAX*100); Serial.println(percentage); //Serial.println(TankHeight); lcd.setCursor(0,0); lcd.print("WATER LEVEL:"); lcd.print(percentage); lcd.print("% "); if(DRYsensorValue>=100) { if(percentage<=20) { lcd.setCursor(0,3); lcd.print("SUMP: WATER FILLED "); lcd.setCursor(0,1); lcd.print("PUMP STATUS: RUNNING"); digitalWrite(MOTORPIN,HIGH); flag=1; EEPROM.write(addr2, flag); flag= EEPROM.read(addr2); // ZeroPercentage(); } else if(percentage>20 && percentage<=100) { flag= EEPROM.read(addr2); if(percentage>20 && percentage<=100 && flag ==1) { digitalWrite(MOTORPIN,HIGH); // digitalWrite(EXTRELAYPIN,LOW); lcd.setCursor(0,1); lcd.print("PUMP STATUS: RUNNING"); } else if(percentage>20 && percentage<=100 && flag ==0) { digitalWrite(MOTORPIN,LOW); lcd.setCursor(0,1); lcd.print("PUMP STATUS: OFF "); } } else if(percentage>100) { delay(500); lcd.setCursor(0,1); lcd.print("PUMP STATUS: OFF "); lcd.setCursor(0,0); lcd.print("Water Level:"); lcd.print("100"); lcd.print("% "); digitalWrite(MOTORPIN,LOW); flag=0; EEPROM.write(addr2, flag); flag= EEPROM.read(addr2); // HundredPercentage(); } } else if(DRYsensorValue<=100) { flag= EEPROM.read(addr2); if(flag==1) { // lcd.clear(); lcd.setCursor(0,3); lcd.print("SUMP: WATER FILLED "); lcd.setCursor(0,1); lcd.print("PUMP STATUS: DRYRUN!"); digitalWrite(BUZZER,HIGH); digitalWrite(MOTORPIN, LOW); digitalWrite(BUZZER,LOW); } else if(flag==0) { lcd.setCursor(0,3); lcd.print("SUMP: NOWATER/CHECK"); } } } Subscribe App: https://drive.google.com/file/d/1_5t3tVkQNHQk60k0gRRFQR1lUCjvaC1z/view?usp=sharing Subscribe and Download code.

  • Arduino Based Wireless Notice Board using Bluetooth and Android Application

    The project based on HC-05 Bluetooth module which Controlling 16x2 LCD display using android application. For Programmed ardunio Uno & Price: https://www.dofbot.com/product-page/arduino-based-wireless-notice-board-using-bluetooth-android-app The stuff you will need: Breadboard. HC-05 bluetooth module. 16x2 LCD display I2c Module Arduino UNO or Nano. Some wires. Mobile phone from Android. That's all! First, pin your LCD with I2C board on the breadboard and power the breadboard by connecting a wire from "5V" (Positive) on your Arduino to the positive row on the breadboard and another one from "GND" (ground or 0V) to the negative row. Then connect the LCD to the I2C module and I2C to Arduino: I2C SCL pin 4 - Arduino pin A5 I2C SDA pin 3 - Arduino pin A4 I2C GND pin 2 – 0V I2C VCC pin 1 – 5V Then connect the Tx(Transmit) pin on your Bluetooth module to the Rx (Receive) on the Arduino, and connect the Rx pin on your BT module to the Tx on the Arduino. Finally, power the BT module by connecting the VCC (or 5V) to the positive row on the breadboard and connect the GND to the negative one on the breadboard. Now open android app and goto Bluetooth setting and connect to Bluetooth is “ON” and select HC-05. Then simply write your text in L1 & L2 row in the app through mobile and press send text Button and text should be printed on the LCD. Trouble shooting of Bluetooth issue: Turn on the Bluetooth in your device. Search for new device. Click on Hc05 once it appear. Enter the password "1234" or "0000". Step 1: To print text to the LCD, the LCD I2C address should be 0x27 or 0x3F. Subscribe and Download code. #include LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display void setup() { lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); lcd.setCursor(0,0); lcd.print("Hello world"); lcd.setCursor(0,1); lcd.print("Hello World"); } void loop() { } Here the Final output Download Code Here: https://drive.google.com/drive/folders/1K4hHoZI1XtdjYtE2CEKEbkd3ubI7qSeZ?usp=sharing Step 2: To print Scroll text to the LCD, the LCD I2C address should be 0x27 or 0x3F. #include // set the LCD number of columns and rows int lcdColumns = 16; int lcdRows = 2; // set LCD address, number of columns and rows // if you don't know your display address, run an I2C scanner sketch LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows); String messageStatic = "Dofbot.com"; String messageToScroll = "arduino, IoT, NODEMCU Projects done here"; // Function to scroll text // The function acepts the following arguments: // row: row number where the text will be displayed // message: message to scroll // delayTime: delay between each character shifting // lcdColumns: number of columns of your LCD void scrollText(int row, String message, int delayTime, int lcdColumns) { for (int i=0; i < lcdColumns; i++) { message = " " + message; } message = message + " "; for (int pos = 0; pos < message.length(); pos++) { lcd.setCursor(0, row); lcd.print(message.substring(pos, pos + lcdColumns)); delay(delayTime); } } void setup(){ // initialize LCD lcd.init(); // turn on LCD backlight lcd.backlight(); } void loop(){ // set cursor to first column, first row lcd.setCursor(0, 0); // print static message lcd.print(messageStatic); // print scrolling message lcd.setCursor(0,1); scrollText(1, messageToScroll, 250, lcdColumns); } Download Code Here: https://drive.google.com/drive/folders/1x5YoJn3vOa88mDWWWzBrxO7l3yWAIzmO?usp=sharing Step 3: To print text to the LCD using android app, the LCD I2C address should be 0x27 or 0x3F. // Project by G Ramesh // dofbotindia@gmail.com // dofbot.com #include #include int lcdColumns = 16; int lcdRows = 2; LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows); char Display; String Word; String messageStatic; String messageToScroll; int L1; int L2; void scrollText(int row, String message, int delayTime, int lcdColumns) { for (int i=0; i < lcdColumns; i++) { message = " " + message; } message = message + " "; for (int pos = 0; pos < message.length(); pos++) { lcd.setCursor(0, row); lcd.print(message.substring(pos, pos + lcdColumns)); delay(delayTime); } } void setup() { lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); lcd.begin(16,2);// Columnas y filas de LCD Serial.begin(9600); } void loop() { if(Serial.available()) { Display = Serial.read(); Word = Word + Display; if (Display == '*') { Serial.println(Word); Serial.println(); L1 = Word.indexOf(','); messageStatic = Word.substring(0, L1); L2 = Word.indexOf(',', L1+1); messageToScroll = Word.substring(L1+1, L2); Serial.print("messageStatic"); Serial.println(messageStatic); Serial.print("messageToScroll"); Serial.println(messageToScroll); Word = ""; lcd.setCursor(0,0); lcd.print(messageStatic); lcd.setCursor(0,1); lcd.print(messageStatic); // lcd.setCursor(0,1); // scrollText(1, messageToScroll, 250, lcdColumns); } } } Subscribe and Download code. Here the Final output Download Android App Here: https://drive.google.com/file/d/1EyUCdOk0eEvBCo37PAmKTUnhz9ICIaXu/view?usp=sharing Wireless LCD application: Updating New Menu list in Remote LCD. The notice board is used to update with new information. #where is my bot? #Here is my bot! Good news!

  • Gesture Controlled Door using servo Motor

    Here to Control the Car doors using APDS-9960 Gesture sensor using servo and send data to Android application through Bluetooth HC-0 5 for graphic image on door opening/closing. Circuit Diagram: For Programmed ardunio Uno & Price: https://www.dofbot.com/product-page/gesture-controlled-servo-motor-using-apds-9960 Components required: Arduino uno: 1 no APDS-9960 - 1 no Servo SG90 OR MG995- 3 nos Bluetooth HC-05- 1 no LCD 20X4, I2c- 1no APDS-9960: This is the SparkFun RGB and Gesture Sensor, a small breakout board with a built in APDS-9960 sensor that offers ambient light and color measuring, proximity detection, and touchless gesture sensing. With this RGB and Gesture Sensor you will be able to control a computer, microcontroller, robot, and more with a simple swipe of your hand! This is, in fact, the same sensor that the Samsung Galaxy S5 uses and is probably one of the best gesture sensors on the market for the price. The APDS-9960 is a serious little piece of hardware with built in UV and IR blocking filters, four separate diodes sensitive to different directions, and an I2C compatible interface. For your convenience we have broken out the following pins: VL (optional power to IR LED), GND (Ground), VCC (power to APDS-9960 sensor), SDA (I2C data), SCL (I2C clock), and INT (interrupt). Each APDS-9960 also has a detection range of 4 to 8 inches (10 to 20 cm). Servo motor: A servo motor is an electric device used for precise control of angular rotation. It is used in applications that demand precise control over motion, like in case of control of a robotic arm. The rotation angle of the servo motor is controlled by applying a PWM signal to it. By varying the width of the PWM signal, we can change the rotation angle and direction of the motor. Wire Configuration: Brown - Ground wire connected to the ground of system Red - Powers the motor typically +5V is used Orange - PWM signal is given in through this wire to drive the motor Bluetooth HC-05: HC-05 is a Bluetooth module which is designed for wireless comunication. This module can be used in a master or slave configuration. Bluetooth serial modules allow all serial enabled devices to communicate with each other using Bluetooth. It has 6 pins, 1. Key/EN: It is used to bring Bluetooth module in AT commands mode. If Key/EN pin is set to high, then this module will work in command mode. Otherwise by default it is in data mode. The default baud rate of HC-05 in command mode is 38400bps and 9600 in data mode. HC-05 module has two modes, 1. Data mode: Exchange of data between devices. 2. Command mode: It uses AT commands which are used to change setting of HC-05. To send these commands to module serial (USART) port is used. 2. VCC: Connect 5 V or 3.3 V to this Pin. 3. GND: Ground Pin of module. 4. TXD: Transmit Serial data (wirelessly received data by Bluetooth module transmitted out serially on TXD pin) 5. RXD: Receive data serially (received data will be transmitted wirelessly by Bluetooth module). 6. State: It tells whether module is connected or not. HC-05 module Information HC-05 has red LED which indicates connection status, whether the Bluetooth is connected or not. Before connecting to HC-05 module this red LED blinks continuously in a periodic manner. When it gets connected to any other Bluetooth device, its blinking slows down to two seconds. This module works on 3.3 V. We can connect 5V supply voltage as well since the module has on board 5 to 3.3 V regulator. As HC-05 Bluetooth module has 3.3 V level for RX/TX and microcontroller can detect 3.3 V level, so, no need to shift transmit level of HC-05 module. But we need to shift the transmit voltage level from microcontroller to RX of HC-05 module. HC-05 Default Settings Default Bluetooth Name: “HC-05” Default Password: 1234 or 0000 Default Communication: Slave Default Mode: Data Mode Data Mode Baud Rate: 9600, 8, N, 1 Command Mode Baud Rate: 38400, 8, N, 1 Default firmware: LINVOR Subscribe Arduino Code: #include #include // Pins #define APDS9960_INT 2 // Needs to be an interrupt pin // Constants // Global Variables SparkFun_APDS9960 apds = SparkFun_APDS9960(); int isr_flag = 0; #include Servo RoofSERVO1; // create servo object to control a servo Servo SideSERVO2; // create servo object to control a servo Servo RearSERVO3; // create servo object to control a servo // twelve servo objects can be created on most boards int pos = 0; // variable to store the servo #include LiquidCrystal_I2C lcd(0x27,20,4); void setup() { // Set interrupt pin as input pinMode(APDS9960_INT, INPUT); // Initialize Serial port Serial.begin(9600); Serial.println(); Serial.println(F("--------------------------------")); Serial.println(F("SparkFun APDS-9960 - GestureTest")); Serial.println(F("--------------------------------")); // Initialize interrupt service routine attachInterrupt(0, interruptRoutine, FALLING); // Initialize APDS-9960 (configure I2C and initial values) if ( apds.init() ) { Serial.println(F("APDS-9960 initialization complete")); } else { Serial.println(F("Something went wrong during APDS-9960 init!")); } // Start running the APDS-9960 gesture sensor engine if ( apds.enableGestureSensor(true) ) { Serial.println(F("Gesture sensor is now running")); } else { Serial.println(F("Something went wrong during gesture sensor init!")); } RoofSERVO1.attach(9); SideSERVO2.attach(10); RearSERVO3.attach(11); lcd.init(); // initialize the lcd // Print a message to the LCD. lcd.backlight(); lcd.setCursor(0,0); lcd.print(" GESTURE CONTROLLED "); lcd.setCursor(0,1); lcd.print("DOOR OPENING & CLOSE"); lcd.setCursor(0,2); lcd.print("USING SERVO MOTOR , "); lcd.setCursor(0,3); lcd.print("BLUETOOTH & ANDROID "); delay (3000); lcd.clear(); } void loop() { lcd.backlight(); lcd.setCursor(0,0); lcd.print("GESTURE DOOR CONTROL"); if( isr_flag == 1 ) { detachInterrupt(0); handleGesture(); isr_flag = 0; attachInterrupt(0, interruptRoutine, FALLING); } } void interruptRoutine() { isr_flag = 1; } void handleGesture() { if ( apds.isGestureAvailable() ) { switch ( apds.readGesture() ) { case DIR_UP: Serial.println("10"); // for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree RoofSERVO1.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } lcd.setCursor(0,1); lcd.print("S1: TOP ROOF OPENED "); // break; case DIR_DOWN: Serial.println("20"); // for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees RoofSERVO1.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } lcd.setCursor(0,1); lcd.print("S1: TOP ROOF CLOSED "); // break; case DIR_LEFT: Serial.println("30"); // for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree SideSERVO2.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } lcd.setCursor(0,2); lcd.print("S2: SIDE DOOR CLOSED"); // break; case DIR_RIGHT: Serial.println("40"); // for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees SideSERVO2.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } lcd.setCursor(0,2); lcd.print("S2: SIDE DOOR OPENED"); // break; case DIR_NEAR: Serial.println("50"); // for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree RearSERVO3.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } lcd.setCursor(0,3); lcd.print("S3: REAR DOOR CLOSED"); // break; case DIR_FAR: Serial.println("60"); // for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees RearSERVO3.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } lcd.setCursor(0,3); lcd.print("S3: REAR DOOR OPENED"); // break; default: Serial.println("100"); } } } Android application: Subscribe Download .aia file https://drive.google.com/file/d/1gzr25Sf-L9GMJpB6esQUDGN0nNC7TFg7/view?usp=sharing

  • Line Follower Bot using Arduino Uno

    In this project based on black line follower and white surface. The line follower is an automated self-driven vehicle in which follows the line. In general, there are two types of line follower. one is a black line follower which follows the black line and the second is a white line follower which follows the white line. Line follower actually senses the line and follows it. These types of line followers are used in the industries, food restaurants for food delivery, the medical field for transmitting the medicine to the required patients, etc. Circuit Diagram: Components: Arduino Uno - 1 Infrared Obstacle Avoidance IR Sensor - 2 L298N Motor driver module - 1 2WD Car chassis kit -1 9V battery - 1 For Programmed ardunio Uno & Price: https://www.dofbot.com/product-page/arduino-based-line-follower-bot-using-ir Explanation IR Sensor has three terminals, two terminals for power supply and one terminal for Output. Additionally, there is a potentiometer to calibrate the sensor. An IR sensor contains IR LED and a photodiode. The IR LED will be continuously emitting the IR rays and the photodiode will act as a receiver to the IR rays emitted by the IR LED. Whenever the IR rays emitted by the IR LED hits an object (Note: the surface shouldn’t be black color), the rays are reflected back. If the photodiode receives the IR rays emitted by the IR LED, then the output of the IR sensor is digital high. If the photodiode doesn’t receive any IR rays emitted by the IR LED, then the output will be digital low. When it comes to the operating voltage of the IR sensor, it operates on 5V and the output of the IR sensor module is either 5V (high) or 0V (low). The concept of working of line follower is related to light. We use here the behavior of light at the black and white surfaces. When light falls on a white surface it is almost fully reflected and in the case of a black surface light is completely absorbed. This behavior of light is used in building a line follower robot Arduino UNO is the main controller in the project. The data from the sensors (IR Sensors) will be given to Arduino and it gives corresponding signals to the Motor Driver IC. L293D Motor Driver module IC is used in this project to drive the motors of the robot. It receives signals from Arduino based on the information from the IR Sensors. Program Code: At first, we will define the pins, which will make our coding easy. The pins which are connected to enable pins of the L293D module is called en1 or en2. The pins connected to the input pins of the L293D are defined as Left motot T1, Left motor T2, Right motot T1,Right motor T2 pins. The sensor, which is connected to the right side of the line follower is called Right sensor and the sensor which is connected to the left side is called the Left sensor. Subscribe Arduino code: #define Leftsensor 9 // left sensor #define Rightsensor 2 // right sensor #define LeftMotorT1 10 // left motor #define LeftMotorT2 11 // left motor #define RightMotorT1 3 // right motor #define RightMotorT2 4 // right motor void setup() { pinMode(Leftsensor, INPUT); pinMode(Rightsensor, INPUT); pinMode(LeftMotorT1, OUTPUT); pinMode(LeftMotorT2, OUTPUT); pinMode(RightMotorT1, OUTPUT); pinMode(RightMotorT2, OUTPUT); } void loop() { // Move Forward if(digitalRead(Leftsensor) && digitalRead(Rightsensor)) { digitalWrite(LeftMotorT1, HIGH); digitalWrite(LeftMotorT2, LOW); digitalWrite(RightMotorT1, HIGH); digitalWrite(RightMotorT2, LOW); } // Turn right if(!(digitalRead(Leftsensor)) && digitalRead(Rightsensor)) { digitalWrite(LeftMotorT1, LOW); digitalWrite(LeftMotorT2, LOW); digitalWrite(RightMotorT1, HIGH); digitalWrite(RightMotorT2, LOW); } // turn left if(digitalRead(Leftsensor) && !(digitalRead(Rightsensor))) { digitalWrite(LeftMotorT1, HIGH); digitalWrite(LeftMotorT2, LOW); digitalWrite(RightMotorT1, LOW); digitalWrite(RightMotorT2, LOW); } // stop if(!(digitalRead(Leftsensor)) && !(digitalRead(Rightsensor))) { digitalWrite(LeftMotorT1, LOW); digitalWrite(LeftMotorT2, LOW); digitalWrite(RightMotorT1, LOW); digitalWrite(RightMotorT2, LOW); } } Applications of Line Follower Robot Line follower Robots are commonly used for automation process in industries, military applications and consumer applications. They are very useful as they can work without any supervision i.e. they work as automatic guided vehicles. With additional features like obstacle avoidance and other security measures, line follower robots can be used in driver less cars. Demo: Subscribe Pay and get arduino code.

  • Arduino Based Fire alarm using dot matrix display

    In this article we interface Flame Sensor with Arduino and learn all the steps to build Fire Alarm System by using Arduino, flame sensor and Dot matrix display. Flame sensor module has a photodiode to detect the light and an op-amp to control the sensitivity. It is used to detect fire and provide a HIGH signal upon the detection. Arduino reads the signal and provides alert by turning on the buzzer and Dot Matrix Fire Animation. The flame sensor used here is an IR based flame sensor. We have also used the same concept to detect fire in our Fire Fighting Robot, you can also check that our if you are interested. Fire Alarm Systems are very common in commercial building and factories, these devices usual contain a cluster of sensors that constantly monitors for any flame, gas or fire in the building and triggers an alarm if it detects any of these. One of the simplest way to detect fire is by using an IR Flame sensor, these sensors have an IR photodiode which is sensitive to IR light. Now, in the event of a fire, the fire will not only produce heat but will also emit IR rays, yes every burning flame will emit some level of IR light, this light is not visible to human eyes but our flame sensor can detect it and alert a microcontroller like Arduino that a fire has been detected. Circuit Diagram Components Required Arduino Uno (any Arduino board can be used) IR Flame sensor module Dot Matrix Display 8x8 Buzzer Jumper wires For Programmed ardunio Uno & Price: https://www.dofbot.com/product-page/arduino-based-fire-alarm-using-dot-matrix-display Flame Sensor The flame sensor detects and responses to the presence of fire or flame. The module is based on the IR receiver and basically detects the presence of flammable gases likes nitrogen, hydrogen, carbon mono oxide. The sensor can be directly interfaced with I/O pins of processors and controllers. It works in the wavelength of the range between 760 nm to 1100 nm in the light source. Specification Voltage supply: 3.3-5V Signal detection capacity: adjustable Wavelength range: 760 nm-1100 nm Detection angle: up to 60 degree Fast response time Easy to use Applications of flame sensors Fire alarm Firefighting robot Home security system Installing the Arduino_Library Download Led Control library Subscribe and Download code. In your Arduino IDE, to install the libraries go to Sketch > Include Library > Add .ZIP library… and select the library you’ve just downloaded. After installing the required libraries, copy the following code to your Arduino IDE. Subscribe and Download code. Arduino Code #include const int numDevices = 1; // number of MAX7219s used in this case 2 const long scrollDelay = 120; // adjust scrolling speed unsigned long bufferLong [14] = {0}; LedControl lc=LedControl(12,11,10,numDevices);//DATA | CLK | CS/LOAD | number of matrices const unsigned char scrollText[] PROGMEM ={"NO FIRE"}; const int buzzerPin = 8; const int flamePin = 9; int Flame = HIGH; int theHeightTarget[8]; int theHeightCurrent[8]; int fireHeight = 0; int sparkX = 0; void setup() { for (int x=0; x

  • Arduino Controlled Motion Camera using PIR Sensor

    A camera that is positioned on a wall between two rooms, however, you can only see one room at a time unless you log into the camera software to rotate it manually. If someone were to walk into the opposite room, the camera would never record the action. To solve this, to create a motion detecting/tracking base on which I could attach the camera so it would automatically reposition itself to wherever the motion was detected. So let's start building this Arduino Security Motion Camera. Circuit Diagram: Components: Arduino Uno - 1 no HC-SR501 PIR Motion sensor- 6 nos Servo Motor MG995 -1 no Power supply DC 5V, 9V- 1 no For Programmed ardunio Uno & Price: https://www.dofbot.com/product-page/arduino-controlled-motion-camera-using-pir-sensor Explanation: The PIR motion sensor is ideal to detect movement. PIR stand for “Passive Infrared”. Basically, the PIR motion sensor measures infrared light from objects in its field of view. So, it can detect motion based on changes in infrared light in the environment. It is ideal to detect if a human has moved in or out of the sensor range. The sensor in the figure above has two built-in potentiometers to adjust the delay time (the potentiometer at the left) and the sensitivity (the potentiometer at the right). Wiring the PIR motion sensor to an Arduino is pretty straightforward – the sensor has only 3 pins. GND – connect to ground OUT – connect to an Arduino digital pin 5V – connect to 5V This Arduino Security Camera uses 5 PIR motion sensors to detect any movement within a 180º radius. Once motion is detected, a servo motor rotates the camera base to point in that direction. There are also 5 LED "status" lights positioned inside the base that will light up anytime one of the PIR sensors detects motion. The servo motor is attached to the stand where the camera sits, and rotates the camera to align with the active PIR sensor. Using the pinout for your motor, connect one pin to power, another pin to the Arduino digital input 10, and the last pin to ground. One thing to note about servo motors is that not all have a full 180º range of motion. So modify the code accordingly if your motor differs. You'll know the motor is trying to move too far when it makes a grinding noise at the last PIR sensor position. You can follow the below images to cut out and assemble your cardboard base for the Arduino Security Camera. Here's what everything looks like after the PIR sensors have been installed and all the circuitry completed. Each of the five sections has a PIR motion sensor. L bracket is Connected to the servo motor and Camera. In this we are used for carton material for the demo purpose Program Code: // Motion tracker #include Servo CameraServo; int currentPIRposition = 0; // set current angle of servo // PIR sensors int PIRpin[] = {2,3,4,5,6}; // PIR pin numbers int currentPIRpin = 2; // the current PIR pin; begin with the first in the sequence above int PIRprevState[] = {1,1,1,1,1}; // the previous state of the PIR (0 = LOW, 1 = HIGH) int PIRposition[] = {157,117.75,78.5,39.25,0}; // assign angles for servo motor (0-157 distributed equally between 5 PIR sensors) boolean PIRstatus; // Set status of PIR sensor as either true or false void setup() { Serial.begin(9600); CameraServo.attach(7); for (int p = 0; p < 5; p++) { // set all PIR sensors as INPUTS pinMode(PIRpin[p], INPUT); } Serial.print("Calibrating PIR Sensors "); for(int c = 0; c < 15; c++){ // calibrate PIR sensors for 15 seconds (change from 10-60 sec depending on your sensors) Serial.print("."); delay(1000); } Serial.println("PIR Sensors Ready"); CameraServo.write(78.5); // move the servo to the center position to begin } void loop() { for (int PIR = 0; PIR < 5; PIR++) { // start this loop for each PIR sensor currentPIRpin = PIRpin[PIR]; // set current PIR pin to current number in 'for' loop PIRstatus = digitalRead(currentPIRpin); if (PIRstatus == HIGH) { // if motion is detected on current PIR sensor digitalWrite(currentLEDpin, HIGH); // turn corresponding LED on if(PIRprevState[PIR] == 0) { // if PIR sensor's previous state is LOW if (currentPIRposition != currentPIRpin && PIRprevState[PIR] == 0) { // if high PIR is different than current position PIR then move to new position CameraServo.write(PIRposition[PIR]); Serial.print("Current angle : "); Serial.println(PIRposition[PIR]); delay(50); currentPIRposition = currentPIRpin; // reset current PIR position to active [PIR] pin PIRprevState[PIR] = 1; // set previous PIR state to HIGH } PIRprevState[PIR] = 1; // set previous PIR state to HIGH if the current position is the same as the current PIR pin } } else { PIRprevState[PIR] = 0; // set previous PIR state to LOW } } } Demo:

  • 8X8 LED Matrix Max7219 Control using Android app via Bluetooth

    Here to learn how to control 8×8 LED Matrix using the MAX7219 driver (FC-16 Module) and Arduino board and android application. It is a two-dimensional patterned LED array that is used to represent event text message. This is a simple and somewhat inexpensive way of controlling a FC-16 module matrix. In addition they can be chained together to control two or more dot matrices, in this project we are used 8 and 12 module for scrolling and effect message and also effect setting are save, reset and clear using android app via bluetooth. The android application can Provides control of: Displayed message text and justification Message frame Speed, pause time and inverted display Display brightness Saving parameters to EEPROM Display configuration reset, Arduino hardware reset For Programmed ardunio Uno & Price: https://www.dofbot.com/product-page/8x8-led-matrix-max7219-control-using-bluetooth-android-app Demo for 12 Dot Matrix Module 8x8 LED Dot Matrix Display A typical single color 8×8 dot matrix unit has 16 pins, 8 for each row and 8 for each column. so it contains a total of 64 LEDs. The reason for all rows and columns being wired together is to reduce the number of pins required. Pin Configuration MAX7219 LED Driver IC The LED matrix can be driven in two ways. They are parallel (where each row or column are sent with parallel data) and serial (where the data is sent serially and an IC is used to convert this serial data into parallel data). MAX7219 FC-16 Module Overview There are several MAX7219 breakout boards available, two of which are more popular – one is the generic module and the other is the FC-16 module. The first variable, HARDWARE_TYPE, tells the arduino which version of the module you are using. Set the HARDWARE_TYPE to GENERIC_HW, Set the HARDWARE_TYPE to FC16_HW, MAX7219 Module Pinout There will be two connectors on that module, they are Input Connector and Output Connector. The breakout pins at one end of the module are used for communication with the microcontroller. INPUT VCC connects to 5V. Due to the high current draw of the display (up to 1A, if the brightness is cranked all the way up), it is recommended to run it directly from the external power supply instead of the 5V supply from the Arduino. Otherwise, be sure to keep the brightness below 50%, so that the Arduino’s voltage regulator does not overheat. GND connects to the common ground. DIN is the Data In. Connect it to any digital pin 11 of the Arduino. CS is Chip Select (sometimes labeled as LOAD). Connect it to any digital pin 10 of the Arduino CLK is the Clock pin. Connect it to any digital pin 13 of the Arduino. OUTPUT: he breakout pins at one end of the module are used for communication with the microcontroller. VCC connects to 5V. Due to the high current draw of the display (up to 1A, if the brightness is cranked all the way up), it is recommended to run it directly from the external power supply instead of the 5V supply from the Arduino. Otherwise, be sure to keep the brightness below 50%, so that the Arduino’s voltage regulator does not overheat. GND connects to the common ground. DIN is the Data In. Connect it to any digital pin 11 of the Arduino. CS is Chip Select (sometimes labeled as LOAD). Connect it to any digital pin 10 of the Arduino. CLK is the Clock pin. Connect it to any digital pin 13 of the Arduino. Circuit Diagram: Components required: 1. ARDUINO 2. FC-16 4in1 MODULE 2 or 3 (2 demo in this project) Subscribe and Download code. Arduino Code: #include #include #include #include // BT interface serial interface #define USE_ALTSOFTSERIAL 0 #if USE_ALTSOFTSERIAL #include #else #include #endif // MAX72xx Definitions ---------------- // Define the number of devices we have in the chain and the hardware interface // NOTE: These pin numbers will probably not work with your hardware and may // need to be adapted #define HARDWARE_TYPE MD_MAX72XX::FC16_HW #define MAX_DEVICES 8 // here to change device used number yourself #define CLK_PIN 13 #define DATA_PIN 11 #define CS_PIN 10 // Bluetooth Serial interface --------- // Bluetooth Serial comms pins and parameters const uint8_t BT_RECV_PIN = 3; // Arduino receive -> Bluetooth TxD pin const uint8_t BT_SEND_PIN = 2; // Arduino send -> Bluetooth RxD pin const char BT_NAME[] = "Parola"; // Define the type of hardware being used. // Only one of these options is enabled at any time. // The HM-10 is the JHHuaMao (HMSoft) version, not Bolutek. Line ending for AT commands differ. #define HW_USE_HC05 0 #define HW_USE_HC06 1 #define HW_USE_HM10_HMSOFT 0 #define HW_USE_HM10_OTHER 0 #if HW_USE_HC05 const uint8_t HC05_SETUP_ENABLE = 7; #endif // Miscellaneous #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) #define BUF_SIZE 100 // message buffer size #define EEPROM_START_ADDR 0 // EEPROM address for setup info //===================================================== //======= END OF USER CONFIGURATION PARAMETERS ======== //===================================================== // Turn on debug statements to the serial output #define DEBUG 0 #if DEBUG #define PRINT(s, x) { Serial.print(F(s)); Serial.print(x); } #define PRINTS(x) Serial.print(F(x)) #define PRINTX(x) Serial.println(x, HEX) #else #define PRINT(s, x) #define PRINTS(x) #define PRINTX(x) #endif // Serial protocol parameters const uint16_t BT_COMMS_TIMEOUT = 1000; // Protocol packet timeout period (start to end packet within this period) const char PKT_START = '*'; // protocol packet start character const char PKT_END = '~'; // protocol packet end character const char PKT_ESC = '#'; // protocol packet escape character const char PKT_CMD_SPEED = 'S'; // number (ms delay between frames) const char PKT_CMD_BRIGHT = 'B'; // Toggle 0-15 const char PKT_CMD_RESET = 'R'; // Reset the Arduino hardware const char PKT_CMD_FACSET = 'F'; // Factory settings const char PKT_CMD_SAVE = 'W'; // Write current setup to EEPROM const char PKT_CMD_MESSAGE = 'M'; // Displayed message const char PKT_CMD_JUSTIFY = 'J'; // Toggle L, C, R const char PKT_CMD_INVERT = 'V'; // Toggle Invert/Normal const char PKT_CMD_TPAUSE = 'P'; // number (ms delay between in and out) const char PKT_CMD_IANIM = 'I'; // In Animation - toggle through Animations table const char PKT_CMD_OANIM = 'O'; // Out animation - toggle through Animations table const char PKT_CMD_ACK = 'Z'; // Acknowledge command - data is PKT_ERR_* defines const char PKT_ERR_OK = '0'; // no error/ok const char PKT_ERR_TOUT = '1'; // timeout - start detected with no end within timeout period const char PKT_ERR_CMD = '2'; // command field not valid or unknown const char PKT_ERR_DATA = '3'; // data field not valid const char PKT_ERR_SEQ = '4'; // generic protocol sequence error const char *szStart = "AT+"; #if HW_USE_HC05 const char *szEnd = "\r\n"; const char PROGMEM ATCmd[] = {"NAME=\0ROLE=0\0CLASS=800500\0RESET\0\0"}; #endif #if HW_USE_HC06 const char *szEnd = "\r\n"; const char PROGMEM ATCmd[] = {"NAME\0\0"}; #endif #if HW_USE_HM10_HMSOFT const char *szEnd = ""; const char PROGMEM ATCmd[] = {"NAME\0TYPE0\0ROLE0\0RESET\0\0"}; #endif #if HW_USE_HM10_OTHER const char *szEnd = "\r\n"; const char PROGMEM ATCmd[] = {"NAME\0TYPE0\0ROLE0\0RESET\0\0"}; #endif // Data tables -------------- const textPosition_t textPosition[] = { PA_LEFT, PA_CENTER, PA_RIGHT }; const textEffect_t textEffect[] = { PA_PRINT, PA_SCROLL_UP, PA_SCROLL_LEFT, PA_SCROLL_RIGHT, PA_SCROLL_DOWN, #if ENA_SCR_DIA PA_SCROLL_UP_LEFT, PA_SCROLL_UP_RIGHT, PA_SCROLL_DOWN_LEFT, PA_SCROLL_DOWN_RIGHT, #endif // ENA_SCR_DIA #if ENA_WIPE PA_WIPE, PA_WIPE_CURSOR, #endif // ENA_WIPES #if ENA_OPNCLS PA_OPENING, PA_OPENING_CURSOR, PA_CLOSING, PA_CLOSING_CURSOR, #endif // ENA_OPNCLS #if ENA_GROW PA_GROW_UP, PA_GROW_DOWN, #endif // ENA_GROW #if ENA_MISC PA_SLICE, PA_MESH, PA_FADE, PA_DISSOLVE, PA_BLINDS, PA_RANDOM, #endif //ENA_MISC #if ENA_SCAN PA_SCAN_HORIZ, PA_SCAN_VERT, #endif // ENA_SCAN }; // Global Variables ------------------ // Parola with HARDWARE SPI MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); // SOFTWARE SPI //MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES); #if USE_ALTSOFTSERIAL AltSoftSerial BTChan = AltSoftSerial(); #else SoftwareSerial BTChan = SoftwareSerial(BT_RECV_PIN, BT_SEND_PIN); #endif #define SIG0 0x55 #define SIG1 0xaa struct globalData { uint8_t signature[2]; // recognise this as a valid setup uint16_t scrollSpeed; // frame delay value in ms uint16_t scrollPause; // msg pause in ms uint8_t effectI; // in effect index into table uint8_t effectO; // out effect index into table uint8_t align; // justification index into table uint8_t intensity; // display intensity bool bInvert; // display inverted char msg[BUF_SIZE+1]; // the message being displayed } G; // Global message buffers shared by BT and Scrolling functions char newMessage[BUF_SIZE+1] = { '\0' }; bool newMessageAvailable = false; bool newConfigAvailable = false; // Application Code ------------------ void(*hwReset) (void) = 0; //declare reset function @ address 0 void writeGlobal(void) { PRINTS("\nSaving Global"); EEPROM.put(EEPROM_START_ADDR, G); } void readGlobal(bool bInit = false) { PRINTS("\nLoading Global"); EEPROM.get(EEPROM_START_ADDR, G); if (bInit || G.signature[0] != SIG0 || G.signature[1] != SIG1) // set the default parameters { PRINTS("\nInitialising Global"); G.signature[0] = SIG0; G.signature[1] = SIG1; G.scrollSpeed = 25; G.scrollPause = 2000; G.effectI = G.effectO = 0; G.align = 1; G.intensity = 7; G.bInvert = false; strcpy(G.msg, "Setup"); writeGlobal(); } newConfigAvailable = true; } bool BT_getATCmd(char* szBuf, uint8_t lenBuf, bool fReset = true) // Copy the AT command from PROGMEM into the buffer provided // The first call should reset the index counter // Return true if this is the last command { static uint16_t cmdIdx; if (fReset) cmdIdx = 0; strncpy_P(szBuf, ATCmd + cmdIdx, lenBuf); cmdIdx += (strlen_P(ATCmd + cmdIdx) + 1); return(pgm_read_byte(ATCmd + cmdIdx) == '\0'); } bool BT_getATResponse(char* resp, uint8_t lenBuf) // Get an AT response from the BT module or time out waiting { const uint16_t RESP_TIMEOUT = 500; uint32_t timeStart = millis(); char c = '\0'; uint8_t len = 0; *resp = '\0'; while ((millis() - timeStart < RESP_TIMEOUT) && (c != '\n') && (len < lenBuf)) { if (BTChan.available()) { c = BTChan.read(); *resp++ = c; *resp = '\0'; len++; } } return(len != '\0'); } void BT_sendACK(char resp) // Send a protocol ACK to the BT master { static char msg[] = { PKT_START, PKT_CMD_ACK, PKT_ERR_OK, PKT_END, '\n', '\0' }; msg[2] = resp; PRINT("\nResp: ", msg); BTChan.print(msg); BTChan.flush(); } void BT_begin(void) // initialise the BT device for different hardware { const uint16_t BAUD = 9600; char szCmd[20], szResp[16]; uint8_t i = 0; bool fLast = false; PRINT("\nStart BT connection at ", BAUD); BTChan.begin(BAUD); #if HW_USE_HC05 // Switch the HC05 to setup mode using digital I/O pinMode(HC05_SETUP_ENABLE, OUTPUT); digitalWrite(HC05_SETUP_ENABLE, HIGH); delay(10); // just a small amount of time digitalWrite(HC05_SETUP_ENABLE, LOW); #endif // Process all the AT commands for the selected BT module // Send each command, read the response (or time out) and then // do the next one. // First item is always the name! do { fLast = BT_getATCmd(szCmd, ARRAY_SIZE(szCmd), (i == 0)); // Print the preamble, AT command, end of line by assembling the // data into a string of allocated memory. This allows the data to // send out in one hit rather than piecemeal. char *sz = (char *)malloc((strlen(szStart) + strlen_P(szCmd) + \ strlen(BT_NAME) + strlen(szEnd) + 1) * sizeof(char)); strcpy(sz, szStart); strcat(sz, szCmd); if (i == 0) // first item - insert the name strcat(sz, BT_NAME); strcat(sz, szEnd); BTChan.print(sz); BTChan.flush(); free(sz); i++; // Wait for and get the response, except for the // last one when we don't care as normally a RESET. if (!fLast) { if (!BT_getATResponse(szResp, ARRAY_SIZE(szResp))) { PRINT("\nBT err on ", szCmd); PRINT(":", szResp); } } } while (!fLast); BTChan.flush(); } uint8_t BT_executeCommand(uint8_t cmd, char *pd) { uint8_t sts = PKT_ERR_OK; // assume all ok ... PRINT("\nexecuting ", (char)cmd); PRINT(" with '", pd); PRINTS("'"); switch (cmd) { case PKT_CMD_RESET: hwReset(); break; case PKT_CMD_FACSET: readGlobal(true); PRINTS("\nCMD Factory Settings"); break; case PKT_CMD_BRIGHT: G.intensity = (G.intensity + 1) % (MAX_INTENSITY + 1); PRINT("\nCMD Brightness ", G.intensity); break; case PKT_CMD_IANIM: G.effectI = (G.effectI + 1) % ARRAY_SIZE(textEffect); PRINT("\nCMD In Animation ", G.effectI); break; case PKT_CMD_OANIM: G.effectO = (G.effectO + 1) % ARRAY_SIZE(textEffect); PRINT("\nCMD Out Animation ", G.effectO); break; case PKT_CMD_INVERT: G.bInvert = !P.getInvert(); PRINT("\nCMD Invert ", G.bInvert ? "on" : "off"); break; case PKT_CMD_JUSTIFY: G.align = (G.align + 1) % ARRAY_SIZE(textPosition); PRINT("\nCMD Text Align ", G.align); break; case PKT_CMD_SAVE: writeGlobal(); PRINTS("\nCMD Save"); break; case PKT_CMD_MESSAGE: strcpy(newMessage, pd); newMessageAvailable = true; PRINT("\nCMD Message '", newMessage); PRINTS("'"); break; case PKT_CMD_SPEED: case PKT_CMD_TPAUSE: { int16_t v = atoi(pd); if (v < 0 || v > 10000) sts = PKT_ERR_DATA; else { if (cmd == PKT_CMD_SPEED) { G.scrollSpeed = v; PRINT("\nCMD Speed ", v); } else { G.scrollPause = v; PRINT("\nCMD Pause ", v); } } } break; default: sts = PKT_ERR_CMD; PRINT("CMD Error - ", cmd); break; } // set global flags newConfigAvailable = (sts == PKT_ERR_OK && cmd != PKT_CMD_MESSAGE); return(sts); } void BT_getCommand(void) // Call repeatedly to receive and process characters waiting in the serial queue // Return true when a good message is fully received { static enum { ST_IDLE, ST_CMD, ST_DATA, ST_END } state = ST_IDLE; static uint32_t timeStart = 0; static char cBuf[BUF_SIZE+1]; static uint16_t countBuf; static char cmd = '\0'; static bool prevEsc, inEsc = false; // check for timeout if we are currently mid-packet if (state != ST_IDLE) { if (millis() - timeStart >= BT_COMMS_TIMEOUT) { BT_sendACK(PKT_ERR_TOUT); timeStart = 0; state = ST_IDLE; } } // process the next character if there is one if (BTChan.available()) { char ch = BTChan.read(); // deal with the escape sequence indicator prevEsc = inEsc; inEsc = (ch == PKT_ESC && !prevEsc); // now run the FSM switch (state) { case ST_IDLE: // waiting start character if (!prevEsc && ch == PKT_START) { PRINT("\nPkt Srt ", ch); state = ST_CMD; cmd = cBuf[0] = '\0'; timeStart = millis(); countBuf = 0; } break; case ST_CMD: // reading command cmd = ch; // save the command until we have a full protocol packet PRINT("\nPkt Cmd ", cmd); switch (ch) { case PKT_CMD_RESET: case PKT_CMD_FACSET: case PKT_CMD_BRIGHT: case PKT_CMD_IANIM: case PKT_CMD_OANIM: case PKT_CMD_INVERT: case PKT_CMD_JUSTIFY: case PKT_CMD_SAVE: case PKT_CMD_MESSAGE: case PKT_CMD_SPEED: case PKT_CMD_TPAUSE: state = ST_DATA; break; default: BT_sendACK(PKT_ERR_CMD); cmd = '\0'; state = ST_IDLE; break; } break; case ST_DATA: // reading data if (countBuf >= BUF_SIZE) // message too large - stop processing it now { PRINTS("\nBuffer overflow"); BT_sendACK(PKT_ERR_DATA); state = ST_IDLE; } else if (ch == PKT_END && !prevEsc) // end character not escaped { PRINT("\nPkt end @", countBuf); cBuf[countBuf] = '\0'; // terminate the string BT_sendACK(BT_executeCommand(cmd, cBuf)); state = ST_IDLE; } else if (!inEsc) // not escaping, so save this { PRINT("\nPkt cBuf[", countBuf); PRINT("]:", ch); cBuf[countBuf++] = ch; } break; default: // something screwed up - reset the FSM state = ST_IDLE; BT_sendACK(PKT_ERR_SEQ); break; } } } void setup() { #if DEBUG Serial.begin(57600); #endif PRINTS("\n[Parola_BT_Control Debug]"); readGlobal(); P.begin(); P.displayClear(); BT_begin(); } void loop() { // get the next thing from the BT channel BT_getCommand(); // if the config has changed, need to change the display parameters if (newConfigAvailable) { PRINTS("\nSetting new config"); P.setSpeed(G.scrollSpeed); P.setPause(G.scrollPause); P.setTextEffect(textEffect[G.effectI], textEffect[G.effectO]); P.setTextAlignment(textPosition[G.align]); P.setIntensity(G.intensity); P.setInvert(G.bInvert); P.setTextBuffer(G.msg); P.displayReset(); newConfigAvailable = false; } // if we have a new message, copy it over if (newMessageAvailable) { PRINTS("\nSetting new message"); strcpy(G.msg, newMessage); P.displayReset(); newMessageAvailable = false; } // keep the animation going in all cases if (P.displayAnimate()) P.displayReset(); } Demo: 8 dot matrix module Pay and get arduino code and .aia file. Android application: Download app: https://drive.google.com/file/d/1X5bxwOOY8HEDI2v6Z8VnsiMyzyGJmB7p/view?usp=sharing

  • Visitor Counter with Automatic light Control using IR sensor

    In this project, we will make a Arduino based Visitor Counter with an Automatic Light Control System using Infrared sensor. The pair of IR sensors can detect the visitor IN/OUT directions and display presence of Visitor inside the building or store. The device counts the total number of people presence and automatic light. When no people are inside the room, i.e. the total number of people presence is zero then the room light is turned off. Circuit Diagram Components Required Arduino Uno - 1 no LCD16x2 I²C - 1no Obstacle Avoidance IR sensor Module - 2 nos Relay 1 channel - 1 no Infrared Obstacle Avoidance IR Sensor Module The IR sensor module consists mainly of the IR Transmitter and Receiver, Opamp, Variable Resistor (Trimmer pot), output LED in brief. IR LED Transmitter IR LED emits light, in the range of Infrared frequency. IR light is invisible to us as its wavelength (700nm – 1mm) is much higher than the visible light range. IR LEDs have light emitting angle of approx. 20-60 degree and range of approx. few centimeters to several feet's, it depends upon the type of IR transmitter and the manufacturer. Some transmitters have the range in kilometers. IR LED white or transparent in colour, so it can give out amount of maximum light. Photodiode Receiver Photodiode acts as the IR receiver as its conducts when light falls on it. Photodiode is a semiconductor which has a P-N junction, operated in Reverse Bias, means it start conducting the current in reverse direction when Light falls on it, and the amount of current flow is proportional to the amount of Light. This property makes it useful for IR detection. Photodiode looks like a LED, with a black colour coating on its outer side, Black colour absorbs the highest amount of light. LM358 Opamp LM358 is an Operational Amplifier (Op-Amp) is used as voltage comparator in the IR sensor. the comparator will compare the threshold voltage set using the preset (pin2) and the photodiode’s series resistor voltage (pin3). Photodiode’s series resistor voltage drop > Threshold voltage = Opamp output is High Photodiode’s series resistor voltage drop < Threshold voltage = Opamp output is Low When Opamp's output is high the LED at the Opamp output terminal turns ON (Indicating the detection of Object). Variable Resistor(Preset POT) The variable resistor used here is a preset. It is used to calibrate the distance range at which object should be detected. How to Use IR Sensor Module? The 5 VDC supply input is given to the VCC pin and the supply negative is connected to the GND terminal of the module. When no object is detected within the range of the IR receiver, the output LED remains off. When a object is detected within the range of the IR sensor the LED glows. Applications Obstacle Detection Industrial safety devices Wheel encoder Pin Configuration Pin Name Description VCC Power Supply Input GND Power Supply Ground OUT Active High Output IR Sensor Module Features 5VDC Operating voltage I/O pins are 5V and 3.3V compliant Range: Up to 20cm Adjustable Sensing range Built-in Ambient Light Sensor 20mA supply current Mounting hole Installing the Arduino Library LiquidCrystal_I2C.h : you need to Download and install the LiquidCrystal_I2C library. Follow the next steps to install those libraries. In your Arduino IDE, to install the libraries go to Sketch > Include Library > Add .ZIP library… and select the library you’ve just downloaded. After installing the required libraries, copy the following code to your Arduino IDE. Subscribe and Download code. After a successful upload, open the Serial Monitor at a baud rate of 9600. Press the “EN/RST” button on the Arduino Uno board and Open Serial monitor and see the result in Serial monitor.

  • Node MCU Based Water Level Controller with EEPROM

    In this tutorial, I 'll Published how to controlling Water level using web server over WiFi using Node MCU, Ultrasonic, OLED display and multiple web pages. In this project Automatic and semi manual mode water level controller through assigned web page and Level graphical display using fusion charts and level graph using high charts in separate web pages is advantage of the project. Components Required To make this project you need the following components: Node MCU ESP8266 Development Board - 1 no HC-SR04 Ultrasonic sensor - 1 no 0.96 OLED Display 4wire Module - 1 no 3.3V single Channel Relay Module - 1 no 4k7 Resistor - 1 no Push Button - 1 no Jumper wires Circuit Diagram Ultrasonic: The HC-SR04 ultrasonic module is a module that can provide non-contact measurement within the range of 2cm to 400cm with ranging accuracy that can reach 3mm. It works on the principle of echolocation. The ultrasonic sensor as a trigger and an echo pin. The arduino provides a high signal of 10microseconds to this pin. After the HC-SR04 is triggered, it sends out eight 40Khz sound waves to the surface of the water. On getting to the surface of the water, the wave is echoed back to the sensor and the ESP8266 reads the echo pin to determine time spent between triggering and receiving of the echo. Since we know that the speed of sound is around 340m/s then we can calculate the distance using; Distance = (time/2)*speed of sound. Flat Slider Here's a nice example of a modern, flat style slider using pips. There are no labels so this kind of slider would be purely visual without much help to the user for knowing their real chosen value. In this example we make use of the .ui-slider-pip-inrange class to create the nice "filled in" effect on the pips. https://simeydotme.github.io/jQuery-ui-Slider-Pips/ The default way to use the plugin is to call the pips method on an initialized slider. This will add the markers along the slider, and place the min/max values to the beginning/end of the slider: In this Project jQuery UI Slider Pips added in the Web page to adjust the Value between two points 0 to 100. 1st Point for water Level Lower Threshold value adjustment slider to Control Motor ON. 2nd Point for water Level Higher Threshold value adjustment slider to Control Motor OFF. Fusion Charts Fusion Charts helps you build beautiful dashboards for your web & mobile projects. With extensive documentation, cross-browser support, and a consistent API, it is easier than ever to add interactive and responsive charts. From simple charts like line, column, and pie to domain-specific charts like heat maps, radar, and stock chart Cylinder Fill The cylinder gauge is represented by a vertical cylinder, whose fill level is defined by the data value you plot. You can use it to report inventory levels, fuel levels, etc. The cylinder gauge is a real-time chart, which can update its data after intervals you specify, without any page refreshes. What makes a cylinder gauge different from other gauges is that this gauge can only be rendered with one fill color. You cannot create a cylinder gauge with color ranges. The cylinder is the main component in a cylinder chart. You can understand the value being illustrated by looking at the percentage of cylinder filled. Use the following attributes to create a simple cylinder gauge: Specify the type using the type attribute. To render Cylinder gauge, set cylinder. Set the container object using renderAt attribute. Specify the dimension of the chart using width and height attributes. Set the type of data (JSON/XML) you want to pass to the chart object using dataFormat attribute. Use the lowerLimit attribute to specify the lower limit, or the minimum value, of the gauge scale. Use the upperLimit attribute to specify the upper limit, or the maximum value, of the gauge scale. Use the lowerLimitDisplay attribute to specify the label to be displayed with the lower limit value on the gauge scale. Use the upperLimitDisplay attribute to specify the label to be displayed with the upper limit value on the gauge scale. Use the numberSuffix attribute to specify the character(s) to be appended to the end of a number. https://www.fusioncharts.com/dev/chart-guide/gauges-and-widgets/cylinder-gauge Bulp Gauge Bulb gauge is used to indicate a specific dataset by utilizing a circle that indicates whether the monitored data is within defined limits, and if it is, then which limit does it belong to. Colors for the bulb can be selected to suit the application such as green for satisfactory, yellow for caution, and red for alarm. https://www.fusioncharts.com/dev/chart-guide/gauges-and-widgets/bulb-gauge High Charts High Charts make it easy for developers to create charts for web and mobile platforms. For Javascript, Angular, React, VueJS, iOS, R, .NET, Python, and more. Line Charts The line chart is represented by a series of data points connected with a spline. Line charts are most often used to visualize data that changes over time. Subscribe Arduino Code #include #include #include #include "index.h"; #include #include #include #include #include #include #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) #define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); #include int addr = 0; int distance; #define buttonPin D0 int buttonState = 0; float TankHeight; int Motor_Pinvalue; const int Motor_Pin = D7; String data; String lowset; String highset; UltraSonicDistanceSensor distanceSensor(D5,D6); //D5 trig, D6=echo int waterLevelLowerThreshold=20; int waterLevelUpperThreshold=75; float liters = 0; int waterLevelDownCount=0,waterLevelUpCount=0; WiFiClient client; ESP8266WebServer server(80); void handleRoot() { String s = MAIN_page; //Read HTML contents server.send(200, "text/html", s); //Send web page } void handleLevelRequest(){ server.send(200,"text",String(liters)); } void handleDistanceRequest(){ server.send(200,"text",String(distanceSensor.measureDistanceCm())); } void handleNotFound(){ String message = "File Not Found\n\n"; server.send(404, "text/plain", message); } void handleStatus(){ Serial.print("Motor:"); Serial.print(digitalRead(Motor_Pin));//MOTOR Off/On server.send(200,"text",String(digitalRead(Motor_Pin))); } void handleRangeSetting(){ waterLevelLowerThreshold=(server.arg(0)).toInt(); waterLevelUpperThreshold=(server.arg(1)).toInt(); Serial.print("Low Level "); Serial.print(waterLevelLowerThreshold); Serial.print(":"); Serial.print("High Level "); Serial.println(waterLevelUpperThreshold); server.send(200, "text/plain", "range"); } void measure_Volume() { distance = distanceSensor.measureDistanceCm(); // volume=(MAX_HEIGHT-heightInch)/28;//MAX_HEIGHT-distance will give actual height, liters = ((1-(distance/TankHeight))*100); Serial.println("Level:"); Serial.println(liters); if(liters<=waterLevelLowerThreshold) waterLevelDownCount++; else waterLevelDownCount=0; if(liters>=waterLevelUpperThreshold) waterLevelUpCount++; else waterLevelUpCount=0; if(waterLevelDownCount==3) {//TURN ON RELAY Serial.println("motor turned on"); digitalWrite(Motor_Pin,HIGH);//Relay is active LOW } if(waterLevelUpCount==3) {//TURN OFF RELAY Serial.println("motor turned off"); digitalWrite(Motor_Pin,LOW);//Relay is active LOW } } void handleMotor_Pinon() { digitalWrite(Motor_Pin,HIGH); //Motor_Pin is connected in reverse server.send(200, "text/html", "ON"); //Send ADC value only to client ajax request } void handleMotor_Pinoff() { digitalWrite(Motor_Pin,LOW); //Motor_Pin off server.send(200, "text/html", "OFF"); //Send ADC value only to client ajax request } void runPeriodicFunc() { static const unsigned long REFRESH_INTERVAL1 = 1000; // 2.1sec static unsigned long lastRefreshTime1 = 0; if(millis() - lastRefreshTime1 >= REFRESH_INTERVAL1) { measure_Volume(); handleDisplay(); lastRefreshTime1 = millis(); } } void setup(void){ Serial.begin(115200); delay(100); EEPROM.begin(512); pinMode(Motor_Pin, OUTPUT); // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever } display.display(); //WiFi.begin(ssid, password); //Serial.println(""); WiFiManager wifiManager; wifiManager.autoConnect("Smart Level"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.print("IP address:"); Serial.println(WiFi.localIP()); display.display(); display.setTextSize(2); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(0, 17); for (int i=0; i<=5; i++) { display.setCursor(0, 17); Serial.println("Press & Hold Button "); display.setCursor(0, 47); Serial.println(3-i); Serial.println(" Seconds "); delay(1000); buttonState = digitalRead(buttonPin); if (buttonState == LOW) // Button to GND connection { distance = distanceSensor.measureDistanceCm(); TankHeight = distance; EEPROM.write(addr, TankHeight); EEPROM.commit(); } delay(100); } { TankHeight= EEPROM.read(addr); display.clearDisplay(); display.display(); display.setTextSize(2); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(0, 1); Serial.println("Tank Height Scan"); Serial.println(" "); Serial.println(" cm ... "); Serial.print("TankHeight : "); Serial.println(TankHeight); delay(1000); display.setCursor(30, 1); Serial.println("Tank Height Cm:"); Serial.print("TankHeight : "); Serial.println(TankHeight); Serial.println("IP :"); Serial.println(WiFi.localIP()); } server.on("/", handleRoot); server.on("/level",handleLevelRequest); server.on("/distance",handleDistanceRequest); server.on("/configRange",handleRangeSetting); server.on("/motor_status",handleStatus); server.on("/Motor_PinOn", handleMotor_Pinon); server.on("/Motor_PinOff", handleMotor_Pinoff); server.on("/readdisplay",handleDisplay); server.onNotFound(handleNotFound); server.begin(); Serial.println("HTTP server started"); } void loop(void){ runPeriodicFunc(); server.handleClient(); } void handleDisplay() { // volume=(MAX_HEIGHT-heightInch)/28;//MAX_HEIGHT-distance will give actual height, display.clearDisplay(); display.setTextSize(1); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(2, 2); display.println("IP: "); display.setCursor(22,2); display.println(WiFi.localIP()); display.display(); display.setTextSize(3); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(0, 17); display.println(String(liters)); display.println(" "); display.display(); delay(100); if (digitalRead(Motor_Pin)>=1) { Serial.println("Pump Motor : ON "); } else { Serial.println("Pump Motor : OFF "); } Motor_Pinvalue = digitalRead(Motor_Pin); Serial.println(digitalRead(Motor_Pin)); display.setTextSize(1); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(0, 45); display.print("L: "); display.print(waterLevelLowerThreshold); display.display(); display.setTextSize(1); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(70, 45); display.print("H: "); display.print(waterLevelUpperThreshold); display.display(); if (digitalRead(Motor_Pin)==LOW){ display.setTextSize(1); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(0, 55); display.print("Pump OFF "); display.display();} else if (digitalRead(Motor_Pin)==HIGH){ display.setTextSize(1); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(0, 55); display.print("Pump ON"); display.display();} display.setTextSize(1); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(70, 55); display.print(TankHeight); display.display(); String data = "{\"Height\":\""+String(TankHeight)+"\", \"TankLevel\":\""+ String(liters) +"\", \"LowLevelThreshold\":\""+ String(waterLevelLowerThreshold) +"\", \"HighLevelThreshold\":\""+ String(waterLevelUpperThreshold) +"\", \"Motorstatus\":\""+ (digitalRead(Motor_Pin)) +"\"}"; //Serial.println("data:"); // Serial.println(data); server.send(200, "text/plane", data); } Subscribe Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve configure your WiFi Credentials using mobile. After a successful upload, open the Serial Monitor at a baud rate of 115200. Press the “EN/RST” button on the ESP8266 board. Now it should print its IP address Pay and get index.h file, arduino code and library files. Demo: Subscribe

  • NodeMCU Web Server Controlled Servo Motor Using Angular Slider

    In this tutorial, we will explore to control the Pan & Tilt servo using ESP8266 web server angular slider. The servo position can vary from 0 to 180 degree and can be controlled through a Web Page slider. When this web page is accessed from a computer or mobile phone that is connected to the same WiFi Network as the ESP8266, you can control the position of the Servo Motor by adjusting the slider. Circuit Diagram Components Required ESP8266 12E Servo Motor SG90 or MG90S Pan tilt Servo Bracket Installing Library you need to add Servo.h and FS.h from library. After installing the required libraries, copy the following code to your Arduino IDE. Finally, to build the web server we need two different files. One is The Arduino sketch and the other is an HTML file. So, the HTML file should be saved inside a folder called data. It resides inside the Arduino sketch folder, as shown below: Create an index.html file with the following content. The index.html file will contain web pages that will be displayed by the server along with JavaScript that will process the formation of graphics. While all server programs and sensor readings are in the .ino file. arduino code #include #include #include //Include File System Headers #include const char* htmlfile = "/index.html"; // Replace with your network credentials const char* ssid = "TP-Link_3200"; // your SSID const char* password = "95001121379884265554"; // Your Wifi password #define ServoPin 5 //D1 #define Servo2Pin 4 //D2 int pos = 100; int pos2 = 100; Servo myservo; // create servo object to control a servo Servo myservo2; // create servo object to control a servo ESP8266WebServer server(80); void handlePOS(){ String POS = server.arg("ppos"); int pos = POS.toInt(); myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); Serial.println("Pan Servo:"); Serial.println(pos); server.send(200, "text/plane",""); } void handlePOS2(){ String POS2 = server.arg("tpos"); int pos2 = POS2.toInt(); myservo2.write(pos2); // tell servo to go to position in variable 'pos' delay(15); Serial.println("Tilt Servo:"); Serial.println(pos2); server.send(200, "text/plane",""); } void handleRoot(){ server.sendHeader("Location", "/index.html",true); //Redirect to our html web page server.send(302, "text/plane",""); } void handleWebRequests(){ if(loadFromSpiffs(server.uri())) return; String message = "File Not Detected\n\n"; message += "URI: "; message += server.uri(); message += "\nMethod: "; message += (server.method() == HTTP_GET)?"GET":"POST"; message += "\nArguments: "; message += server.args(); message += "\n"; for (uint8_t i=0; i

bottom of page