Control LED from Teensy uC - Page 1
Forum section: electronics / beginners

author: andrew_c
author_rank: Regular Contributor
timestamp: November 16, 2018, 10:26:44 am
content: 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

author: spec
author_rank: Frequent Contributor
timestamp: November 16, 2018, 11:46:00 am
content: Hi andrew_c,Would advise to change your circuit as per the attached image.

author: andrew_c
author_rank: Regular Contributor
timestamp: November 16, 2018, 11:52:20 am
content: 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.

author: spec
author_rank: Frequent Contributor
timestamp: November 16, 2018, 12:33:02 pm
content: Yes, I noticed- had me a bit confused at firstWould 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:BSN20BKPMF370XNEN2550CSD17381F4CSD17483F4

author: andrew_c
author_rank: Regular Contributor
timestamp: November 16, 2018, 01:35:04 pm
content: A single chip would be excellent!! Please, what do you have?P.S. Nice and simple schematic non the less.

author: spec
author_rank: Frequent Contributor
timestamp: November 16, 2018, 01:49:09 pm
content: Working on it

author: andrew_c
author_rank: Regular Contributor
timestamp: November 16, 2018, 02:47:03 pm
content: 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 componentsCheers,Andy

author: spec
author_rank: Frequent Contributor
timestamp: November 16, 2018, 04:59:05 pm
content: Quote from: andrew_c on November 16, 2018, 02:47:03 pmHell! 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.Quote from: andrew_c on November 16, 2018, 02:47:03 pmAfraid to say, you will have to go for surface mount in this instance.

author: spec
author_rank: Frequent Contributor
timestamp: November 16, 2018, 05:21:37 pm
content: 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

author: spec
author_rank: Frequent Contributor
timestamp: November 16, 2018, 05:33:07 pm
content: Quote from: blueskull on November 16, 2018, 05:24:32 pmYes, 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.

author: SeanB
author_rank: Super Contributor
timestamp: November 16, 2018, 08:32:48 pm
content: 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.

author: Zero999
author_rank: Super Contributor
timestamp: November 16, 2018, 10:05:17 pm
content: 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.

author: andrew_c
author_rank: Regular Contributor
timestamp: November 19, 2018, 08:50:55 am
content: Quote from: spec on November 16, 2018, 05:21:37 pmThe 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!!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

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: November 19, 2018, 09:14:16 am
content: Can also use an optocoupler.

author: spec
author_rank: Frequent Contributor
timestamp: November 19, 2018, 10:13:38 am
content: Quote from: andrew_c on November 19, 2018, 08:50:55 amYes 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.

author: andrew_c
author_rank: Regular Contributor
timestamp: November 19, 2018, 10:31:03 am
content: Quote from: spec on November 19, 2018, 10:13:38 amThank 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..-Quote from: GeorgeOfTheJungle on November 19, 2018, 09:14:16 am.... okay that's simple .. just connected up a TCET1101 and it worked like a charm!Nothing to stop me doubling this up for each LED.

author: spec
author_rank: Frequent Contributor
timestamp: November 19, 2018, 10:47:52 am
content: Quote from: andrew_c on November 19, 2018, 10:31:03 amNo sweatYou know what they say: 'Those that can do, and those that can't advise others'-

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: November 19, 2018, 11:28:22 am
content: A Piher... those are good trimmers!