Musical Fish (MSP430 Captouch & Bare Conductive Paint)

This is a short article demonstrating an experiment with Bare conductive ink and the MSP430's capacitive sensing hardware.

I've experimented with various capacitive sense methods previously; the most common uses one pin to charge up an electrode, while using another pin to measure the amount of time needed to charge up to the logic high threshold level of an input pin. A couple of similar approaches are illustrated here:

An alternate method is available on several of the MSP430 value line microcontrollers (G2xx2, G2xx3, FR58xx, FR59xx). In addition to the typical pin peripheral functions, they include a relaxation oscillator circuit that includes pin capacitance to set the frequency. By measuring the number of oscillations in a given time period, a small change in capacitance can be measured...enough to detect whether a finger is touching an electrode.

Photo Jan 04, 1 43 12 AM (HDR)

Bare Conductive makes a carbon-bearing paint that is fairly conductive, and available in pen form. Combined with capacitive sensing, it is possible to draw an interface on a sheet of paper, and use it as input to a microcontroller. For this experiment, we used it to play a few notes from a speaker and make a very basic piano-like instrument.

Attaching wires to paper is a fairly difficult problem, as the paint is not strong enough and the paper is fragile. Here is one possible solution, using a right angle header and hot glue.

Photo Jan 04, 1 43 31 AM

The code was slapped together in Energia and uses the capacitive touch library available for it...readability and optimal performance were not priorities.

#include <CapTouch.h>

#define BUTTON4 P1_4
#define BUTTON3 P1_5
#define BUTTON2 P2_0
#define BUTTON1 P2_1

#define LED1 P1_0

uint8_t state = false;

CapTouch testbutton1 = CapTouch(BUTTON1, TOUCH_BUTTON);
CapTouch testbutton2 = CapTouch(BUTTON2, TOUCH_BUTTON);
CapTouch testbutton3 = CapTouch(BUTTON3, TOUCH_BUTTON);
CapTouch testbutton4 = CapTouch(BUTTON4, TOUCH_BUTTON);

boolean buttonState1 = false;
boolean buttonState2 = false;
boolean buttonState3 = false;
boolean buttonState4 = false;

void setup() {
  /* Use the middle LED to indicate touch */
  pinMode(LED1, OUTPUT);  

void loop() {
  if (testbutton1.isTouched() > 0) {
    if (buttonState1 == false) {
      buttonState1 = true;
      tone(P2_3, 440, 100);
  } else if (testbutton2.isTouched() > 0) {
    if (buttonState2 == false) {
      buttonState2 = true;
      tone(P2_3, 494, 100);
  } else if (testbutton3.isTouched() > 0) {
    if (buttonState3 == false) {
      buttonState3 = true;
      tone(P2_3, 523, 100);
  } else if (testbutton4.isTouched() > 0) {
    if (buttonState4 == false) {
      buttonState4 = true;
      tone(P2_3, 554, 100);
  } else {
    buttonState1 = false;
    buttonState2 = false;
    buttonState3 = false;
    buttonState4 = false;

Submitted by Garrett on Sun, 01/19/2014 - 13:58.