Analog temperature reading (again)

This goes back to my original question over a year ago

https://www.ghielectronics.com/community/forum/topic?id=7890

Rather than open back up the old post since it is a bit dated I thought I would ask about the status.

Has this ever been addressed in the SDK as indicated? I am using the 4.2 R3 release on my EMX development board, and still have the exact same issue. The analog values are just all over the place. However, the same code works perfect on my Netduino.

I have even tried (as suggested) putting all my unused analog pins to ground, and that does not work. Is the EMX board (and the Cobra v1) just not good for analog reading? I just ordered 2 Cobra II WiFi boards, so am a bit concerned that this may still be an issue.

I have read that perhaps it is because the 3.3v on the board is not a true reference voltage and can bounce around a bit. Is that true?

Roy

I’m having same problem with Spider.
I grounded unused pins, and didn’t help.
I’m using 4.2, and problem is annoying. I don’t have good electronic skills, so I don’t know how to apply custom filters and techniques like capacitor decoupling, but on my Mikroelektronika EasyAvr6 development board I don’t have this problems.

We will investigate this issue as we have indicated that this issue should have been improved. We will work on it as soon as possible.

Many factors go in the accuracy of an analog input. The processor used, the frequency running the processor, the analog peripheral, the voltage powering the analog and digital sides on the processor, the complexity of the design (SDRAM/LCD for example). Comparing two complete different systems does not mean much.

We can do some averaging and digital filtering on the analog input but this can be done on the C# side as well, so it is better to be done that way so you have control over how to filter the analog values.

However, like Aron said, we will happily take a second look to see if we missed something.

I sort of have a more stable reading when I added a 0.1uF ceramic capacitor between the power and analog line. LIke Adafruit says, “0.1uF ceramic capacitors are the magic fairy dust of electronics”.

Though I am not sure I should have had to do this, I think it might help point out the problem.

Roy

Your best bet might be an external ADC. These boards aren’t really designed for high-accuracy analog input. There’s a lot that goes into that, like Gus said.

While I don’t disagree, you would think if there is an analog input pin, then it should work. What else would you use it for? I had switched over to a OneWire interface for a digital sensor, but OneWire is still a pain to work with when you have multiple devices. And there are a lot of sensors out there that I can only find in an analog IC.

Can you recommend a good easy to use external ADC that I can hook up?

Roy

There’s a million of them, with different resolutions, packages, and interfaces. I can’t really recommend one over any other, as I have little experience with any of them.

Depending on what you’re doing, you might be ok with a little filtering… say, take 10 samples, and average them, or throw out any samples more than one or two orders of magnitude away from the mean, or … (there are lots of filtering strategies).

Your issues also might be environmental. These boards aren’t designed with a separate analog reference voltage, which would improve their performance. Therefore, you’re at the mercy of the power supply that’s supplying the board. Some boards (I’m looking at you, Panda II) are poorly decoupled. Adding some additional decoupling capacitors might help (something you’ve already looked into, it seems).

If you look at the Netduino board, the AREF is filtered separately from the other VDD pins. I’m guessing that this has a lot to do with the better analog input performance.

I believe this is the whole issue. I know my Netduino works great with this sensor (TMP36), but the Cobra I (EMX chip) and the EMX dev board do not.

I’ll try the Cobra II (GS120) and the Raptor (GS400) when I get them tomorrow, but I don’t hold out much hope since its not really the chip, but the board design.

I have other options for my temperature sensor, but I can’t find a good light sensor (lux measurement) outside of an analog version.

I’ll keep doing some more research and see if I can find a good article on decoupling capacitors to make sure I’m using the right size and whatnot.

Roy

I looked at the schematic for the EMX and I assume you are using the GHI Development board for this or is this a custom board?

If the GHI dev board, then looking at the ADC5 to 7 inputs, which I assume you are using, these lines run under the LCD cabling and there is no separation with a ground trace between them.

Generally, I keep ADC inputs well clear of high speed digital signals and I try to make sure there is a good ground trace between them although in this case the LCD lines are at 90 degrees I am still concerned because there is more than a few passing over the analog input traces.

I don’t often use the internal ADC though unless I can use it with a precision reference. I have a design here with a 16 bit ADC reading a pressure sensor that has a range of 10M and I get 1mm precision from it so it is possible to get good clean analog signals.

Hi Roy, have a look a the MCP3428 from Microchip. It’s a very nice and simple to use 4 channel 12/16/18 bit ADC. There is even a nice driver for this in codeshare. :slight_smile:

The only downside that may affect what device you are using is the input range is only 0-2.048 volts. I use 4-20mA so it fits nicely.

Other than this, that device is rock steady for my design. Just make sure you put a 0.1uF cap on the power rails and use an inductor in the line to the AVCC power pin. The reference is internal.

Yes, I have the EMX dev board. I also tried the Cobra I board. I wonder where the Cobra II and the Raptor has the ADC lines?

Roy

Yea, the power would be a problem. But I will look at that one anyway as it might give me some ideas on other ones.

Thanks

Roy

From the Eagle board files, the ADC6 & 7 inputs are nice and short. It would all depend on what the ADC reference pin on the CPU is connected to. The ADC ref input is not brought out to the external connections.

By the way, the MCP3428 is 2.7 to 5.5V supply, it is only the ADC input that is -2.048 to +2.048V because of the internal ADC.

I gave up on my Panda IIs’ built in ADCs–not sure if they are inherently inaccurate or if i’ve toasted them with >3.4 volts. I’m now using NXP PCF8591 ADC/DAC, data sheet here:

I’m not sure the advantages/disadvantages of this particular ADC as i bought the first one i saw. Communication is I2C, 8-bit (256 step) precision. I’ve written basic driver code for the chip and for communicating with I2C devices in general that seems to work ok, but haven’t implemented the DAC conversion side of things. Also coded a DataSet object to be used with any analog-in sensor that takes a set of readings (user defined set size) and returns an adjusted mean value that takes into account wild readings by throwing out readings with a large variance (again, the variance amount is user defined.) Happy to share the code if you’re interested.