In this post we are creating an arduino based rain alert alarm circuit with the code explanation line by line.Here we also discuss about the working of the rain water sensor which includes the intensity of rain falls into the circuit
Rain water sensor working
This module works on the basics of opamp LM393, The sensor board is coated with Nickel as lines which helps analyse the moisture content in the board. when there is moisture content the resistance is low and when the board is dry the resistance will be high and the opamp amplifies the output
Adopts high quality of RF-04 double sided material.
Area: 5cm x 4cm nickel plate on side,
Anti-oxidation, anti-conductivity, with long use time;
Comparator output signal clean waveform is good, driving ability, over 15mA;
Potentiometer adjust the sensitivity;
Working voltage 5V;
Output format: Digital switching output (0 and 1) and analog voltage output AO;
With bolt holes for easy installation;
Small board PCB size: 3.2cm x 1.4cm;
Uses a wide voltage LM393 comparator
//paste this code in arduino IDE
const int sensorMin = 0; // set minimum sensor value
const int sensorMax = 1024; //set maximum sensor value
//void setup is single time running program in Arduino
Serial.begin(9600);//here we initialize the baud rate to 9600
//loops are continuously executing the programme in Arduino programming
int sensorReading = analogRead(A0); //to read analog value from the A0 pin
int range = map(sensorReading, sensorMin, sensorMax, 0, 3); //map funtion to map the values to our rated range
HC-SR04 ultrasonic module is generally used t calculate the distance.As name implied this module works by creating ultrasonic sound and the time required to reach its echo(operating range 2cm to 400cm)
The smart dustbin is an Arduino based project which is an innovative method to keep the city clean, top of the dustbin will open automatically when a person approaches the dustbin and get closed when he returns
Ultrasonic sensor work based on the ultrasonic sound, ultrasonic sensor continuously monitor the echo signal and detect the obstacle in front of the device if the obstacle is within the threshold range by using a mathematical formula (Distance (in cm) = (duration/2) / 29). then microcontroller and make a decision to open the cap of the dustbin by using a servo motor ,
Arduino is an opensource platform which is an easy to use hardware-based development, This development boards are commonly used Atmel based microcontroller which is programmed by using Arduino IDE(Integrated Development Environment). This freeware can be downloaded from the Arduino official site or use can program in a web-based platform named as Arduino create
16Mhz CLK speed
5v operating voltage
Input voltage can be vary from 7v to 12V(recommended)
The input voltage ranges from 6v to 20V
14 Digital input/output pins
6 Analog i/p pins
40 mA DC Current for each input/output pin
Flash Memory is 32 KB
SRAM is 2 Kb
Pin diagram of arduino uno
Once you purchase Arduino UNO (buy now ) you can connect with the computer after installing Arduino ide, Then you need to choose the development board and port from the tools option
Adruino was written in C++ also with some other functions and specific methods which are called as a sketch in Arduino IDE and then it process and compiles to machine language
For open serial monitoring option, we can see a magnifying glass icon in the right top of the Arduino IDE. This tool is mainly used for interacting the Arduino development board with the computer. Which means this tool help to debug and monitoring of the real-time program similarly like serial monitor Arduino also have a serial plotter which helps to plot the graph of a realtime running Arduino application
Inverters are made for producing high voltage from low voltage DC sources/batteries. We are here to design an inverter circuit for converting 12V DC source into 220V AC power. Its components are easily available in our electronics markets and so easy to build on PCB boards.
Operations of this kind of inverters are based on switching pulses and were uses step-up transformers. So, the CD4047 microcontroller acts as a switching pulse oscillator and IRFZ44N (N-channel power MOSFET) acts as it’s switch. Then the 12-0-12 secondary transformer will inversely used as a step-up transformer.
Inverter Circuit Diagram
Power MOSFET IRFZ44 = 2.
12-0-12V secondary transformer 1 amps
Variable Resistor 22KΩ
Resistors 100Ω / 10 watts = 2
12 volt battery
Construction & Working
This inverter circuit has switch device and step-up transformer. As per the theories, high switch frequency pulse reaches the step up transformer and due to the mutual inductance; output voltage will reach high value.
The microcontroller CD 4047 is configured as an astable multi-vibrator mode with the help of variable resistor RV1 and capacitor C1. By varying the value of RV1, we will collect different range of output pulse at Q and Q’ pins. These all results the variation of output voltage at the step-up transformer.
The IRFZ44 (N-channel power MOSFET) will drain, pins are connected with secondary pins of the transformer and common pin connected with the secondary winding and is connected with battery positive bias. Both MOSFETs source pins are connected to the negative bias of battery. And these are driven by Q and Q’ output from CD4047 micro-controller. If an alternate square pulse drives the MOSFETs switches, the secondary winding may forced to induce alternate magnetic field. This magnetic field induce primary winding of transformer and will produce high alternate voltage.
Note: High AC voltage circuit. Attention for handle with extreme care.
The NodeMCU board is based on an ESP8266-12 but features a built-in serial over USB interface and other amenities like 2 buttons and 2 LEDs. The board is compact and fits on a breadboard. The board can be programmed using the Wiring / Arduino framework as the other ESP8266 boards.
It features more available GPIOs, of which
9 digital GPIOs operating at 3,3V
One analog GPIO, limited to 1.8 V.
The NodeMCU uses the CH340 serial to USB programmer, which requires the installation of a specific driver. NodeMCU is a Wi-Fi SOC (System On a Chip) produced by Espressif Systems. It is based ESP8266 -12E WiFi module. It is an highly integrated chip designed to provide full internet connectivity in a small package. ESP8266 is a low-cost, WiFi Module chip that can be configured to connect to the Internet for Internet of Things(IoT) and similar Technology Projects. It can be programmed directly through USB port using LUA programming or Arduino IDE. By simple programming we can establish a WiFi connection and define input/output pins according to your needs exactly like arduino, turning into a web server and a lot more. NodeMCU is the WiFi equivalent of ethernet module. It combines the features of WiFi access point and station + microcontroller. These features make the NodeMCU extremely powerful tool for WiFi networking. It can be used as access point or station, host a web server or connect to internet to fetch or upload data.
Programmable WiFi module.
Arduino-like hardware Input-Output.
Can be programmed with the simple and powerful Lua programming language or Arduino IDE.
USB-TTL included, plug & play.
10 GPIOs D0-D10, PWM functionality, IIC and SPI communication, 1-Wire and ADC A0 etc. all in one board.
Event-driven API for network applications.
Wi-Fi Networking enabled
Software and Drivers:
The IDE (Integrated Development Environment) is a specific release of Arduino-Compatible IDE with ESP8266 Support developed by Ivan Grokhotkov. The IDE is runs on Windows, Mac OS X and Linux.
Arduino-like hardware IO:
Advanced API for hardware IO, which can reduce the unnecessary work for configuring and manipulating hardware. Code like Arduino, but interactively in Lua script.
NodeJS style network API:
Event-driven API for network applications. Highly speed up evey IOT application developing process.
Lowest cost WI-FI:
Less than Rs.140 WI-FI MCU ESP8266 integrated and easy to prototyping development kit. NodeMCU provides the best platform for IOT application development at the lowest price.
Advantages of NodeMCU:
The ESP8266 is a low-cost Wi-Fi enabled microchip with full TCP/IP stack and microcontroller capability.
NodeMCU includes CPU core, faster Wi-Fi, more GPIOs, and supports Bluetooth 4.2, and low power Bluetooth.
Additionally, the ESP32 comes with touch sensitive pins, and built-in Hall Effect sensor and temperature sensor.
Very cheap as compared to Arduino Uno.
Disadvantages of NodeMCU:
Need to learn a new language and IDE
Reduced pin out
Arduino is a development board with sets of digital and analog input/output (I/O) pins that converts the codes into physical affects. In this platform, Arduino can serve as a node by connecting sensors to it. Arduino is an open source that allows anyone interested to contribute. It have large libraries and sample projects developed worldwide it is one of the most used microcontroller board. Arduino has an Atmel AVR microcontroller (ATmega328P), and other necessary side units for programming and connecting to other boards. There is at least 5V power-supply and 16 MHz crystal oscillator. Arduino’s microcontroller is pre-programmed with a boot loader so it does not need an external chip programmer.
Arduino IDE (Integrated Development Environment)
AVRDude (Software that programs the microcontroller on Arduino), and Compiler (AVR-GCC).
Arduino software is consists of IDE and libraries. IDE is a cross-platform application written in Java. It originated from the IDE for the languages processing. The libraries are written in C and C++, and compiled with AVR-GCC and ACR Libc.
Arduino libraries helps everyone program easily.
Everyone can process, received analog and digital signals.
Also can design interactive robots or systems by using the sensor signals.
Can have their system respond in motion, voice or light.
Arduino has various designs of boards for various solutions.
Pros – Arduino:
Low power architectures.
Easy to get started with great online support, rapid prototyping makes easy.
Easy interfacing with sensors and data collection.
Can send data wirelessly using Bluetooth, RF etc to the server via a computer.
A lot of GPIOs with PWM capabilities.
Everyone can use IDE, python, ruby, embedded C etc for programming it.
It’s completely an Open-source.
Memory limitations (ATmega328P has 32KB of Flash memory for the boot-loader + uploaded sketch, and only 2KB SRAM for runtime data.)
Costlier than NodeMCU
Connectivity to the internet needs additional shields which are not cost friendly, especially in India.
Can’t run a lot heavy algorithms, or interface say a touch-screen, etc without using additional shields.