Skip navigation

Arduino

1 Post authored by: joff

This is my first blog post on Element14 and hopefully the first one of a long list

ACAL BFi [1] kindly offered me a free sample of an illuminated capacitive switch for evaluation.

The switch is made by Stadium IGT [2] who are coincidentally only a short drive away from where I live.

This is a great opportunity for me to share my findings with the wider community.


So What Is It?


It is an ‘off-the-shelf’ innovative module that combines a touch switch (no moving part) with a multi-colour backlight.

It is effectively a capacitive switch with built-in (Red/Green/Blue) RGB LED fitted within a thin assembly, see Figure 1.

It comes in two standard square sizes of 35mm and 20mm.

The 35mm module includes 4 built in LEDs whereas the 20mm module contains only one.

The free sample I got was the 35mm module which is the one described in this article.

switch_illustration_35mm.png

Figure 1 - 20mm and 35mm modules (courtesy of Stadium IGT)


The module is designed to be mounted behind a glass or Acrylic panel with a thickness of up to 11mm.

The touch sensitivity is preset by 2 micro switches fitted on the rear of the module.

It comes with a self adhesive patch for easy fitting. Other more robust fitting techniques should also be considered.

At time of writing, free samples are available from ACAL BFi [1].

 

switch_35mm_front_rear.jpg

Figure 2 - Front and rear of 35mm module


Under the hood


The schematic for the 35mm module is provided in the module datasheet as shown in Figure 3.

The schematic shows 4 RGB LEDs [3] in a single package, an LM2936 [4] low dropout voltage regulator and touch sensor QT100 [5].

switch_35mm_schematic.png

Figure 3 - Module Schematic (courtesy of Stadium IGT)


The height for RGB LED package is 1.2mm.

The LED forward voltage is 3.2V (Blue/Green) and 2.1V (Red) typical when a forward current of 20mA is applied.

The maximum forward current is specified as 35/50mA at constant current or 110/220mA with a current pulse width less than 10ms and duty cycle less than 10%.

The luminous intensity is quoted as 240/1100/550 mcd for Red/Green/Blue with 20mA forward current.


The LM2936 is a voltage regulator from Texas Instruments (was previously National Semi).

It provides a regulated output voltage of 3.3V to the touch sensor from the 6-24V input power supply.

The LM2936 is a linear regulator so high supply voltage will result in power wasted in the form of heat dissipated by the regulator.


The QT100 touch sensor is an integrated circuit that detects proximity or touch.

A charge transfer method senses an increase in load capacitance caused by the human body in close proximity to the “sense pad”.

The sense pad is probably built onto the switch module PCB. More information is available in Quantum Research Application Note [6].

The QT100 was originally made by Quantum Research Group which was later acquired by Atmel in 2008.

The QT100 has been replaced by the AT42QT1010 from Atmel.


Simple Interfacing with Arduino


The module was evaluated with an Arduino Leonardo board.

The connection between the Arduino board and the module is given in Figure 4.

 

basic_arduino_connection_bb.png

Figure 4 - Captured with open source Fritzing application [7]

 

The module is powered from the Arduino board 5V output power.

The module datasheet specifies a 6V to 24V supply but it operated correctly at 5 volts.

It is not clear why the supply voltage is restricted to 6 volts.


The easiest way to drive the RGB LEDs is to connect them directly to Arduino digital output pins.

The Green, Red and Blue LEDs are connected to pin 9 to 11 respectively.

These pins can be programmed to output a Pulse Width Modulation (PWM) signal, refer to the Arduino PWM tutorial [8] for details.


The microcontroller IO pins on my Arduino board can sink a maximum current of 40mA, with the total current not exceeding 80mA.

However it is recommended to limit current to around 20mA. So resistors were added to limit the current sink on pins 9 to 11 to 20mA.

Driving of higher current LED can be achieved by controlling a transistor gate, such as the commonly used PN2222 NPN bipolar transistor.


The output from the capacitive sense pad was connected to pin 8. A current limiting resistor was added inline as a precaution.


A Very Simple Example Code


The PWM signal allows us to change the output duty cycle from 0 to 100% duty cycle via an 8-bit value (0 to 255).

The 8-bit value is set using Arduino’s analogWrite() function call.

This is equivalent setting an analogue output voltage between 0 and 5 volts.

Since each LED is driven by its own PWM output pin, in theory 24-bit colours may be generated.


A simple program to drive the module is given in the code listing below.

The original code, taken from example RGB specturm [9], cycles an RGB LED through the colour spectrum using the 8-bit PWM pins.

