Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Clarification Request - 3.3v logic w/ 5v power to 2946
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Clarification Request - 3.3v logic w/ 5v power to 2946

by eph123 on Sat Aug 08, 2020 9:14 pm

Greetings,

Please let me start by saying that I've chosen a project to make a custom keyboard as my initial foray into learning electronics. I'm a total noob, and apologize if my question is daft because of my lack of understanding!

I am seeking clarification of the documentation for the Adafruit 2946 I31FL3731 16x9 Charlieplexed PWM LED driver. The documentation states:

"If you are using a 3.3V logic, you can ... power from 5V and then use ~2.2K resistors from SDA and SCL to 3.3V to 'overpower' the built in 20K pullup resistors.


If I'm interpreting this correctly, it seems to be saying connect 5V on the logic board with VCC on the 2946. That makes sense because that's power to power. My confusion is more specifically regarding this part:

from SDA and SCL to 3.3V


Does that mean a connection between the 2946's SDA and SCL pins and the logic board's 3.3V pin, with a 2.2Kohm resistor on each of those two connections? In other words:

1. Wire between logic board GND and 2946 GND (Ground connection).
2. Wire between logic board 5V and 2946 VCC (Power connection).
3. Wire between logic board SDA and 2946 SDA (Data connection).
4. Wire between logic board 3.3V pin and 2946 SDA, with a 2.2Kohm resistor between (Power and data connection?).
5. Wire between logic board SCL and 2946 SCL (Clock connection).
6. Wire between logic board 3.3V pin and 2946 SCL, with a 2.2Kohm resistor between (Power and clock connection?).

Because of connections #3 + #4 and #5 + #6, unless a diode was used in each connection to enforce a direction of current flow, wouldn't this also imply a connection between the logic board's 3.3V and its own SCL and SDA pins? Wouldn't this be undesirable?

I don't feel like I really understand what's being described, and don't want to proceed with my designing until I do. I've tried to find some examples online of this kind of wiring for the 2946 but came up empty handed, so I figured, asking on Adafruit's own forum would be the next step in trying to get clarification on this.


Context:

    - Using a QMK Proton-C (Ardruino Pro-Micro derivative) as the logic board.
    - Using an Adafruit 2946 breakout board for the IS31FL3731 PWM LED driver to control a grid of 37 LEDs.
    - Each LED is a VCC VAOL-3MSBY2 blue LED with a VF of 3.5 @ 20mA.
    - Therefore I doubt I can power the 2946 at just 3.3v, even though I plan to run the LEDs much closer to 5mA each.
    - Accordingly, I believe I have to power the 2946 using 5v from the Proton-C, but I'm uncertain how that wiring would look (as per my above questions).

Thank you to all that attempt to assist me with my confusion!

Thanks!

~ EPH

eph123
 
Posts: 11
Joined: Sat Aug 08, 2020 8:32 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by eph123 on Sun Aug 09, 2020 6:25 pm

Is this the wiring that is being recommended when powering the 2946 with 5v from a 3.3v logic board?
Proton-C to 2946 LED Driver Wiring.pdf
(67.56 KiB) Downloaded 4 times

eph123
 
Posts: 11
Joined: Sat Aug 08, 2020 8:32 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by adafruit_support_mike on Mon Aug 10, 2020 12:41 am

eph123 wrote:"If you are using a 3.3V logic, you can ... power from 5V and then use ~2.2K resistors from SDA and SCL to 3.3V to 'overpower' the built in 20K pullup resistors

That part means you can connect the IS31FL3731's VCC pin to 5V, but if you do, it's SDA and SCL pins will also connect to 5V (through 20k resistors built into the board).

In that state, the SDA and SCL pins could damage a 3.3V microcontroller. The general rule of thumb is that you don't want to connect an IC's pins to any voltage more than about 0.3V beyond its VCC and GND voltages unless the datasheet explicitly says you can. In most cases, that excess voltage can kill the circuits that make the pin do its thing.

