1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Measuring negative voltages with a PIC

Discussion in 'Microcontrollers' started by bigal_scorpio, Jul 3, 2012.

  1. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Al,
    Rechecked your images for the PCB, any chance you have the Pink and Brown wires crossed over on the 0.1R sense.???

    E
     
  2. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    Just swapped them round to test and no apparent difference. :(

    Al
     
  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Al,
    I have been over and over the circuits and images, I cannot see a problem.

    Do you want to send me the offending PCB's .??

    Eric
     
    Last edited: Jul 19, 2012
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England

    Hi Eric,

    A rew things to try first. Will swap the circuits round so the one that won't work is on the pos5 side instead just to see if that does anything. I am also going to pick up another couple of 0r1 resistors, just to have a spare to swap out.

    Failing these options I will be truly stumped and then it will be time for a trip to the post office! ;)

    Thanks, Al
     
  6. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    Just swapped all 3 connections on both sides of the OPA and I am still getting +5 ok, so it MUST be before the circuit!

    Only things left are resistor and connections to board, and my soldering skills are reasonable so I'm thinking resistor.

    Just going to try parallelling up a 1r and see if anything happens.

    Al
     
  7. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    Had a Eureka moment! with the 1r in par still nothing but with JUST the 1r I get a reading!

    Admittedly the reading is wrong, I can only adjust between 33 to70 odd mA and it is fluctuating a lot but that is probably expected seeing the resistor is 1r now?

    It just HAS to be a faulty resistor! Obviously it reads as a short on my meter so I can't say whats wrong with it unless it is 0r and not 01r?

    Anyway I will be getting some tomorrow.

    Do you think the adjustment range is because of the 1r or is that still part of the problem?

    Al
     
    Last edited: Jul 19, 2012
  8. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Al,
    A 1R would saturate the OPA, go with a 0.1R.

    E
     
    Last edited: Jul 19, 2012
  9. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    I just meant while trying it. Is that why the readings are so far off?

    But at least I know why now. :)

    Al
     
  10. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Al,
    The readings will be well off what you expect.

    I have the project board running with the PIC and ADC test pots connected all ok

    Eric
     
  11. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Al,

    Three images.

    01, is the circuit for testing the voltages for the A2D inputs AN0,1,2,3

    02, are the plots for the above circuit

    03, is the full circuit, I thought you may find it helpful.

    E.
     
  12. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    Thanks mate. You know I appreciate all the help.

    I couldn't wait til the morning and went for more 0r1s to get up and running! Still the same! :(

    But what else can it be?

    If I have ruled out the OPA and the supply and the PIC then all that remains is the resistor!

    What tolerance have you used? These are 5% and the only ones I can get! Maplins! More like Butlins!

    Anyway going to put in the last one now and hope it works.

    Al
     
  13. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Morning Eric,

    Well I tried all the new resistors and still nothing! So I thought leave it for now! Let some fresh air blow past it for a while and get on with something else.

    So I set about the temperature job again but this time I was determined to get the thing right.

    Had a real bad night with pain, not a wink of sleep, but now have a perfectly stable temp reading. How do you get a stable reading with an old computer thermistor you ask? Cheated and used a DS18B20!

    Anyway that is now sorted and after a good few hours messing with the old sensor I have come to the conclusion that I will never try to utilise one of them again. No wonder computers overheat sometimes.

    Anyway since I got the temp working I now have no excuse not to go back to looking for the cause of the var current problem, but just can't think of a new way to go about finding the problem.

    Yesterday I swapped the sense wires from one side of the OPA to the other, leaving the output wire where it was and got a reading on the var rail display. So that proves the OPA is ok.

    Next I swapped the OPA output wires to match, so I have effectively changed the sides of the OPA completely and the readings are back on the +5 rail again ok. Now as expected nothing on the var rail reading.

    Next I swapped the current sense resistor for a 1r and got some way off readings on the var rail, but readings never the less. So I got some more r1s and tried them ALL in but got nothing.

    The only verdict I can reach is that ALL the r1s are faulty (would be very unlucky) or that the varying voltage side of the circuit is somehow effecting things.

    Any thoughts or ideas on what I can try? Or is it time to call it a day and just be content with how ar I got?

    Al
     
  14. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Al,
    If you wish, send the PCB's to me [not the main psu] and I will debug them for you.

    You have my address.

    ERic
     
  15. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    Thanks for the offer mate but I really wouldn't know which bits to send.

    From the investigation I have done so far it seems to be the actual resistor, or the supply to it that is at fault and that would basically mean sending the lot.

    There must be a way of finding the fault logically? When I swapped things about I seem to have disproved everything at one time or another except the resistor itself. The only thing I didn't try is swapping the one that shunts the 5v onto the variable. I didn't want to end up with nothing working at all. But I will bite the bullet and try that.

    If you have a logical way of determining the actual part(s) that is causing the problem I would gladly go through it, even if it means retrying some things.

    Any thoughts mate? Have to be sure before I send you a parcel that it is the faulty bit. ;)

    Al
     
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Al,

    Can we try a step by step approach.??

    Lets first check thru the +5V supply, forget the +/-15V

    Is the +5V giving the correct Vout and the correct Vadc over a 0 to 1Amp[ or 500mA] range.?? and what are the values displayed on the LCD.??

    If not, what are the measurements.?

    Eric

    BTW: I get double pay for weekends and time off in lieu .:rolleyes:
     
  17. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    I have just swapped the working 5v rail resistor for one of the others I got and it still works ok.

    At 1A load (actually reads on DMM at 1.006) I get a reading on the LCd of 1023mA, thats very close and considering I just swapped the resistor and didn't even readjust the pot.

    As for the pay, do you want sticky buns or cream when you call in mate? ;) We will get double rations in!

    Al
     
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    So we can assume that the basic design of the current sense circuit works OK.

    I guess you tried at 500mA as a check and it gave you ~500mA

    Step2:

    On the +15V variable circuit, does the Vadjust of the LM317 give a range of +5V thru to +15V with a 500mA load.??

    If yes, set the Vout at +15V. with a load current of 250mA [ or close]

    Set the pot in the 2N3904 emitter to 0V at half way ie: 50% of its value.

    What are the voltages at the +Vin pin5, and -Vin pin6, of the LM358, also what is the voltage on pin 7 of the LM358.

    Check that LM358 has ~+18V on pin8

    Lets know what you measure.

    Eric
     
    Last edited: Jul 21, 2012
  19. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi Eric,

    Just tried another load that reads 0.21 on dmm an get 282mA on lcd.

    Var gives 4.7 to 15.75 with 400mA load.

    pin 5 = 4.91v
    pin 6 = 4.91v
    pin 7 = 0.01v
    pin 8 = 4.85v

    they were with the pot at 1/2 way and a 400mA(at 15v) load.

    Al
     
  20. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,181
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Al,
    Pin 8 of the LM358 should be around 18V from the Zener supply.

    E
     
  21. bigal_scorpio

    bigal_scorpio Active Member

    Joined:
    Oct 6, 2007
    Messages:
    1,072
    Likes:
    4
    Location:
    Rotherham South Yorkshire England
    Hi eric,

    The pin 8 volts should read 17.85v

    I honestly don't know why I wrote that value?

    Must be the wife nagging thats getting me confused! She is at her growliest at the moment. LOL

    Al
     

Share This Page