Have you seen this signal waveforms? (Decoding this scroll wheel sensor's output)

Go To Last Post
21 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is a long post, if you go through it, I would like to thank you for your time upfront :). In short, I am trying to understand how the manufacturer of the original hardware into which this sensor was built uses the signals that drive this sensor to compute a speed and direction of the input, maybe even an absolute position. The questions I have are at the end of the post.

 

Brief background on the question

I am hacking into an old remote control for my music players hoping to breath new life into it. The manufacturer has discontinued support for it so the firmware in it can no longer be updated and has thus become incompatible with the newer firmware that the manufacturer has released for the player. When I say hacking, what I mean is that I am replacing all the electronics in the remote with custom made boards (for power and logic) but I wish to keep the hardware inputs as those are part of what I like about this remote control. The firmware for the original device is closed anyway and reversing it is beyond my abilities and time availability.

 

The hardware inputs are a trivial set of buttons and a scroll wheel. The scroll wheel sensor functionality is the focus of the question. The wheel resembles that of an older generation iPod. It has no moving parts, that is, it does not rotate to translate the motion of the user's finger into electrical signals. However, unlike the iPod wheel, there are no active components on this one. The iPod wheel has a digitizer IC that translates the user's input to a digital message. This sensor breaks out 4 lines and appears to be divided into 3 sensing segments. Here are pictures, provided by user Beryl on the pjrc forums, of the sensor removed from the case:

 

Front view Back view

 

Although it may initially appear to be a capacitive sensor, it turns out that it is in fact resistive. This is the equivalent circuit I have deduced from my attempts to reverse its functionality:

 

Equivalent Circuit

 

The capacitor is not on the sensor, it is on the PCB that the sensor connects to:

Scroll Wheel Under Test

 

The microcontroller on the original hardware appears to be a Rensas M16C/26. Three of its I/O pins are wired to channels 1-3 and a pin that can be used as an ADC input channel (according to the datasheet) is connected to channel 4. This gives me confidence that the output of the scroll wheel sensor is supposed to be interpreted as an analog voltage level.

 

The setup above is what I used on the original device to characterize the communications between the M16C and the sensor and try to decode them. As it turns out, it is a train of pulses. The train is made up of two repeating patterns, one I refer to as the wide pattern and the second as the narrow pattern. The wide pattern has a total length of 2ms with 8 pulses in between, each 0.25ms wide. The narrow pattern is 0.2ms wide with 4 pulses, each 0.05ms wide. The wide pattern repeats every 45ms while the narrow pattern repeats every 50ms. The time offset between the two patterns appears to be 3ms at start, which causes the two patterns to shift in time relative to each other (see linked video below).

 

Have you seen these signal waveforms?

 

Wide view of pulse train

 

Here is a close up where I managed to capture the both the wide and narrow pulse trains present on the lines for channel 1-3:

 

Close up of pulse signals

Disregard the droop on the signal on channel 3 (magenta), this turned out to be a issue with my wiring.

 

Video on YouTube of the signals on the scope:

Scroll Wheel Demonstration

 

 

How I Understand This Signals Should Be Interpreted.

 

Using an Arduino I wrote a short program to replicate the behavior of the input pulse trains from the original hardware. For the wide pattern, the width is 2ms and there are signal changes at every 0.5ms. My program reads the voltage on channel 4 a few cycles after each 0.25ms when there is a step change in the input signals. This results in 8 samples taken each "frame" where the sample on channel 4 is the combination of the voltages drops at each input channel. The relative change of the values can be used to decode the direction of the movement at the sensor and the rate of change in values to decode the speed of the movement (if I am doing this right).

Here is a plot of the data capture of these frames:

 

 

Plot of combined sampling of pulse train.

 

Besides the fact that I am probably not reading the signals the way they are meant to be read, I am confused about the need for the 2 patterns. To produce the above capture I chose to drive the inputs on channels 1-3 using the wide pattern alone. If both patterns are present then they overlap every once in a while and appear to distort the output.

 

Below is the code I wrote to read the sensor using the pulse train inputs as the original hardware appears to do:

 

