Try adding a bit of capacitance from the wiper of the pot to ground - say 100nF.
This should minimise some of the variations you are experiencing.
Cheers
Barry
VK2XBP
Try adding a bit of capacitance from the wiper of the pot to ground - say 100nF.
This should minimise some of the variations you are experiencing.
Cheers
Barry
VK2XBP
KeithV, You could always low pass filter the A/D reading if you are not requiring the responce speed. If you require the speed then just read the A/D faster. Something like this:
FILTG CON 32 'FILTER CONSTANT (255 = NO FILTER, 1 = MAXIMUM FILTER)
VOUT VAR WORD 'FILTER HISTORY
LOWPASS: '------------------- LOW PASS FILTER --------------------------
VOUT = VOUT - (VOUT */ FILTG) + A_D_READING
FILTERED_VOLTAGE = VOUT */ FILTG 'FINAL FILTERED OUTPUT COMPUTED
RETURN
I use something similar to it all the time....
Dave Purola,
N8NTA
EN82fn
How do you have the 2.4955V in memory? Is that a word? Because that wouldn’t give you much range past 6 Volts.
You can keep the resolution and take the mean of the last n readings if you can calculate it, which you probably can.
The larger n is, the less responsive your potentiometer is, at least “apparently”,
but the smaller the fluctuation you see, the easier it is to pad out.
If you’re going to blow out a variable used to calculate the mean, you can add and divide small groups of variables
to arrive at a new smaller group of variables, and work down to one number that way.
Heart rate monitors at least used to do this because the interface to the body, and radio between the chest sensor and device was so clumsy.
I tried adding a cap to ground off the wiper. That seemed to help a tiny bit, but not much.
I had the same idea about sampling and averaging in the shower this morning. Unfortunately, I haven't had a chance to try it yet. I'm using a 16F676 which only has 1023 words of program memory, and I've already been "trimming the fat" to get what I've already got working on there. I need to use a PDIP14, so my options are limited. I just ordered some 16F616, so that should give me twice the memory.
There's plenty of modern options in 14 pin packages.
16F1503 is pin compatible, has twice the amount of flash and twice the amount of RAM and costs less than 16F630.
If you need even more then 16F1507/8/9 are all "the same", just more flash and RAM.
Plenty of other to choose from as well.
/Henrik.
Bookmarks