Learning the correct value calculations

SteveSFX

Well-known member
Vague title I know

I have built many projects over the years.... I mean, LOADS. And they all work fine. I take much longer than someone who can work out the correct method immediately, but I get there in the end.
Without Google, I would be lost. If I need a circuit or assistance, someone will have done something similar before and I can nearly always adapt it.

Saying that, I will always get the datasheets for particular IC's and 'try' to get my head around it and understand what I am actually doing.

Take my current project. Teensy 3.2, with x MCP23017 multiplexers attached over I2C.

I have 16x MOCD208 Opto-isolators connected to one of the MCP23017's as inputs. Multiplexers running at 5v.
I have 16x BC548 transistors connected to the other as outputs. It all works fine.

To calculate the resistors I needed for that...... I stabbed in the dark, going from past experience. I have no clue on how to actually work them out.

The transistors have a 1k from the MCP23017 to the base, and they seems to switch fine. 1k is my default 'base' resistor value.

The Opto-isolators have a 4k7 on the input, which appears to give me a range of around 5v-24v DC input. The output of the opto-isolator (running on 3.3v) goes through a 220R to the MCP23017. Held low with a 10k.
Again... seems to work fine.

I chose the 220R because 1k seemed a little bit 'borderline' on the reliability of the switching.

I would love to understand how to calculate this stuff, but my old brain just cannot grasp it. Is that a terrible way to go forward? It's not like it's my living.

One thing I have learned...... never buy just one of anything
 
BJTs used for switching is pretty simple - you want the base current to be about 5 to 10% of the collector current.
So if you are switching a 100mA relay coil you want 5 to 10mA for the base, which from a 3.3V supply works out as
(3.3-0.7)/0.005 = 520ohm ought to just give enough current. Allowing for the output resistance of the microcontroller
pin (typically of the order of 50 ohms), that suggests 470 ohm as the standard E12 resistor value, though you can
pick a lower value for more base current.

With (standard, photo-transistor output) opto-isolators the input and output currents are related by the
current-transfer ratio, which is typically around 1, but with a large spread (for instance something like
0.25 to 2 might be quoted in the data-sheet, ie a spread of nearly a decade).

This reflects the large variation in LED and photo-transistor performance and in the optical path between them.

To design with such opto-isolators only the minimum transfer ratio is needed, as thats the worst-case.

For instance if you have a device with that 0.25--2 ratio, we just assume the input current needs to be 4
times the output load current. Forward voltages of IR LEDs (universally used in opto-isolators) are about
1.2V or so, check the datasheet.

Thus lets assume a 1k pull-up on the opto output, at 3.3V, so load current = 3.3mA, we'd need 4x3.3 = 13mA
on the opto input to guarantee all devices will work (which from 3.3V means Rin = (3.3-1.2)/0.013 = 160
ohms.

Clearly a higher value pull-up on the opto-output allows lower input current, but this comes at a cost - the
speed will eventually fall as the currents get smaller. Its worth finding opto-isolators with a large current
transfer ratio as this makes circuit design easier/less critical.
 
May I ask a question regarding PCB silk printing?

Designing a PCB (done a few before). Using mainly 0805 resistors etc. Is it bad practice to cover an area with a filled silk print with components on them (as picture attached)?
These resistors are optional pull-up's and I wanted to highlight them as the board is quite complex.

I read somewhere that this was OK for 0805 size, as they are not too small. Smaller components can 'tombstone' apparently.
A simple unfilled rectangle just doesn't stand out enough.

Untitled.png

Thoughts?
 
I have a Pam8406 Amplifier on my board. 5W output (although I won't be running it at that), 5v supply.
I would really like to switch it off when not used.

I can just about squeeze a SOT23 transistor in the design. Would that be OK (breaking the Amplifiers 0v feed)? Ideally, I expect a Mosfet would be more suitable, but I just don't have the room.
I did a quick test using a BT3904 on a breadboard and it seemed fine, but I am sure it is far from ideal. I would probably find a SOT23 transistor with a higher current rating than the BT3904 I found however.

What are the disadvantages of using a transistor?
 
Back
Top