Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Mini Analog


  • Please log in to reply
10 replies to this topic

#1 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 10 December 2011 - 08:51 AM

Hi all, I'm having issues with Analog on my Mini. Pin 5 on my mini is reading the analog voltage exactly as expected; which is around 223 (int) but when I move the connection to pin 6, 7 or 8 on the mini I get an analog voltage of about 205 (int). The strange thing is that I'm seeing the same behavior on my (relatively new and untouched) Netduino Plus. The first analog pin reads as it should and the rest of the pins read the exact same average value but much lower than the first pin. I'm now running version 4.2 RC3 on my Mini but I had the same results using firmware version 4.1.0.6 - same as the Netduino Plus. Has anyone seen this behavior? I find it hard to believe that I did any hardware damage to my Mini since the newer Netduino Plus hasn't been used hardly at all and I'm getting the same results on both platforms. I have simplified the code to the point of just printing out the raw analog value and I get the same results as stated above. I would love to hear any suggestions. Thanks!

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 10 December 2011 - 09:11 AM

Hello ajcg1973. I own just a N Plus (fw 4.1.0.6). There are some issues around the ADC readings, but I never heard anything as of yours. Could you post some clue more, as long as a bit detailed description on the circuit to feed the analog inputs. The code would be really useful as well. Cheers
Biggest fault of Netduino? It runs by electricity.

#3 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 10 December 2011 - 11:50 AM

Hi ajcg1973, Did you connect your analog input to the 5V pin or did you use a voltage devider circuit?
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 December 2011 - 05:33 AM

Hi ajcg1973, Curious. If you open up the unused analog pins on your Netduino Mini as OutputPorts (set to FALSE to drive 0V), does that help any? Chris

#5 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 11 December 2011 - 05:59 AM

Hi ajcg1973,

Did you connect your analog input to the 5V pin or did you use a voltage devider circuit?



Hi Stefan, I'm using a Microchip MCP9700A connected to the 5V VDD line. (I should say that I have the Mini mounted on a Boe-Bot board from Parallax). The MCP9700A has a voltage range of 2.3V to 5.5V so I should be Ok on that...

#6 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 11 December 2011 - 06:33 AM

Hi ajcg1973,

Curious.

If you open up the unused analog pins on your Netduino Mini as OutputPorts (set to FALSE to drive 0V), does that help any?

Chris



Unfortunately it didn't seem have any effect on the results of the readings. I'll keep playing with it to see if I can gather any more info on the problem. I might treat myself to a new mini next month just to make sure it isn't a hardware problem.


Thanks guys for the replys.

#7 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 11 December 2011 - 07:02 AM

Hello ajcg1973.
I own just a N Plus (fw 4.1.0.6). There are some issues around the ADC readings, but I never heard anything as of yours.
Could you post some clue more, as long as a bit detailed description on the circuit to feed the analog inputs.
The code would be really useful as well.
Cheers



All of the issues that I have seen on the forum have been about the difference in readings on the same ADC port and I haven't seen anyone else complain about this specific issue. The interesting thing is with the Mini, the readings on the first Analog Pin (Pin 5) seems to be spot on with little variance. The other three ports on the Mini also have little variance in the readings but all read 20 units lower (0.064 Volts) than Pin 5.


Here is the simple code that I'm using:
public static void Main()
{
 SecretLabs.NETMF.Hardware.AnalogInput an0 = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_5);

 while (true)
 {
  Debug.Print("Raw: " + an0.Read().ToString());

  Thread.Sleep(1000);
 }
}

I'm using the Microchip MCP9700A temperature sensor which converts temperature into a voltage value. The circuit is also simple - VDD (5V) to power the MCP9700A. GRD to GRD. MCP9700A voltage out to the ADC on the mini. I should also point at that 5V in on the MCP9700A is within spec and it outputs temperature as a voltage in Celcius but it is less than 1V so it is well within the Mini's ADC voltage range.


One thing that I did want to mention is the first reading on Analog 0 (PIN5) seems to be the same reading as the other analog pins where it is about 20 units less than the correct reading then it starts reading as expected from the second reading on:
Posted Image

#8 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 11 December 2011 - 12:47 PM

Ajgc1973, try the follows using the program above: - detach the MCP probe, and short all the analog inputs altogether, as closest as possible to the Netduino board; - be sure to have the Aref stable, connected (if applies), to +3.3V; - take two resistors (e.g. both 10k), and place the first one from the analog short to the ground, the other from the analog short to +3.3V or +5V; - run the program. What do you read? Now use a multimeter (if you own), and measure the voltage across the short and the ground: does the multimeter read match with the expected Netduino ADC readings? This test ensures that there's no problems from the Netduino analog input pins to the MCU chip, and the firmware/software layer. If you still read relevant differences, it means there's a problem somewhere. If all the readings are very close each other, it means that the problem is off the Netduino, and you should check the probe and/or the connections. Note that a difference of +/- 1 or 2 digits is quite normal. The embedded ADC is not targeted for high precision measurement. Thus, if the nominal value is 500, a reading from 498 to 502 is within the error margin, and has to be considered correct. Let us know. Cheers
Biggest fault of Netduino? It runs by electricity.

#9 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 11 December 2011 - 09:13 PM

Hi Stefan, I'm using a Microchip MCP9700A connected to the 5V VDD line. (I should say that I have the Mini mounted on a Boe-Bot board from Parallax). The MCP9700A has a voltage range of 2.3V to 5.5V so I should be Ok on that...

Hi ajcg1973,

The Mini inputs aren't 5V tolerant, they accept 0 to 3.3V. This might be the case!
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#10 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 24 December 2011 - 06:42 AM

Hi ajcg1973,

The Mini inputs aren't 5V tolerant, they accept 0 to 3.3V. This might be the case!


Hi Stefan,

Good suggestion. I took a look at the datasheet and it looks like the MCP9700A outputs 0.1V to 2.0V max. I don't think that I have a bad part because I have used it on other microcontrollers and it reads just fine. I'm going to try and power the sensor directly from one of the output pins (only uses 6uA) to see if that makes any difference. Hopefully I will have time to get out the meter this holiday week to help troubleshoot. I'll keep you posted. Thanks!---AJB

#11 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 29 December 2011 - 05:49 AM

Hi all,

Here is an update...

This is a weird one and it is quite puzzling to say the least. While troubleshooting I was trying different things. One of the things that I tried was to hook a MCP9700A sensor to multiple analog inputs each at the same time to see what the average difference in readings returned was between Analog Port 0 and Analog Port 1. What happened was very curious, Analog 0 and Analog 1 started to both read *perfect* results. So I started to experiment a little to see if I could explain what might be happening. When I moved Analog 0 input to GND, I read 0 units on Analog 0 but Analog 1 returned back to reading about 20 units less than it should. When I connected Analog 0 to 3.3V I started to read 1023 on Analog 0 (as expected) but I started to read ~600 units on Analog 1, instead of the correct 220 units that I was reading if Analog 0 was connected to the MCP9700A.

Any ideas? I looked at both the schematics and the firmware code to see if there was any difference in the code between Analog 0 and any other analog inputs and I wasn't able to find a difference. It is a little confusing as to why Analog 0 would have so much impact on Analog 1 when I'm within specification.


Mario,
I haven't tried your suggestion yet but I shall shortly. I'll post the results as soon as I can...---AJB




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.