This is probably a part in a series where I figure out some basics of electronic circuits. I take absolutely no responsibility and I might as well be totally wrong. I try to figure stuff out and see if it makes sense to me. The I’ll hook it up to my controller and if there’s no magic smoke I might have done something right đź™‚

I’m a programmer, I can write code for microcontrollers an hook some sensors up and I know that plus is minus and red is black đź™‚

But when it comes down to calculating specific dimensions of components or knowing what basic component I need in a circuit to adapt to specific conditions I’m totally lost and start all over like I’m back in 7th grade.

Part 1 – Voltage dividers

Simple Problem: Voltage coming from a 6V Solar Panel needs to be measured with an ADC which has a maximum input voltage of 2.048V (to be more specific: I use an ADS1015 with GAIN_TWO – more on that later)

Basic circuit: 2 Resistors in series connected to the PV panel, ADC between both Rs and GND.

+6V ---| []R1 | ----- ADC max 2V | []R2 | GND ---------uC GND

2V is a third of 6V so we need a ratio of 1:3 between the capacitors. Obvious way would be 2k+1k, 20k+10, 200k+100k …

2k for R1 “eats”/drops more voltage than 1k on R2 so we get our 2Volts at the ADC.

Q1: Now that the ratio is out of the way, how big do the capacitors need to be?

A1.1: The bigger the more noise, the smaller the more load on the power source.

So we want them to be as small as possible.

Q2: What is as small as possible?

A2.1: Ever dropped a wrench on a car battery? An ideal wrench has no resistance, (thus shorting the battery). No resistance and all the power flows through the wrench, draining the battery and baking the wrench to the terminals (ok, battery might aswell explode right into your face).

This is an example of a too small resistance. I=U/R -> 12V/0.01Ohm (only Chuck Norris divides by zero) ->1200Amps!

A2.2: Rule of thumb: Put a drain of 1mA on the power source and start your dimensioning from here.

R=U/I so R=6V/0.001A = 6K for both resistors together. Now it’s obvious we need something like a 2k and 4k. If we go higher we might drop this further but introduce more noise. Next commonly available are 4k7 and 2k2 thus bringing us to 6.9K which makes 0.87mA

Q3: What about the wattage these know-it-alls at the electronics counter always want to know?

A3.1: P=Uxi

Voltage drop is different on both Rs but I is the same (wired in series). So on R1 we have P=4V*0.001A=4mW and on R2 P=2V*0.001=2mW. So pick 1/8 or so – doesn’t really matter for this case.

Q4: Reality-check: Put 4k7+2k2 on mains (DON’T DO THIS!). Doesn’t sound good, is it mathematically?

A4.1:

R=U/I -> I=U/R -> 220V/6900 = 31mA -> P=U*I -> 220V*0.031 = 7W

This means your standard uC resistor with normaly 1/4 or 250mW will go up in flames pretty quick.

What resistance does my wrench need to drop it safely onto my car battery (STILL DON’T DO THIS!)?

R=12V/0.001A = 12k. Theoretically.

Just checked my wrench and it has 0.3Ohms resistance on my multimeter. Better not drop it there.

So that concludes Part 1.

So tomorrow I’ll probably hook up the PV and the LiPo to my ADC and see if I get some readings or all goes boom.

Next step is to hook up a ACS712 to get the current the panel provides.