Uniformity of 'POT' accross pins?


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2004
    Posts
    448

    Default Uniformity of 'POT' accross pins?

    I am trying to measure 3 capacitors being used as sensors on PortA.0 to PortA.2 on a 16F887, using POT.

    The resistor is 10K, capacitor varies from .1 uf down to perhaps 0.01.

    I'm sure I've set all the pins as digital, ADCs, comparators disabled, no schmitt input pins used.

    While individually each channel seems to work fine, great repeatability, the readings for the same capacitor on different channel is significantly different.

    Just to rule out something specific to PortA that I might have missed, I tried this on other sets of pins, with the same result.

    My question is, is this normal?

    I'm getting frustrated enough to consider using 3 external CMOS 555s (with 'C' as the unknown capaitor) as oscillators, with the pic just reading the pulses. But I'm still hoping this could be done without any external chips.

    Any suggestions, folks?

    Regards,

    Anand

  2. #2
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Reconfirmed the above results on a 16F628.

    Am thinking of using just 1 pin to measure all the 3 POT values, multiplexed thru' 3 low power mosfets driven individually. Does that make sense?

    Regards,

    Anand

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Or instead of resistors you could use trimpots and adjust them until they are equal.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Thanks for the suggestion, Joe.

    I'm afraid presets in place of fixed resistors would mean I'd have to calibrate each channel individually; also, I should have mentioned, the capacitor is actually a string of 10 capacitors that get successively shorted by a fluid. So, having unequal fixed resistors in each string would affect the overall linearity.

    I intend to try out my 2nd idea, but perhaps with CMOS switches instead of separate mosfets.

    Regards,

    Anand

  5. #5
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default POT repeatability

    Recently I have been working on a robotic system that gets direction fron the position of the sun.

    I use two LDRs on either side of a vein mounted on a stepper motor that tracks the sun so that the amount of light falling on the left LDR is equal to the right LDR.

    To compensate for the difference in channnel and LDR measurement I have an initialisation routine that scans the whole arc of sky and records the difference between left and right LDRs. This correction is the applied to the readings.

    Could you do a callibration run that records a table of corrections to the readings. These corrections are then added/subtracted from the readings to give an absolute result?

    I do note that your question concers pin variations - and it is a good question. In my experience with the sun tracker the variation between channels (PORTA) plus the LDRs was quite small- about 2 parts in 255. If you are getting large variations I guess something is wrong? I think a hunt through the PIC MCU documentation "electrical charcteristics' may be useful?

    Surley a simple RCTIME test will sort this out?

    Regards Bill Legge

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Hi Anand. I had the same problem measuring resistors. And yes, I found that portc gave me entirely different results than portb on a 16F73. The portb pins were very close but 2 of the 4 used gave me a slightly different result. So, I modified the automatic calibration program shown in the PBP manual. Perhaps you can do a similar routine to calibrate your capacitors. Scale1, scale2, scale3 and scale4 get calibrated individually and I am getting consistent results reading resistors from 470 ohms to 47K. The gosub makesound simply beeps a sounder letting you know as each scale gets calibrated. I also have a program that will beep the scale value to let you know what the actual number is. Let me know if you want that.

    Clear 'ALL VARIABLES = 0
    LET SCALE1 = 1 'START CALIBRATION @ 1

    TEST1:
    Pot PORTB.7,SCALE1,Y 'START ADVANCING SCALE UNTIL THE DEFAULT RESISTOR 47K = 253
    IF (Y < 253) Then LET SCALE1 = (SCALE1 + 1): GoTo TEST1
    GoSub MAKESOUND 'CALIBRATION1 COMPLETED


    LET SCALE2 = 1 'START CALIBRATION @ 1

    TEST2:
    Pot PORTB.6,SCALE2,Y 'START ADVANCING SCALE UNTIL THE DEFAULT RESISTOR 47K = 253
    IF (Y < 253) Then LET SCALE2 = (SCALE2 + 1): GoTo TEST2
    GoSub MAKESOUND 'CALIBRATION2 COMPLETED

    LET SCALE3 = 1 'START CALIBRATION @ 1

    TEST3:
    Pot PORTB.5,SCALE3,Y 'START ADVANCING SCALE UNTIL THE DEFAULT RESISTOR 47K = 253
    IF (Y < 253) Then LET SCALE3 = (SCALE3 + 1): GoTo TEST3
    GoSub MAKESOUND 'CALIBRATION3 COMPLETED

    LET SCALE4 = 1 'START CALIBRATION @ 1

    TEST4:
    Pot PORTB.4,SCALE4,Y 'START ADVANCING SCALE UNTIL THE DEFAULT RESISTOR 47K = 253
    IF (Y < 253) Then LET SCALE4 = (SCALE4 + 1): GoTo TEST4
    GoSub MAKESOUND 'CALIBRATION4 COMPLETED
    Last edited by peterdeco1; - 23rd February 2009 at 15:32. Reason: shorten post

  7. #7
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Bill, Peter, thanks for the suggestions.

    Although I think the self-calibration idea is ingenious, in my app. it might be difficult/cumbersome to implement, as I have 4 channels, and when I deploy the instrument it might not be possible to sweep each channel from minima to maxima at the same time.

    Also, I notice that the dissimilar readings on the different channels are happenning not because of the sensors (caps) themselves, but the inherent differences in the pic pins, even if they are on the same port.

    I got around this by a technique that seems to be working very well; maybe it would helps others with a similar issue.

    I am using just 1 pin to measure all 4 channels; the 4 sensors are multiplexed using a 4066 CMOS switch chip.

    The outcome is that I now need to calibrate for just one channel, and as long as my sensors are uniform (which I found they are) I get a consistent reading for all 4 of them as I scan them one after the other.

    Regards,

    Anand

Similar Threads

  1. Using the Pot command.
    By timseven in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 17th August 2009, 20:23
  2. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  3. A/D, Pot, Input, A,B So lost now....
    By Helmutt in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th March 2008, 22:23
  4. Replies: 4
    Last Post: - 24th January 2007, 22:20
  5. pot controlled pwm -- help
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 29th January 2006, 12:29

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts