Go Down

Topic: analog reference (Read 1 time) previous topic - next topic

RaHuLL

hello all,
I am using atmega328(without arduino,but programmed using arduino) in my project where in I am checking input from sensor on analog pin.
if it is HIGH necessary action is taken.
But even when no input is given by sensor,atmega shows HIGH signal.
Is this related to analog reference?

JimboZA

It's probably just noise, and you need a pull-down to force it low.... Just because a pin isn't deliberately high, doesn't mean it's actually low.

RaHuLL

Actually I am getting HIGH when it should return LOW.

fungus


hello all,
I am using atmega328(without arduino,but programmed using arduino) in my project where in I am checking input from sensor on analog pin.
if it is HIGH necessary action is taken.
But even when no input is given by sensor,atmega shows HIGH signal.


What sensor, what circuit, what code? My crystal ball isn't working today.


Is this related to analog reference?


Very unlikely.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

JimboZA


Actually I am getting HIGH when it should return LOW.


But how do you know it should be low?- when it's not getting any input there's no way of telling what it "should" be.

As fungus says, post more detail....

RaHuLL

I am doing this as my college project.
I am using sim900 module along with PIR sensor.
Code: [Select]

void loop()
{
    val1 = digitalRead(inputPin1); // read input value from PIR
    if (val1 == HIGH) { // check if the input is HIGH
      mySerial.print("ATD +919*********;");//dial the number
      delay(100);
      mySerial.println();
  }
  else {
  }
}


now this code calls me even when nothing is detected by PIR.
And for power,I am using 3.7V battery.

Grumpy_Mike

Why all the talk of analogue reference when all you are doing is a digital read?

Have you measured the input on the pin you are using?

You need to post ALL the code so we can see what you are doing.

Quote
I am doing this as my college project.

Then you should have access to test equipment.

Nick Gammon

Code: [Select]

val1 = digitalRead(inputPin1); // read input value from PIR
    if (val1 == HIGH) { // check if the input is HIGH
      mySerial.print("ATD +919*********;");//dial the number


I should point out that loop is executed thousands of times a second, so you are going to be dialing that number an awful lot.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

RaHuLL

Quote
I should point out that loop is executed thousands of times a second, so you are going to be dialing that number an awful lot.


How if condition will be satisfied every time?

AWOL

Quote
now this code calls me even when nothing is detected by PIR.

Which PIR?
Where is your code?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Grumpy_Mike

Quote
How if condition will be satisfied every time?

Yes if you hold down the button for say one second it will be executed about 1000 times.
All it does is check if the button is down, it does not check that it has just gone down. In other words it checks for a level not an edge.

You need to read this:-
http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

RaHuLL

I tried example given at http://playground.arduino.cc/Code/PIRsense where in inbuilt pull up is used.
But still i am getting continues calls.

AWOL

Quote
But still i am getting continues calls.

...and we're still waiting for details of the PIR.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


Nick Gammon


I tried example given at http://playground.arduino.cc/Code/PIRsense where in inbuilt pull up is used.
But still i am getting continues calls.


Post your new code.

Did you address what I said in reply #7?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up