PDA

View Full Version : Little help needed to understand Dimmer for DC lamp?



Megahertz
- 7th April 2010, 21:57
Hi, can someone help me understand how I can control the brightness of a DC halogen lamp 12/24V using my PIC. The PIC is suppose to get a pulse from a PLC circuit, first pulse the brightness to be 60%, 2nd pulse to be 100% & on 3rd pulse ALL lamps to be OFF.
I would like to ask what will be the suitable PIC for this job and any ideas/help as how to start with this project (including schematic to control the lamps). Can 16F877A do the job? and also how many of these lamps can I control with one PIC. Thanks in advance.

aratti
- 7th April 2010, 22:41
Can 16F877A do the job? and also how many of these lamps can I control with one PIC

Yes. you can control two indipendent lamps, since you have two pwm channels per chip.

There is a typo in the schematic First command duty cycle = 255 (full power)

Al.

Megahertz
- 9th April 2010, 07:30
Yes. you can control two indipendent lamps, since you have two pwm channels per chip.

There is a typo in the schematic First command duty cycle = 255 (full power)

Al.

Thanks. I looked in the PBP Manual - it asks for Channel, Dutycycle,Frequency.

From what you said, Duty cycle value should be from 0-255 (255 Full power)
Channel will be the Port on which the lamp will be connected.
What will be the frequency?

Also the circuit you mentioned, can it work on 12V as well? Thanks

aratti
- 9th April 2010, 18:52
From what you said, Duty cycle value should be from 0-255 (255 Full power)

Yes.


Channel will be the Port on which the lamp will be connected.

Where you connect the interface, that drives that lamp.



What will be the frequency?

I have indicated 20 KHz (20000) but you should experiment variuos frequency and choose the one that gives you the best result. Remember that frequency must be the same for both channels. Refer to the table @ page 74 of PBP manual for max & min frequency available.



Also the circuit you mentioned, can it work on 12V as well? Thanks

Yes, but you should change the 10 K pullup resistor with a 4.7 K one. (On both channels)

Edited: I have posted a new schematic with the correct pullup value for 12 volts and correctly wired, since in my previous post, schematic shows resistor wrongly connected (see the two schematics and note the mistake)

Byte_Butcher
- 9th April 2010, 20:55
Wouldn't it be easier just to use a single MOSFET as a low side driver?



steve

aratti
- 9th April 2010, 22:38
steve, the answer is yes, but you should use mosfet with logic level capability. These devices, anyway are not capable of high current as the normal mosfet, and you will end up to pay more than a normal mosfet plus a small NPN transistor.

Al.

Byte_Butcher
- 9th April 2010, 23:46
Hmmm. Well, it seems like there's an awful lot of < $2 N-channel MOSFETS that will easily switch 10 or more amps with gate voltages well under 5 volts. You've got P-channel MOSFETS cheaper than that? Plus a NPN?

I use a 16F684 and N-channel MOSFET to PWM control power to a 50 watt 12 volt heater element @ 100Hz with no issues.
I suppose the question is how much current is Megahertz talking about? Small 25-50W halogens, or 250 watt driving lights?

As long as the frequency isn't too high there shouldn't be any trouble driving an N-channel MOSFET directly from a PIC. For driving a halogen lamp there's probably no need for more than about 100 Hz.

If your PIC is running at 3 volts or less, then the choice of logic level high current FETs does diminish greatly and a driver circuit may be necessary.

I suppose it might be worth mentioning that dimming a halogen bulb reduces the operating temperature and disrupts the halogen cycle which can lead to premature envelope blackening and early death. For cheap garden variety bulbs, you may not care. But if you're playing with expensive photography bulbs or something like that, then it might be worth mentioning...

Steve

Megahertz
- 10th April 2010, 06:20
Easily available MOSFET I found out is IRF540 -
This is link is to the datasheet:
http://www.irf.com/product-info/datasheets/data/irf540n.pdf