The code was slightly modified so that the colour cycling loop waits for the capacitive switch to be pressed.

This code is for illustration purpose only as the microcontroller will be ‘stuck’ in an infinite loop, doing nothing more than waiting for a button press to update the LED colour.

 

// Original code from:
// https://gist.github.com/jamesotron/766994

const int redPin = 10;
const int greenPin = 9;
const int bluePin = 11;
const int buttonPin = 8;

// variable for reading the pushbutton status
int buttonState = 0;

void setup()
{
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT); 

  // Start off with the LED off.
  setColourRgb(0,0,0);
}

void loop()
{
  unsigned int rgbColour[3];

  // Start off with red.
  rgbColour[0] = 255;
  rgbColour[1] = 0;
  rgbColour[2] = 0;

  // Choose the colours to increment and decrement.
  for (int decColour = 0; decColour < 3; decColour += 1)
  {
    int incColour = decColour == 2 ? 0 : decColour + 1;

    // cross-fade the two colours.
    for(int i = 0; i < 255; i += 1)
    {
      rgbColour[decColour] -= 1;
      rgbColour[incColour] += 1;
      setColourRgb(rgbColour[0], rgbColour[1], rgbColour[2]);
  
      // Wait for button press before changing color
      do
      {
        delay(5);
        // read the state of the pushbutton value:
        buttonState = digitalRead(buttonPin);
      }
      while(buttonState == LOW);
    }
  }
}

void setColourRgb(unsigned int red, unsigned int green, unsigned int blue)
{
  analogWrite(redPin, 255-red);
  analogWrite(greenPin, 255-green);
  analogWrite(bluePin, 255-blue);
}





 

The example video below shows the module driven by colour cycling code.

A buzzer was connected across the touch sense output.

The buzzer sounds when the pad senses a press.





General Observations


It is not clear why the module supply voltage is specified to be 6V to 24V.

May be these are industry-standard voltages in control panels for which the module is targeted as a direct replacement?


The application note [6] mentions that switching signals from other circuits should be routed away from the sense traces and electrodes to prevent interference which may result in false detection.

So it bears the question whether the PWM signals driving the LEDs may interfere with the touch sense electro-static field?

No issue was observed during my tests.


The quote I was given for the 35mm module was around £50 (Great British Pounds) per unit for small quantities.

This may be affordable for industrial prototype designs but not so for home projects.


An alternative RGB LED is the WS2812B Intelligent Control LED also known as NeoPixel, see Figure 5.

The RGB LEDs and driver circuit are integrated onto the same chip.

The 24-bit colour is programmed via a single control line, no clock signal required.

The same control line can be used to daisy chain up to 1024 NeoPixel LEDs thus significantly simplifying hardware interfacing to multiple modules.

ws2812_B_tims_blog.png

Figure 5 - WS2812B Intelligent Control LED (Courtesy of Tim’s Blog [10])


An alternative to the QT100 is the CapSense technology from Cypress Semiconductor.

A low-cost evaluation kit [11] is available from Cypress.

This is not an ‘off-the-shelf’ product like the module from Stadium IGT.

Capsense_kit.jpg

Figure 6 - Low-cost CapSense evaluation kit from Cypress Semiconductor.



Final thought


I like the module simple integration of touch and visual feedback.

The module target market is industrial designs in sectors such as Aviation and Marine.

This off-the-self module has great potential within the maker community but its high price probably means that it is unaffordable for most hobbyist projects.

The module could possibly benefit from other technologies such as NeoPixel and CapSense technology.

 

The usual Disclaimer – I have no affiliation with this product, IGT Solutions or ACAL BFi.

The information provided in this article is given in good faith without warrantee.


References


[1] http://www.acalbfi.com/uk/p/00000013WR

[2] http://www.stadium-igt.com/interface-and-displays/standard-illuminated-capacitive-switches

[3] http://www.lumotronic.eu/files/p457-NSSM038A.pdf

[4] http://www.ti.com/lit/ds/symlink/lm2936.pdf

[5] http://www.atmel.com/devices/qt100.aspx?tab=overview

[6] http://www.atmel.com/images/an-kd02_103-touch_secrets.pdf

[7] http://fritzing.org/home/

[8] http://arduino.cc/en/Tutorial/PWM

[9] https://gist.github.com/jamesotron/766994

[10] http://cpldcpu.wordpress.com/2014/01/14/light_ws2812-library-v2-0-part-i-understanding-the-ws2812/

[11] http://www.cypress.com/capsensembr3/





Filter Blog

By date: By tag: