PIC 16F88 ADC Inconcistency, Voltage Drops??? PLEASE HELP!!!

Discussion in 'Embedded Systems and Microcontrollers' started by donjuan201, Aug 5, 2014.

  1. donjuan201

    Thread Starter New Member

    Mar 2, 2011
    3
    0
    Hi Guys,

    I hope someone can point me in the right direction, I am completely lost! I have built a Solar Charge Controller based on a IRF4905 MOSFETchip. I use 2 x 3904 and one 3906 transistors to power the GATE of the MOSFET. I then use the PIC to switch the MOSFET ON and OFF on a specific voltage. I also have a LCD connected to the PIC that prints the solar and battery volts respectively using the 10 bit ADC through resistor divider networks.

    Now with that said I am experiencing the following issue regarding the ADC values; When the solar panel is connected the reference voltage of the 78L05 chip comes down from 4.96V to about 4.66V and this creates a huge problem as the ADC reading is not correct due to the reference voltages fluctuating and this results in the charger not switching ON / OFF at the correct voltages. When I disconnect the solar panel supply the voltage returns to normal. I have tried various different techniques to solve this issue but I can't seem to find the solution.

    I have tried the following:

    1. Ground the solar panel directly to the battery (this seemed to work better but I still have a variance of about 0.15V).
    2. tried different CAP values on the voltage divider networks (this made little to no difference at all).
    3. Increased the CAP value on the 78L05 IC (this only works for a mere couple of seconds until the CAP is drained).

    I don't know if I am missing something vary obvious in my design but I can't seem to figure this out, are there any experts out there that can assist me please!!! I attached my circuit from PDF export from Proteus to explain the circuit in more detail.
     
  2. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    This is kind of disturbing since there is a diode before the battery.

    Do you know you can just strap the P MOSFET to positive rail, and then ground it with one transistor?

    Also what is the battery voltage?
     
  3. donjuan201

    Thread Starter New Member

    Mar 2, 2011
    3
    0
    Thanks for the quick reply...I wish I knew a lot more about electronics, I basically built this circuit from bits and pieces that had used in previous projects. So please bare with me as I try and explain why.

    The diode was put before the input of the 78L05 to protect it from reverse polarity. As far as the MOSFET is concerned, I built the network of transistors to be able to switch the GATE ON / OFF using the PIC's 5V source. I am not sure how this can be done using only a single transistor?

    The battery will operate between 10.5V and a MAX of 15V.
     
  4. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    7805 is connected to the battery. If its voltage drops, it could be eaither because:

    1. Vcc drops. Possible (unlikely) causes:
    - you drain a lot of current from it, so the voltage sags
    - battery voltage is going down dramatically.

    and/or

    2. GND rises. Means there's a current between GND where you put your probe and 7805's GND. Measure directly at the pins of 7805. Make sure that it (and all your logic) is connected to the battery directly, not to some sort of wire by which the solar current flows.
     
  5. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    After you identify and correct your voltage sag problem, you might also consider moving from the PIC16F88 to a PIC16F1827 or a PIC16F1847. Both contain a voltage reference module which can be used as the ADC vref (2048 or 4096 millivolts).

    Regards, Mike
     
  6. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    The idea is to short out the gate voltage with a NPN. The 5v from the PIC are higher than the GND potential. For a transistor the base voltage relative to the emitter counts.
     
  7. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,790
    Using a 7805 for an ADC reference would not be my first choice. It is a voltage regulator, NOT a voltage reference. Use a proper voltage reference.
     
  8. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    it does have a reference built in, for 8bit it should be adequate.
    consult the datasheet.
     
  9. donjuan201

    Thread Starter New Member

    Mar 2, 2011
    3
    0
    :)

    Thanks for this info, I think #2 is my issue here as the battery volts does not drop at all, it actually increases as the solar panels current starts to flow into the battery. The volts in my original message is the actual volts on the 78L05 pins. So I think my GND reference is definitely rising due to the current flowing through the common GND.

    Any ideas how I can separate the 78L05's GND from the Solar Panels GND? I will play around with a couple of links on the board and see how I can resolve this...

    Thanks for this, I did read up on the FVR (Fixed Voltage Reference), I think the controllers you mentioned will also have this built in function. Unfortunately the 16F88 does not have this function.

    I actually tried using the 7805 and the 78L05 voltage regulator IC's both yield the same results. What do you mean with "Use a proper voltage reference."
     
  10. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,790
    Check the specifications on the regulation. They are in the 1-2% range. Good enough for Vcc to a circuit or a board, but not so good for A2D work. A good reference should be in the 0.1% range. The reference should be immune to power supply variations and changes in the load on a power supply.

    In your specific case the variation is almost 6% so there must be something else going on.
     
  11. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    If you use a switcher primarily the stability isnt so bad, the 78l05 cant flucate 2% when the switcher stays within 0.5% or so.

    I used it for A/D, no movement of digits, that was all I needed. Temp stability isnt so good either but there are cases where it mostly remains 25C nothing really heats up.
     
  12. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    A reference with a 0.1% tolerance is terrible when you need a reading to within .001%

    A reference with a 2.0% tolerance is wonderful when you need a reading to within 5.0%

    Selecting parts before defining the spec is madness.
     
  13. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    1. Connect 7805's ground directly to the battery terminal. It is Ok to have a longish wire, but do not connect any other grounds to that wire (except after 7805 of course).
    2. Install all recuired capacitors for 7805
    3. Install a 10uF+ capacitor accross power supply right next to the MCU.
     
  14. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,790
    He said 8 bit A/D so at least 0.4% would be indicated. A little bit better (0.1%) than the required minimum can't hurt. I don't think a 78L05 can come close to either of those.

    BTW why are you yelling at me for not defining the requirements? It is the OP's project, and I'm just trying to help; but I don't get paid to do designs for other people any more. Take it or leave it with a grain of salt. It's all the same to me.
     
Loading...