Week 11 Assignment:Input Devices



So here what we are assigned do is that to measure something:add a sensor to a microcontroller board that we have designed and read it


I wanted to test out the moisture sensor which I plan to use it on my final project. So along with that I wanted to do a board which would also have enough pinouts that would satisfy my requirement for that final project. Thus went for the atmega328p microcontroller we have at our lab. I also refered Daniele Ingrassa's Satsha kit for the schematic. His work is an improvement on FabKit. Also using Satsha kit, I could use Arduino IDE for writing code and programming.

The documentation of using Eagle to build the schematic and board design as explained on Electronic Design week.

Components needed.
Then I milled the board
But when I checked the continuity I came to know that, the circuit was not grounded properly. But the schematic was ok to see. But one connection was actually not ok. So what I did was that, I gave an external connection as shown and now its ok..

About Atmega328

Some of the Features of ATMEGA 328 are

  • 1.8-5.5V operating range
  • Up to 20MHz
  • 32kB Flash program memory
  • 1kB EEPROM
  • 2kB Internal SRAM
  • Two 8-bit Timer/Counters
  • One 16-bit Timer/Counter
  • RTC with separate oscillator
  • 6 PWM Channels
  • 8 Channel 10-bit ADC
  • Serial USART
  • Master/Slave SPI interface
  • 2-wire (I2C) interface
  • Watchdog timer
  • Analog comparator
  • Data retention: 20 years at 85C/ 100 years at 25C
  • 23 IO lines

So now for the week assignment, I decided to connect a moisture sensor as input.
First I decided to test it with the Arduino board and then with the Satsha
I tested out the following code to get a viable theshold value for the moisture sensor. This code was available from instructables.

void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // print out the value you read: Serial.println(sensorValue); delay(1); // delay in between reads for stability }
Here in Arduino board, set a value of 50 and when the sensor is dipped in the water, the value should get increased and the LED should have to glow.
Next is to replace the arduino board with Satsha. I refered the documentation of Ganadev and followed as stated. I did not encounter the issue thats mentioned in his documenation because I did not use SoftwareSerial.

The LED is connected to the 13th pin on the Satsha board. The LED lights up when it goes past the threshold value of 50.

Programe file here

design files here

design files here

Go back HOME