Author Topic: Control LED from Teensy uC  (Read 2480 times)

0 Members and 1 Guest are viewing this topic.

Offline andrew_cTopic starter

  • Regular Contributor
  • *
  • Posts: 57
  • Country: gb
Control LED from Teensy uC
« on: November 16, 2018, 10:26:44 am »
Hi all, I need to control a 24Vdc Tricolour-LED from a Teensy 3.2 uC (3.3V). Unfortunately I need to switch the high side as it has two anodes and a single cathode.

I would like to get away with as few components as possible (space is really tight) but I don't see any other way than a NPN controlling a PNP transistor (please forgive the lack of any missing resistors in the drawing).

Each of the LEDs is rated for 20mA. Is there any other way I can do this?



Thanks,
Andy
« Last Edit: November 16, 2018, 11:36:25 am by andrew_c »
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: Control LED from Teensy uC
« Reply #1 on: November 16, 2018, 11:46:00 am »
Hi andrew_c,

Would advise to change your circuit as per the attached image. :)
 

Offline andrew_cTopic starter

  • Regular Contributor
  • *
  • Posts: 57
  • Country: gb
Re: Control LED from Teensy uC
« Reply #2 on: November 16, 2018, 11:52:20 am »
Hey there, made a few changes immediately after I created the post. I really would love to magic something simpler out of thin-air though.
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: Control LED from Teensy uC
« Reply #3 on: November 16, 2018, 12:33:02 pm »
Yes, I noticed- had me a bit confused at first :)

Would a single chip be acceptable to drive the two LEDs. Is that what you are after?

Meantime, I have reduced the count to 3 components per LED as per the attached image.

For Q2 you need an NMOSFET with an input threshold of around 1V.

Some suitable NMOSFETS are:

BSN20BK
PMF370XN
EN2550
CSD17381F4
CSD17483F4
 

Offline andrew_cTopic starter

  • Regular Contributor
  • *
  • Posts: 57
  • Country: gb
Re: Control LED from Teensy uC
« Reply #4 on: November 16, 2018, 01:35:04 pm »
A single chip would be excellent!! Please, what do you have?

P.S. Nice and simple schematic non the less.
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: Control LED from Teensy uC
« Reply #5 on: November 16, 2018, 01:49:09 pm »
Working on it  :-X
 

Offline andrew_cTopic starter

  • Regular Contributor
  • *
  • Posts: 57
  • Country: gb
Re: Control LED from Teensy uC
« Reply #6 on: November 16, 2018, 02:47:03 pm »
In the mean time, can I ask why Q2 has to have such a low VGS(th), I'm currently using a PSMN1R1-30PL in another part of the circuit which works great with the 3.3V of the uC.

P.S. If it makes it any more complicated... I am using through-hole components :)

Cheers,
Andy
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: Control LED from Teensy uC
« Reply #7 on: November 16, 2018, 04:59:05 pm »
In the mean time, can I ask why Q2 has to have such a low VGS(th), I'm currently using a PSMN1R1-30PL in another part of the circuit which works great with the 3.3V of the uC.
Hell! the PSMN1R1-30PL is a nice NMOSFET.

VGS(th) is the point where the MOSFET just starts conducting. If you take the RDss figure of 1.3mR for the PSMN1R1-30PL, it is for a VGS of 10V. The conduction of a MOSFET can also be adversely affected by other factors, junction temperature and VDS, being two. I use worst case design- if at all possible - and the worst case VGS(th) for the PSMN1R1-30PL is 2.2V, which is cutting it a bit fine with 3.3V logic. Of course, most samples of the PSMN1R1-30PL will have a much lower VGS(th) than worst case anyway, so most samples will be OK.

The other thing is that the NMOSFETS I listed for the LED driver are low current and relatively low conductivity types.

P.S. If it makes it any more complicated... I am using through-hole components :)
Afraid to say, you will have to go for surface mount in this instance.  ;D
« Last Edit: November 16, 2018, 05:29:16 pm by spec »
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: Control LED from Teensy uC
« Reply #8 on: November 16, 2018, 05:21:37 pm »
Attached below is an outline schematic for a single chip circuit to drive your two LEDs with your Teensy 3.2.

