Help with PIC Circuit

Discussion in 'The Projects Forum' started by Art, Dec 16, 2009.

  1. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Hi Guys,
    I'm trying to make a pic powered voltmeter using an LCD display and Pic 16F876.
    and then hope to go on to log voltages, display averages, predict battery behavior, etc.

    A couple of the panel voltmeters sold at Jaycar are powered from the line being measured.
    I'm wondering if they go about this by regulating the line with a 7805 or similar to power the device,
    and then also feed the unregulated side of the 7805 through a voltage divider,
    and then straight into one of the ADC channels without being regulated???

    Also.. I have an ADC variable being readout to LCD for experimentation.
    The LCD shows zero when the ADC is grounded, and 255 when connected to +5 Volts.
    Is this what I should be using for a voltmeter? (once some calculation is done)
    Cheers, Art.
     
  2. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    No takers??

    Well I completed a working Voltmeter with a few other features built in.
    The only issue I'd complain about now is that the ADC result used for the Voltage readout is not stable where an off the shelf Multimeter/Voltmeter would be.

    http://www.youtube.com/watch?v=txb2Tv7-f_w

    I used a voltage divider to scale down the input voltage from the battery.
    Cheers, Art.
     
  3. lmartinez

    Active Member

    Mar 8, 2009
    224
    6
    Interesting project! Did you use C or assembly language to program your pic?
     
  4. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    It's PicBasic with some in line assembler.

    I managed to keep the readout stable by displaying the mean average
    of the last ten voltage readings.

    It would be nicer to have a hardware solution though.
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Are you having the PIC sleep while the ADC is sampling?

    Do you have the PIC Vdd/Vss supply bypassed with a 0.1uF cap?

    Is the ADC using an external precision reference with a cap on it, or is it having to live with the noise on the 5v supply?

    Do you have a small cap on the ADC input to provide it with a low-impedance sample input?
     
  6. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    What is the span of your voltage measurement range? i.e. from 0V to how many volts DC?

    Are you using 5V as ADC reference and what value is the battery input voltage divider resistors?
     
  7. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    No! How could I forget?

    It seems to be stable now, sometimes jumping between 0.1Volt whihc is acceptable.

    Cheers, Art.
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Much better. :)
    Try using a cap on the input pin you're using for the ADC, too. A resistive voltage divider has a pretty high impedance (by definition) - a small cap, say 1nF to 10nF, will drop the impedance quite low. Make sure you wait 20mS or so between samples, so that the cap has a chance to stabilize - that's if your divider network is about 100k total. If higher, adjust your time between samples upwards to suit.

    Posting a schematic would be most helpful.
     
  9. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    I haven't done a schematic for the whole thing,
    but here's what I posted on a pic programming forum when I
    was having the issue with the ADC result jumping around:

    [​IMG]

    I got the resistor values from a thread here. Second post on this page:
    http://forum.allaboutcircuits.com/showthread.php?t=12537&page=2
    The red wire in the schematic connects the battery powering the 7805 directly
    to the voltage divider connected to the ADC pin. I will try the cap you suggested.
    It is connected between the ADC pin and ground right?

    [​IMG]

    It appears I've fried the 24LC16B EEPROM during experimentation.
    I destroyed a few pics at the same time, but the EEPROM isn't socketed :(
    I'll just have to use on-chip EEPROM to log information about the battery.



    Art.
     
    Last edited: Dec 19, 2009
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I personally would multiply the values of the resistors by at least 10, and add a 10nF cap at the ADC input - and make sure that the sample rate was low enough to ensure the cap had time to charge/discharge. This is in the interests of reducing the power drain on the battery.
    Yes.
    Keep in mind that the 7805 is pretty power-hungry. You would be better off to use a newer regulator.

    Darn, too bad. :( But, burning up stuff is part of the learning experience. You will probably learn more from burning up stuff than you will from building things that "sort of" work.

    I don't know that you can directly write to a PIC's memory, but if you can, don't do it very often - you'll probably burn it up too.
     
  11. Rick Martin

    Active Member

    Jun 14, 2009
    31
    2
    Hey mate, what newer regulators would suggest. I have a couple of things on the go were power consumption is a issue and interested in your thoughts on this.
     
  12. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    There's a section of on-chip EEPROM, seperate from program memory, put there for storing data.
    I've soldered in a new EEPROM chip anyhow.. I just didn't want to risk soldering to this PCB too many times.

    I'm alsso interested in a better alternative to the 7805.
     
    Last edited: Dec 19, 2009
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, since you asked first, but our OP replied in agreement, then it is fair to proceed for the moment - even though it is a complete hijack of the original topic. If it goes on for more than a reply or two, it needs to be branched off to a new topic, which will unfortunately be more work for our Moderators.

    Switching regulators are the way to go. Linear regulators are from a time when we didn't know how to do things any better.

    An ICL7660 switched capacitor regulator can be better than 99% efficient for low-power supplies. That's impressive.

    A 7805 has a 5mA "tax" minimum off the top - you can't get away with anything less than that.

    A PIC in "sleep" mode might draw as little as 100uA, or perhaps even less. 5mA, in comparison, is a huge amount of current. Nearly all of the power wasted in linear regulators is wasted in the form of heat.
     
  14. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    After Googling the ICL7660, It seems it's maximum input voltage is 10 Volts.
    It might be good for circuits running from battery packs, but for a battery
    monitor, it needs to handle at least 15 Volts.
     
  15. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Art- Nice work! I can see how long it must have taken to solder all those tiny wires.

    I would suggest using veroboard or stripboard, you can make stuff 3x faster;
    28pin PIC on veroboard example
    after a while you hardly need to use any wire jumpers.

    May I ask where you got the fine single core blue wire (and is it the stuff that automatically strips the insulation when you solder it)?
     
  16. Art

    Thread Starter Distinguished Member

    Sep 10, 2007
    785
    61
    Hi Roman,
    This one was bad planning :D There should be less wires.

    The wire is called wrap wire or "Wrapping wire"
    It doesn't strip itself when you solder to it, you have to strip it yourself.
    Cheers, Art.
     
  17. McBurto

    New Member

    Dec 9, 2009
    1
    0
    Art,

    Nice job on the project.

    From my past experience with the Microchip A/D converter, there were two things that I remember had an effect on the value read. The first was the source impedance ( the voltage divider in your case ) which Microchip suggests should be no more that 10K ohm and the second being the acquisition time. Both are explained in the datasheet.

    Hope this helps.
    Rob.
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If you'd like to make your own switching regulator, why not take a look at Roman Black's page:
    http://www.romanblack.com/smps/smps.htm

    If you'd rather use a commercial IC, take a look at ONSemi's NCP3063, which is based off of the popular MC34063.
    Link: http://www.onsemi.com/PowerSolutions/product.do?id=NCP3063PGa
    I suggest this switching regulator because it's rated for automotive temperatures, can be used as a buck, a boost, or inverting regulator, and has an Excel spreadsheet tool that you can use to easily calculate the components you'll need (see the Design & Development Tools link from that page)
     
Loading...