View Full Version : How to control and dim a 12V lamp with a BS2?

04-06-2007, 11:50 PM
Hello, I've got a question about digital to analog conversion with the BS2.

I'd like to use my BS2 to control a 12V lamp which will draw a max of 1.5A. I need to be able to dim it with moderate resolution, but I can't tie up the processor with PWM since I need to monitor some sensors while outputting the lamp setting.

I've designed a system that does what I want, but uses a servo mated to a dimmer rheostat. I'd like to get rid of this, and electronically control the brightness of the lamp.

I found the following N & V article helpful, it describes the creation of a D/A circuit : http://www.parallaxinc.com/dl/docs/cols/nv/vol2/col/nv59.pdf

The problem is that the above setup can only source 20mA, but I need considerably more than that.

Can anyone suggest an easy way to electronically dim my lamp, or perhaps a way to modify the above example to work for my needs?


Martin Hebel
04-06-2007, 11:59 PM
The "Process Control" text from Parallax has a circuit driving a fan at variable speeds that does not tie up the processor. Using a transistor of sufficient current capacity, it should be able to be modified to drive your lamp.



StampPlot - GUI and Plotting, and XBee Wireless Adapters (http://www.selmaware.com/)
Southern Illinois University Carbondale, Electronic Systems Technologies (http://www.siu.edu/~isat/est)

04-07-2007, 12:19 AM
Any recommendations for a transistor which can handle 1.5A max at 12V?

Phil Pilgrim (PhiPi)
04-07-2007, 01:12 AM
The circuits shown in the book, even though they use the Stamp's PWM output for regulating fan speed, operate the drive transistor in the linear region. When driving a 12V lamp at 1.5A in this manner, your drive transistor is going to dissipate a lot of heat. A better solution would be to pulse-width modulate the lamp itself, using a logic MOSFET like the IRLZ14. A constant PWM output for driving the MOSFET can be obtained from either the PWM Pal (http://www.parallax.com/detail.asp?product_id=28020) or the MoBoStamp-pe (http://www.parallax.com/detail.asp?product_id=28300).


04-07-2007, 07:49 AM
Phil, great idea, that's what I'm looking for. I notice that Parallax appears to carry the IRL520 at


but I can't add it to a cart. Has it been discontinued, site admins?