Also attached is the data sheet for the Maxim MAX14874 which does the work.

The data sheet says that you need a capacitor between 24V and ground, but you might get away without a capacitor because the LEDs, at 20mA, are a very light load for the MAX14874.

Hope the circuit works OK ::)
« Last Edit: November 16, 2018, 05:24:14 pm by spec »
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: Control LED from Teensy uC
« Reply #9 on: November 16, 2018, 05:33:07 pm »
NXP has PNP/NPN combo chips, as well as BJTs with built-in bias resistors, and also PMOS+NPN combo.

Yes, I had a look at those, but could not work out a singe chip implementation for driving the two LEDs. If you have a design please post- I for one would be really interested to see it. :)
« Last Edit: November 16, 2018, 05:40:01 pm by spec »
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16284
  • Country: za
Re: Control LED from Teensy uC
« Reply #10 on: November 16, 2018, 08:32:48 pm »
How about having each LED powered from the 24V rail via a 2k7 resistor, which will probably be pretty bright with modern LEDs even at around 7mA, and simply use the MCU to short each LED instead using a simple logic level small signal MOSFET.  Plenty of SO mosfets which will work, all it needs is to have a threshold voltage compatible with your MCU supply, a current capacity of 20mA on and able to withstand 5V when off.

Only 2 jellybean components needed, in addition to the the LED's and the 2 resistors.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19524
  • Country: gb
  • 0999
Re: Control LED from Teensy uC
« Reply #11 on: November 16, 2018, 10:05:17 pm »
The LED has no current limiting resistors, so will blow up, unless it has them built-in.

Why not just drive the LED directly from the MCU or is it really a string of many LEDs connected in series?

To drive a PNP transistor, from a lower voltage, it's better to put the resistor in the emitter connection of the NPN transistor, than in series with the base.


 

Offline andrew_cTopic starter

  • Regular Contributor
  • *
  • Posts: 57
  • Country: gb
Re: Control LED from Teensy uC
« Reply #12 on: November 19, 2018, 08:50:55 am »
Attached below is an outline schematic for a single chip circuit to drive your two LEDs with your Teensy 3.2.

The PSMN1R1-30PL is fantastic for switching my peltier tiles without requiring a heat sink (24V 8A). With the minimum VGS(th) being stated as a max 2.2V I thought this would be perfectly acceptable with the uC logic being >1V more, is there a standard or guideline I should look to follow in future?

I've never had any dealings with surface mount - aside from one LED about 8 years ago. I'm interested, just is this really practical for small runs? Space is extremely tight so I'm pretty certain surface mount components would help a bunch!

The MAX14874 looks massively overkill on paper but it's tiny!! :D To be fair though, if I were to go surface mount, then the component count wouldn't be an issue. Half of my board is peppered in analogue logic and precision resistors.

--

This is a single unit with 2 LEDs, with built in resistors.



If I were to go surface mount then I would definitely go simple with the NPN in series with the base of a PNP.

Cheers :)
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Control LED from Teensy uC
« Reply #13 on: November 19, 2018, 09:14:16 am »
Can also use an optocoupler.
The further a society drifts from truth, the more it will hate those who speak it.
 
The following users thanked this post: andrew_c

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: Control LED from Teensy uC
« Reply #14 on: November 19, 2018, 10:13:38 am »
Attached below is an outline schematic for a single chip circuit to drive your two LEDs with your Teensy 3.2.

The PSMN1R1-30PL is fantastic for switching my peltier tiles without requiring a heat sink (24V 8A). With the minimum VGS(th) being stated as a max 2.2V I thought this would be perfectly acceptable with the uC logic being >1V more, is there a standard or guideline I should look to follow in future?

I've never had any dealings with surface mount - aside from one LED about 8 years ago. I'm interested, just is this really practical for small runs? Space is extremely tight so I'm pretty certain surface mount components would help a bunch!

The MAX14874 looks massively overkill on paper but it's tiny!! :D To be fair though, if I were to go surface mount, then the component count wouldn't be an issue. Half of my board is peppered in analogue logic and precision resistors.

