18M2 ADC readings noisy using internal reference

matherp

Senior Member
I'm just testing using a 18M2 to read voltages using its internal 1.024V reference as vref+.
The test circuit is an axe091 and I've used a 1K resistor from the pot to the chip's input pin and 0.47uF capacitor from the pin to ground as a noise filter. Testing the input to the chip with an oscilloscope the input looks absolutely clean.
Program is
Code:
#picaxe 18M2
setfreq M8
fvrsetup FVR1024 ; set FVR as 1.024V
adcconfig %011 ; set FVR as ADC Vref+, 0V Vref-
do
	readadc10 B.4,w0
            pause 1000
	sertxd (#w0,13,10)
	pause 1000
loop
Note I've put delays both before and after the sertxd to ensure this shouldn't effect the measurement. I've tried the picaxe at various clock speeds with no change. My input voltage is .982V which should of course give an ADC reading of 982 whereas I'm getting numbers varying from 975-981 with an average of about 979.

Obviously the intention of using the internal reference is to increase the sensitivity of the measurement for a voltage in the range 0-1.024V but given the noise I might as well be using VCC (5.01V on my AXE091) as the reference when I see a rock solid measurement of 200 which is exactly what I would expect from my input (.982/5.01*1024 =200.7).

Any ideas?

Thanks

Peter
 

hippy

Ex-Staff (retired)
I will see if I can investigate the issue.

What are you using as a download cable ? The AXE091 doesn't have the enhanced download interface and while newer PICAXE are much more immune to affects on ADC it may be an issue and more noticeable at lower voltages. Using the AXE027 should not have an adverse affect, only RS232 which puts out -12V when idle.
 

matherp

Senior Member
I'm using an axe027 serial adapter. The power supply is the standard axe091 regulated circuit. I've now proved this isn't the issue by putting a MCP3421 i2c 18 bit ADC onto the same input and the reading from this is completely stable down to the 16th bit (31440 read, 1.024V reference = 31440/32768*1.024= 0.9825V). So basically it looks like it is definitely the 18M2 ADC or reference that is noisy
 

william47316

New Member
have you got another picaxe to try with, im guessing different adc pin is out of the question as its using the same reference and if that's noisy then the rest will be. how new is the chip, if its been around then it wouldnt surprise me if something is a bit noisy what kind of filtering have you got on the power rails of the picaxe or is this a pretty much standard board with all the filtering mojo etc
 

hippy

Ex-Staff (retired)
Tried with just a pot to 18M2 and adjusted by hand to get a reading of ~980 and that seems to show a similar range of readings which you get ( 979-984 ). Same at 4MHz, 2MHz, using different ADC channels, and 2.048V internal Vref.

Replacing READADC with "CALIBADC w0" also shows fluctuations in readings when it should be a rock-steady 1023. Getting 1021-1023 with 1.024 internal Vref and one could argue that as it limits to 1023 the un-limited noise would be 1021-1025 which parallels the READADC results.

We will have to investigate whether this is a silicon issue or something else.
 

matherp

Senior Member
Hippy

Thanks for looking at this. I have put a BAT85 onto my axe091 and this may have made a tiny difference but I am still seeing 4lsb swings

best regards

Peter
 

hippy

Ex-Staff (retired)
This does seem to be an 'internal chip issue' rather than external influences.
 

Dippy

Moderator
Whiklst you are checking to see the effect oif the download circuit it would be a good idea to look at decoupling.
On PIC/dsPIC circuits the decoupling is crucial for ADC stability; don't forget that PICs are noisy.
 

hob0014

New Member
enhanced download curcit

you could try breadboarding it with the enhanced download curcit. or you could hook up a serial lcd to elimenate the computer
 

hob0014

New Member
another thought:
if u dont have a serial lcd then write a simple program that turns an led on or off either side of the value eg:
Code:
do
            readadc10 B.4,w0
            pause 10
            if w0<979 then
            high (led)
            else low (led)
loop
then you can try varoius things until the led stays on or off
 

Milos

Member
I have finished my LC-meter on 28X2. I have an oscillator built on the internal comparator. I measure its frequency using count command. When I am calibrating my meter, repeated results vary too. Maybe not so much, but do vary. I think that it is normal. The results are influenced by temperature, electromagnetic field etc. There are not exact numbers in real world.
 

john2051

New Member
Hi,
Before I saw the light as it were, I have several E-blocks, which are ok, but not as versatile as the picaxes. I programmed a pic 16f88 to read an analog voltage and display it on an lcd, and it is rock solid stable, from 0.000 to 1023v. I also tried it on a pic16f877a, with the same results. Unfortunately I dont have anything more modern pic wise.
I did set up a picaxe 40x2 reading an analog voltage and displaying it on the axe033, without any major fluctuations.
What sort of input impedance are you trying to read on?, and if you ground the pin you're using does that change anything?
Apologies if someone has already asked you this, usual mad rush today!!

regards John
 

hippy

Ex-Staff (retired)
I don't think it's an impedance problem or a result of external influences, only a specific issue with using the FVR to set +Vref on the 18M2. The PICAXE range does read rock-solid ADC results ( excepting external noise and pot jitter etc ) as well as any other, but in this specific case there is something odd going on. That's shown by the CALIBADC test using FVR which is an entirely internal loop-back reading which shouldn't be affected by any external influences.

For COUNT, PULSIN and similar commands, these can vary by a slight amount and that's usually because of 'aliasing', where the signal doesn't fit perfectly with the PICAXE sample length, timebase or frequency ...

Code:
Input   ___|___|___|___|___|___|___|___|___|___
               _________         _________
Sample  ------|_________|-------|_________|----

Count              3                 2
 
Last edited:

Technical

Technical Support
Staff member
Do you get a better result at FVR value of 2048 instead of FVR 1024?

We ask because the PIC datasheet specifically gives these options for +Vref:

Vref+ pin
+Vdd
FVR 2.048
FVR 4.096

but strangely makes no mention of the 1.024V option....​
 

marks

Senior Member
eventually i hope to get a 18m2 too .
had a quick look at the data sheet 16f1827(just for general info lol)

it mentions 15 outputs does the 18m2 hav this many?

it does mention a stabilization period for the FVR
so maybe this is the difference experienced between using an external reference.

usually they use a 0.01uf for ADC.

i noticed the newer chips recommend .01 and .1 uf caps in parallel for supply couplling

sink 90ma source 65ma
 
Last edited:

hippy

Ex-Staff (retired)
The 18M2 has 16 I/O : C.3 is output only ( Download Serial Out ), C.4 is input only ( Download Serial In ) and C.5 is input only ( by silicon design ).

C.3 can be controlled as a digital output in its own right by a PICAXE program making for 1 up to 14 outputs.

C.4 can be read as a pin in its own right making for 2 up to 15 inputs.
 

John West

Senior Member
An aside:

I have finished my LC-meter on 28X2. I have an oscillator built on the internal comparator. I measure its frequency using count command. When I am calibrating my meter, repeated results vary too. Maybe not so much, but do vary. I think that it is normal. The results are influenced by temperature, electromagnetic field etc. There are not exact numbers in real world.
Milos, is the final version of your LC meter the schematic shown at the bottom of this page?
http://www.picaxeforum.co.uk/showthread.php?t=11991&highlight=Milos&page=3
How about the code?

I would greatly appreciate seeing a completed project posting of it in the User Projects forum, as I'd like to build a copy of it, and perhaps also do a PCB layout for it.

I think it's a project that others might also want to build.
 
Last edited:

Technical

Technical Support
Staff member
Upon more digging the PIC datasheet does state this:

"For proper operation, the minimum value of the ADC positive voltage reference must be 1.8V or greater. When selecting the FVR or the VREF+ pin as the source of the ADC positive voltage reference, be aware that the voltage must be 1.8V or greater." We'll add this to the PICAXE manual.

The accuracy of the FVR voltage is -7 to +6 % and the accuracy of the ADC is +/- 2 LSB, so your results are pretty much as to be expected.

However it should be noted to use FVR at 2.048, not 1.024, as that is less than 1.8V
We would also recommend, as Dippy already has, a 100nF decoupling cap as close to the power pins as possible.
 
Last edited:
Top