Since I am not familier with most of the terms in the datasheet, can you please advise if I can use this Mosfet and If I can use the same circuit?

Also, I need to control lamps upto 100W, which I believe can be done using Heatsink on this Mosfet. Thanks for the help.

aratti
- 10th April 2010, 08:03
can you please advise if I can use this Mosfet and If I can use the same circuit?

No! IRF540 is a N channel mosfet the schematic uses a P channel mosfet.

Al.

Megahertz
- 10th April 2010, 08:26
No! IRF540 is a N channel mosfet the schematic uses a P channel mosfet.

Al.

Thanks Al, provided the circuit is changed, will this mosfet be able to do the Job?
I normally keep the components as advised, but IRF9540 is not normally available where I am.

aratti
- 10th April 2010, 10:24
....provided the circuit is changed, will this mosfet be able to do the Job?

Yes, it will work.

Al.

Charles Linquis
- 10th April 2010, 16:00
Use an N-channel FET if you are going to switch the GND side of the circuit. Use a P-channel FET if you are going to switch the positive (high) side. If you switch the high side, you will need a level shifter like Aratti has shown. If you switch the low side, you don't need the level shifter and can drive the FET directly.

Switching the high side is necessary if one side of your lamp must be grounded. Since I doubt that is the case, then I would recommend using an N-channel logic-level FET with the source connected to GND, the drain connected to the lamp (and the other lamp terminal connected to 12V), and the GATE connected to the PIC. Use a 10K pull DOWN resistor between the gate and GND, so that the lamp is off until your program gets started.

At the low frequencies you are running, most of your losses will be resistive. Look at the RDSON with the gate drive you will provide (probably around 4V). If it is 50 milli-ohms, then at 10A the FET will have a (.050*10) = .5V drop. .5V X 10A = 5 Watts. The lower RDSON, the lower the amount of heat produced. My guess is that you will produce maximum heat at around 80-90% of full brightness.

Megahertz
- 25th April 2010, 13:20
I found one mosfet P30NF10
datasheet: http://www.st.com/stonline/products/literature/ds/7817.pdf

The setup worked upto some extent but with few concerns.
firstly when system was fired up, the lamp started glowing but very DIM. I increased the resistance with 1.5K more with 4.7K and this problem got sorted. Now the lamp stays OFF when system is powered up

The problem is that the lamp is not glowing to its full potential. Any ideas please as what changes I can try in the hardware to make this work, i.e. make the lamp off at value 0 & glow at full potential at 255.
I am using 20KHz as frequency with HPWM command.
Thanks

Byte_Butcher
- 25th April 2010, 14:54
Which circuit are you using? The one Aratti posted requires a P-channel MOSFET.

If you are using an N-channel MOSFET in a low-side driver circuit, then you probably need one with a lower gate threshold voltage.

Either way, that MOSFET doesn't look well suited to the job.


Steve

Megahertz
- 25th April 2010, 19:54
I use a 16F684 and N-channel MOSFET to PWM control power to a 50 watt 12 volt heater element @ 100Hz with no issues.
I suppose the question is how much current is Megahertz talking about? Small 25-50W halogens, or 250 watt driving lights?

As long as the frequency isn't too high there shouldn't be any trouble driving an N-channel MOSFET directly from a PIC. For driving a halogen lamp there's probably no need for more than about 100 Hz.

If your PIC is running at 3 volts or less, then the choice of logic level high current FETs does diminish greatly and a driver circuit may be necessary.

Steve

Hi Steve, this is the only mosfet I could find locally, I am in India currently and I have to develop this using easily available components. Though I will try once again to find P-Channel, but I would like to request you if you can upload the circuit here for N-Channel mosfet you use for 12V - 50W heater.

I need it for 50W @ 12V halogen.
My PIC is running on 5V.
Widely available mosfet is IRF540 (N-Channel)

All help is much appreciated. Thanks