

Best way to do this?
#1
Posted 26 October 2011 - 08:14 AM

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#2
Posted 26 October 2011 - 09:06 AM
#3
Posted 26 October 2011 - 09:52 AM
Good point! I could do that.One more thought... We sometimes do "software PWM" in C# to change the intensity of LEDs. If there's not a lot going on in your program, you can actually create reasonable effects by turning the LED on briefly several hundred times a second.
I also considered a schematic like this, not sure if it'll work though, I don't have the ability to test right now. Yellow=PWM, Blue=GPIO.
Oh and I fergot resistors in the schematic, but it's about the generic idea of using transistors to feed back the ground in pulses.

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#4
Posted 26 October 2011 - 11:05 AM

(Red and green LEDs antiparallel) - that way, if the GPIO is low, pulses on the PWM make the green LED light (higher duty cycle -> brighter), if the GPIO is high, it makes the red LED light (higher duty cycle -> darker).
-- H.L. Mencken, "What I Believe"
#5
Posted 26 October 2011 - 11:14 AM
I considered that, but I'm afraid it would heat up my mini, and my mini doesn't like to get hotWhy don't you simply do it like this:
(Red and green LEDs antiparallel) - that way, if the GPIO is low, pulses on the PWM make the green LED light (higher duty cycle -> brighter), if the GPIO is high, it makes the red LED light (higher duty cycle -> darker).

Unless someone can confirm it won't harm the mini...?
But the 'transistor-way', if the schematic is valid, could even use one PWM, and all 4 leds could use that one. I realized that after drawing out that schematic, that I just PWM ground, so it could contain all leds that need to have that brightness.
So I could use a shift register and have 8 outputs, and one PWM'ed Ground through a transistor, so all 8 leds will have the same brightness. Would that work?
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#6
Posted 26 October 2011 - 11:39 AM
I considered that, but I'm afraid it would heat up my mini, and my mini doesn't like to get hot
Unless someone can confirm it won't harm the mini...?
It's all about the current - if you stay within 8mA (low-current LEDs, or just LEDs with not full brightness), it won't harm it - and your "transistor way" is also drawing the curent from the pins. There's actually LEDs that are like this internally (two LEDs antiparallel) and i've used lots of them with arduino, netduino, and other microcontrollers without releasing magic smoke

But the 'transistor-way', if the schematic is valid, could even use one PWM, and all 4 leds could use that one. I realized that after drawing out that schematic, that I just PWM ground, so it could contain all leds that need to have that brightness.
So I could use a shift register and have 8 outputs, and one PWM'ed Ground through a transistor, so all 8 leds will have the same brightness. Would that work?
I wouldn't call it a "PWM'ed Ground", but yes (you already mentioned that your schematic is incomplete though, needs some more resistors and wires

-- H.L. Mencken, "What I Believe"
#7
Posted 26 October 2011 - 11:40 AM
Attached Files
#8
Posted 26 October 2011 - 11:46 AM

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#9
Posted 26 October 2011 - 02:29 PM
#10
Posted 26 October 2011 - 02:36 PM
Thanks, my own way, by adding a transistor doesn't have your support? Just checkingMy vote for the StefanW way. The Richard's one is also good, but wastes too many pins IMHO.

The purpose has something to do with an upcoming holiday, I hope that when it's done, I can post some more details, but I'm not sure if I get it done in time

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#11
Posted 26 October 2011 - 03:56 PM


-- H.L. Mencken, "What I Believe"
#12
Posted 27 October 2011 - 11:20 AM
You can get these chips from Farnell (order code 1226306) in breadboard friendly DIL packages.
See link to TLC5940
#13
Posted 27 October 2011 - 12:30 PM

-- H.L. Mencken, "What I Believe"
#14
Posted 27 October 2011 - 12:33 PM
Good pointThe IC probably does not fulfill the "I should be able to get the missing parts before friday", that's why I just put it in as a joke
There are also other chips that talk over I2C and save one more pin, if that's really an issue.

I haven't got it tested yet, going to work on it tonight/tomorrow (I'm a day off tomorrow). Yesterday I had to take care of user input for my project

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#15
Posted 27 October 2011 - 07:15 PM

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#16
Posted 27 October 2011 - 08:19 PM
#17
Posted 27 October 2011 - 08:22 PM
True, but the red wires to the led, I'm going to switch those, not the PWM. I think I can then decide which leds will emit, according to the PWM brightnessDid I miss something or won't all the LEDs come on at once? They are all connected to the same transistor so will come on together.

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#18
Posted 27 October 2011 - 09:39 PM


-- H.L. Mencken, "What I Believe"
#19
Posted 28 October 2011 - 03:46 AM
#20
Posted 28 October 2011 - 01:56 PM

My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users