Analog voltage inconsistent when use USB versus battery
#1
Posted 31 August 2010 - 03:12 AM
#2
Posted 31 August 2010 - 03:19 AM
#3
Posted 31 August 2010 - 03:21 AM
Hello Hai,
Could you please give me more details on this? How are you powering the Netduino (which connectors/pin headers), and where are you reading the voltages?
Chris
Chris, you woke me up with that question, I power netduino via FEZ interface card, may be that is the reason, let me strip it naked and test again. Will let you know soon
Thanks!
#4
Posted 31 August 2010 - 04:19 AM
Chris, you woke me up with that question, I power netduino via FEZ interface card, may be that is the reason, let me strip it naked and test again. Will let you know soon
Thanks!
Chris,
I removed extra parts, and connect 4.5V battery directly to Vin, GND. Turn it on, I measure voltage going to the analog sensor 3.0v instead of expected 3.3v. is that right?
What so strange about this was my robot has two 2 analog sensors in the front, whenever i powered the board with laptop's USB cable, and operate the robot on debug mode, it works just fine. but everytime I tried to run on a external battery powered, it failed due to some sort of unexpected analog reading...
basically what the robot does is when an object near to the robot, the robot would stop and reverse. now the robot stops and reverses everytime without going forward whenever netduino is powered by an external battery which indicates front analog reading is invalid, I dont have LCD so I cannt see what the value are
#5
Posted 31 August 2010 - 04:59 AM
#6
Posted 31 August 2010 - 05:23 AM
Chris,
I removed extra parts, and connect 4.5V battery directly to Vin, GND. Turn it on, I measure voltage going to the analog sensor 3.0v instead of expected 3.3v. is that right?
Hai,
Vin is rated for 7.5VDC-12VDC (although it will handle ~6.5V-20VDC). The USB input is connected to the 5VDC "regulated" power pin. I'd generally recommend providing a 5VDC regulated input to the 5V pin header...but if you're providing a clean 4.5VDC regulated power input you're probably alright plugging that in as well.
But don't plug your 4.5V battery into Vin...it will run thorugh two LDO power regulators (each dropping it ~1VDC) before reaching the Atmel MCU--which is out of spec.
Does that answer the question well?
Chris
#7
Posted 31 August 2010 - 05:50 PM
Hai,
Vin is rated for 7.5VDC-12VDC (although it will handle ~6.5V-20VDC). The USB input is connected to the 5VDC "regulated" power pin. I'd generally recommend providing a 5VDC regulated input to the 5V pin header...but if you're providing a clean 4.5VDC regulated power input you're probably alright plugging that in as well.
But don't plug your 4.5V battery into Vin...it will run thorugh two LDO power regulators (each dropping it ~1VDC) before reaching the Atmel MCU--which is out of spec.
Does that answer the question well?
Chris
Chris,
That explained why, I thought the 5VDC pin is output pin the same fashion as 3.3V pin. I should have read netduino's manual before even plug it in :-), but anyway, it is even better to have a walky-talky manual right here :-)
Though it wierd that one of the 3 sensors I have works fine with both USB powered or external power that way despite my mistake. not quite sure why
I hope I didn't BBQ mine board by doing so?
Thank You so much Chris.
#8
Posted 31 August 2010 - 11:42 PM
#9
Posted 10 December 2011 - 05:45 PM
It is a 10cm to 80cm analogue sensor. The full part number on the bag is: GP2Y0A21YK0F.
The data sheet says the distance in cm is approximately = (27 / voltage).
This gives quite a good result. (Apart from the occasional divide by zero error!)
Doing a search on the forums, I found this thread. So I copied the code above into a test program on my Netduino plus.
I assumed that my sensor would work with the settings for the "GP2Y0A21YK":
case SharpSensorType.GP2Y0A21YK: Y0 = 10; X0 = 315; Y1 = 80; X1 = 30; break;But, I got results that were completely wrong.
I noticed that the analogue port range is being set to 0-100: port.SetRange(0, 100);
So I am not sure how X0 can be 315.
To cut a long story short, I added a new sensor type and the following case to the switch statement:
case SharpSensorType.GP2Y0A21YK0F: Y0 = 10; // Minimum distance cm X0 = 64; // Raw analogue port reading at minimum Y1 = 80; // Maximum distance cm X1 = 11; // Raw analogue port reading at maximum break;
So the questions I have are as follows:
- should the code have worked with my sensor using the GP2Y0A21YK settings? (Is the GP2Y0A21YK equivalent to the GP2Y0A21YK0F?)
- where did the code come from? (Was it written for a different device (e.g. Arduino) with a different ADC range?)
- can I feed my results back into a library somewhere for others to use?
Paul
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users