Ahhh!!! Long day. I followed you off the bridge. Source to ground, Drain to led.
I know I think your right I'll try to make a diagram, I just get moving and then I get stuck and I get frustrated. I am sorry about the marathon thing it's just I didn't really want to do all this electrical stuff, it is a major scope creep situation and they keep wanting more.
I watched a youtube video and it gave the analogy of a water valve. The drain was the water main lets say where city water is coming in.
the gate controls this water main
and the source went to your sprinkler or your sink etc.
Now we are putting the switch on the negative leg between the led negative and mother earth ground.
I think this is where I was getting confused it sounds like the water main would be ground (mother earth). I was following the circuit from positive to ground thinking that the main was the negative on the led. That makes sense
Now to adding the 10k resistor it sounds like I connect that to ground and my gpio 19. And I connect my gpio 19 to gate. Which originally in my mind would ground it out but the resistor must be stopping that.
So when I go high on the pin it goes to the gate because it is the route of least resistance.
I'll work on the diagram tonight
Thanks guys
Mark
................ Oh ya I should add that I am hoping that once connected when I use PWM and limit the duty cycle the mosfet will switch on and off quickly enough to limit the power getting to the led and as such dimming it.
So when I go high on the pin it goes to the gate because it is the route of least resistance.
Don't think of it that way. Current is very much going through that 10K resistor as well, but using ohms law (learn it), only 300uA is sent to ground, so the voltage stays constant. If that resistor was only 150ohm, it would pass 20mA to ground causing the voltage from the io pin to drop with max current and would simply damage the chip. Since you have a 8mA limit on the pin, with 10k, you now have 7.7mA available. You still need a resistor on the gate of that mosfet to limit inrush current which can well exceed the amount of current the pin can source.
As for the diagram, it's only going to have 2 power sources, 2 controllers, 2 resistors, a mosfet and led. Like Wawa stated, care must be taken to limit current to leds, lest you want them to burn out. Some led modules/strips have those means installed, while others require it to be added. All that info needs to be included when asking questions.
I am having a bit of a problem with ohms law
I=V/R so I have I = 5/10000 .... I = .0005
Now your figure was .003
I think the identifier is the problem .0005 what
I think the .003 is amps
If you have a second maybe show me what I use to convert the .0005 to .003
I think you mentioned a 3volt (3.3volt) GPIO pin in post#0.
That would be 0.0033A (0.33mA, 330uA)
Insignificant.
Leo..
Like Wawa said. If you have a 5V microcontroller with 5V gpio pins, then yes, it would be I=5/10000. You stated the 3V microcontroller and rf modules. Like Wawa stated, the 3 mA is good, and also why you are using that 10K to ground. Use lower values and the current goes up. With 412ohms, you reach the 8mA limit of the i/o pin. You need to be very mindful of what you ask of the io pins.
I don't know what I was thinking, 3.3 volt pins. sorry guys but i am getting the idea.
I also think that I understand the schematic part because my setup isn't working and trying to figure out why would be difficult if you can't see what I am doing.
So attached is my diagram best I could do
Here is a link too
When I power the 24 volt power source the light comes on and I know the pin is pulled low.
there still seems to be .12 or so volts (when I check the gate with mm) not sure what I am doing wrong. Also my diagram is what I will be using everything is the same except I am using a walwart now to supply the 5 volts
Thanks again guys
circuit.pdf (347 KB)
mtalent:
When I power the 24 volt power source the light comes on and I know the pin is pulled low.
Maybe you need to swap source and drain (wrong on the diagram).
Read post#18 again.
Leo..
Your diagram is at least somewhat legible. You can just have a short flag for the power inputs, 5v/24VCC, and the same for all grounds. Power flags would go upward, grounds downwards. That saves some spaghetti on the screen. The 3V can have an arrow flag pointed away from the WIFI chip pin, and an inward flag at the rf chip as long as they are labeled. Instead of pictures, just use the schematic representation of the component, with the controllers just being a box with only the pins that you are using numbered. The resistors are correct, but the mosfet is hard to follow in that form.
As for your circuit, you have the source/ drain backwards. The problem with that is the body diode, which will be forward biased with what you have drawn, and will always be on. Source goes to Ground on a "n-channel" mosfet. Remember that. P-channel is the opposite
You might have to also try another mosfet. It's possible you fried it without a cloud of smoke, which is pretty common. That's why you double check the inputs/outputs/ min/max levels of the supply and components.
Swapping source and drain shouldn't blow up anything.
Current just flows through the body diode, and always turns the light on.
Link in post#18 was also ignored (20ohm gate resistor and 10k on the wrong side of that).
Leo..
Cool I have 5 mosfet's so if I blew one I have another.
I swear the gate drain thing is killing me. But I am actually glad I got it wrong that means that everything else is probably doing what it should. I was going to be done for the day (at Buffalo Wild Wings having a beer and watching football) but I might just head back to the office (10 min) and see if it will work.
Once it's working as a switch I am excited to try the PWM and see if I can dim it.
Then it's just a matter of a slider set 0 - 255 (very easy in c#) and I will be dimming from the app.
And I think I'll probably have to switch forums to find out the answer to the next question is what multiples should I send to the pwm (5's or 10's or 1's) my internet setup isn't going to be able to do 1's. I am going to have to see what is noticeable and looks smooth. I am hoping 10's so from light to dark only 25 messages sent over the net.
I was using rectangles (in visio) but I was spending more time adding little pins to each rectangle then making sure there where the right number etc. and believe it or not for a newbie the pictures help when wiring the schematic because they look familiar. I am thinking the flags you are talking about are the arrow looking thing with like 4 lines each getting smaller. pointing up and down
I got a COM-13705 PicoBuck LED Driver today but I am not sure it is worth the trouble. The lights I am using now have drivers attached and I believe that eliminates a lot of my trouble (just supply power and done). If you guys want to see what this thing is and let me know if it's worth the trouble that would be cool. I think the only advantage would be cost I am pretty sure (and I'm not paying you guys so I should probably keep it simple and be thankful I get help at all) this thing I am using now is $50 and all it consists of is an led driver and 6 led's
Anyhow I will try to do the flags and let you know if switching the source and drain helps
Thanks guys
Mark
20ohm gate resistor and 10k on the wrong side of that
re-checking link
I am confused the 20ohm is to keep me from losing to much of my 8ma correct? so it should go between my pin and gate.
the 10k is to pull the gate down so should go from gate to gnd
HELP
mtalent:
I got a COM-13705 PicoBuck LED Driver today but I am not sure it is worth the trouble.
If you're using that 6-LED downlight, then yes. It could be needed.
Then you also don't need a mosfet.
That driver takes care of on/off and dimming.
I assume you have a 24volt constant voltage supply, not a constant current supply.
Otherwise all the previous answers given could be wrong.
Or maybe you use the original LED supply.
Then dimming might be impossible.
You should have listed all your hardware, diagram, images, requirements, and code in the first post.
Seems another 20 posts are needed to complete this project.
Leo..
I am confused the 20ohm is to keep me from losing to much of my 8ma correct? so it should go between my pin and gate.
Yes/No. At this point in time, it's way over your understanding and would only serve to confuse you. Mosfets are voltage controlled devices, but can have inrushing current spikes while switching on that can easily exceed your power source (controller). The resistor has to be small enough not to drop too much voltage but still put a check on that current. Connect BOTH resistors to your gpio pin, then the other end of each to either ground (10K) or gate (20).
Leo you are killing me. Please try to remember when you were a noob.
I believe if you look at my diagram it shows all the equipment.
the 24 volt power supply pictured is a clg-150-24v and I don't know what it's constant at.
The driver (on the 24v led) says it is a dimming led. So are you saying I just hook the pwm up to it and it will work.
Listen it appears there are two of you that play here. And I could not have gotten this far without you. I am forever gratefull
But listen your not the only forum/person to scream walk before run a marathon I was hired as a programmer and since I started 2 engineers have left. They spent a lot of time telling me I couldn't do what I wanted (not to mention they would go off the grid for days at a time).
I have been able to over come every obstacle that comes my way. I am a mobile/web programmer by trade. I have built a very sophisticated mobile web interface that controls microelectronics. I don't know if you saw the link to the movie I put in one of my posts but once I get anything to work on my desk I can have a mobile app button (working over the net) in minutes.
If you guys want we just build a circuit that fulfills managements desires on this project. They want to be able to up sell clients with led strips and lights like the one shown (that dim).
They also want me to control color (which I am not planning on doing because I barely understand this) all I know is that if set up right I send (0 -255) which corresponds to rgb and viola color.
Anyhow we can count on 200 a year + (they are shooting for the moon) installations that would need lights an unlimited number. I am a christian man and as such I handle all my en devours fairly. I will pay a license fee to you (us we would all own it) too for each installation.
Then we can move into smart houses which I don't understand (what people want).
the led light I am showing is $50 if we can design a similar product using the pico drivers we can make some money (not alot on this deal but with internet connectivity we can sell it again and again)
The CLG-150-24 is a constant current supply (datasheet available online).
You should have bought a 24volt constant voltage supply for these 6-LED downlights, but it could work.
You need constant current PWM drivers for these downlights (e.g. the pico-buck drivers).
NO mosfets. Mosfets (no current limiting) will burn out the downlights.
Are these downlights 6watt, 12watt, or 18watt (another thing you didn't tell us).
A link to the product could help.
$50 seems an awful lot for a 6-LED downlight.
The pico-buck drivers have a solder jumper, to supply 330mA (6watt) or 660mA (12watt) to the 6-LED downlight.
They also have a PWM input, that can directly connect to a GPIO PWM pin.
Leo..
I currently use these (homegrown) WiFi enabled boards to control the downlights in my basement.
All that is needed is a 24volt supply (mains or solar/battery), and the 16 (wired) downlights.
Onboard 3.3volt supply, ESP8266-12, PCA9685 hardware PWM, etc.
Nothing else.
Leo..
Ok good Morning,
I had to take a day off from this, watched my nephew play travel ball all day.
I think I am getting the hang of this, we need exact schematics and a list of parts I am using. I am going to put together the parts list and try to clean up the schematic.
Leo that thing is awesome with the 8266 very clean, how do you control it did you write a forms application? Or a mobile app or did you build a voice recognition unit and you just tell it what to do ![]()
Oh ya and I plan on taking the advice I have gotten SLOW DOWN
Thanks all I will reply with all the necessary information ASAP
thanks again
Mark
Ok this is the equipment I have at the moment.
This is a picture of the driver between the actual light and the +/- wires (it seems this would do kind of what the pico-buck would do ??)
This is a picture of the tag on the light
And the actual power supply which I wawa says is wrong, my question can I test with it and then when we put together the proto-type I will get the correct one
Just because I spent so much time I want to see the mosfet work. And I am kinda hoping that since the light has a driver attached maybe the mosfet will still work.
I completed the setup correctly but 3.3v at the gate doesn't activate it. I put 5v from my wallwart to it and it worked perfect. I am looking for a 3.3 to 5 converter if I find one local I'm going to go get it and see if I can make this setup work even if I can't use it in the end.
Next I'm going to start on the pico-buck and try to get it figured out.....![]()