--

This is a single unit with 2 LEDs, with built in resistors.



If I were to go surface mount then I would definitely go simple with the NPN in series with the base of a PNP.

Cheers :)

Yes the PSMN1R1-30PL is a fantastic MOSFET. I was quite surprised how good it is.

There are quite a few characteristics to look for when specifying a MOSFET: VCE, SOA, RDss, Vth and Thermal resistance J/C being the main ones. IDmax, and especially Ptot max, have little practical use and are mainly sales inspired parameters.

When it comes to driving MOSFETs it is a common mistake to think that Vth is the only parameter to consider. While it is important it is not the end of the story. Paradoxically Vth only really tells you the point at which you can turn the MOSFET off, which is obviously important. But what really counts is the value of Rd, because Rd defines the voltage drop between the drain and source. So it is important to look at the MOSFETs graphs of Vg/Rdss or equivalent.

In summary, I would suggest that, as a general rule, choose a MOSFET that has a low enough Vth to be turned off by the logic low output voltage of your driving device, so that there is the largest possible positive swing from the logic 0V to the logic 1V.  That way you will get the lowest Rd and can drive the most current.

Tthere is another factor though. In general, the lower the Vgth the worse are the other MOSFET characteristics, particularly VDSmax and Rdss. In addition the various parasitic capacitors go up to alarming values.

Taking all of the above into consideration I would suggest that a MOSFET suitable for driving with 3.3V MOS logic should have a Vth of around 1V. That gives an effective gate drive of 2.3V for logic 1 but still ensures that you will be able to turn the MOSFET off with logic 0.

I hate to say this, but describing any design/device as 'overkill' is very dangerous. If you applied the implications of that word generally very few items would pass the criteria, especially MCUs. I suggest that the only criteria that should be applied, in practice, are: cost, size, weight, performance. So it is with the MAX14874. I can remember when 16k byte memory chips were defined as overkill. :)

As you also say, you can squeeze an awful amount of electronics into almost no space at all using surface mount components. I prefer the bigger SM chips with around 1mm pin spacing rather than the teeny SM chips increasingly used. Like it or lump it though, SM is the only way to go if you want to use the latest and greatest chips. But from a performance point of view SM does have problems: heat dissipation being one, and ceramic SM capacitors have a worse performance than the larger through hole types. As you no doubt know, for breadboarding you can fit your SM components to DIL headers: especially useful for messing with opamps.
« Last Edit: November 19, 2018, 07:37:12 pm by spec »
 
The following users thanked this post: andrew_c

Offline andrew_cTopic starter

  • Regular Contributor
  • *
  • Posts: 57
  • Country: gb
Re: Control LED from Teensy uC
« Reply #15 on: November 19, 2018, 10:31:03 am »
Yes the PSMN1R1-30PL is a fantastic MOSFET. I was quite surprised how good it was.
Thank you so much for the detailed explanation. Of course the main attraction with that MOSFET was the RDS(ON) as I wanted the chip to stay cool. It appears to be driving the tiles quite nicely though I will take some measurements this afternoon and see how the voltage drop compares to the datasheet :) ..

-

Can also use an optocoupler.

.... okay that's simple .. just connected up a TCET1101 and it worked like a charm! :D



Nothing to stop me doubling this up for each LED.
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: Control LED from Teensy uC
« Reply #16 on: November 19, 2018, 10:47:52 am »
Yes the PSMN1R1-30PL is a fantastic MOSFET. I was quite surprised how good it was.
Thank you so much for the detailed explanation. Of course the main attraction with that MOSFET was the RDS(ON) as I wanted the chip to stay cool. It appears to be driving the tiles quite nicely though I will take some measurements this afternoon and see how the voltage drop compares to the datasheet :) ..
No sweat :)

You know what they say: 'Those that can do, and those that can't advise others' :palm:

-


 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Control LED from Teensy uC
« Reply #17 on: November 19, 2018, 11:28:22 am »
A Piher... those are good trimmers!  :-+
The further a society drifts from truth, the more it will hate those who speak it.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf