Input devices



Assignment : Measure something: add a sensor to a microcontroller board that you've designed and read it

In this week we have to read sensor input through microcontroller In electronic design this sensory part is most imporatant ;as I learned so many thiongs and tried on different sensor inputs. For my final project its required to measure moisture content inside soil . So I used soil moisture sensor to read this and this one is my input device for assignment.

Here I used Hello world board as a main unit. Its fabricated in Electronic design assignment and used here. You can see here about my Hello world board.

Grass Cutter Front View



Circuit description :

Inside Attiny44 datasheet there are two ports ,8 bit I/O Port A and 4bit I/O Port B. Both this can we set as either input or output port.Here I used PORT A0 pin as ainput pin for soil moisture sensor ;Also PORT A1 pin is output pin which is attached to relay to show results. Also attached one indiactor LED at pin PA3 to see operation.

Sensor: Soil moisture sensor I used is purchased from Local market having no. YL-38. .This mainly have three terminals VCC GND and signal. There is given potentiometer to adjust intensity of soil moisture.

Grass Cutter Front View

Normally its voltage divider circuit which gives output based on conductivity. When soil moisture exceeds set value its give LOW output at signal pin,normally its at HIGH stage. Its giving analog as well as digital ouput at signal pin. Here I attached this signal pin to PA0 pin to take input from sensor. Go through following circuit diagarm:

Grass Cutter Front View



Programming :

To read this soil moisture signal its need to write programm on controller. Here Initially sensor giving high output contineously to input pin PA0. When soil moisture exceeds its start to give low output. To read this soil moisture sensor written following code.

Grass Cutter Front View

Inside this defined PA0 pin as a INPUT pin and when value of this pin is HIGH then output pins are HIGH means soil is dry. When there is sufficient content of water inside soil it goes low and all output pins are LOW.

I did this programming using Ardunio IDE and burned this on Hello world bard using Ardunio programmer.

Grass Cutter Front View Grass Cutter Front View


Go with following video link for operation.

Video link: Soil Sensor Operation



Files :

Soil moisture sensory board

Soil Moisture source code.