#define DELIM ","
#define DB 50

// Drive using the narrow pattern
//#define RUN_CLOCK
// Drive using the wide pattern
#define RUN_SIGNAL

// Initialize TIMER1, CTC mode, interrupt every 0.05 milliseconds.

void timer1_Init()
{
    /* Enable TC1 */
//  PRR0 &= ~(1 << PRTIM1);

   TCCR1A = (0 << COM1A1) | (0 << COM1A0) /* Normal port operation, OCA disconnected */
       | (0 << COM1B1) | (0 << COM1B0) /* Normal port operation, OCB disconnected */
       | (0 << WGM11) | (0 << WGM10); /* TC16 Mode 4 Normal / CTC, depends on WGM13 and WGM12 on TCCR1B*/

   TCCR1B = (0 << WGM13) | (1 << WGM12)                /* TC16 Mode 4 CTC */
           | 0 << ICNC1                               /* Input Capture Noise Canceler: disabled */
           | 0 << ICES1                               /* Input Capture Edge Select: disabled */
           // divide by 8 // effective clock rate is 250KHz
           | (0 << CS12) | (1 << CS11) | (0 << CS10); /* IO clock divided by 8 */

    // at 16MHz count to 100 (desired time step is 50uS which is 20,000 Hz)
    OCR1A = ((F_CPU / 8UL) / 20000UL) - 1; // Count to 100

   TCNT1 = 0;
   TIFR1 = 0;

  // Enable the interrupt
  TIMSK1 = 0 << OCIE1B   /* Output Compare B Match Interrupt Enable: disabled */
           | 1 << OCIE1A /* Output Compare A Match Interrupt Enable: enabled */
           | 0 << ICIE1  /* Input Capture Interrupt Enable: disabled */
           | 0 << TOIE1; /* Overflow Interrupt Enable: disabled */
}

// Narrow pattern repeats every 50ms
#define CLOCK_INTERVAL 1000
// Wide pattern repeats every 45ms.
#define SIGNAL_INTERVAL 900

uint16_t dtC = 0, dtS = 6, dtS2 = 0;
uint8_t clk = 0, sig = 0;
// Bit patterns used to drive the pulses for both the narrow and wide patterns
uint8_t CLOCK[4]  = { B00000111, B00000011, B00000101, B00000110 };
uint8_t SIGNAL[8] = { B00000110, B00000101, B00000011, B00000011, B00000101, B00000110, B00000101, B00000011 };

// Multiple variables to synchronize behavior and capture output.
volatile uint8_t out = 0, OUT = 0;
volatile bool ready = false, go = false;
bool capture = false;
uint8_t captADC = 0;

// TIMER1 interrupt handler
ISR(TIMER1_COMPA_vect)
{
#ifdef RUN_CLOCK
   // Clock wave. Pulses spaced at 50us, train spaced at 50ms.
   ++dtC;
   if(dtC >= CLOCK_INTERVAL)
   {
      // Release the clock
      if(clk < 4)
      {
         PORTB = CLOCK[clk++];
      }
      else if(clk == 4)
      {
         clk = 0;
         dtC = dtC - CLOCK_INTERVAL;
         PORTB = 0x00;
      }
   }
#endif

#ifdef RUN_SIGNAL
   // Data wave. Puleses spaced at 250us, train spaced at 45ms.
   // This train appears to be offset by 5ms from the Clock wave at start.
   ++dtS;
   if(dtS >= SIGNAL_INTERVAL)
   {
      go = true;
      // Release the signal
      ++dtS2;
      if(sig < 8)
      {
        if(sig == 0)
        {
           PORTB = SIGNAL[sig++];
           capture = true;
        }
        else if(dtS2 % 5 == 0)
        {
            PORTB = SIGNAL[sig++];
            capture = true;
        }
        else if (capture == true)
        {
           capture = false;
            out = (out << 1);
            out = ((PINC >> 3) & 0x01) | out;
            captADC++;
        }
      }
      else if(sig == 8 && dtS2 % 5 == 0)
      {
         sig = 0;
         dtS2 = 0;
         dtS = dtS - SIGNAL_INTERVAL;

         out = (out << 1);
         out = ((PINC >> 3) & 0x01) | out;

         PORTB = 0x00;
         OUT = out;
         out = 0;
         ready = true;
         go = false;
      }
   }
#endif
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  // 8, 9, 10 - out, A3 input (PC3)
  DDRB = B00000111;
  PORTB = 0x00;

  timer1_Init();

//  // Reference is AVCC
//  ADMUX |= (1 << REFS0);
//  // Scale ADC clock by 128 (F_CPU == 16MHz)
//  ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);
//  // Use channel 3
//  ADMUX |= 3;
//  // Enable ADC
//  ADCSRA |= (1 << ADEN);

  sei();
}

