Arduino Forum

Using Arduino => General Electronics => Topic started by: GreyArea on Dec 17, 2017, 05:35 pm

Title: Cap sense advice please!
Post by: GreyArea on Dec 17, 2017, 05:35 pm
I'm looking to make a cap slider that's 800mm to 1m long on/in a curved pole. The effect I want to achieve is sliding a hand down the pole will cause LEDs within the pole to light up as the hand passes over them, so it's a large contact area and a large gesture, but over a metre there could be 60 LEDs and I'd like the output to be sensitive enough for them to come on one at a time...but obviously 60 pins is a no-no!

Programming I can manage, just wondering the best design for the actual slider. The tube is composite, either carbon or glass fibre, 25mm diameter and should be invisible...the tube wall could be around 4mm thick too, so hope someone can advis3 on best resistor value to pick up contact through 4mm of resin composite.

All advice gratefully received.
Title: Re: Cap sense advice please!
Post by: Paul_KD7HB on Dec 17, 2017, 05:53 pm
I'm looking to make a cap slider that's 800mm to 1m long on/in a curved pole. The effect I want to achieve is sliding a hand down the pole will cause LEDs within the pole to light up as the hand passes over them, so it's a large contact area and a large gesture, but over a metre there could be 60 LEDs and I'd like the output to be sensitive enough for them to come on one at a time...but obviously 60 pins is a no-no!

Programming I can manage, just wondering the best design for the actual slider. The tube is composite, either carbon or glass fibre, 25mm diameter and should be invisible...the tube wall could be around 4mm thick too, so hope someone can advis3 on best resistor value to pick up contact through 4mm of resin composite.

All advice gratefully received.
First let's look at your request. By "cap" are you referring to "capacitor" or "capacitance", or some type of cover?

Next, is a single hand involved or multiple hands, or other body parts?

Next, sliding of the hand, how fast? Is the hand wrapped around the tube?

And finally, you describe the tube as being invisible, how does that work.

I suggest you look at sensing the body acting as an antenna and a sensor picking up the change in level of the 50 or 60 cycle power that is always present in buildings. Probably don't need and Arduino for that.

Paul
Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 17, 2017, 10:04 pm
I am not sure you understand how a capacitance sensor works.
Have a look here:- Atmel 42479 Capacitive Touch Long Slider  (https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwiHioLL-JHYAhWHIewKHa_eCAQQFggxMAE&url=http%3A%2F%2Fww1.microchip.com%2Fdownloads%2Fen%2FAppNotes%2FAtmel-42479-Capacitive-Touch-Long-Slider-Design-with-PTC_AT11805_ApplicationNote.pdf&usg=AOvVaw09Q_gEmz1BM902u9OKpm_2)

I think you will be hard pushed to get it that long or indeed that sensitive and accurate.
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 18, 2017, 04:07 am
The effect I want to achieve is sliding a hand down the pole will cause LEDs within the pole to light up as the hand passes over them, so it's a large contact area and a large gesture, but over a metre there could be 60 LEDs and I'd like the output to be sensitive enough for them to come on one at a time...
Interesting problem !
As has been said by others, a large capacitive sensor is not going to work. A whole bunch of separate sensor areas may be ok, but I suspect you'll have a shift register full of LED's right next to 'em - which won't help at all.

I'd be tempted to look at making strips of hall effect sensors with a shift register, say thin PCBs each with 8 sensors spaced at 20mm and an 8-bit shift register. The 'performer' will have to wear some ornate ring with a big magnet in it.

