Reading 60v via P1's ADC. Need Help

Hey everybody!

I’m using the P1 module in a system that has a solar charge controller built into it.

The solar charge controller can accept a input voltage of up to 60v DC.

I plan on using a Resistor Divider setup to bring that 60v range down to a level that the P1 can accept via one of it’s Analog input pins so its within acceptable voltage ranges.

At first I planned on using the Teensy 3.1 and had help figuring out a Resistor Divider value that was best for the Teensy 3.1 but now I just want to make sure this will work for the P1 also or does it need to be tweaked some?

Can anybody out there smarter than me verify if this resistor combo is OK to feed to a P1 ADC pin or not?

Any help is greatly appreciated :grinning:

Hi @RWB

The divider is set up at the moment to give a 3.66V output at 60V input. (Remember dividers are pretty easy to calculate: https://en.wikipedia.org/wiki/Voltage_divider)
The P1 runs off 3.3V, so feeding 3.66V into the ADC is a bit high as the ADC reference voltage will be 3.3V. The reference voltage can be set to lower values but can’t be higher than VCC (3.3V in this case) as far as I know.
You’ll need to rework this divider so that Vout (SolarInVoltageReading) is just under 3.3V at a 60V input. I could do this for you but it’s better done at your end as there are many different values that you could use and it’s best for ease of design if you use resistor values that you are already using in other parts of the circuit (less reels and set up time if you’re manufacturing etc.)
The signal you’re measuring has a very low output impedance meaning that your resistor choice is pretty flexible, keep in mind however that the lower your divider resistance is, the more solar power you’ll be wasting as heat :smile:
Remember that at 60V, in the above example you’ll be feeding about 5.6mA through the divider to ground, this means around 0.3W will need to be dissipated by the 10K resistor! Standard through hole resistors are rated at 0.25W and surface mount varieties much less, so you’re definitely going to want to increase your resistance.

I don’t want to further complicate things but if you’re planning on selling this product you may want to consider isolation between solar DC and the microcontroller side of things. 60V DC is quite high and depending on regulations etc. it may be required that this voltage be isolated from the low voltage. People used to feed mains voltage through a resistor divider directly into a microcontroller ADC to measure the line voltage but I think that’s a bit frowned on these days! If you have any more questions let me know.

2 Likes

One more thing, if you do decide to go down the resistor divider route I would recommend adding a clamping diode to the ADC input. This helps prevent the ADC from being damaged during an ESD or over voltage event (there’s quite a good explanation here: http://electronics.stackexchange.com/questions/45127/what-kind-of-diode-to-use-with-adc-inputs)

2 Likes

@G65434_2 Thank you very much for taking your time to answer my question.

I came across a diagram that helped me out also which is basically what your advice is also.

The only part I’m still needing guidance with is picking the right resistor values to have the lowest power dissipation at the higher voltage ratings. If the solar panels will normally be operating in the 20-40v range but under no load the voltage could be close to the 60v range.

I don’t mind using a single higher current resistor just for this circuit.

What do I need to know about the positives and negatives to different resistor combos?

I thought about using a INA169 60v Current Voltage chip but I’m not sure if I can just use the voltage reading part of the chip and leave the current resistors not populated or not. This would bring the current consumption down to the 60uA range.

Any thoughts on this option?

@RWB, you can use this handy voltage divider calculator for figuring out the correct values. Remember also that on the Photon, the maximum voltage is 3.3v so the zener needs to be 3.3v.

Using the divider, assuming an R2 of 100K, an input voltage of 60V and an output voltage of 3v (slight safety margin), you get R1 = 1.9M ohm.

The INA169 is a current sense resistor amplifier, not a voltage detector. A voltage divider is still required. :wink:

3 Likes

I think @peekay123 has answered what you were after :slight_smile: the only other thing I would say is go for at least an 0603, probably 0805 package as your voltage on the large resistor is going to be pushing 57V. (larger packages have larger clearances between pads). I say this because there’s a chance of things going wrong in a high pollution environment, e.g. contaminants/humidity on the PCB can sometimes cause carbonization leading to ignition if you’re unlucky.

1 Like

@peekay123 Thanks for helping out :smile:

I checked out your values via the website you provided and I think you meant to say 1.9k ohm instead of 1.9M ohm.

Now I found a site that calculates the power dissipation per resistor, I assumed the power consumption to be .03 A which I’m sure is higher than what the P1 will consume but are the numbers below correct? http://www.bowdenshobbycircuits.info/r2.htm

And to add to the conversation here is what the engineer for the solar charge controller chip had to say about this voltage divider + zener diode.

If you add a zener for overvoltage protection it must be placed before the divider, because it will leak an un known amount of current and affect the reading accuracy.

If you add a zener or a transient protector you should add some impedance in series with the input if you expect a high energy transient on the input. Otherwise the zener will short-circuit.

So if you add 100ohm resistor with high transient voltage rating from Vin to the divider, and add the zener across the divider your uC adc input pin should be well protected, but then your 8490 and input stage MOSFETs still may die.

So you may want a transient protector to clamp the input voltage to the charger if the cables to the solar panel are long and you are worried about nearby lightning strikes killing the charger. That can happen. I attach one example of a transient protector, there are many different parts.

@G65434_2 Thanks for the tip about using 0805 for more pad clearance, that’s something I would have not thought of. I stick with parts 0603 or larger just because they are easier to place by hand it the PnP machines don’t have much trouble with this size which I hear gives you better yields.

@RWB, no I DID mean 1.9M ohms. You entered 100 ohms for R2 instead of 100000 (100K) ohms! With R2=10K, R1=190K.

I adapted an automotive DC analog input protection circuit designed for ESD and overvoltage protection since automotive power is notoriously noisy and spiky. The design is exactly what the engineer describes (mostly since it is a very popular design). I only have a TI TINA simulator circuit but essentially it is:

                 Vcc
                  |
                  DD
                  |
DC IN --- R1 --------- R2 ---------------- Photon Analog Pin
              |   |       |     |    |
              C1  DD      R3   C2   Z1
              |   |       |     |    |
             GND GND     GND  GND  GND

The input to this circuit is a slow changing DC voltage ( in my case, max 24V)

R1, is inrush current limiting resistor (eg. 1K) also creating an RC delay with C1 (eg. 0.01uF) to reduce the rise time of voltage spike. DD are schottky diodes to the supply rail and ground to clamp over/under voltages (R1 reduces max current through these diodes). (R1+R2) and R3 create the voltage divider, C2 (optional) again reduces the rise time to the analog input and Z1 is a 3.3v zener to clamp any over voltage beyond the divider. All components are rated for the current/voltage they are exposed to.

Ahh My Bad :blush: Sorry about that. Makes sense now :smile:

Thank you for providing the circuit layout, it looks to be a robust solution.

Also your 1.9M Ohm + 100K Ohm resistor divider has a much lower power loss if the math below is correct:

Looks like I can get by with simple 0805 1/10 watt resistors if that is the case.

@RWB, you may want to consider a 190K/10K resistor divider to reduce the impedance of the circuit for the analog input (otherwise it may affect your sampling). Even with those new values (and adding the 1K input resistor), you get:

So you can use 0805 1/10 watt resistors and 0805 100V ceramic caps. Don’t forget to adjust your full range ADC values with the new scaling. :smiley:

1 Like

Perfect! :smiley:

Thanks for helping with this!

1 Like

Hey @peekay123 for the DD Schottky diodes in the schematic you posted they need to be rated for the full input voltage from the DC input right?

The max DC input from the solar panel is rated at 60v DC, so would 60-80v Schottky diodes with a 15mA current rating work for those parts?

Like these ? - http://www.digikey.com/product-detail/en/CMOD6263%20TR/CMOD6263%20CT-ND/4807021

@RWB, the current through the diodes is limited by the first resistor (R1). If you use a 1K resistor and assume 60v to GND via one of the diodes (negligible voltage drop) then that gets you 60ma. You need more than that if the voltage exceeds 60v so you can choose 100ma or more. The diode should be rated higher than the expected 60V of the batteries plus any spike voltage (which is the reason for the diodes in the first place). So a 100V, 150ma diode like the BAT46ZFILM will do the job.

Don’t forget to select R1 to reduce the current through the diodes! Also, make sure C1 is rated for 100V. :wink:

1 Like

@peekay123 Thank you very much for your help!

@peekay123

Here is what I drew up, it’s everything except the optional C2 capacitor.

I chose this 3.3v Zener diode, let me know if I need something else or not: http://www.digikey.com/product-detail/en/UDZVTE-173.3B/UDZVTE-173.3BCT-ND/4571447

I’m not sure if I have Schottky diode that is supposed to go to Vcc right or not? This is a solar panel input with a max input voltage of 60v, which feeds a MPPT charge controller circuit to charge a 12v battery. So I’m not sure what other Vcc that top Schottky would connect to.

Here is the schematic. It’s backwards to your drawling but the same part layout.

@RWB, the zener is good. Not sure what all the caps on VIN are for though?

@peekay123 The caps are part of the solar input side of a 20 Amp MPPT solar charge controller module.

Thanks again for looking this over.

1 Like