Author Topic: high side switching circuit  (Read 4984 times)

0 Members and 1 Guest are viewing this topic.

Offline JaseGTopic starter

  • Contributor
  • Posts: 30
high side switching circuit
« on: October 21, 2016, 10:34:16 am »


Hi,

I'm working on a little project where I'm switching LED's with a shift register.  So far I've been running the LED's straight off the IC and it's been working ok - I haven't hit the current limit yet.  However, I wanted to add the ability to dim the lights with a pot so I have to re-think my design.

My thinking is that I need to have a separate power rail for the lights and switch the lights with a transistor.  The problem is further complicated because I need to have the switch on the positive side of the light because I'm using RGB leds with a common cathode and want to switch the channels individually.

I've thrown together this circuit on a breadboard with parts I had laying around: http://jasongilholme.com/wordpress/wp-content/uploads/2016/10/led_high_side_switch.jpg

This is taken from an example on the internet and it works ok. I do have a few questions though.

 1) How do the values of R1 and R2 affect this circuit?
 2) With the variable VCC and either 3.3 or 5v logic level, are there any traps to look out for?
 3) What common transistors would be suitable for my application? The current is only a few mA but I'd like to be switching this quickly (multiplexing application)
4) Is there anything obvious missing? or some good enhancements?

Sorry for the rather vague questions, but the theory of transistors is a bit lost on me and I'm pretty new to electronics.  I need to put some time into this circuit and experiment with it some more. 

Any tips for the circuit or ideas for things to try would be appreciated.

Jase
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: high side switching circuit
« Reply #1 on: October 21, 2016, 10:43:59 am »
do you want to dim each LED, or do you want to dim them all at the same time?,

If you want to dim them seperatly, just stick the pot inline with your LED's on the positive.
if dim all together, depending on what shift register you used, you may be able to pulse the output enable pin to PWM it.

as leds are indeed diodes, adding your resistor inline with it (the potentometer) will not change the voltage across the LED by much, instead the current will decrease  making it dimmer.
 

Offline JaseGTopic starter

  • Contributor
  • Posts: 30
Re: high side switching circuit
« Reply #2 on: October 21, 2016, 11:20:21 am »
Currently I'm able to dim each led separately as part of the software multiplexing.  I'm using 74 series shift registers at this stage.

What I'm hoping to achieve is a way of limiting the maximum brightness that the led's will be able to achieve with hardware.  With the RGB leds, I'm using a different value resistor per channel to balance the colors, this pot would have to be in addition to that.
 

Offline JS

  • Frequent Contributor
  • **
  • Posts: 947
  • Country: ar
Re: high side switching circuit
« Reply #3 on: October 21, 2016, 12:07:20 pm »
  You could use the PWM enable to do it but your PWM would need to be much faster than the rest of the switching, so you do the chopping a few times in each multiplexed stage. Otherwise it will flicker as nuts.

Alternatively, if you are using one LED at a time you could use a Constant Current Source, regulating that current would dim all the LEDs on that string. (by one LED at a time, I mean ON in the multiplexed group). Each group of multiplexed LEDs should have a CCS but you could control all them with a single pot, quite easy to implement, just a bunch of PNP, all bases together, bunch of equal resistors from emitters to +PS, each collector is the CC output. Controlling the voltage in the base would make a CC at the collector, equal to (Vss-Vb-Veb)/R being the Vb your input voltage.
 
JS
If I don't know how it works, I prefer not to turn it on.
 

Offline JaseGTopic starter

  • Contributor
  • Posts: 30
Re: high side switching circuit
« Reply #4 on: October 21, 2016, 12:23:56 pm »
Thanks JS, I'll have to read through your reply a few times in order to fully understand it i think.

Playing around with it on the bread board, i was able to get the right affect by adjusting the voltage on my bench power supply.  Would this be a viable option?  having some sort of variable power regulator to drop the input voltage.

I tried a constant current setup a while back but didn't get the results I was expecting.  The more leds I enabled, the dimmer the whole thing got.  Which makes sense, as it was limiting the total current that the lights could draw.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: high side switching circuit
« Reply #5 on: October 21, 2016, 12:26:50 pm »
I found the colour scheme on that schematic made it difficult to read.

It will have a slow turn off time, which may be a problem if the PWM frequency is quite high.

Try this. It will be much faster and draw less current from the MCU output.

« Last Edit: October 21, 2016, 12:32:52 pm by Hero999 »
 

Offline JS

  • Frequent Contributor
  • **
  • Posts: 947
  • Country: ar
