Languages

You've got the magic touch

Mimosa Pudica (touch-sensitive plant) at ComPeung

Since Jean-Marc showed me these plants, lots of ideas have started flowing through my mind. The mimosa pudica grow on the ComPeung ground and they are very impressive. Watch the video to get the idea... As thus, I've started looking at touch sensing electronic devices.

I've put my attention at very simple circuits at first. Here are a few links I found, I put them here for later reference:

Since Jean-Marc showed me these plants, lots of ideas have started flowing through my mind. The mimosa pudica grow on the ComPeung ground and they are very impressive. Watch the video to get the idea... As thus, I've started looking at touch sensing electronic devices.I've put my attention at very simple circuits at first. Here are a few links I found, I put them here for later reference:

CapSense Arduino Library

There's now an Arduino library available for such applications, I haven't tested it yet but it's worth trying.

Interesting link: EMLI

This looks like an interesting project wrt plants reactions. The idea is to send a small current to a plant and amplifies the signal.
http://www.vslvx.org/EMLI/II/

It also has links to other interesting projects (scroll down the page). In particular this page contains a long explanation of the process as well as a schematics.

TouchSensor.h

Here is a small class that I implemented which works GREAT for detecting touches. It also explains the circuit that needs to be built.

/*
 * TouchSensor.h
 * 
 * (c) 2008 Sofian Audry (info __AT__ sofianaudry __DOT__ com)
 *
 * This code was adapted from a technique by Pontus Frössander described at
 * http://www.e.kth.se/~pontusf/touchsensor.html
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
#ifndef TOUCH_SENSOR_INC
#define TOUCH_SENSOR_INC

/*

Circuit schematics
------------------


                ~0.5 M 
  PIN_OUT -----/\/\/\----*
                         |
  PIN_IN  ---------------*------------- SENSOR
                         |
                         = 100 pF
                         |
                        GND

The sensor is a simple copper plate, with or without insulation.
The 100pF capacitor can be dropped if the circuit is grounded, it is
especially recommended for battery-operated systems that are not plugged
to ground.

Example Arduino code
------------------------------
#include "TouchSensor.h"

#define SIGNAL_OUT 5
#define SIGNAL_IN 6

#define N_SAMPLES 8
#define THRESHOLD 0.2f

TouchSensor sensor(SIGNAL_OUT, SIGNAL_IN, N_SAMPLES);

void setup() {
  sensor.init();
  Serial.begin(9600);
}

void loop() {
  float s = sensor.sense();
  if (s >= THRESHOLD) {
    Serial.print("Touch: "); Serial.print(round(s*100)); Serial.println("%");
  }
}
  
*/
class TouchSensor {
  byte _sendPin;
  byte _receivePin;
  int _nSamples;
  
public:
  TouchSensor(byte sendPin, byte receivePin, int nSamples = 8)
    : _sendPin(sendPin), _receivePin(receivePin), _nSamples(nSamples) {}
    
  void init() {
    pinMode(_sendPin, OUTPUT);
    pinMode(_receivePin, INPUT);
  }
  
  boolean detect(float threshold = 0.5f) {
    return (sense() >= threshold);
  }
  
  boolean senseOne() {
    digitalWrite(_sendPin, LOW);
    delay(2);
    digitalWrite(_sendPin, HIGH);
    delayMicroseconds(5);
    return (digitalRead(_receivePin) != HIGH);
  }
  
  float sense() {
    float nTouches = 0;
    for (int i=0; i<_nSamples; i++) {
      if (senseOne())
         nTouches++;
    }
    return nTouches / (float)_nSamples;
  }
  
};

#endif

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <h3> <h4> <h5> <h6>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Fill in the blank
By submitting this form, you accept the Mollom privacy policy.