uint8_t captADC2 = 255, a = 0;
uint16_t adc[8] = { 0 };
void loop()
{
#ifdef RUN_SIGNAL
   if(go == true && captADC2 != captADC)
   {
      //ADCSRA |= _BV(ADSC);
      //while(bit_is_set(ADCSRA, ADSC));
      //ADCSRA |= _BV(ADSC);
      //while(bit_is_set(ADCSRA, ADSC));
      //adc[a] = ADC;

      //adc[a] = analogRead(A3);
      adc[a] = analogRead(A3);

      captADC2 = captADC;
      a++;
   }
   else if(go == false && captADC2 == captADC)
   {
      Serial.print(adc[0]);Serial.print(", ");
      Serial.print(adc[1]);Serial.print(", ");
      Serial.print(adc[2]);Serial.print(", ");
      Serial.print(adc[3]);Serial.print(", ");
      Serial.print(adc[4]);Serial.print(", ");
      Serial.print(adc[5]);Serial.print(", ");
      Serial.print(adc[6]);Serial.print(", ");
      Serial.println(adc[7]);
      a = 0;
      captADC2 = 255;
   }
#endif

#ifdef RUN_CLOCK
   if(ready == true)
   {
      ready = false;
      Serial.print(OUT, BIN);Serial.print(", "); Serial.println(OUT, DEC);
   }
#endif
}

 

 

How I started (and am currently) reading the sensor.

 

Wrote a short program to sequentially input a constant voltage into channels 1, 2 or 3 in a sequence. Only one of the input channels holds a voltage at a time and this is read on channel 4 using the ADC. A "frame" consists of three analog readings in sequence and the voltage for each channel is stored in separate variables. Using these readings the values can be used to compute the direction and velocity of the movement on the scroll wheel by comparing them to each other. Essentially how I first decided to read the sensor was by doing the same as described above except that only taking 1 sample per input channel per "frame", as opposed to the 8 samples described above where each sample is a combination of the 3 input channels. With some tuning, this method has worked for me so far but after seeing what the original hardware was doing, seems deceptively simple and gives me the feeling that there is a pitfall in the method which I am not seeing.

 

Reading the signal usng constant inputs.

 

The questions I have

 

  1. Is there a name for the technique used by the original hardware to drive an read this scroll wheel sensor?
  2. Is my understanding on interpreting the pulse train into an analog signal correct? Is this how these signals are meant to be read?
  3. Is there an advantage to driving the inputs with a pulse train as opposed to simply relying on a sequence of constant voltages?
  4. Any suggestions on better methods I could try to read this sensor?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I'm working from memory here, but I did a lot of investigation of capacitive sensing a couple of years ago (proof of concept stuff, before we chose a processor that has it on board). You'll find a number of explanations of the basic concept scattered around the net; there's a good one from Microchip that explained it well.

 

The basic concept is that one has a capacitor consisting of one plate. There is capacitance between that plate and the rest of the world - a few pico or nanofarads. When a large object like a finger (or a cat!) comes close to it, the capacitance increases significantly. The trick is how you detect that change.

 