Re: high side switching circuit
« Reply #6 on: October 21, 2016, 06:50:22 pm »
Thanks JS, I'll have to read through your reply a few times in order to fully understand it i think.
That's OK, you probably learned something if you expended some time on it.
Quote
Playing around with it on the bread board, i was able to get the right affect by adjusting the voltage on my bench power supply.  Would this be a viable option?  having some sort of variable power regulator to drop the input voltage.
It's fine, not the most efficient way and the brightness might depend on several things, also the controllable usable range may be an issue and not very linear, the full schematic helps in this cases.
Quote
I tried a constant current setup a while back but didn't get the results I was expecting.  The more leds I enabled, the dimmer the whole thing got.  Which makes sense, as it was limiting the total current that the lights could draw.
Again, full schematics helps. What I was saying is you need to have one CC source for each set of LEDs such that each CC source never have 2 LEDs on at the same time. If you have 4 strings of multiplexed LEDs you need 4 CCS. If you load CCS in parallel you will get this loss of brightness depending on the amount of LEDs and individual LED brightness.

If you need real help you need to give all the info, if not we are shooting in the dark, we can mention a few concepts but to find a solution the problem must be fully understood first.

JS
If I don't know how it works, I prefer not to turn it on.
 

Offline JaseGTopic starter

  • Contributor
  • Posts: 30
Re: high side switching circuit
« Reply #7 on: October 21, 2016, 08:11:29 pm »
Thanks js.  My intention was actually to get peoples opinions on the transistor circuit for use as a switch.  At some point I'll start another thread regarding the implementation of the dimming circuit and will post appropriate detail.  Hopefully theres enough info here for the questions provided.

@hero. Thanks for the schematic.  I'll compare the switching times with a scope to see how the circuit behaves.  I found some good info about this after reading your post. From that ive learnt that once the base is saturated it takes longer to switch off and keeping it just on the saturated side with a diode facilitates faster off times.  There was also mention of a cap and resistor on the base input to help accellerate the switching further.  Thanks!
 

Offline JaseGTopic starter

  • Contributor
  • Posts: 30
Re: high side switching circuit
« Reply #8 on: October 22, 2016, 04:05:19 am »
@Hero999, Thanks for the previous response, I implemented what you suggested and it's far better than version 1.  After doing some more reading, I added some things to the circuit.  I've posted the schematics and response curves for version 2 (your suggestion) and version 3 (my additions) of this circuit below. 

In version 3, I've started to play with some resistors and a cap on the base of Q1.  From what I can understand, the two resistors are working like a voltage divider and reduce the saturation of Q1.  Does this sound right? Either way, I've been able to halve the response time of the circuit.  I tried to add a Baker Clamp to the transistor in order to get it to sit just under the saturation point but it didn't seem to work at all.  Any ideas on how to implement that concept, or another solution of the same effect, in this circuit?

The other question that comes up is to do with the response of the Yellow trace.  This probe is on the output of Q2 and before R3.  In the attached image, it drops to about 2.7v and then it's rate drastically changes and it eventually gets to 0v (about 2 ms later)  Is this to do with the load after Q2? or is there something I can do to pull this to 0 as quickly as possible?

Version 2



Version 3



 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19345
  • Country: gb
  • 0999
Re: high side switching circuit
« Reply #9 on: October 22, 2016, 05:51:57 pm »
@Hero999, Thanks for the previous response, I implemented what you suggested and it's far better than version 1.  After doing some more reading, I added some things to the circuit.  I've posted the schematics and response curves for version 2 (your suggestion) and version 3 (my additions) of this circuit below. 

In version 3, I've started to play with some resistors and a cap on the base of Q1.  From what I can understand, the two resistors are working like a voltage divider and reduce the saturation of Q1.  Does this sound right? Either way, I've been able to halve the response time of the circuit.  I tried to add a Baker Clamp to the transistor in order to get it to sit just under the saturation point but it didn't seem to work at all.  Any ideas on how to implement that concept, or another solution of the same effect, in this circuit?
Adding a Baker clamp to Q1 won't do anything because, as you've said it never saturates. When Q1 starts to turn on, it flows through R1, developing a voltage across it and the emitter sits at around 0.6V less than the base. The collector will be at Vcc - 0.6V, hence it won't be saturated.

A  Baker clamp could be added to Q2 though, as it does saturate.

Quote
The other question that comes up is to do with the response of the Yellow trace.  This probe is on the output of Q2 and before R3.  In the attached image, it drops to about 2.7v and then it's rate drastically changes and it eventually gets to 0v (about 2 ms later)  Is this to do with the load after Q2? or is there something I can do to pull this to 0 as quickly as possible?
Perhaps the probe and LED itself has some capacitance so some energy? If it's a problem then a resistor in parallel with the LED would help,

An alternative is to let Q2 do the current limiting. Now Q2 won't saturate either. If you want it to turn off more quickly put 1k in parallel with D2 & D3.
« Last Edit: October 22, 2016, 05:57:26 pm by Hero999 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf