Resistors education please- with prop shield and with normal Teensy 3.2

Status
Not open for further replies.

Tejkaran

Well-known member
I am currently trying to understand the full role of what 'things' do in circuitry and resistors crop up quite often. I understand their basic role is to create a resistance, however quite often I see resistors placed next to the Teensy such as with the OctoWs2811 (link) however what is the purpose of adding resistors there. What greater purpose does it serve? How does it change the outcome, because my simple thinking is that you would want as much current as possible to flow to led strips (I'm not saying, just I don't understand any better)

Secondly, so with the Teensy it is easy to add a resistor, with the prop shield I am using it with the APA102 lights and have connected it as can be seen on here (Fast LEd driver). Do i need to use resistors with the prop shield

I am guessing it would be of use but I currently use the Meanwell LRS350-5 (5V,60A) power supply.

Tej
 
That's a pretty open ended question there!

The short answer is adding a low (~100ohm) value resistor to outputs is always a good safety net since it limits max current. So in the Octo case if we cross wires up at the far end and short to ground the resistors constrain how much current flows under ohms law

V = I*R so I(current) = V(voltage)/R(resistance). So that 100 ohms limits the worst case current flow to 3.3/100 = 0.033amps or 33 millis amps (or 50mA for the 5V octo board). Which is higher than the recommended 25mA normally quoted for micro controller pins but probably survivable. The level converter on the Octo board can probably drive more than that anyway but that's one reason. It can also limit current IN in the case of us dumping big inductive or capacitive loads on, such as with long strips of high current LEDs. Also helps clamp currents for ESD and related excitement from upsetting the micro.

Finally and I believe the key part of the reason for the Octo resistors is impedance matching:
https://en.wikipedia.org/wiki/Characteristic_impedance
TLDR is that you want maximum POWER (watts = current * voltage) on the cable to maximise the useful signal at the far end, not lots of current or voltage - A short circuit has lots of current flowing but no voltage to measure, an open circuit has lots of voltage but by definition of being an open circuit means nothing useful there either.

With the prop shield, used for it's intended purpose of having a having a strip within 10 cm of it as built is fine. If you are prototyping a wearable, adding two resistors will make things less likely to go bang if you twist or fold things so wires touch. If you need to make a really long wire run (>2 meters) then you need to get the maths out and work out cable impeadance and how to couple it correctly at both ends and/or experiment.
 
Thanks Gremlin, really nice answer :)

Sticking with the Octo example; to rephrase so I can understand properly:
1)the resistor next to the Octo would be used to limit any damage happening to the Octo should a short occur in the circuit. The resistance next to the Octo should be able to absorb enough current leaving only about 25-50mA which would not harm the circuit?
2)the resistor next to the led strips is used to stop 'surges' such as by a capacitor(why would this happen? are capacitors not used to stream/steady electrical flow?)

I need to read through the impedance matching properly to get my head around it all, but in simple is it used to have uniform signalling? <--I will be reading it again, so don't worry if this is wrong.
 
Couple of things there, and for all the actual EEs out there apologies for butchering all sorts of physics to summerise this.

Current will be the same anywhere in a circuit. So it can't disappear. You need to look at ohms law and how it applies to things in series,
http://www.build-electronic-circuits.com/ohms-law/
https://www.physics.uoguelph.ca/tutorials/ohm/Q.ohm.example.ohm.html
In the real world we don't have perfect wires or resistors so the real model of a output pin driving a lamp has R values for inside the chip (drive components), the wire, the lamp and the power supply *. So for a simple drive we could say 1ohm from drive components, 0.1 ohm in the wire 9 ohms in the lamp and 0.9 ohms in the power supply. Totals to 10 ohms which at 5V will have a 5/10 = 1/2 amp current flow (outside a chip drive pin but well within a good driven transistor). If we screw up the alligtor clips and short the lamp we get 1+0.1+0.9 ohms of resistance = 2 ohms. 5V/2 = 2.5 amps current flow. To put that in perspective we can use the power forumula

