Tuesday, December 20, 2011

Diner Light


The prototype Diner Light is up for Christmas. Using the touch sensor from the previous post to give independent control of 4 LED spot lights to individually light the four seats at our family dining table.

The Christmas holidays should thoroughly test the prototype. Then a final version can be manufactured in the new year with any modifications. Already on the list is a master touch sensor for all on and all off control. Oh and a pretty case to make it an acceptable addition to the lounge. The PCB design is already almost complete in Fritzing.

Details on the touch sensor design used is given on my website. It is very simple using just a diode and 2 resistors to provide capacitive touch sensing. The only change required for use in the Diner Light was to change to using a port interrupt on the Arduino so that 4 channels of interrupt could be implemented on a Atmega328 Arduino.

The LED lamps are driven via a simple transistor current source, thus making the supply voltage non-critical. Further details of the design will be published in the new year with a documentation of the build of the final version. So for now an excerpt from the circuit is shown below. It shows all the main circuit component structures, a touch sensor is on the left and a constant current LED drive is on the right of the Pro Mini.

Friday, December 9, 2011

Touch sensor on Arduino

With a task to build a table lamp under way I decided that I needed a touch sensor. Well four of them really, to control the individual place lighting. Low and behold the next day hackaday has a post on a touch sensor using the capsense library. So I hook up the circuit used with the library and write a bit of code to control and measure the sensor. But I wasn't convince by how it behaved. The circuit used tries to measures the charge rate of the capacitance provided by human touch. However I found that leakage currents in my cobbled together circuit stopped the capacitance charging even to half the supply voltage driven out an Arduino IO pin. The set up still sensed a definite and repeatable change upon touching the sensor plate but this was due to the fact that I was applying ~10V of mains pick-up to the circuit. Whilst I expect there is a way to build this circuit with less leakage and susceptibility to electrical pick up from the human user I wanted something less picky for my solution. Mainly because I only want to build it once. So back to the web.


Further research showed that most methods measure discharge of the capacitance or voltage drop of a charge capacitor switch to the sense plate. The second method gets into more low level micro controller coding than I want to. So the discharge method looked best bet.

I rigged up the circuit shown above which uses an output pin on the Arduino to charge the capacitance of the circuit through a diode, which avoids having to switch the pin to high impedance. This drive pin is set as a PWM output which provides a 490Hz drive to the circuit. The sense point of the circuit is connected to an interrupt pin on the Arduino has a resistor, ~3Mohm, connected to ground to discharge the circuit's capacitance once the supply pin is switched off. The sense plate for the test set up was a piece of painted aluminium alloy sheet with a screw holding the connection wire to it. The sense plate is connected to the circuit's sense point via a 12KOhm resistor to provide protection from ESD. It should be noted that diodes have a parasitic capacitance which can be anything from .5pF to 200nF or so depending on the type. If a diode with very low capacitance is used then an extra capacitor of a few pF connected between sense point and ground may be required. The diode I used is a 1n4148 which is a small high frequency signal diode which I would expect to have a 5 to 15pF capacitance. If a diode with large capacitance is used then the circuit changes little with the addition of the human touch capacitance.

The Arduino needs to be set up to have a change interrupt on the input sensing pin. I simply used the Arduino standard pin interrupt commands for test. The final 4 channel touch sensor for the lamp will require a port interrupt to be configured as a pro mini will be used. For more info, a code example and the circuit diagram go to Arduino Touch .