If you have a small cap charged to the rail and switch it to the plate, the charge on the small cap will add to existing charge on the plate. As a result the voltage on the plate will rise, which you can sense via an ADC. With multiple switching cycles the voltage will eventually rise to some preset level (use a high input impedance ADC, or even a logic input gate though that's a bit vague) and you can count the number of cycles it has taken to reach that point. The bigger the number, the closer the sensed object is. Once you reach your limit, you short the sensing plate to ground and start again.

 

There are improvements and complications which help the reliability of the thing - guard rings, calibration, and the like - and it is certainly easier to use a control chip or a processor with the smarts built in (e.g. STM32L073) but that's the basic idea. In your case I would expect to see rising DC waveforms on each of the segments followed by a crash to 0v, sequentially, and I would expect the output from the sensor chip to be three count outputs. Converting those three signals into finger position and movement is almost certainly a matter for software, not the hardware chip.

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This brings back memories...in the mid 80's I worked on high res/high accuracy resistive digitizers hardware & software.  This was based on using a resistive sheet & a capacitively coupled pickup pen. 

We were probably the very first to directly couple a high accuracy capacitive digitizer onto a display.

The display was a plasma screen used for full page newspaper typesetting...we also did a unit for some handwriting recognition place using an expensive laptop https://en.wikipedia.org/wiki/To...

After leaving, I heard about some Apple people sniffing around...wonder what they wanted?

A few note from those times is below.

You system is different, since you don't have a stylus pickup, but you may glean a few general ideas from this.   Does you sensor required it to be physically pressed at all, or is it barely touched?  

 

The resistance was nonlinear & we corrected for it in software.  We also calibrated it to 0.001 inch In both dimensions.

The absolute sheet resistance varied quite a lot, from sheet to sheet, so for high accuracy we couldn't count on an exact resistance (or sheet uniformity)

The applied signal level varied, due to the low cost circuitry (in terms of being accurate to 0.001)

 

One of the main tricks was to measure ratiometrically  ...by doing so, both the drive level & sheet resistance dropped out of the equations.

Imagine having a long linear resistor (sheet)  with a connection on the far left and on the far right...you can measure voltage anywhere along the way.

You ground the left end & apply your signal (say 5V) to the right end   ...take a voltage measurement & call it A

Now you reverse the process & apply your signal on the left  and ground the right end and take another voltage reading , call it B

Now you calculate (A-B)/(A+B)   ....you will get a result ranging from -1 to +1 corresponding to the position (from left to right)

This result will be the same, regardless of the signal generator's output level & regardless of the sheet's nominal resistance. 

 

During this X position measurement, the  top & bottom edges (Y) were kept in high impedance mode. 

Now the tables are turned & X edges are put in hi-Z and the process repeated for determining Y.  So you now have a decent position readout . 

Using some 2 dimensional cubic spline fitting calibration (gee did I really do that in assembler??...ah foolish youth),  you can greatly increase performance down to  0.001 inch over 36/48 inches or so (we made up to E-size drawing units).

Since CD players were fast coming down in cost, we eventually used some of their 16-bit analog parts to get better resolution (from our original 13). 

 

Yours could be measuring something similar, but using some sort of polar coordinate scheme.

If you drive different pairs, you can get the partial measurements & combine them & massage them into an x y position (or magnitude and angle).

I make come back and think about it when I get  moment.

Here is one of our original patents

https://pdfpiw.uspto.gov/.piw?Pa...

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Feb 14, 2021 - 10:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you Neil, this helps better understand how capacitive sensing works but unfortunately does not apply in my question. When I was first trying to reverse the functionality of the sensor I treated it as a capacitive device and did in fact order a couple different micros with QTouch compatibility. But on the very first test it was clear that this was not the way the sensor worked because as soon as it is touched, the voltage drops because the two elements in the device come into contact. The other evidence I found to confirm that this was not a capacitive device was that it would respond to touch with anything that touched it: fingers, erasers, wooden dowels, plastic dowels, metal screw driver, etc. And it was when I finally (duh) had the idea to connect the common pin and each of the other channels to a multimeter set to measure resistance that the behavior of the sensor was revealed.

 

Now the question is, how best to read it? Specifically I am hoping to understand why the original manufacturer used the digital pulsing technique I saw in the scope.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

You system is different, since you don't have a stylus pickup, but you may glean a few general ideas from this.   Does you sensor required it to be physically pressed at all, or is it barely touched?  

 

It needs to be pressed. And it can be pressed with any object, any material. However, it is (in my opinion) well built and is very sensitive, much more than you typically expect to find with resistive input sensors and so much so that it "feels" like it should be capacitive, which is how I first tried to read it but quickly failed.

 

 

Quote:

 

One of the main tricks was to measure ratiometrically  ...by doing so, both the drive level & sheet resistance dropped out of the equations.

 

This makes sense, but it is doing essentially what I am doing which is to feed a constant voltage into the resistive elements. I am not doing it ratiometrically though, I am only feeding and reading the voltage once to get an absolute value. I may add the second measurement to each channel then to increase the consistency of the readings multiple instances of the device/sensor.

 

What I am trying to understand, is if feeding in a pulsed voltage in a specific pattern (as the original manufacturer does) makes a difference, and if so, how?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am hoping to understand why the original manufacturer used the digital pulsing technique I saw in the scope.

They are no doubt applying different pairs of signals to develop differing directional voltage gradients.    It appears that none of the pins are going to high-z, since you only see full hi/lo levels at the driving pins (if any changed to hi-z, they'd show a partial voltage divider level).  They may be "swapping drives"  to perform ratiometric measurements (see above).   The ratiometric style helps to even out the measuring against resistance variations & drive levels. In theat case you'd see a pairing &  the reverse at some point in the sequence.

Could you  set up some switches to  drive your different sensor lead &  put a paper grid over the disk...then touch  points & record the voltages you get with the switches set  in different drive patterns...that might give some geometric clues as to what is going on.

Can you see how (where) the leads connect into the sensor surface?  That can also help to predict the voltage vs position. 

 

Is it possible the razor-thin pulses mean nothing at all--perhaps remnants of some "don't-care"  operations or the process of getting things situated.  it would help if you know exactly when the ADC is being read (which you prob can't)

 

Here is the sequence of the large pulses---notice they always change 2 at a time...my bet for the moment is these are all the pairs you need (you don't need super-high postion resolution).

011
110
101
110
011
110
101
000

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Feb 14, 2021 - 07:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

 

Is it possible the razor-thin pulses mean nothing at all--perhaps remnants of some "don't-care"  operations or the process of getting things situated.  it would help if you know exactly when the ADC is being read (which you prob can't)

 

Here is the sequence of the large pulses---notice they always change 2 at a time...my bet for the moment is these are all the pairs you need (you don't need super-high postion resolution).

011
110
101
110
011
110
101
000

 

 

Did you happen to watch the video I recorded on the scope of the signals varying with position? Here is the link in case you missed it in the original post: https://youtu.be/HEh2bW7W_fI

This shows how the pattern you identified above is interpreted by channel 4 when the sensor is active.

 

I can't see evidence on the scope that there is ratiometric reading since the signal input is only on one side of the circuit, channel 4 never shows a voltage unless the sensor is touched.

 

I've been thinking that the narrow pulse is some sort of clocking identifier, but can't really make sense of why it would be needed and why it would need to be specified sequence either. So far in how I have been reading the sensor I have not found a need for it but this is where I was hoping to find some insight from some more experienced folks about how this works.

 

If it is possible to derive direction and speed by simply driving a constant voltage into each channel at a time and then comparing them, why would a more complicated approach like the one using the pulse trains be preferred?

 

As I typed the above sentence and thinking about your explanation of the ratiometric technique, it got me wondering if by using 8 samples of the combined channels per frame, as opposed of to 3 samples of 3 separate channels, it may be possible to balance out the offsets created by noise or manufacturing differences. So this would not be ratiometric measurements except between themselves. I would almost bet there would have been a lookup table in the firmware of the MC16 relating the relative position sequences to movement direction.

 

By the way, I should mention that on the original application and use of the sensor, with OEM software, there appears to be no computation or determination and use of absolute position. Only touch + movement generates an event in the software, and that movement is incremental in one direction or the other. Touching on different places around the wheel does not cause the cursor to move or jump onto a position.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

. Touching on different places around the wheel does not cause the cursor to move or jump onto a position.

That is very likely the result at a higher level of the application...the sensor readings give a location & what is done with that location determines whether motion is detected, what the speed is,  something happens, etc. 

 

Now, after watching the video, around the 26 sec timeframe, I am almost certain the little pulses mean next to nothing..everything you need is in the 8 voltage levels  (the BOTTOM trace), those will give you the position on the wheel...

Make a chart of maybe 12 positions around the wheel (at a constant diameter) and each of the 8 voltage levels (12 rows of 8 columns)...the secret will be revealed.  Use a stylus, not finger, for accuracy of the voltages

Also at a position (angle) move from the edge inwards....how does that change the 8 voltages?

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Mon. Feb 15, 2021 - 05:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Now, after watching the video, around the 26 sec timeframe, I am almost certain the little pulses mean next to nothing..everything you need is in the 8 voltage levels  (the BOTTOM trace), those will give you the position on the wheel...

Make a chart of maybe 12 positions around the wheel (at a constant diameter) and each of the 8 voltage levels (12 rows of 8 columns)...the secret will be revealed.  Use a stylus, not finger, for accuracy of the voltages

Also at a position (angle) move from the edge inwards....how does that change the 8 voltages?

 

I agree, and I am not worrying about the narrow pulse train, who knows what that would be needed for but I will look at building a table as you mention. I will also test moving in the radial direction to see if there is anything to be sensed there. I probably won't be able to try this until the weekend, but I'll update my findings here.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

By the way...anytime you have a seesaw pair (one goes up while the other goes down), that is a potential for a ratiometric type  (thought that doesn't MEAN ratiometric is being used).  This may differ from my experience, since you have 3 lead & I'm used to 4  (or a multiple of 4) with 2 of 4 being in Hi-Z, for X then Y).  In any case, you seem to have various combos of 2 out of 3 geometric leads driven hi & the other at gnd.

 

you might enjoy this (for fun)

https://www.researchgate.net/pub...

 

do you have info on the sensor---model, brand, etc?  anything?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Feb 16, 2021 - 10:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

you might enjoy this (for fun)

https://www.researchgate.net/pub...

That's a lot of ways to skin a cat :), all interesting.

 

Quote:

do you have info on the sensor---model, brand, etc?  anything?

None. There are no markings or labels of any kind on it. I can't even think of a way to describe the sensor for a search because most resistive sensors of this kind are single wiper and the ones with multiple signal lines are capacitive. So there lies part of my challenge because I am almost convinced that this is a custom made part for the music player. As I said in the original post, the closest thing I have seen besides it is the iPod scroll wheel, but that I believe is made by Synaptics and its protocol has been reverse engineered already. Otherwise, I've asked in multiple forums and no one has seen them outside of the device that they originally came in. That is why I finally decided to give the question a try with the sages at avr freaks :).

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This seems a little different than what I was expecting---it appears to be more segmented...take a look & you might thank me.  Each angular section is treated somewhat independently, rather than as one large surface.  So part of the signalling is to determin which of the 3 sections you are in.

 

https://www.trossenrobotics.com/...

 

the secret sauce:

https://www.manualsdir.com/manua...

 

buy some more:

https://buyinterlinkelectronics....

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Feb 19, 2021 - 06:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just for fun perhaps take a look at this:

 

https://www.youtube.com/watch?v=...

 

He take a cheap digital caliper apart to find out how it works.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


avrcandies wrote:

This seems a little different than what I was expecting---it appears to be more segmented...take a look & you might thank me.

Might??? I am VERY thankful that you found this. I took a look through the documents and it is uncanny how similar they are. I am almost convinced that they are the same part, so much so that I ordered 2 to inspect and test. Also because the one that is on my hacked controller is in the case and getting it out to test involves removing the PCB.

 

avrcandies wrote:

Each angular section is treated somewhat independently, rather than as one large surface.  So part of the signalling is to determin which of the 3 sections you are in.

Yes, I had figured this out, you can see it from the pictures in the original post and is what let me to guess what the internal circuit is. Although if the part I have is in fact what is described by the documents then I got the circuit wrong.

 

The interesting thing is that both documents show 2 different ways of wiring and reading the sensor. This one from the product guide shows the capacitor in the same position as the controller has it. The description of the technique for reading the sensor is to use the charging time constant by alternating readings of the sensor elements and comparing them to each other. It does not mention the ring sensor directly but it does refer to multi-channel which I guess the ring would be.

 

 

This one from the ring's integration guide is fairly straight forward. It does not show the capacitor but it describes a different technique that reads the resistance directly and does not count on a charging time constant.

What I will borrow from this diagram is the connection to the interrupt pin with the pull-up. I should have thought about this as a means to tell when the sensor is touched. Anyway, in reading the algorithm provided for reading the sensor, I believe it explains the use of the narrow pulse train. I think that is what is being used to perform the first stage reading, the one used to determine which of the 3 sensing segments is under contact. And then, the setup of the wide pulse train allows reading the drive line pairs from both directions to create a ratiometric reading. My guess is that the software would keep and operate on the samples in the pulse that match the ends of the segment under touch and discards the rest. So this indeed would appear to be the magic sauce.

 

Fortunately I should be able to alter my current algorithm and not have to change the hardware to take advantage of this new knowledge. I'll give this a shot and will update with my findings.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:

Just for fun perhaps take a look at this:

 

https://www.youtube.com/watch?v=...

 

He take a cheap digital caliper apart to find out how it works.

 

Thanks! I do enjoy Big Clive's videos and this one was quite informative.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the difference between the two approaches mentioned - capacitor charging time vs direct reading is that the direct reading requires an ADC for each segment; the charging version could be done on a processor without an ADC just by timing until the voltage reaches the digital input threshold voltage.

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

capacitor charging time vs direct reading is that the direct reading requires an ADC for each segment; the charging version could be done on a processor without an ADC just by timing until the voltage reaches the digital input threshold voltage.

I  assumed the same & didn't pay much attention to it ---assuming it was the old school way of making the poor man's ADC.    One thing to be said, is if they are using some dual slope methods, it can be a pretty clean conversion (trading off not being in a hurry to a clean sweep).

 

I noticed in the guide they used the complementary reading (where voltage pins are swapped) as a sanity check, rather than doing an actual ratiometric calculation....maybe they didn't realize what could be done, or the benefits.  It might be your board actually does it in code.   On the other hand you aren't trying to  figure out position to 1/1000 of an inch (are you?).    Again, the ratiometric calc means the drive levels drop out (assuming they are similar when swapped).

 

I might order a few just for fun.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Feb 21, 2021 - 11:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:

  On the other hand you aren't trying to  figure out position to 1/1000 of an inch (are you?).    Again, the ratiometric calc means the drive levels drop out (assuming they are similar when swapped).

Correct, if I can get positions at 12 degrees around the ring (30 clicks) then that will be very close to what I have measured with the original equipment.

 

avrcandies wrote:

I might order a few just for fun.

In the original equipment they behave really well and provide a very solid and clean input. No noise or jumpiness and quite stable after 15 year, all from a resistive sensor. They are nice.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have not read all this but :

 

10 years back I wrote a AVR program for a 1/4 VGA display with restive touch.

 

Depending of how good you need it, here is a good way: (short delays needs to be added)

The best way to do this is to use 4 analog IO's, first the two for X as output the other two input (analog and no pullup). Put 5V over X and ADC both Y.

Then flip the two X output so 5V now flow the opposite direction, now read the ADC's again.

About the AVG of all 4 is a ok X value.

Repeat all for the other direction.

now you have Y.

If you want it better you can compensate X now when you know Y , and Y with X (tests needes to be done)

 

 

I guess this is done the same way just with 120 deg. at the time.  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:

I guess this is done the same way just with 120 deg. at the time.  

 

Yes, this is my understanding of the method listed in the documentation that avrcandies shared. Sensors are on their way from California, should be here tomorrow and I can try this out.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A single 360 deg loop "pot" has a problem where the loop crosses from 360 back to 0, in terms of being able to read passing through there.  So they instead use 3 segments A B C butted next to each other.  They don't treat the entire thing as one surface (as would be done in a digitizer), but as 3 separate pot segments.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!