Projects‎ > ‎Electronics‎ > ‎

Touch Light Controller

This project expands on the current driver design discussed previously, adding a touch sensor and microcontroller for brightness control. It was built for the Illuminate Project - a new set of light fixtures in our camper.

Electrical Design

This is a fairly simple circuit. A 12V battery supplies the power which is regulated to 3.3V by an MCP1702 linear regulator. The brain is an Atmel ATtiny25 MCU which works in combination with the Atmel AT42QT1010 single channel touch sensor to control the brightness of an LED bank. Although the ATtiny25 is used, a smaller MCU such as the ATtiny13 is a pin for pin replacement part that costs a few cents less. As of firmware version 1.2, only 15% of the total program memory space was being used, so having only 1k of flash instead of 2k would make sense for this application.

The LEDs are driven by a constant current sink. When a high pulse is sent from the MCU, the MOSFET Q2 turns on, allowing current to flow through the resistor R3. With the voltage across R3 reaches the base-emitter trigger voltage of Q1, Q1 begins to fully saturate. This causes the voltage at the gate of Q2 to drop, and it begins to turn off. This cooperation between Q1 and Q2 ensures the current through the LEDs stays where it is supposed to be. The brightness control is a factor of the LED pulse duty cycle. If the pulse has a frequency of 100Hz (10ms) then a high level for 1 ms followed by a low level for 9 ms would constitute a 10% duty cycle, and Q2 would only be "on" for 10% of the time. Because the pulse rate is well above the refresh rate of the human eye, we will perceive the LEDs as being constantly on but with a significantly reduced brightness.

With such a low value for R3, an estimated 1A will be able to flow through the LED bank. Divided across 10 strings, this is 100mA per LED. This is OK as long as the LEDs are pulsed with a duty cycle of 50% or less. In actuality, with this high of a current the base voltage of Q1 will probably not reach the full 0.6V because of the high voltage drop across the LEDs, meaning that the current through the LEDs will be a bit less than expected. This will help to ensure they do not overheat from too much current. The unused MCU pins are pulled down to conserve power as suggested by the datasheet.


* Update *
Although the original description called for 10 parallel strings of 3 series LEDs, a total of 24 parallel strings were used. This is detailed in the complete Illuminate Project description. Because of the larger amount of parallel strings, a resistor value of 0.33Ω was used for R3. With this value, an estimated 1.8A should flow during the "on time." This comes out to be 75mA per LED string - a safe number between the maximum rated constant current of 50mA and pulsed current of 100mA for the SMD LEDs. The instantaneous power consumption of R3 would be 1.07W. The resistor used is rated for 3W, so this OK. 

The Build

Normally, the hardest thing about building these circuits is fitting them nicely on the board I have picked out, but this one had a a bonus challenge - hand soldering a surface mount part to a standard perf board. The only available package for the Atmel tough sensor (that I could even pretend to handle) was SOT23-6. 

I had previously found a few of these SMD to DIP conversion boards that have come in handy before, but I didn't really want to use all of the SOT23-6 boards that I had for this project. As you can see, I did solder one chip to be used in breadboarding. Soldering SMD parts to a pad on the board is hard enough, but soldering wires directly to the pins is a totally different kind of challenge. To start, I slightly bent the pins up from the chip for easier access. I then put a tiny drop of super glue on the board and placed the chip on it. 

While that dried, I prepared a few wires. I cut six strands of 32 gauge wire and stripped a couple of millimeters off the end of each. I then coated the tips with a bit of solder. To attach them to the chip, I would collect a tiny amount of solder on the tip of iron, apply the iron to a pin, and poke the wire into it before removing the iron and letting the solder harden. The thing to remember is to not hold the iron on the pins for too long and to give it some time to cool off in between pins. Once all six wires were in place, I put a few drops of hot glue over top to make sure I don't rip them off. The wire colors do serve a purpose: red is the supply voltage, white is ground, and blue is a signal. Once the glue was dry, I ran the wires down through the perf board holes and stripped the other ends. It may be a good idea to stip the other ends before soldering the wires. It is much easier for checking for continuity and making sure you don't short two of the pins together. I was even able to run the wires into my original breadboard circuit to make sure the chip worked properly.

The tiny chip glued down...     Wires soldered in place...            Testing the chip...

With that out of the way, the rest of the circuit was a cinch to complete. I already had most of the power supply and current sink on the board to make sure it all fit. Lastly, I connected the small signal wires together. I made sure to test the power before I connected the supply line to the chips and retested it afterwards. Everything worked perfectly. The resistor lead sticking out of the circuit is to be used as the touch sensor electrode. I also made sure to keep the current sinking parts as near to the screw terminals as possible to keep the higher current away from the rest of the board.


A description of the MCU code can be found here. Be sure to check out the Illuminate Project to see this circuit in action!
Download

   Check out the source code and Eagle schematic files!