Optocouplers with a little range, 3-9V

I'm building a circuit that I plan to reuse with various batteries, ranging from 3 to 9 volts. The current will be switched with appropriate transistors (e.g. ZTX1049A) but controlled by a uC running at 5V, so I plan to use optocouplers.

Can an optocoupler, perhaps 4n25, be used with that range of voltages? What do I need to look for in a datasheet?

Thanks for reading.

Why the optocouplers?
Just adds unneeded parts & complexity.
Arduino is perfectly suited to control BJT or MOSFET transistors which will do the actual current control.

I'd developed the impression that unless the transistors' bases were coupled to the same current source as collector and emitter, due to disparity of voltages mucking up the biasing, that they wouldn't be able to switch properly. I thought that a PNP BJT switching 9V wouldn't switch off when fed 5V to its base, and an NPN might not switch on. If I'm mistaken I'd be thrilled.

I'm... Very new to transistors.

You need to understand the concepts behind low-side switching and high-side switching.

In this example, getting the 9v to switch off a high-side switch is difficult, so a low side switch (NPN) will be perfect.

I certainly do need to understand, but at the moment I absolutely do not understand. I'm trying to learn, but time constraints and being woken at 3am by a toddler are hindrances.

So, if I use only low-side NPN switches, will I be able to use the same circuit if I switch to a 3V source? Wouldn't I need different resistor values? My recent reading (which I've probably failed to grasp) suggests that the NPN must have a lower base voltage than collector-emitter.

I'm sorry if these are really stupid questions.

To turn in a NPN transistor you need 0.7V at the base. In fact you can't get any more than that. You need a resistor in line with the base to limit the current. Then the collector and emitter become connected together. There is a load in series with the transistor and one end is connected to the collector an the other to the supply voltage. This can be as big as you like the collector and emitter still switch together when you supply base current at 0.7V.

Edit :- Thanks raschemmel - now corrected.

"There is a load in series with the resistor..."

Mike meant " in series with the TRANSISTOR"

If you do high-side switching you first need an NPN low-side switch to drive the high-side
PNP base (via a resistor). Thus the uCont only has to concern itself with NPN's, but you
will need two transistors per switch - that's how it is.

Now if you had open-drain outputs on the uController, that would be great, but that's not
normal because the process used for uControllers is optimized for speed & power, not
breakdown voltage.

Grumpy_Mike:
To turn in a NPN transistor you need 0.7V at the base.

Oh! I totally misunderstood this before, I thought it had to be a 0.7V potential between collector and base. I'll go back and try to figure out how I got that so wrong.

MarkT:
If you do high-side switching you first need an NPN low-side switch to drive the high-side
PNP base (via a resistor). Thus the uCont only has to concern itself with NPN's, but you
will need two transistors per switch - that's how it is.

Also brilliant! I'd like to think that I would've thought of this after reading Grumpy_Mike's post but my track record doesn't make that seem likely.

This information is really going to help me, thank you both especially and also everyone who's contributed.

Oh! I totally misunderstood this before, I thought it had to be a 0.7V potential between collector and base.

It's be base-emitter voltage. In a common-emitter circuit (with the emitter grounded) 0.7V on the base (relative to ground) will turn it on.

If you do high-side switching you first need an NPN low-side switch to drive the high-side
PNP base (via a resistor). Thus the uCont only has to concern itself with NPN's, but you
will need two transistors per switch - that's how it is.

Also brilliant!

Yes, well , this has been done for many years...

Low-side NPN driving High-sde PNP transistor