Something like DRV5032 (https://www.mouser.co.uk/ProductDetail/Texas-Instruments/DRV5032FADBZT)

Yours,
 TonyWilk

Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 09:21 am
For some reason quote button not working on my iPad...having to do this manually so hope it's not too confusing...

First let's look at your request. By "cap" are you referring to "capacitor" or "capacitance", or some type of cover? - sorry,  I was thinking capacitive (capacitance), but how the effect is achieved is unimportant as long as it does the job.

Next, is a single hand involved or multiple hands, or other body parts? A single hand...the other hand may or may not be holding the tube, but if so there is room to have an area of the tube that is not acting as a sensor.

Next, sliding of the hand, how fast? Is the hand wrapped around the tube? - A range of speeds, from perhaps half a second to five seconds. If there is a limit to how fast it can respond that is acceptable. Yes, the hand could either encircle the tube or be pressed flat against it...but if one method is required for it to work, again that is acceptable.

And finally, you describe the tube as being invisible, how does that work. - Ha! It doesn't, I'm an idiot...I meant the sensor should be invisible...although, depending on certain factors it may be possible to incorporate it as part of a design;I know it's possible to use copper tape for capacative switches, I was wondering if inidividual parts of the sensor could be designed so that the whole sensor looks like a snake (for example). If not, would it be possible to have the sensor sufficiently responsive that it would work under 3 to 4 mm of fibre reinforced resin?

I suggest you look at sensing the body acting as an antenna and a sensor picking up the change in level of the 50 or 60 cycle power that is always present in buildings. Probably don't need and Arduino for that. - the rod needs to be portable and the whole system needs to use a5v DC power source. It may not always be used in a building. Does that change things?

In short, I'm looking for a method of turning on (and off) a line of 5v WS2812b LEDs in the centre of a 25mm OD, 17mm ID fibre reinforced resin tube by "stroking" them. If capacative sensors are not the best option, I'm open to suggestions...though it must be just a hand, no extra devices like rings etc please. Due to space restrictions for circuitry, I'll be using a trinket style Arduino device, hence the need to limit both the number of pins used and the size of the sketch!

Yes I'm new at this, so if I'm asking for the moon, please let me know...!

Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 18, 2017, 09:26 am
Quote
For some reason quote button not working on my iPad...having to do this manually so hope it's not too confusing...
Is the quote icon not visible? If not then hold down the refresh icon in the URL window and a menu will appear saying "request desktop version", kick that and the icons will appear.

I don't thing your project is possible at all.
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 09:33 am
Is the quote icon not visible? If not then hold down the refresh icon in the URL window and a menu will appear saying "request desktop version", kick that and the icons will appear.

I don't thing your project is possible at all.
Your forum operating advice is 100% accurate, thanks. Quote button was visible but didn't respond until I requested desktop site.

Kind of hoping your Arduino advice isn't as accurate :-).

It was this video that got me started...I just wondered how long the foil strip could be made...

https://m.youtube.com/watch?v=_r_8z0pAQ-o
Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 18, 2017, 09:43 am
I am not sure what you think that video is showing but it is not showing a reading of how far along the strip the hand is but how far above the strip the hand or grounding point is. So it is not related to your proposed project at all.

Quote
Kind of hoping your Arduino advice isn't as accurate
Sadly it is.
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 09:51 am
I am not sure what you think that video is showing but it is not showing a reading of how far along the strip the hand is but how far above the strip the hand or grounding point is. So it is not related to your proposed project at all.
1:10 in the video. "As I touch the pad, the LEDs light up. As I move my finger to the right they progressively light more and more"

I hope you can at least see where my confusion arose given the above!
Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 18, 2017, 09:56 am
 I see the confusion. The way that works is their is a diagonal cut in the masking tape and the A/D inputs are floating. The angle of this cut looks about 20 degrees. Even if you could, to extend this to a meter would require such a shallow angle that you would not get much resolution at all. This is the problem with demos like this, they simply do not scale up.

But that link I posted is the way to do a slider and it is a limited distance and not what you want. The cap sense example using no external components is not very reliable and stable anyway.

Edited because she woke up.
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 10:10 am
I couldn't have the sound on because I am in bed and my wife is sleeping. I see the confusion, I think the poster of the video is confused about what is happening as he has not even posted his code. Also I would never trust anyone who uses Solderless bread board for anything on a video.

 But that link I posted is the way to do a slider and it is a limited distance and not what you want. The cap sense example using no external components is not very reliable and stable anyway.
Ah it's hard to tell without the sound but it does become clear that what appears to be one bit of foil is actually two triangles, so he's using a method the same as your link (which I'd found before you posted and is great, btw, but with my limited experience I couldn't make out if there was a maximum length and sensitivity.

Thanks for the advice. I'll try building a long one by the methods in your link and see what happens.
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 18, 2017, 02:37 pm
Well, I am sort of surprised...

Watched the linked YouTube video (https://m.youtube.com/watch?v=_r_8z0pAQ-o) and thought, hmm, bet that's a) unreliable and b) running on mains pickup.

Anyhow, I built one.

For his application it's not bad, but it does rely on pickup (probably from mains electricity) because it stops working if you ground yourself. So it wouldn't work outdoors for example. It also depends a lot on the surface it is on. It only works when you press a finger on it - it has no range i.e. no effect from a few mm away. I also thought I'd damaged an analog input, which is a real possibility, but it seems ok now.

The real news is on a bit of an improvement - this is what I built:
(http://tonywilk.no-ip.org/wardoctor/CapStrip1.jpg)

The sensing strip is cut from copper foil tape, the central diagonal cut strips are about 10mm down to 1mm wide and about 300mm long, spaced by about 1mm. Around the outside is another strip roughly 5mm wide and spaced 3mm from the ones in the middle. Here's a closer view of each end:
(https://forum.arduino.cc/index.php?action=dlattach;topic=517581.0;attach=237712)
(if the images don't appear inline, they are attached)

The foil was laid on some thin plastic sheet (maybe mylar, about 0.2mm thick), wires soldered on and then covered with a layer of clear packing tape. I've taped it to a length of PVC pipe (about 30mm dia.)

The idea is to drive the outer strip so there is something to couple to the inner strips.
The mashed-together code is:
Code: [Select]

#define DEBOUNCE_TIME 20  //20mS per debounce step
const int calPin = 2;     // calibration button pin

// useful functions:
int debouncePin( uint8_t * pdebounce, int pin, int to_level );
void Sprint( char *fmt, ... );

//-----------------------------------
void setup() {
  Serial.begin(9600);
  pinMode(calPin, INPUT_PULLUP);// CAL button pin

  pinMode( A0, INPUT );
  pinMode( A1, INPUT );
  pinMode( 4, OUTPUT );
  digitalWrite( 4, LOW );
}

//-----------------------------------
static uint32_t time10mS=0;
static int count100mS= 0;
static int32_t a0,a1, total, b0, b1, cal0=0, cal1=0;
static uint8_t d_calPin= 0x7f;
int i;

void loop() {
  // run 10mS and 100mS loops:
  if( millis() > time10mS + 10 )
  {
    do_10mS_loop();
    if( ++count100mS > 10 )
    {
      do_100mS_loop();
      count100mS= 0;
    }
  }
}

// Executed every 10mS
//
void do_10mS_loop()
{
  if ( debouncePin( &d_calPin, calPin, LOW ) )
  {
    // do something useful...
    Serial.println("Calibrate!");
    cal0= b0;
    cal1= b1;
  }
}

// Executed every 100mS
//
void do_100mS_loop()
{
  a0= a1= 0;
  for( i=0; i<500; i++ )
  {
    digitalWrite( 4, LOW );
    digitalWrite( 4, HIGH );
    a0+= analogRead( A0 );
    digitalWrite( 4, LOW );
    digitalWrite( 4, HIGH );
    a1+= analogRead( A1 );
  }
  total= a0+a1;
  b0= (a0 * 1000)/ (total/2) - cal0;
  b1= (a1 * 1000)/ (total/2) - cal1;
 
  Sprint("a0= %ld, a1= %ld, b0= %ld, b1= %ld, diff= %ld\n", a0, a1, b0, b1, b1-b0 );
}


//----------------------------------------------------------------------
// debouncePin
// - debounces the given pin input
// passed:
//    debounce   - pointer to a byte used to debounce this pin
//    pin        - no. of the pin to read and debounce
//    to_level   - the level at which the input is 'active'; LOW or HIGH
// returns:
//    1 when pin has just transitioned to the 'active' state
//    otherwise 0
//
// usage:
//    static uint8_t pin3debounce= 0x7f;  // always initialise to 0x7f
//    if( debouncePin( &pin3debounce, 3, LOW ) )
//       \\ pin debounced LOW
//
int debouncePin( uint8_t * pdebounce, int pin, int to_level )
{
  uint8_t levelFlip= (to_level == HIGH) ? 0 : 1;
 
  *pdebounce &= 0x7f;         // clear action bit
  *pdebounce= (*pdebounce & 0xc0) | ((*pdebounce & 0x3f) << 1) | (digitalRead(pin) ^ levelFlip);
  if( *pdebounce == 0x3f )
    *pdebounce= 0xff;         // is debounced '1', set state and action flags
  if( (*pdebounce & 0x3f) == 0 )
    *pdebounce= 0x00;         // is debounced '0', set state= 0;
  return (*pdebounce >> 7);   // return 'action' bit
}

//-----------------------------
// Serial.print helper function
// - a real cut-down printf()
//
void Sprint( char *fmt, ... )
{
  char c;
  va_list args;
  va_start( args, fmt );
  while( (c=*fmt) != 0 ){
    switch( c )
    {
    case '%':
      c= *(++fmt);
      if( c == 'l' ){  // lower case L for "%ld" or "%lu"
        c= *(++fmt) & 0xdf; // convert 'd', 'u' to 'D', 'U'
      }
      switch( c )
      {
      case 'd': Serial.print( va_arg(args,int16_t) ); break;
      case 'u': Serial.print( va_arg(args,uint16_t) ); break;
      case 'D': Serial.print( va_arg(args,int32_t) ); break;
      case 'U': Serial.print( va_arg(args,uint32_t) ); break;
      case 'f': Serial.print( va_arg(args,double) ); break;
      case 'h': Serial.print( va_arg(args,int), HEX ); break;
      case 'c': Serial.print( (char)va_arg(args,int) ); break;
      case 's': Serial.print( va_arg(args, char *) ); break;
      default:  break;
      }
      break;
    case '\\':
      c= *(++fmt);
      if( c == 'n' )
        Serial.println();
      else
        Serial.print( c );
      break;
    default:
      Serial.print( c );
      break;
    }
    ++fmt;
  }
  va_end( args );
}


Analog inputs A0 and A1 are connected to the diagonal-cut strips and have 1Mohm resistors to ground.
Digital output D4 is connected to the outer strip. I've used D2 as an input for a 'Calibrate' button which removes offsets.

When calibrated it prints:  (note the 'diff' value)

a0= 79048, a1= 69030, b0= 0, b1= 0, diff= 0
a0= 78969, a1= 69060, b0= -1, b1= 1, diff= 2
a0= 79093, a1= 68950, b0= 1, b1= -1, diff= -2


Hand gripping lower end:

a0= 111710, a1= 100892, b0= -17, b1= 17, diff= 34
a0= 111669, a1= 100791, b0= -16, b1= 16, diff= 32
a0= 111773, a1= 100860, b0= -16, b1= 16, diff= 32

Hand gripping upper end:

a0= 113945, a1= 128126, b0= -126, b1= 126, diff= 252
a0= 114930, a1= 129889, b0= -129, b1= 129, diff= 258
a0= 115349, a1= 130419, b0= -129, b1= 129, diff= 258


Surprisingly it seems to work !  However, you have to grip the tube for it to register well.

I may play with this some more and see if I can get anything out of a longer 'sensor'. It may help to have the 'driving strip' all the way around the tube so there's more area to couple into your hand.

Even this quick'n'nasty test piece lays nice and flat, so putting it around the outside of the tube and painting it may work.


Yours,
  TonyWilk

P.S.
tip: cheap copper foil tape is sold as 'Slug Tape' - apparently garden slugs don't like sliming over copper, so you use it to protect plants.
 
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 04:28 pm
I too have been busy and subject to reining in my ambitions, have something that may deliver what I need...not as elegant as Tony's solution, but functional and limited to only two pins.

The main thing I've sacrificed is the resolution...because why do I need to light up each LED one at a time when my great hulking fist will be covering five of them?

Also, I'm using the fact that I'm on a round pole to my advantage...I can make two interlocking touchpads, and though each will be on a common pin, if I am careful only to stroke (not wrap my hand around) the pole, I only contact the teeth where they interlock, as the "rail" they are on is below the touch plane because of the curve of the pole (I'll post a pic in a bit).

Getting a third contact in would give a direction...either 123123 or 321321...but I haven't figured out how to wire that yet, so I've jury rigged it. As long as the total number of "teeth" is even (from pad one AND pad two combined), then in one direction I always hit pad one first, in the other, pad two.

So far I've got an output of the ratio of the two signals in the graph monitor providing me quite a nice square wave (with noise, of course!). A ratio of 0.25 or less means pin one is on, 4 or more means pin two is on.

So now I have question about the code...

The "total1 =  cs_4_2.capacitiveSensor(30);" line. This "adds up" readings from the pin I assume. Is the figure in brackets a period of milliseconds or a number of readings? I assume either way that a higher number would be a slower response?
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 04:39 pm
Pic as promised...just need to work out code to do the magic with the lights...

...and I knew about slug tape, but to save myself a half hour trip to B and Q, decided I'd spend five hours faffing about with bacofoil and sellotape!
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 18, 2017, 04:41 pm
Well...  :o

I apologise for pouring scorn on the idea of using a capacitive sensor earlier.

Went for gold this time, made an 800mm long version. This time using full width 'Slug Tape' (23mm) cut diagonally and applied directly to my bit of PVC pipe, then added the 'driving' strips around the rest of the tube. Works surprisingly well.

There is a bit of a knack to getting repeatable readings tho', the best being when your fingers wrap around the tube to equally cover the sensing strips. The worst is when you only cover one of the sense strips - I was wondering why it'd suddenly 'gone all funny' when I realised I had my extended thumb and palm over only one strip.

I didn't modify the code I posted earlier... (but there is a bug: the Calibrate bit only works the first time, thereafter it's using already-calibrated values.)


see attached pic.

Yours,
TonyWilk

P.S. 'Slug Tape' (look on eBay) comes in straight-edged and crinkly-edged (presumably to further deter the little beasties from eating your prize Delphiniums). The crinkly stuff is a pain.

Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 18, 2017, 04:54 pm
Getting a third contact in would give a direction...either 123123 or 321321...but I haven't figured out how to wire that yet, so I've jury rigged it. As long as the total number of "teeth" is even (from pad one AND pad two combined), then in one direction I always hit pad one first, in the other, pad two.
Ah, so you'll count your way up the pole... neat.
With just inputs to the A-D's you are relying on picking up mains 'hum' I think, so it may stop working when it's portable.

Quote
The "total1 =  cs_4_2.capacitiveSensor(30);" line. This "adds up" readings from the pin I assume. Is the figure in brackets a period of milliseconds or a number of readings? I assume either way that a higher number would be a slower response?
Sorry... what code is that from ?

Yours,
 TonyWilk
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 04:57 pm
It's the example from the capacative sense library by Peter Badger...
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 05:02 pm
Yours is superior of course as it allows a change in direction...my way you have to keep going left if you started left...once the lights are added with my method you'd be able to keep lighting them by going back and forth between contacts...your way it should sense a change of direction.

One advantage to my method though may be aesthetics if it's visible...instead of two toothed contact plates, imagine two sinusoidal "snakes", back to back...as long as the snakes are wide enough that there's no loss of contact "under" the same snake, the effect should be the same...

I do need it to work when "mobile" though...the grounding issue may become a pain...

Title: Re: Cap sense advice please!
Post by: allanhurst on Dec 18, 2017, 07:02 pm
If you tightly ran a a length of very thin ( ie high resistivity) nichrome wire along your pole, spaced off from a fixed contact plate by a few mm ,   and supplied +/- 5v to the nichrome wire, you'd get a voltage on the fixed contact proportional to where you pressed it to the fixed contact.....

I'd add a capacitor to cut out mains pickup.



Allan
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 18, 2017, 08:38 pm
If you tightly ran a a length of very thin ( ie high resistivity) nichrome wire.... *snip*
Ah, yes... that could be very accurate.

You also just reminded me that these are a thing: SoftPot Membrane Potentiometer (https://www.sparkfun.com/products/8681)

Yours,
  TonyWilk
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 18, 2017, 09:56 pm
The nichrome idea and the softpot require actual pressure I guess? ie it would not be possible to put them in the tube?
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 18, 2017, 10:36 pm
The nichrome idea and the softpot require actual pressure I guess? ie it would not be possible to put them in the tube?
Yes, they'd have to be on the outside - tho' you could paint the softpot and maybe use a painted strip of Aquadag (or other conductive paint) as the contact strip for the wire to touch.

For the softpot you'd have to get a finger on it - it's just a thin membrane thing like old resistive touchscreens.

Yours,
 TonyWilk
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 19, 2017, 02:08 am
Hmm, prefer hidden if possible, or decorative if not. Not sure the wire or soft pot delivers on either.

I figured out a way of getting a third contact, without using a third contact! Again cos the pole curves, it's possible to change my original contact layout to include one where the hand touches both...thus giving me my directional order...either 12b12b12b or b21b21b21...(b = both). Seems reliable, just fighting with the code to interpret it and activate the LEDs at the moment.

Got slug tape, but only serrated edge. Grrr. Will give your long triangles a go too, but a question...

You have the triangles...and other strips. What are the other strips for and how are they connected?

I'll post my code once it's reliably turning LEDs on and off. Right now it's a nightmarish hodge podge of the ghosts of variables past...

Thanks for all the help everyone!
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 19, 2017, 03:50 am
You have the triangles...and other strips. What are the other strips for and how are they connected?
See attached picture.
(https://forum.arduino.cc/index.php?action=dlattach;topic=517581.0;attach=237791)

The original sensor made use of two things:
1) the high impedance analog inputs are left 'floating'
2) the surroundings have electrical noise

So when you move near a strip, noise couples into the analog input, with the strips being tapered and the finger being in the middle, more noise gets injected where there is more tape. The comparison of the two AtoD readings gives the position.

Problems with that are: a) touching floating inputs can easily damage a chip and b) it only works if there's electrical noise.

What the 'drive band' does is make "loud" noise (the line is driven HIGH just before a readAnalog ) very close to the strip so we can afford to add the 1Mohm pull-down resistors which make it less sensitive to anything else around and makes it more repeatable.

Yours,
 TonyWilk
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 20, 2017, 08:58 am
Thanks for that Tony. Really appreciate the time you've spent on this!

I persisted with my design and have it lighting up the LEDs - sometimes! The code has ended up being horrendously complex because I've written my own calibration routine.

The reason it only works "sometimes" I think is actually physical rather than anything else...my contacts aren't cut accurately enough and the spacing between them is on the borderline of being narrower than my finger (see pics) meaning I'm often hitting contact one and two together, which the code reads as "contact three".

I might persist in tidying it up. If I can find wider copper tape, I have a plotter/cutter that I believe could cut the contacts more accurately, consistently and efficiently (wasting less material) - and make them more aesthetically pleasing (my snake idea)...
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 20, 2017, 11:07 am
From what you said earlier and seeing your picture there just made me think...

The long-capacitive-thing tries to measure you hand position wherever you put it, with your variation you 'count' your way up and down the pole.

You could do the same 'counting' thing with resistive sensors - just a couple of studs at each position that pulls up the input. With 3 inputs you'd count 1,2,3,1,2,3 or 3,2,1,3,2,1 etc.

You might even be able to use what you already have to use as a test

real hasty diagram:
(https://forum.arduino.cc/index.php?action=dlattach;topic=517581.0;attach=237962)


Yours,
  TonyWilk
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 20, 2017, 11:46 pm
Hasty diagram? Still looks complicated.

Thought I'd hit on a much better way to achieve result today...but the programming is not working as expected;

There's four possible "conditions" for two cap sensors A and B in the way I use them;
C1: both no signal
C2: A full signal, B no signal (in practice B picks up a bit, but the ratio is still easily ten to one)
C3: both half signal (I assum cos it's my capacitance, when I touch both, it's shared between them)
C4: B full signal, A no signal (or same as above, a tiny bit)

I've rejigged my sensor pattern to take advantage of this pattern and my fat fingers (see image); as it's set up I thought it would be very responsive; because the two tongues are close together, it's not possible to straight from C2 to C4; the sliding finger has to pass through C3 first...and that gives me direction, It;s only possible to go 1234 or 4321.

So I set up a "contact" as integer to be 1,2,3 or 4...

...so how in all that's holy is it giving me NEGATIVE values (mostly -1 and -4)?

The value is never incrementally changed, it's always assigned directly. I am stumped. Anyone seen this behaviour before
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 21, 2017, 12:04 am
This is what's going on but I don't know why; the left half of the screen is my calibration setup...peaky, bt workable. The inputs are sensor1 (blue) and sensor2 (red). In the calibration there are three clearly recognisable states, plus a baseline (not recorded here, but it's fine at calibration.

But then when I try and get readings in the main program it does this crazy rubbish (right hand side)

Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 21, 2017, 03:32 am
But then when I try and get readings in the main program it does this crazy rubbish (right hand side)
From the graph I'm guessing your calibration routine is taking an average of the blue and red levels  - which will be a line straight thru the wiggly bits, if you are subtracting that av. level you are left with just +- wiggly bits

Signal in the 1st 1/2 of the graph look great...

Try calibrating by taking:

R= average red
B= average blue
RB = average red+blue

Then your trip levels  are:
t1 = RB/2
t2= (R - RB)/2

so:

(sig < t1) = nothing
(sig > t1) && (sig < t2) = RB active
(sig > t2 ) = R active

Yours,
  TonyWilk


 
Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 21, 2017, 07:20 am
Hi gents:-
Quote
.so how in all that's holy is it giving me NEGATIVE values (mostly -1 and -4)?
Post your code and we can see.

@GreyArea - What you are doing is not capacitave sensing and I suspect that you are using the cap sense libiary. What you are doing is what was suggested by Paul at the end of reply #1. See what I mean about reliability?

@TonyWilk - I like what you have done with adding that noise inducing track. Have you tried putting a high frequency signal on it. I would modify the speed of one of the PWM timers and put something like a 40KHz signal on it. Then couple the sensor tracks into the A/D inputs through a diode. If the diode don't work ( due to the forward volt drop ) I would bias the analogue input pin with a pull up and pull down resistor of 1M and use a 100K to connect the sensor electrodes to the A/D input. It might also benefit from a 100pF capacitor from input to ground to smooth the input. This way you will have a modicum of protection on the analogue inputs. I would also read the inputs twice and only use the second reading to allow the input A/D capacitor time to charge when switching the input channels.

I also note that you titled that picture you posted as capacitave sensing, this is not what you are doing. You are using, as I am sure you know, capacitave coupling to inject noise into a potential divider.
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 21, 2017, 07:56 am
@TonyWilk - I like what you have done with adding that noise inducing track. Have you tried putting a high frequency signal on it. I would modify the speed of one of the PWM timers and put something like a 40KHz signal on it. *snip*
No I havn't tried any waveform on the 'driving' track - at first I just tried wiggling the pin HIGH/LOW and noticed one channel had much higher signal than the other, what I'd done was something like:

Code: [Select]
digitalWrite( pin, HIGH );
digitalWrite( pin, LOW );
digitalWrite( pin, HIGH );
digitalWrite( pin, LOW );
a0= analogRead( A0 )
digitalWrite( pin, HIGH );
digitalWrite( pin, LOW );
digitalWrite( pin, HIGH );
a1= analogRead( A1 )


where a1 had a much higher signal... "ah, 'tis the rising edge we're coupling in" thought I, and that was good enough for the test, the code I posted earlier never changed after that.

Nice idea with the PWM, maybe set it for 25/75 or something - however there's still going to be that pretty small interval where the ADC is capturing the input, but if you can couple in a shift in the dc level on 100pf or so... yeh, I can see that... Let us know how it turns out.


Yours,
  TonyWilk

Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 21, 2017, 08:05 am
At least try:-
Code: [Select]

a0= analogRead( A0 );
digitalWrite( pin, HIGH );
digitalWrite( pin, LOW );
digitalWrite( pin, HIGH );
digitalWrite( pin, LOW );

a0= analogRead( A0 );
a1= analogRead( A1 );

digitalWrite( pin, HIGH );
digitalWrite( pin, LOW );
digitalWrite( pin, HIGH );

a1= analogRead( A1 );


You might get better results as the A/D's input channel is switched first to the channel you want to read so the sample an hold capacitor can charge up with the disturbance signal.
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 21, 2017, 10:30 am
You boys are seriously leaving me behind...

@GrumpyMike
Sorry if what I'm doing isn't capacitive sensing and yes I'm using the library. Wanted to post code last night but at 9000 lines, couldn't.

@TonyWilks
Can't say how chuffed I am that you've done so much work on my mad idea.

Now then...much to my shame and my partner's annoyance I was up until 4am trying to find the bug. Or bugs, as it turned out. First, "not equal" should be "!=" and not as I had typed in multiple places "/=". Helllooo madly switching negative numbers...

Then I noticed that because I'd got confused in my switch...case statements for the "old" and "new" states, I was turning LEDs off when I should have been turning them on and vice versa...but...

https://youtu.be/0bS3CqB_9hs

You may applaud. If it fits on my nano trinket, I shall expect a standing ovation.

Just kidding, but for only my second project and no real knowledge of microelectronics I'm amazed it works at all...

Lemme know how I can zip or otherwise post the code if you're interested...but be gentle, like I said I'm a novice. If you think the programming is rough, you should see my soldering.
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 21, 2017, 11:19 am
Well...even my hugely bloated, "verbose enabled" code does in fact fit on my Pro Trinket 5v...it runs, but it's not as reliable as on the Mega...I'm getting "flicker" which I've learned is a sure sign of insufficient differentiation between states.

My code accurately and certainly identifies "state 1" (no sensors) and state 2 and 4 (full signal to sensor one and sensor 2)...but it's that "state 3" (finger on both contacts) that is the pain.

To go from the Mega to the trinket, I've had to switch from using pins (2 and 4) and (6 and 4) to using pins (3 and 4) and (6 and 4). I'm thinking this may not be wise as having the sensor so close to the reference may cause interference.

I've read you can use the analog pins...would it be possible to keep pin 6 as the reference and use the analog pins (on the other side of the Trinket) as sensors to maximise physical separation...

...@Grumpy_Mike, I can hear you grumbling about breadboards from here...I know...remove the long wires and solder everything and a lot of the problems go away. There's a reason I don't solder much - I have Parkinson's, so bear with me...

...but something tells me mixing digital and analog like that is not wise.

What are the BEST pins to use for capacitive sensing (again my apologies if that's not what I'm doing - insert correct terminology here!) and are there some that should be avoided at all costs?

Thanks again!
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 21, 2017, 12:12 pm
@GreyArea - What you are doing is not capacitave sensing and I suspect that you are using the cap sense libiary. What you are doing is what was suggested by Paul at the end of reply #1. See what I mean about reliability?
Honestly, I've no idea what I'm doing. Yes,it uses the capacitive sensor library.

I went back and read Paul's answer. I've already confirmed it works well enough on battery power...but if Paul is right, does that mean that this is unlikely to work outdoors?

@TonyWilks - regarding the variation in calbration and actual sensing steps; the part I don't understand is that because I'm using the capacitive sensing library, the calls and methods I'm using to the two sensor channels are EXACTLY the same.

I actually added in a "multisample" ("m") parameter and sent the read command to the sensor pin "m" times and took an average, thinking that might stabilise it (at the expense of some speed). Doesn't seem to make a lot of difference if I'm honest, but it has made me think...

Currently I'm assessing static values of the two sensors; the ratio of one to the other and then the relative strength compared to the calibration stage.

This is is fine for when either sensor 1 or sensor 2 has full contact...but I was wondering whether I should actually be looking at rate of change as well? Though the physical "minimum, average and maximum" values of the sensor channels do seem to drift as time goes on...the rate of change appears pretty constant (as the graph I posted shows).

It's entirely because the non-linear arrangement of the contacts I've created only permits a certain pattern of changes;

* Moving a finger from a blank area to sensor 1 results in sensor 1 rising fast and sensor 2 not moving (much)
* Moving a finger from sensor 1 to sensor 2 results in sensor 1 falling and sensor 2 rising
* Moving a finger from sensor 2 to the blank area again results in sensor 2 falling and sensor 1 not moving much.

Going in the opposite direction

* Moving a finger from a blank are to sensor 2 results in sensor 2 rising fast and sensor 1 not moving (much)
* Moving a finger from sensor 2 to sensor 1 results in sensor 2 falling and sensor 1 rising
* Moving a finger from sensor 1 to the blank area again results in sensor 1 falling and sensor 2 not moving much.

So there's unique conditions in the rate of change for each transition; this arises because the "gap" between the sensors is unequal - it's not possible to travel in a forward direction from sensor 1 to a blank area or in a reverse direction from sensor 2 to a blank area - the contacts are too close together to permit it as the gap is narrower than your finger.

Of course, along with programming and microelectronics, mathematics is another area where I am poorly prepared...but if anyone could give any advice on equations I could use that may achieve this? I realise there's going to be a "delta t" component and thus some lag may occur...but I could live with that if the tradeoff is more reliable transitions.
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 21, 2017, 01:24 pm
Now then...much to my shame and my partner's annoyance I was up until 4am trying to find the bug.
After 25+ years, my missus has almost gotten used to me staying up 'til 4 working on software :)

Quote
https://youtu.be/0bS3CqB_9hs (https://youtu.be/0bS3CqB_9hs)
Yay !!! well done !

Some other points:
Those LEDs take a lot of current, you may need a bigger power bank at some point.

Sensing... I've not used the 'Capacitive sensing library', so this is a bit of guesswork based on that graph you posted earlier:

I don't think you need to look at rate of change or anything, you just need to determine states:

Your sensing relies on detecting: 1, both, 2 .. 1, both 2 in one direction and 2, both, 1 etc. in the other direction. If you are getting readings like in that graph and you can pretty reliably distinguish between "some signal" and "no signal" on each of the 2 inputs, then I think it can be worked out like:

Code: [Select]
int signal1, signal2;   // the 2 signals you just measured

int level1;       // a level above which signal1 is 'ON'    \ including when both are activated
int level2;       // a level above which signal2 is 'ON'    /

static int current_state= 0;
int s1state, s2state;

// State machine to determine what's going on...

s1state= 0;              // all we need to know is if the signals are ON or OFF
s2state= 0;
if( signal1 > level1 )
  s1state = 1;
if( signal2 > level2 )
  s2state = 1;

switch( current_state )
{
case 0:   // currently OFF... looking for (1) or (2)
  if( s1state == 1 )
    current_state= 1;
  else if( s2state == 1 )
    current_state= 2;
  break;

case 1:  // currently on '1'... looking for (1 and 2) or (nothing)
  if( (s1state == 1) && (s2state == 1) ){

    // just gone from (1) to (1 and 2)
    // ----- do GOING UP here ---

    current_state= 3;
  }else if( (s1state == 0) && (s2state == 0) ){
    current_state= 0;
  }
  break;

case 2:  // currently on '2'... looking for (2 and 1) or (nothing)
  if( (s1state == 1) && (s2state == 1) ){

    // just gone from (2) to (1 and 2)
    // ----- do GOING DOWN here ---

    current_state= 3;
  }else if( (s1state == 0) && (s2state == 0) ){
    current_state= 0;
  }
  break;
 
case 3:  // In the middle... looking for (1) or (2)
  if( (s1state == 1) && (s2state == 0) )
    current_state= 1;
  else if( (s1state == 0) && (s2state == 1) )
    current_state= 2;
  break;
}


The 'state machine' only switches states for particular conditions, others are ignored (like going from 'both' to 'nothing') so even if the signals are poor and you skip detecting UP or DOWN at one contact, it should process the next one ok.

Disclaimer: havn't run or tested the above code. I just typed it in.
It may, or may not, execute perfectly. But give it a go anyway.

Yours,
  TonyWilk






Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 21, 2017, 02:59 pm
Quote
What are the BEST pins to use for capacitive sensing
They are all the same, their is no best.

Quote
I can hear you grumbling about breadboards from here...I know...remove the long wires and solder everything and a lot of the problems go away.
Which only goes to prove my point.

Quote
.but something tells me mixing digital and analog like that is not wise.
Not that but it is something you need to pay attention to. The real electronics term for this is "mixed signals".

Quote
but if Paul is right, does that mean that this is unlikely to work outdoors?
Yes it is less likely rather than unlikely. That is why Tony added that extra strip to provide it with some interference to pick up in the first place.

Quote
.even my hugely bloated, "verbose enabled" code does in fact fit on my Pro Trinket 5v
Verbose enabled is a term for the output of the compiler, it has nothing to do with the code. The C language is compiled, that is the code you write, the source code, is turned into, code the actual processor can understand, which is called machine code. The output of the compiler is a sort or running commentary it gives during this compile process. It does not affect the size of the resulting code. That is why you can have long descriptive variable and function names because in the code that is run on the machine these are just swashed into a two or three byte address.
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 21, 2017, 03:47 pm
They are all the same, their is no best.
That helps.

Which only goes to prove my point.
Not even disagreeing that soldered is better...but for quick and dirty tests like this a breadboard is quicker, especially with my shaky hands. I both love and hate that the electronics are so small...

Yes it is less likely rather than unlikely. That is why Tony added that extra strip to provide it with some interference to pick up in the first place.
I see. If you've seen the video I've done and my contact design, would a third strip help with reliability there too?

Verbose enabled is a term for the output of the compiler, it has nothing to do with the code.
I realise that, but "verbose" with a small "v" certainly describes what I've written. It got to the stage that I had an "output" flag. It had three settings originally;

0 - off
1 - moderate
2 - detailed

During my bug hunting last night I was forced to add

3 -  it's not working and I have no idea why!

Which flagged up "Serial.print" commands that I had entered on pretty much every other line.

Didn't realise that it didn't contribute to program size though, so thanks for that!

By the way...first outline draft attached of my idea to turn the contact lines into snakes...looks quite Nordic/Celtic, quite please with how it's come out, except for the ugly square heads which I've already decided I'm going to change...
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 21, 2017, 04:09 pm
Yay !!! well done !
Thank you!


Those LEDs take a lot of current, you may need a bigger power bank at some point.
That power bank and another  have drive the 44 in the chain even at 100% Brightness and 255 RGB (full white). I'll admit I've seen the board stop working at more lights...a LOT more lights (oops!) but in practice 60 will be the max and if I have to come down to 44 it's no problem. If you mean more in terms of durability, for the end use in question if I get an hour or two out of it that would be fine. Might consider a Lipo solution for the finished articles, but haven't looked properly at that yet. Whatever I use needs to be small - ideally fitting in the tube.

 
Sensing... I've not used the 'Capacitive sensing library', so this is a bit of guesswork based on that graph you posted earlier:
Neither had I until Sunday. Me and quesswork go back a long way...carry on...

Quote
I don't think you need to look at rate of change or anything, you just need to determine states:

Your sensing relies on detecting...

...The 'state machine' only switches states for particular conditions, others are ignored (like going from 'both' to 'nothing') so even if the signals are poor and you skip detecting UP or DOWN at one contact, it should process the next one ok.
I thought that too, but the trouble is the range of variation is such that the states "bleed" into each other. If a finger on sensor 1 gives me 100%, then a finger on sensor one and two together gives me 50% (on each sensor).

Which sounds like plenty...the trouble is with the variation I'm (suddenly - it wasn't like this until the code got larger) getting, a "trough" on the single sensor signal could be as low as 70% and a "peak" on the dual sensor signal could be as high as 80%. This is why the system gets "confused" between the states.

I could take more readings from the pins to even it out...but that slows things down, meaning it's not as responsive to a quick "swipe" down the lights...some get missed because the software part is reading the sensors for (example) 500 milliseconds, but my hand passes over the junction between the sensors in less than half that if I'm trying to be "dramatic". Thus the sensor reading just looks "a bit low"...but not low enough to detect the transition.

Quote
Disclaimer: havn't run or tested the above code. I just typed it in.
It may, or may not, execute perfectly. But give it a go anyway.
You're talking to a bloke who just makes stuff up as he goes along...but I will have another look at it...though probably after Christmas or my partner may arrange that I am speaking in a high squeaky voice for a while...

Once again thanks to all contributors. I've posted the code as a zipped attachment.
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 21, 2017, 05:25 pm
Quote
...but the trouble is the range of variation is such that the states "bleed" into each other. If a finger on sensor 1 gives me 100%, then a finger on sensor one and two together gives me 50% (on each sensor).
With the state machine all you need is, say, anything over 30% is an ON.

As long as that's a fairly reliable "ON", then you don't need 'relative levels' for the state machine to work.

Quote
...though probably after Christmas or my partner may arrange that I am speaking in a high squeaky voice for a while...
lol... yeh, I've gotta go to Asda for all the xmas stuff (yippee!) or I'll suddenly go high-pitched as well.

Have a good Xmas

Yours,
  TonyWilk
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 29, 2017, 02:03 am
Hey hey, I'm back on the Arduino trail.

I hadn't looked at the triangles options for one very specific reason...big triangles of foil over the top of the LEDs...block out the light from the LEDs!

D'oh!

However...

I have discovered the magic of copper gauze/mesh, and it works really well - and far simpler than my over complicated "count the contacts" option. It's a tad more expensive (ouch!) but it lets the light through so I don't have to worry about placement so much...

My test sensor is only 8 inches so far...but works faultlessly on both mains and battery power...I'll let you know how it progresses...
Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 29, 2017, 02:09 pm
Tony;

Re noise channel

1. Does it have to be foil, or could a trace wire work?
2. If so, does it have to go around the edge, or could it sit between the sensors?
3. If not...I read somewhere that a conductive layer below the sensors but insulated from them could improve stability...could a similar layer function as the noise channel?

Currently I'm laminating the copper mesh which works well...response time to movement almost lag free...but I need finer mesh or laminating makes the contact plates too inflexible to work with.

Thanks again!
Title: Re: Cap sense advice please!
Post by: TonyWilk on Dec 29, 2017, 04:36 pm
Tony;

Re noise channel

1. Does it have to be foil, or could a trace wire work?
2. If so, does it have to go around the edge, or could it sit between the sensors?
3. If not...I read somewhere that a conductive layer below the sensors but insulated from them could improve stability...could a similar layer function as the noise channel?
Hi again...

I think what is going on in the copper tape thing is like this:
Diagram:
(https://forum.arduino.cc/index.php?action=dlattach;topic=517581.0;attach=238968)

Since there's a layer of sellotape insulator on top of the copper strips there's a capacitor formed between the strip and the finger. Driving the 'noise channel' is "ac coupling" from those strips into the finger and across to the "sense strips". The amount of coupling depends on the size of the capacitors. The size of the capacitors depends on the area between strip and finger.

In the diagram, the wider sense strip has more capacitance to the finger than the thin strip, so more 'noise' is coupled in.

So...
1. I don't think a thin wire will work because the area will be really small
- It might work if the wire is not insulated so your finger directly connects to the 'noise', but this would heavily depend on how sweaty (and conductive) your fingers are :)
I guess mesh or several narrow strips would be ok - or a thick strip with LED holes in it.

2. The 'noise' strip could go between the sense strips I think as long as your grip covers all the strips.
- I don't think the order of the strips will make any difference otherwise.

3. A layer below the strips could 'shield' the sense strips from other noise if it was connected to ground, but if it was connected to the noise channel it would simply couple in lots of noise all the time (just like another finger on the other side of the strips all the time).

I have to admit I'm guessing a lot here, the only way to know for sure is to try it I'm afraid.

Yours,
  TonyWilk



Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 30, 2017, 01:20 am
1. I don't think a thin wire will work because the area will be really small
- It might work if the wire is not insulated so your finger directly connects to the 'noise', but this would heavily depend on how sweaty (and conductive) your fingers are :)
I guess mesh or several narrow strips would be ok - or a thick strip with LED holes in it.
Ah, didn't realise you touched that line too. My library based system just connects a pin (no output) so it would seem to me that if there's nothing connected, you can't touch it. It would REALLY help if I knew in any way what I was doing...

Strip with holes in...erm...remind me that whilst your electronics advice is well respected, your aesthetics are somewhat challenged! The whole point with LEDS is to mask that they are point sources...not draw attention to it. I've tried it and it is effing ugly :-) - hence the mesh.

Quote
2. The 'noise' strip could go between the sense strips I think as long as your grip covers all the strips.
- I don't think the order of the strips will make any difference otherwise.

3. A layer below the strips could 'shield' the sense strips from other noise if it was connected to ground, but if it was connected to the noise channel it would simply couple in lots of noise all the time (just like another finger on the other side of the strips all the time).

I have to admit I'm guessing a lot here, the only way to know for sure is to try it I'm afraid.

I will...once I get that softer more flexible mesh. Point 3 in particular resonates though as the stabilising layer was referred to as a "ground plane", so it makes sense that it can't do both jobs...but since my smoothin routine is giving me a really nice response anyway, I think I need the noise more...and since it's fairly easy to do I may give it a go.

I'm using digital pins on my Mega and Trinket...should I be switching to Analog?
Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 30, 2017, 10:37 pm
Quote
Ah, didn't realise you touched that line too.
You don't.
Quote
It would REALLY help if I knew in any way what I was doing...
Yes read reply #42 again and again until you understand.

Title: Re: Cap sense advice please!
Post by: GreyArea on Dec 31, 2017, 03:46 am
You don't.Yes read reply #42 again and again until you understand.


Well, multiple reads not helping. I see Tony's diagram and big fat finger is laid across all three plates, including those connected to "driving noise output".
Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Dec 31, 2017, 08:25 am
No it is not a fat finger, it is a capacitive coupling path. Your body is the Antenna picking up the disturbance signal.
Title: Re: Cap sense advice please!
Post by: GreyArea on Jan 01, 2018, 11:13 am
Regardless of what it IS, it's shown touching all the contacts. Is Tony's diagram wrong?

I think I get your point though...the body acts as antenna picking up the fluctuations in signals...eg, 50Hz mains power. Tony's method creates a signal that means it could work even in the absence of mains power. This is why you suggested driving a pulse wave on that channel...a signal with higher amplitude creates more disturbance.

Am I close?
Title: Re: Cap sense advice please!
Post by: Grumpy_Mike on Jan 02, 2018, 12:01 am
Quote
Am I close?
Yes spot on I would say.
The only thing different is that I suggested upping the PWM frequency to about 40KHz to make it radiate better.
Title: Re: Cap sense advice please!
Post by: GreyArea on Mar 03, 2018, 12:01 am
Right. Back to this again

Happy to take advice from anyone, but particularly hope TonyWilk will contribute what he learned from his trials.

But first, start with what I've got.
1. Acrylic pole approx 30mm diameter, 1m long.
2. Layer of vinyl with design cut into it wrapped around 1. Above. Design is about 70 cm long.
3. Copper mesh 1m Wide, single wrap about 12-15 cm, cast onto pole in clear epoxy resin over the top of the vinyl design

For those who have read backi switched to the mesh becaus3 the copper foil is sold and blocks light. The meshallows light to passwhich mean when puttin LEDs in the tube, the design is still visible.

I know I need to make two triangul plates from the meshplan. I intend to do this by cutting them in-situ through the epoxy in which they are bonded. This should avoid any movement and allow good accuracy and hopefully the cuts will be filled back in with a last wrap of 80gsm fibreglass weave in a polyester resin.

My question surrounds your "driver" line.

My copper mesh is a single wraparound on the pole. I intend to use tape to mark a single turn "helter skelter" down the pole, which when cut should provide the two triangles. There will be two gaps between the triangles...a straight one where the opposite ends of the wrap of copper meet and the cut "helter skelter" cut

But...where to put the driver line? As I see it I have three options;

1. Inside the pole
2. Outside the pole as a single wire set into the resin in the original straight join
3. Outside the pole as a single wire set into the resin in the helter skelter join.

Which do you think would be best?

I've got some beefy 10M Ohm resistors to try and cut through the resin and gf that will be between the finger/hand and the contact plate.

I'm going to post a video of the lights as they are now. I've a finishing process that renders the design invisible when the LEDs are off...it just looks like a plain black pole. The effect I'm looking for is to sweep a hand over it and have it "magically" appear. From a programming point of view all I have to do is relate the input of the capacitive arrangement to the number of LEDs active in the strip. Ideally I'd like the "resolution" of that relationship to be +/-1...ie one LED on or off at a time...but if it has to be in chunks of 4 or 5, so be it.

I've probably missed out something critical...I'm sure someone will let me know...
Title: Re: Cap sense advice please!
Post by: GreyArea on Mar 03, 2018, 12:17 am
Video as promised;

"All that is gold does not glitter" (https://youtu.be/vzkpcgydFa4)
Title: Re: Cap sense advice please!
Post by: GreyArea on Mar 03, 2018, 11:10 am
Also, would it be an advantage to set up the capacitive sensing routine as an interrupt? I've only just started reading about them, but it seems it might have advantages? Thanks!