rain sensor HL-83 HL-01

684
rain sensor HL-83 HL-01

Components Used

Powered byMouser Electronics

Rain sensor with ATMEGA32a.

 

Rain sensor comes with a driver, specifically providing Analog as well as Digital output pin.

The values of analog pin varies in accordance with the Vcc voltage.

Make sure to turn off Pullup resistors for digital pin. The digital output is active low i.e. it will go low, as soon as rain will be detected. 

In our project we specifically read analog values and displayed it on serial monitor using usart (Arduino serial monitor (9-bit mode)).

The controller in play is Atmega32a, which is again programmed in Atmel studio. Also a seperate usart module is used for communication.

The pins are connected as follows: 

Pins (module)Pins (Controller)
A0PORTA - 0
D0PORTC - 0
GNDGnd
VCCVcc

connection for UART module are as follows:

Pins (UART module)Pins (controller)
TxPORTD-1
RxPORTD-0
VccVCC
GndGND

 

The code of the program is as follows:

#include <avr/io.h>
#include "libs/uartlib/uartlib.h"
#include "libs/adclib/adclib.h"

int main(void)
{
	adc_init(2);
	UART_init(9600);
	
    while (1) 
    {
		char tmp[20];
		//char tmp2[20];
		
		dtostrf(adc_read(0),0,0,tmp);
		UART_SendString("rain range : ");
		UART_SendString(tmp);
		UART_SendString("\n");
    }
}

Credits

Built by 1 contributor

Comments0

Join the discussion — share a question or tip.

Be the first to share your thoughts on this project.