To make the IS31FL3731's SDA and SCL pins safe for a 3.3V microcontroller, connect one 2.2k resistor from the IS31FL3731's SDA pin to a 3.3V pin on the microcontroller board (most development boards have a pin that connects directly to the built-in voltage regulator's output), and another 2.2k resistor from the SCL pin to the same 3.3V pin.

Doing that creates a pair of voltage dividers between the IS31FL3731 breakout's 5V supply and the microcontroller's 3.3V supply: 20k from 5V to SDA or SCL, and 2.2k from SDA or SCL to 3.3V.

In a voltage divider (two resistors in series), the same current flows through both resistors, and Ohm's Law says V=IR: the voltage across a resistor is proportional to the resistor's value and the amount of current that flows through it. If 1mA flows through a 20k resistor, the voltage across it will be 20V. If 1mA flows through a 2.2k resistor, its voltage will be 2.2V.

If you play with the algebra a bit, you get what's known as the 'voltage divider equation':

V.R1 = V.total x R1 / ( R1 + R2 )

V.total is the voltage applied across both resistors, so the current through the resistors is V.total / ( R1 + R2 ). Then you can multiply that current by the value of either resistor to find the voltage across just that resistor.

In this case, V.total would be the difference between 3.3V and 5V, or about 1.7V. 20k is about 9x larger than 2.2k (the sum of 20k and 2.2k is 22.2k), so about 90% of that 1.7V will exist across the 20k resistor, and about 10% will exist across the 2.2k resistor. 10% of 1.7V is 170mV, which is within the "don't go more than 0.3V past VCC" rule for a 3.3V microcontroller.

The lower-value resistors pull the voltage on the SDA and SCL pins down to a level that's safe for a 3.3V device when the IS31FL3731's VCC is connected to 5V.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by eph123 on Tue Aug 11, 2020 10:28 pm

Apologies for the delay, my internet cut out yesterday!

Hmm, so it sounds like the 5V from the IS31FL3731's SDA and SCL each, plus the 3.3V from the microcontroller connected via a 2.2K resistor, is *not additive*, but rather a function of the resistors and Ohm's law, which will result in the total voltage on each of the SDA and SCL wires being reduced to 1.7V (function of Ohm's law), instead of being boosted to 8.3V (additive like I had previously thought). I'm a software engineer by trade so that wasn't what I would have intuitively guessed, thank you for that info! Its going to take me some time to adapt to that way of thinking.

Still have a point of confusion, though. Do the IS31FL3731's SDA and SCL even get connected to the microcontroller's SDA and SCL? Or are they both just connected to the microcontroller's VCC at 3.3V? I attempted to update my block diagram based on your response and it looks to me like the microcontroller's 3.3V would be connected to the IS31FL3731's SDA and SCL like you say, but if I then connect the IS31FL3731's SDA and SCL to the microcontroller's SDA and SCL as well, it seems all five of those pins would end up connected together through the common wires from the microcontroller's 3.3V. Wouldn't that cause crosstalk?

Basically, this is what I'm seeing:

First:
IS31FL3731 SDA wired to a 2.2K resistor, which then connects with Microcontroller 3.3V, as you stated.
IS31FL3731 SDC wired to a 2.2K resistor, which then connects with Microcontroller 3.3V, as you stated.
Therefore, there's a connection between the IS31FL3731's SDA and SDC at this point. Crosstalk between these two pins at this stage?
Then:
IS31FL3731 SDA wired to Microcontroller SDA, so there's a connection on that channel between the two devices.
IS31FL3731 SDC wired to Microcontroller SDC, so there's a connection on that channel between the two devices.
Therefore, there's a connection between all five pins (IS31FL3731 SDA, SDC, and Microcontroller 3.3V, SDA, and SDC) because of the common wire from Microcontroller 3.3V. Crosstalk between these two channels at this stage?

Again, many apologies; I'm trying to understand what's happening with this circuit. I'm expecting that if any single wire, or pin for that matter, shares a connection with another wire or pin, then any signal being transmitted on any of those connected wires would be transmitted on all of those connected wires. That's why I'm confused how this would work when all five of these share a common wire with the microcontroller's 3.3V pin. Would this not be the case? I understand a diode can prevent signal propagation to other parts of a connection, but I wouldn't have expected that of a resistor (unless it resists the amplitude of the signal so that its undetectable by the receiving end?).

I thank you considerably for your patience and time!

~ EPH

Updated draft block diagram
Proton-C to 2946 LED Driver Wiring.pdf
updated draft block diagram
(139.22 KiB) Downloaded 2 times

eph123
 
Posts: 11
Joined: Sat Aug 08, 2020 8:32 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by adafruit_support_mike on Wed Aug 12, 2020 12:53 am

eph123 wrote:it sounds like the 5V from the IS31FL3731's SDA and SCL each, plus the 3.3V from the microcontroller connected via a 2.2K resistor, is *not additive*, but rather a function of the resistors and Ohm's law

That's correct.

eph123 wrote:which will result in the total voltage on each of the SDA and SCL wires being reduced to 1.7V (function of Ohm's law)

This part isn't correct. When connected by 2.2k resistors between a 5V SDA/SCL pin (wit 20k pull-ups) and 3.3V, the voltage on SDA and SCL will be about 3.47V.

The difference between 3.3V and 5V is 1.7V. A 20k-2.2k voltage divider will put 90% of that voltage (1.53V) across the 20k resistor and 10% (0.17V) across the 2.2k.

eph123 wrote:instead of being boosted to 8.3V (additive like I had previously thought).

Yeah, that's definitely not correct.

Voltage is the amount of energy it takes to move electrons from one place to another. There are several parallels in mechanical physics, one being distance up a flat slope. The energy used in a circuit is equivalent to objects rolling down the slope. If you have a pile of marbles 5' up a hill and let them roll down to a point 3.3' up the hill, you get 1.7' worth of energy, but the marbles never go 8.3' up the hill.

eph123 wrote:Still have a point of confusion, though. Do the IS31FL3731's SDA and SCL even get connected to the microcontroller's SDA and SCL?

Yes, you have to make those connections. The microcontroller's SDA and SCL pins are the ones that read the SDA/SCL signals.

Think of the SDA/SCL pins as pieces of string with springs pulling one end of them up the hill. The IS31FL3731 has 5' strings, and the microcontroller has 3.3' strings. The strings have a little flex, but if you try to pull the 3.3' strings to the point 5' up the hill, they'll break.

To make the system work, you can connect a stick between the 5' point and the 3.3' point, then tie the strings from both sides to the same point somewhere along the stick. If you choose a point 10% of the way along the stick, both strings will be pulled up to 3.47' (3.3' plus 10% of the 1.7' between 3.3' and 5'). Then each side can pull the same connection point down to 0', watch its own string to see if the other side has pulled the connection point down, and nobody's string breaks.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by eph123 on Wed Aug 12, 2020 7:43 pm

Ok, I think I got it now. I did some reading last night and today, and am now getting the numbers you were saying.

I think my biggest point of confusion was that I thought voltage was a quantification of particles (electrons). When that perspective changed, I thought that voltage was a measurement of a force, which was also wrong. I now understand that voltage is literally just a measurement of potential, and not of a force. I also now understand that amps also have nothing to do with a quantification of electrons, nor a measurement of a force, but rather a measurement of charge. So my preconceived notions of what these measurements represented was totally wrong, and that was throwing me way off.

It makes sense now, that if two potentials are added together, they would be additive, if they were added in a non-conflicting way. But in the case of these connections, the 3.3V is coming from one side, and hitting an opposing 5V. Since those two potentials are in this case working against each other, the resulting potential is the absolute value of the difference between the two (hence why you never said it was a negative voltage), which is the 1.7V you'd been talking about.

So when I was looking at voltage divider calculators, the input voltage would always be 1.7V, no matter which side was being looked at. On the IS31FL3731 side of the 2.2k resistors, the voltage is 3.47V as you said, while on the microcontroller side of those same 2.2k resistors, the voltage is 3.13V.

The 3.13V is below the microcontroller's 3.3V on its VCC pin, which is why it won't hurt the microcontroller, as you said.

Also, I think I verified the math here by adding them all up, and it does in fact equal 3.3V + 5V = 8.3V:

1.53V drop across the 20k resistor +
3.47V on the IS31FL3731 side of the 2.2K resistor +
0.17V drop across the 2.2k resistor +
3.13V on the microcontroller side of the 2.2K resistor
== 8.3V TOTAL (3.3V microcontroller + 5V IS31FL3731)

And I'm guessing the direction of this math works from 5V to 3.3V because things would go from higher potential into the domain of lower potential, and that's why doing the same calculation backwards won't quite work.

I also did some reading about the crosstalk, and was thinking too digitally. Since the communication over I2C deals with detecting three states (high, low, and none), the signal is analog. Therefore, if two analog waves are combined, the resulting signal would produce 'spikes' that produce a distinct indication of the pulses for each of the two signals. I suppose the logic on the IC for the SCL pin somehow knows to look for the kind of signal pattern it expects for an SCL pattern, and likewise on the SDA pin for an SDA pattern. I also read that on both sides, the SCL and SDA pins already share a common connection with their 5V / 3.3V VCC pins anyway, so the additional common connection introduced by the voltage divider is moot.

I've updated my diagram showing how these two should be connected, and I think it's now correct. I've also updated it with the voltage values that are on each wire on each pin, in case I need to refer back to that later. Assuming my statements about my concerns about confusing the SCL and SDA signals being moot are correct, I think I've got all my questions answered. If I'm wrong on anything though let me know :)

Proton-C to 2946 LED Driver Wiring.pdf
Updated block diagram
(142.07 KiB) Downloaded 2 times

eph123
 
Posts: 11
Joined: Sat Aug 08, 2020 8:32 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by adafruit_support_mike on Fri Aug 14, 2020 5:20 am

eph123 wrote:I think my biggest point of confusion was that I thought voltage was a quantification of particles (electrons).

That's current: specifically the number of electrons that pass through a hypothetical surface per second. The unit for counting electrons (or more generally 'charge') is the Coulomb, which is about 6.25e18 electrons worth of charge. 1 Ampere of current is defined as 1 Coulomb of charge passing through a surface per second.

The mechanical analogy I prefer is momentum: it's a combination of how much mass there is and how fast it's moving.

Current is additive. If you have 1mA coming in from the left and 2mA coming in from the right, they combine to make 3mA.

Another analogy for voltage is potential energy.. in fact, back in the early 20th century, the term was 'potential'.. 'voltage' came later. It's also analogous to tension in a spring, and that term was also used. We still call power transmission cables 'high tension lines', not because of physical force directed along their axis, but because the voltage (aka: 'tension') is 100kV or so.

I like the hill-climbing analogy because it implies a kind of distance between two points, and provides intuition on which way current will flow. It's easy to see how current will flow from a point 5' up a hill down to a point 3' up the hill, but not up the other way.

There's also a piece that isn't talked about as much: the electrical equivalent of kinetic energy is the magnetic field around any moving charge.

If electrons are standing still (like on the plates of a capacitor), they store energy as voltage in an electric field. The more energy they store, the higher the voltage. When the electrons start to move, the potential energy in the electric field is converted to kinetic energy in the magnetic field. Going the other way, when current flows into a capacitor, the kinetic energy of the magnetic field is converted to potential energy in the electric field. As that happens, the voltage between the plates of the capacitor increases.

eph123 wrote:It makes sense now, that if two potentials are added together, they would be additive, if they were added in a non-conflicting way.

That's correct in the sense of stacking one battery (or capacitor) on top of another.

I think your notion of 'conflict' might still be steering you in the wrong direction though.

Let's say a 3V battery is equivalent to an escalator from the ground floor of a building to the 3rd floor. A 5V battery is equivalent to an escalator from the ground floor to the 5th floor. Since both escalators start from the ground floor, no path along those two escalators will take you to the 8th floor. When you get to the top of either escalator, you have to walk all the way down to the ground floor (releasing all the potential energy the escalator pumped into you) before you can ride up the other one.

If you want to get to the 8th floor, you need a 3-story escalator on the 5th floor, or a 5-story elevator on the 3rd floor.. then you can take all the potential energy you've collected at the top of the first escalator, and let the second escalator add even more energy to it.

Most electronics are done in terms of things moving down though.. we shove everything that pumps potential energy into the system into a box called 'power supplies' and focus on making sure they give us the amount of energy we want (voltage regulation).

A more appropriate analogy for the voltage divider between 3.3V and 5V rails would be a pair of rubber bands tied between those two points, rather than a stick. We still have the two strings for pulling things down, and the restrictions that the strings have to be tied where the rubber bands meet, and that we can't break the 3.3' string by pulling it too high.

When the strings are slack, both rubber bands pull against each other with the same amount of force (if they didn't, they'd move until they did). If we want the meeting point to be close to the 3.3' end, the rubber band connected to the 5' point has to stretch more than the one connected to the 3.3' point. If we choose the bands so the 5' end stretches 9" for every 1" the 3.3' end does, the point where they meet will land at 10% of the distance from the 3.3' end to the 5' end.

In electronics, 'stronger rubber band' translates to 'easier for current to flow through it'.

The property that interferes with conversion of potential energy (voltage) to kinetic energy (magnetic field around current) is called 'resistance'. Electrons move through solids by hopping from one atom to the next, and it takes a certain amount of energy just to force them away from the atom so they can make the next hop. That energy stays in the atom, making it vibrate against its neighbors. Macroscopically, we call such vibration 'heat', so resistance converts voltage to heat (which can't do any more useful work in an electrical circuit).

The relationship of voltage that can be converted to current through a given amount of resistance is called Ohm's Law: V=IR.. voltage is the product of current and resistance, or more usefully in this case: I=V/R.. the amount of current you can get through a resistor equals the voltage between the ends of the resistor divided by its resistance. If you apply 1 Volt across the ends of a 1 Ohm resistor, the potential energy from the voltage can turn into enough kinetic energy around moving electrons to make 1 Coulomb of electrons pass through the resistor per second (1 Ampere).

If we apply the same 1V across a 9 Ohm resistor, only 1/9th of a Coulomb of electrons will flow through per second. If we put the 1 Ohm resistor in series with the 9 Ohm resistor (all the current that flows through one flows through the other), and apply 1 Volt across the combined 10 Ohms, 1/10th of a Coulomb of electrons will flow through per second (0.1A, or 100mA). If we multiply that 100mA by 1 Ohm, we find that the resistor converted 100mV worth of potential energy to heat. If we multiply the 100mA by 9 Ohms, we find that the resistor converted 900mV worth of potential energy to heat. With the same current flowing through both resistors, the voltage across 9 Ohms was 9x larger than the voltage across 1 Ohm.

Side note: Georg Ohm got fired from his job as a math and physics teacher for publishing that idea. Not only did he disagree with the leading minds of the day, he had the bad taste to base his arguments on empirical data from experiments instead of reasoning them out from first principles, as was the fashion of the day.

eph123 wrote:And I'm guessing the direction of this math works from 5V to 3.3V because things would go from higher potential into the domain of lower potential, and that's why doing the same calculation backwards won't quite work.

Exactly correct. Going from 5V of potential energy to 3.3V of potential energy releases energy. Going from 3.3V to 5V means you have to get more energy from somewhere.

eph123 wrote:I also did some reading about the crosstalk, and was thinking too digitally.

That can of worms will probably do you more harm than good right now.

All electromagnetic activity can be described accurately by Maxwell's equations (strictly speaking, Heaviside's reformulation of what Maxwell published.. Maxwell's published 20 equations in 20 unknowns, which Heaviside reduced to 4 equations in 4 unknowns), but those equations use symbols you don't learn until about a second class in differential equations (the 'del' operator.. Heaviside had a tendency to invent new kinds math to do what he needed). Even once you know what they mean, the equations for anything but trivial examples are far too complex for daily work.

Instead, we use a group of simplifying assumptions called the 'lumped element discipline' that strip away 95% of the complexity at a loss of maybe 1% absolute accuracy. The things we call 'resistors', 'capacitors', and 'inductors' really represent simplified relationships between electric fields (voltage) and moving charge (current). We assume resistors only convert voltage to heat, capacitors only store potential energy, and inductors only store kinetic energy. We assume current flows from one side of an element to the other in zero time, that each component is completely independent of any components around it, that wires have no resistance, capacitance, or inductance, and so on. The answers we get are wrong in the pure math sense, but the errors are usually small enough that we can ignore them.

Crosstalk is where the errors get too big to ignore. All real wire has some amount of resistance, all current flowing through a wire has a magnetic field around it, any two wires near each other form a capacitor, there is some interaction between components near each other, it does take time for signals to move through wires and components, etc.

Trying to make sense of the exceptions to the rules before you're really solid with the rules themselves will probably lead you farther into confusion than understanding. When you start zeroing in on a correct understanding of the lumped element discipline, you'll remember some exception and end up thinking, "well that can't be right". Strictly speaking you'll be correct, but you won't have the piece that says, "yeah, slightly wrong, but darn close and massively useful".

eph123 wrote: If I'm wrong on anything though let me know :)

Still a little off: you have the Proton's SDA and SCL lines connected directly to the 3.3V power supply (and each other). Those pins won't be strong enough to pull the voltage down to 0V (and trying to do it could kill the pins).

You're correct that the 2496 breakout's SDA and SCL pins each need a 2.2k resistor to 3.3V.

You need to move the Proton's SDA and SCL connections to the same points as the 2496 breakout's SDA and SCL connections: the SDA and SCL pins themselves. Then both the 2496 breakout and the Proton can pull SDA or SCL low, and each can watch its own SDA/SCL pins to see what the other is doing.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by eph123 on Sat Aug 15, 2020 3:29 pm

If you apply 1 Volt across the ends of a 1 Ohm resistor, the potential energy from the voltage can turn into enough kinetic energy around moving electrons to make 1 Coulomb of electrons pass through the resistor per second (1 Ampere)


I'm going to have to meditate on this. The hill analogy feels better for me, but not so much strings or rubber bands (at least not yet); I feel like I'm developing a more subliminal intuition about 'potential' (volts) and 'charge' (amps). Though what you'd been saying about amps seems to be a quantification of particles through a given point over a given frame of time, and that I think I'll have to meditate on for a bit to truly absorb it.

Really good info on capacitors and inductors storing potential and kinetic energy; I did actually jump to the conclusion that capacitors stored the 'charge' but now understand that 'charge' is a function of quantity over time, and therefore can't be stored. Storing potential though is super interesting conceptually to me. Inductors was new info to me; I didn't know inductors could store energy. My only exposure to that term was the concept of an induction stove, which I know works by magnetically exciting ferrous molecules in a cooking vessel (ie: a copper or iron skillet, etc).

I looked again at my diagram, and I think I lost something in the learning I've done since we started (and thank you for sticking with me, I am learning, though apologies for not being faster!): the 2946's SDA and SCL pins are now 3.47V each, and the Proton's corresponding pins are still 3.3V; therefore the valley between those two potentials is a mere 0.17V each on the SDA to SDA wire and the SCL to SCL wire. If that's correct, why does it have to be that small? If the Proton's pins were left at 3.3V, and the 2946's at 5V, the valley between those potentials would still be 1.7V, which is still way less than the Proton's logic VCC of 3.3V. I thought each pin on an arduino-type device could withstand up to VCC+0.3V = 3.6V?

Proton-C to 2946 LED Driver Wiring.pdf
Updated Block Diagram
(96.61 KiB) Not downloaded yet

eph123
 
Posts: 11
Joined: Sat Aug 08, 2020 8:32 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by adafruit_support_mike on Mon Aug 17, 2020 6:00 am

It takes a while to internalize the ideas. Keep playing with the ideas and comparing your intuition to results you can measure. Electronics is an applied science, so all of the theory is just a map. It can help you navigate the territory, but is no substitute for actually getting out and walking the landscape.

The theory and practice complement each other. Ten minutes at the bench can make a day's worth of reading actually mean something, then you go back to the books when you see the hardware do something you can't explain.

eph123 wrote: I did actually jump to the conclusion that capacitors stored the 'charge' but now understand that 'charge' is a function of quantity over time, and therefore can't be stored. Storing potential though is super interesting conceptually to me.

I'm gonna nitpick your use of terms slightly:

This part is correct:

eph123 wrote: I did actually jump to the conclusion that capacitors stored the 'charge'

but the exact wording of this part is incorrect:

eph123 wrote: but now understand that 'charge' is a function of quantity over time

'Charge' is just a quantity: the number of electrons doing something you want to measure. The function of time is 'current', defined as Coulombs of charge per second (or if you speak calculus, dQ/dt where Q is the traditional variable for charge).

Taking the rest of your statement with that change in terms, you're right that a capacitor can't store current. Current flowing into a capacitor stops and becomes what's known as 'fixed charge' on the plates. The energy that made the current move into the capacitor turns into energy stored an electric field between the plates, and the voltage between the plates increases. When current flows out of a capacitor, energy stored in the electric field between the plates becomes energy that makes some of the fixed charge move, and the voltage between the plates decreases.

Again in calculus: dV/dt = 1/C x dQ/dt, where dV/dt is how the voltage between the capacitor's plates changes over time, dQ/dt is current (the change in fixed charge inside the capacitor over time), and C is the capacitor's value in Farads (defined as Coulombs of fixed charge on the plates per Volt of energy in the electric field between the plates).

eph123 wrote:I didn't know inductors could store energy.

Yep, they're mechanically equivalent to a flywheel: you have to work to crank them up to speed, and they'll keep turning when you stop cranking.

Electrically, all moving charge (current) creates a magnetic field around itself, and the strength of the field is proportional to the amount of current. If you increase the current, the field has to expand, which it does by stealing some energy trying to push the new current. If you reduce the current, the field has to shrink, which it does by dumping some of its energy into the current.

eph123 wrote:the 2946's SDA and SCL pins are now 3.47V each, and the Proton's corresponding pins are still 3.3V; therefore the valley between those two potentials is a mere 0.17V each on the SDA to SDA wire and the SCL to SCL wire. If that's correct, why does it have to be that small? If the Proton's pins were left at 3.3V, and the 2946's at 5V, the valley between those potentials would still be 1.7V, which is still way less than the Proton's logic VCC of 3.3V.

It looks like you're getting caught on the reference points for the voltage measurements.

The mechanical equivalent to your question is, "I have a piece of string 3.3' long. I know it will break if I stretch it farther than 3.6'. 5' is only 1.7' longer than 3.3' though, and 1.7' is smaller than 3.3'. Why can't I stretch the string to 5'?"

The working construction is: "I have a piece of string that will break if I stretch it farther than 3.6'. I've already stretched it to 3.3', so it can only go another 0.3' (a measurement relative to 3.3') before it breaks. 5' is 1.7' longer than 3.3' (another measurement relative to 3.3'), and 1.7' is longer than 0.3'. Therefore I can't pull the string to 5' without breaking it."

Voltage, like length, has to be measured between two points. For the SDA/SCL pins on both boards, the reference point is the shared GND pin. The Proton's SDA/SCL pins are 3.3V above GND, and the IS31FL3731's SDA/SCL pins start at 5V above GND. The voltage divider pulls them down to 3.47V above GND.

You can compare 1.7V-above-3.3V to 0.3V-above-3.3V because both measurements start from a common point. You can even compare 1.7V-above-3.3V to 3.3V-above-GND if you only care about their magnitudes (is 3.3V closer to GND or to 5V?). You can't use 1.7V-above-3.3V in the context of a maximum-distance-above-GND limit though, because that measurement starts from the wrong place. To make the measurement work in that context, you have to re-frame it in terms of the correct starting point: 1.7V-higher-than-3.3V-above-GND.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by eph123 on Mon Aug 17, 2020 7:41 pm

Ahah, so the 3.3V from the Proton's SDA and SCL pins is actually running "downhill" toward the voltage divider (because the voltage after the splitter on the Proton's side is below 3.3V, and current flows from greater to lesser potential), and is adding to the 0.17V that's on the wire between the 2946 and Proton SCL / SDA pins. Hence, the total voltage there is actually 3.47V, not 0.17V. Does that sound correct? If it does, then the 3.47V coming into the Proton's SCL and SDA pins is within the 3.6V max (3.3V VCC + 0.3V), and I think I see it now. I think I'm also starting to get some more intuitive understanding of the strings analogy, since the "peak" of 3.3V is tied to ground (0V) and some other point on the opposite side of the "peak".

I imagine the recommended resulting 3.47V (instead of going all the way to 3.6V) is as it is so that there's some wiggle room in case of surges, so there's still a 0.13V 'safety margin' if something should spike, correct?

Ooh... and if this is correct, and since current flows from greater to lesser potential, that explains why the signals from the SDA and SCL pins aren't actually going to be interfering with each other via the common connection to the Proton's 3.3V, because the 3.3V pin from the Proton would have 3.13V coming out of it on that side of the voltage divider, and on the 2946 side of the divider, it will be 3.47V, and therefore signals can't come back over those resistors to cause cross-talk on the other channels, correct?

Proton-C to 2946 LED Driver Wiring.pdf
Updated Block Diagram
(141.69 KiB) Downloaded 3 times

eph123
 
Posts: 11
Joined: Sat Aug 08, 2020 8:32 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by adafruit_support_mike on Wed Aug 19, 2020 12:25 am

Your connection diagram is correct.

eph123 wrote:so the 3.3V from the Proton's SDA and SCL pins is actually running "downhill" toward the voltage divider

Close, but still still needs a little tweaking.

The 2946 breakout's SDA and SCL pins have built-in 20k pull-up resistors, and you want to connect those to 5V. Current from the 5V rail will flow down through those 20k resistors into the 2.2k external resistors you added, then down through those to the 3.3V rail ('rail' being a generic term for a connection to a power supply). You're absolutely right about the current flowing from higher potential to lower potential, the same way marbles will roll down a hill.

The voltage at the point where the 20k and 2.2k resistors meet will be 3.47V (90% of the way down from 5V to 3.3V).

Both the 2946's SDA/SCL pins and the Proton's SDA/SCL pins connect to the points where the 20k resistors meet the 2.2k resistors, so both sets of pins will see 3.47V (until one device or the other connects its SDA or SCL pin to GND).

eph123 wrote:I imagine the recommended resulting 3.47V (instead of going all the way to 3.6V) is as it is so that there's some wiggle room in case of surges, so there's still a 0.13V 'safety margin' if something should spike, correct?

Exactly right. Voltage spikes happen, and it takes a lot of work (and components) to eliminate them completely. Most circuits just try to keep them within sane limits and leave a safety margin.

eph123 wrote:the 3.3V pin from the Proton would have 3.13V coming out of it on that side of the voltage divider, and on the 2946 side of the divider, it will be 3.47V, and therefore signals can't come back over those resistors to cause cross-talk on the other channels, correct?

This part is still incorrect. To lower the voltage on the Proton's pins from 3.3V to 3.13V, you'd need another voltage divider between the Proton's 3.3V rail and GND (defined as 0V).

The specific diagram you're using might be causing some confusion.. it just shows the 2946 breakout and the Proton as boxes with pins, and hides things like the 20k pull-ups and the circuits that make the SDA/SCL pins work.

That's useful in a wiring diagram.. it shows you the connections you need to make and doesn't clutter things up with extraneous information. It's not so good for trying to understand the details of the connection though, because important pieces are missing.

Here's a diagram that shows those missing pieces:

voltage-divider.png
voltage-divider.png (123.29 KiB) Viewed 17 times

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by eph123 on Wed Aug 19, 2020 7:47 pm

Hmm, I've seen diagrams like yours before, but they're harder to understand. For example, what are the endpoints of the vertical line in the middle? One points away from a 20k resistor, the other points into a 20k resistor from 3.3V. I understand this kind of diagram is more symbolic / abstract than a wiring diagram, but that's why for me they're harder to understand what they're saying.

On my diagram, I understand the 20ks aren't shown, but I've been mentally being aware that they're somewhere on the 2946 board accessible from its SCL / SDA pins. Is that what you're referring to when you said there are important pieces missing from my diagram?

As far as the voltage on the Proton side of the voltage divider, are you saying then that the voltage is actually still the 3.3V? If it is, then this whole thing might make a lot more sense for me to visualize as a canal with locks on it. One side is higher, say 5 meters, and the other is 3.3 meters. There's a lock on one end (a 20k resistor) that drops the water level by 1.53 meters, going from 5 meters to 3.47 meters. Then there's an additional lock (a 2.2k resistor) that drops the water level down another 0.17 meters, to the final level of 3.3 meters, matching the water level on the other side. The two locks are passive: in order to reduce the level of the water from 5 meters to 3.3 meters, it dumps the extra water into a reservoir. The height of the reservoir is 5 meters, and the water level in the reservoir is already at 3.3 meters. Since a 5m high amount of water will flow into a 3.3 meter high amount of water without additional power, this works passively, and allows for a maximum amount of water height reduced to be 1.7 meters, which is the difference between 5 meters and 3.3 meters.

There's a lot wrong with this analogy when taken too literally (especially when trying to figure out how a signal would go in the reverse direction, "up" the canal), but this image feels correct to me. No energy is being added to this circuit, so to 'pump' the voltage out, it has to go from higher to lower potential. Doing so is accomplished by 'dumping' the extra voltage from 5V to 3.3V. No more than the difference between those two be pumped out without extra energy, because otherwise it would have to be flowing 'uphill'.

I imagine if the 20k resistors weren't already there, then I'd have just been able to add a 20.2k resistor to make the transition from 5V to 3.3V in one component?

5V on the 2946 side
-------------------------
1.53V drop @ 20k resistor
3.47V between 20k and 2.2k
0.17V drop @ 2.2k resistor
-------------------------
3.3V on the Proton side

eph123
 
Posts: 11
Joined: Sat Aug 08, 2020 8:32 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by adafruit_support_mike on Thu Aug 20, 2020 1:52 am

Yeah, schematics have their own alphabet.

eph123 wrote:For example, what are the endpoints of the vertical line in the middle? One points away from a 20k resistor, the other points into a 20k resistor from 3.3V.


The arrow pointing up means "this connects to the supply voltage", which in this case is the 5V supply. The dingus below the 2.2k resistor means some kind of signal or voltage comes in at that point. In this case, that's the connection to the 3.3V power supply. The arrows pointing left and right indicate signals that go to some other part of the circuit, in this case the input circuits in the Proton and 2946 that check to see if the SDA line is high or low. The arrows pointing in are signals that open or close either switch. The upside-down-T shapes under the switches are the symbol for a connection to GND.

eph123 wrote:this whole thing might make a lot more sense for me to visualize as a canal with locks on it. One side is higher, say 5 meters, and the other is 3.3 meters. There's a lock on one end (a 20k resistor) that drops the water level by 1.53 meters, going from 5 meters to 3.47 meters. Then there's an additional lock (a 2.2k resistor) that drops the water level down another 0.17 meters, to the final level of 3.3 meters, matching the water level on the other side. The two locks are passive: in order to reduce the level of the water from 5 meters to 3.3 meters, it dumps the extra water into a reservoir. The height of the reservoir is 5 meters, and the water level in the reservoir is already at 3.3 meters. Since a 5m high amount of water will flow into a 3.3 meter high amount of water without additional power, this works passively, and allows for a maximum amount of water height reduced to be 1.7 meters, which is the difference between 5 meters and 3.3 meters.


That's pretty close.. with a couple of adjustments it will work perfectly.

For starters, let's assume the upper and lower chambers of the lock sit side by side, instead of one being upstream of the other. Both chambers are the same length: 100m. Then let's say the upper chamber is 22m wide, and the lower chamber is 200m wide.

When a boat comes downstream, the lock keeper opens a valve between the upper chamber and the river upstream. When the water level in the upper chamber reaches 5m, she closes the valve, opens the upstream lock, and lets the boat enter. When she closes the upstream lock, the upper chamber will hold 100m x 22m x 5m of water: 11,000m^3. The lower chamber will be at the level of the river downstream (3.3m), and will hold 100m x 200m x 3.3m of water: 66,000m^3.

With the upstream and downstream locks closed, the lock keeper opens a valve between the two chambers. At that point, we have a total of 77,000m^3 of water in a space 100m long and 222m wide. The chambers will equalize when the water is 77,000m^3 / (100m x 222m) = 3.468m deep.

Then the lock keeper closes the valve between the chambers, opens the lock between them, lets the boat move from the upper chamber to the lower one, and closes the lock between the chambers. Then she opens a valve from the lower chamber to the river downstream, lets the water in the lower chamber fall to 3.3m, closes the downstream valve, opens the downstream lock, and lets the boat through.


Now.. that sounds like I swapped the values we used for the resistors: 22m upstream and 200m downstream. It works if you think of a chamber's width using a term called 'conductivity' though:

Let's say we open valves at both ends of both chambers after the level equalizes, adjusting them so water flows through both chambers at the same rate.. call it 1m per minute. To make that work, 1m x 200m x 3.47m = 694m^3 of water will have to flow through the valves in the 200m chamber per minute, and 1m x 22m x 3.47m = 76.34m^3 of water will have to flow through the valves in the 22m chamber. Both values are far smaller than the total amount of water in either chamber, so the effect on the water level will be negligible.

964 / 76.34 = 9.09..., so about 9x as much water flows through the 200m path than the 22m path. If we call the amount of water flowing through the valves 'current', we can say the 200m path carries about 9x as much current as the 22m path.

From there, we can say the 200m path 'conducts' current about 9x as well as the 22m path. Then we can flip the relationship around and say the 22m path 'resists' current about 9x as much as the 200m path. Higher conductance means lower resistance, and vice versa.

In electronics, low value resistors are 'wider' than high-value resistors. In fact, that's how most resistors are made: we start with a square of material whose resistance from one side to the other is R Ohms, then we make a strip N squares long to get an NxR Ohm resistor, or put N squares side by side to get an R/N Ohm resistor.

That leads to an interesting quirk of the math: if we put two squares in series, we get a 2R resistor. If we put two squares in parallel, we get an R/2 resistor. If we put two of the 2Rs in parallel, or two of the R/2s in series, we get a 2x2 square whose resistance is 2R/2, or R. It turns out that the size of the square doesn't matter, only the ratio of its length to its width.

That means we can develop a material whose resistance we know (carbon ink, thin films of nickel-iron alloys, etc), put a layer of the film on a ceramic core (a strip pi times as long as the diameter of the core is just a square wrapped into a tube), then laser-etch the film to make a spiral path from one end of the core to the other. By changing the spiral's length-to-width ratio, we can multiply the film's 'resistance per square' by any value we want. The longer and thinner the path, the higher the resistance.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by eph123 on Sun Aug 23, 2020 10:53 pm

I feel like I intuitively understand this, but admittedly my eyes glazed over with the amount of math -- one of the primary reasons I never ended up going to school for engineering: math easily makes my eyes glaze over for whatever reason. Its not that I ultimately can't understand it, just for some reason my brain ends up with a buffer overflow and my awareness bluescreens :)

It seems the reason a 'narrow' resistor would have lower current is because its cross section has a smaller surface area. In the lock analogy, the lengths were the same in the example, but the width was the representation of the resistance, and the height the representation of the voltage. I can work with that imagery. I think of matter more or less as a screen - the denser it is, the smaller and denser the gaps. So given that visual, to me it would make sense that a resistor of a higher value would have a smaller cross section area, so as to better restrict the ability for electrons to pass into it. The higher value refers to its resistance - inversely proportional to the ease with which electrons can pass through it.

I think I have everything I need to know for now with regards to this particular part of my project; in fact, my design has since changed. I actually found different LEDs that I'm now planning to use instead, which happen to be RGBs. Their typical fV rating is 2.10V for the red LED, and 2.90V for the blue and green LEDs. So even though I'm happy to have learned what I did from this discussion, it doesn't appear that I'm going to have to wire the 2946 with 5V after all, and can just use the Proton's native VCC of 3.3V. Since one of the three LEDs in each module have a different fV, I plan on running the blue and green matrices on one 2946, and use a second 2946 to run just the red matrix. The Proton has pins for two different I2C channels, so I won't have to worry about daisy chaining one 2946 off of another, nor should I have to worry about the address jumpers, since they'll each be on different pins.

I had been reading about the 2946 and the Rext resistor; looks like there's already 20k resistor on the 2946 breakout, so it doesn't sound like I need to worry about supplying my own. The spec sheet for the I31FL3731 itself states that the average current across any one LED is about 3.2mA, assuming the Rext is a 20k resistor. How could they know that value without knowing the fV of the LEDs in the matrix? Or, is it that knowing the fV doesn't matter, because the determination that Rext must be a ~20k resistor is due to a function of the fact its after the LEDs in the flow of current through the matrix, that only one LED is being lit at a time, and that PWM is going to introduce peak currents with each pulse, instead of a constant current?

eph123
 
Posts: 11
Joined: Sat Aug 08, 2020 8:32 pm

Re: Clarification Request - 3.3v logic w/ 5v power to 2946

by adafruit_support_mike on Mon Aug 24, 2020 2:21 am

eph123 wrote:It seems the reason a 'narrow' resistor would have lower current is because its cross section has a smaller surface area.

That's exactly correct.

Resistance is proportional to the cross-sectional area of the conductor, and to the length of the path through the resistor. We usually simplify things by assuming the path's thickness is the same everywhere, making conductance proportional to the width of the path (wider path = easier to carry more traffic).

eph123 wrote:The spec sheet for the I31FL3731 itself states that the average current across any one LED is about 3.2mA, assuming the Rext is a 20k resistor. How could they know that value without knowing the fV of the LEDs in the matrix?

The I31FL3731 has a circuit that measures the current through Rext, and uses that to control the amount of current that goes through the LEDs.

You can use transistors to build something called a 'current source' which lets a fixed amount of current through, no matter what voltage is between the collector and emitter (for BJTs) or the drain and source (for mosfets). That's one of the things that makes transistors so useful and fun.

A current source controlling an LED doesn't care about the LED's forward voltage. Any variation based on color will change the voltage across the transistor, but the transistor can ignore the difference.

Most LED drivers have something similar. It's much easier to set the average LED current with a single external resistor than to mess around with all of the LEDs individually.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.