Hey all, i am posting this aside of the main forum post (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=69887&postdays=0&postorder=asc&start=60
) that has been going on for a few months now. I recently had time to work on some of it and i am not getting the results that i need. So i am looking for help on the problem.
Here is part of the post from my main forum post:
Here a start how you can detect 12V wit a pin of the AVR.
Fuse 10 (Accessory Socket) looks to me like a good 'victim' to get 12V when the switch in in 'Acc' position. NOTE THAT THE PIN IN THIS PICTURE IS NOT CONNECTED TO A ANALOG PIN.. THAT HAS BEEN CORRECTED.
Ok, going back to this.. i got the resistors today to do this and its all hooked up... but i am unable to get the values i was expecting using this code:
int analogPin = 3;
int val = 0;
val = analogRead(analogPin);
When connected to the volts from pin 3 I get values of:
And when i disconnect the voltages from pin 3 it looks like this:
My voltmeter reads the volts going into the Arduino as 4.12 volts dc.
So why am i getting those other off the wall values when i am looking for a number from 1 to 4? And if there is nothing connected to it then the number should be 0?
I have been looking at this design here by member Shadowcat
Now some background: I am attempting to make my own Start up/Shutdown controller for my laptop for the car. Once it detects current on a 12v line then i want it to wait 5 seconds until it sends to start the pc (push the button) and if it detects no volts on the 12v line then wait 5 seconds and send the push again to turn off the pc.
So any help would be great!