Power = current & voltage for an answer in watts. 2.5*5 = 12.5 watts. Which isn't enough to boil a cap of water instantly but will happily vaporise any transistor smaller than your thumb. If we had put a 2 ohm series resistor in there the effect on the lamp brightness would be measurable but low, but would halve the worst case current flow, which depending on design might make the difference between an oops and needing to replace everything.

So for point one the resistor doesn't 'absorb' the current. It acts as a choke that prevents the worst case flow from being impossibly large, water example would be constricting a hose so that even if the end falls off the hose will not thrash around dangerously

With surges in capacitors, yes when everything is in steady state capacitors do smooth current flow. If however we added heaps of capacitors to make our LED power supply stable that means if we have a massive startup current as they all need charging up. Which may happen unexpectedly when we flex that poorly soldered cable. Flow on result from that can also be that our power supply goes from zero to max drive capacity suddenly, droops downwards under the charging load then the capacitors reach full charge but the drive circuits in the power supply are slow to respond and over shoot and suddenly our 5V power supply is now driving up to 7 volts, which will push back into our 5V output pin with damaging results (all explanations above are conventional curren).

With the impedance matching there are several layers to it that you need to work towards, but for the moments suggest using the mental model that for optimal signal quality we want to keep voltage*current consistent along the cable, and therefore anywhere were we change cable design we may need to do some form of matching to avoid fun effects.

Impedance is a deep topic that at it's extremes in the high frequency RF starts to just not behave rationally. For the moment strongly recommend doing some worked examples on Ohms law, and then moving onto how diodes work and how to calculate when they are in circuit and conditions are constant (DC). Transistors are possibly further than you want to go at the moment but applying ohms law to make sure things don't go bang is something you do need. Just be aware that what happens when signals are changing(AC) is deeper and holds some unexpected surprises that you will find as you build more things and can either learn by experience or by reading. I've done both and the smoke from experience certainly stuck in my mind better.

http://www.evilmadscientist.com/2012/resistors-for-leds/
And further reading
http://www.evilmadscientist.com/?s=basics


* more complex in reality but power sources can be considered to have an internal resistance when determining effects of of load. A 9V single battery has a high internal resistance, so will not produce 9V into a big lamp, where 6 1.5V D cells would, because they due to physical design allowed by their size have a lower internal resistance. Ditto 12V of AAs won't start a car but 12V from a car battery with internal resistance in fractions of an Ohm will.
 
I need to read through the impedance matching properly to get my head around it all,

Characteristic impedance of transmission lines (aka: long wires) is indeed a difficult subject to understand. Very difficult. Rather than diving down its very deep rabbit hole of electro-magnetic theory, I recommend learning a couple "rule of thumb" guidelines.

The main issue is whether a wire is "long". If the wire is less than 1/10th the wavelength of the highest important frequency, then you can consider it "short" and not concern yourself with impedance matching.

This involves 2 things you usually don't know perfectly, but an approximate guess is usually fine. The first is highest frequency. For sine waves like radio signals, this is easy. For digital signal square waves, you can use either the signal's rise/fall time (if the driver has slew rate limiting and a clearly defined spec) or just multiply by 7 or 9, which assumes the higher odd harmonics are small and won't matter if distorted. So for WS2812 LEDs, the data rate 800 kHz and the short pulse is about 1/5th of the period, so use 800*5 for the square wave, and then multiply by 7, for a total of 28 MHz.

The other imprecise part is converting from frequency to wavelength. In free space, radio waves travel at the speed of light. In wires, electrical signals usually propagate at speeds between half to 70% the speed of light. To get the wavelength, I usually just use 3e8 / frequency and then divide by 2. So in this case, the wavelength would be 3e8 / 28e6 / 2, which is 5.4 meters.

So if the wire is under half a meter, it's "short" and transmission line effects don't apply. Of course this is all very approximate, so don't think of it as some hard limit where suddenly things go crazy if the wire is slightly longer. But certainly as you go to several meters, impedance matching starts to matter.

The other rule of thumb is to use wires with well specified characteristic impedance. For CAT5 & CAT6 ethernet, the spec is 100 ohms. That's why I designed the Octo board to use CAT5/CAT6 cable, and why it has 100 ohm resistors.
 
Status
Not open for further replies.
Back
Top