Results 1 to 6 of 6

Thread: Flux Capacitors - errr - Flex Resistors

  1. #1
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    174

    Flux Capacitors - errr - Flex Resistors

    I'm working with the SpectraSymbol flex resistors that are in the Trossen Catalog and have some interesting results testing them in the simplest possible voltage divider setup...

    They are horrendously noisy, and I tried to keep the test consistent by strapping the bottom to a stiff wire and then bending them each time until they touched the edge of my breadboard. Not exactly scientific, but fairly consistent. I had two sensors to test, and they were pretty close together in their readings (thankfully!).

    Here's the results of using different resistors in the divider [Vin = 5.026v with +- .00350v drift:] [All resistors tested are 10%]

    22k : 3.60 - 2.63v = 0.97v
    27k : 3.84 - 2.94v = 0.90v
    33k : 4.03 - 3.23 = 0.80v
    15k : 3.15 - 2.2v = 0.95v
    12k : 2.87 - 1.9v = 0.97v
    10k : 2.64 - 1.7v = 0.94v
    4.7k: 1.67 - 0.89v = 0.78v

    Now, since this is a pure resistors thing with everything else being equal, we should be able to consider it a special case "resistive divider":

    Vout = [R2 / (R1+R2)] * Vin right?

    The flex resistor is approx. 9k - 22k

    If we say our R2 = 22k
    22k / (9k+22k) * 5 = 3.55v (Tested 3.60v)
    22k / (22k+22k) * 5 = 2.5v (Tested 2.63v)

    1.05v spread predicted vs 0.97v measured +- 10% = 0.097 <= 1.067

    Sample another:

    R2 = 12k

    12k / (9k+12k) * 5 = 2.85v (Tested 2.87)
    12k / (22k+12k) * 5 = 1.76v (Tested 1.9)

    1.09v spread predicted, 0.97v measured +- 10% = 0.097 >= 1.067

    R2 = 4.7k

    4.7k / (9k+4.7k) * 5 = 1.715v (Tested 1.67v)
    4.7k / (22k+4.7k) * 5 = 0.88v (Tested 0.89v)

    0.835v spread predicted, 0.78v spread measured +- 0.078 <= 0.858

    Wow. I love electronics and math. I'm glad I started writing this (maybe it should have been a blog, but...) The 10% resistors are as guilty of killing the math as the flex resistors are.

    Be that as it may - the voltage swing is really tiny so the resolution is low, and the sensors are rather very noisy. I'll need to come up with some kind of smoothing.

    Hmm. Program to predict the best resistor combination? That sounds like a good college programming class question.

    [edit] Given the thousands of resistors I have on hand, R2 should be optimized at 15k Ohm (3.125 - 2.027 = 1.099) I think my measurements of 3.15 - 2.2 = 0.95 were effected adversely by a 10% resistor (0.855 to 1.045)
    Last edited by Adrenalynn; 01-10-2009 at 04:15 PM.
    I Void Warranties�

  2. #2
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    174

    Re: Flux Capacitors - errr - Flex Resistors

    Woot! A finished flux capacitor!

    Attachment 993

    Attachment 994

    Attachment 995

    Attachment 996
    I Void Warranties�

  3. #3
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    174
    I need to try to wrap my head around the scaling on the opposite side - it's backwards. But here's one door working (it still needs a little fine-tuning on the scaling algo.)

    http://www.jlrdesigns.com/one-door-1.wmv

    I'm sure this will be more obvious after I get some much needed sleep, I'm sure I'm over-complicating things.

    If I want to scale an input to an output, like a range of 400-500 in equals 1200-1900 out 400=1200, 500=1900, it's as simple as (input - min_in) * (out_range) / (in_range) + min_out
    But what if the input is inverted from the output desired?

    If I have an input range of 400-500 and an output range of 1900-1200 (notice the inversion 400=1900, 500=1200) - there's got to be an easy to way juggle that that I'm just too tired to see...
    Last edited by Adrenalynn; 01-11-2009 at 02:09 AM.
    I Void Warranties�

  4. #4
    Join Date
    Sep 2008
    Location
    Southampton, UK
    Posts
    37
    Rep Power
    39

    Re: Flux Capacitors - errr - Flex Resistors

    Hi Adrenalynn

    Think this is what you want:
    max_out - ((input - min_in) * (out_range) / (in_range))

    I was thinking of trying them at some point. What sort of amplitude of noise are you getting?

  5. #5
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    174

    Re: Flux Capacitors - errr - Flex Resistors

    Heya, Amp:

    A great big +Rep coming there! Now that you write it, it's obvious. Thank you for that!

    You know, I captured a bunch of time on my storage 'scope, but I haven't done anything with it yet. What I did was just scale the input. At that scale the noise basically disappears (on the door that works right now, I'm scaling 420 - 620 digital in to 1350uS - 1900uS servo pulses, so the noise is basically a non-issue, the chatter isn't enough to even think about waking-up the servo). If you like, I can transfer over the data from the scope and upload it so you can see the noise. The big potential "gotcha" is recovery. They recover to resting state very slowly and are very noisy in that period with large swings from ~9kOhm to 11kOhm. It really takes a good five or ten seconds to settle down depending on the speed you shift them from flexed to resting. I just took a sliding window on acceleration, a little Kalman filtering, and it behaves pretty well. As you can see from the video there is a bit of lag when reversing directions - that's probably a function of processor speed. That poor little Arduino is pretty overloaded now and needs a few more clock cycles. I haven't done any simulation or any real optimization - I wanted to get everything working together before I started tearing into my code.

    Long answer to a short question, huh? Let me know if you want the scope output. I could also capture the 10bit A/D and then you could just plot it with your favorite package.

    Thanks again!

    [Man, I got the +rep mojo. I can't give anyone +Rep without them getting another reputation box automagically. ]
    I Void Warranties�

  6. #6
    Join Date
    Apr 2008
    Location
    Sacramento, CA, USA Area
    Posts
    5,341
    Rep Power
    174

    Re: Flux Capacitors - errr - Flex Resistors

    I implemented the function, but still need to test it. I'll edit this post with the results. With the XBee and the input board piggy-back, it's a pita to upload and test code to the board without risking the servos in a full-scale test. [sigh]

    I modified the algo to be compatible with the Arduino "map" function:

    long inversemap(long input, long min_in, long max_in, long min_out, long max_out)
    {
    return max_out - ((input - min_in) * (max_out - min_out) / (max_in - min_in));
    }

    Woot! Worked first time out. I need to dial-in my filtering and scaling a little bit. Maybe read a dynamic calibration for each startup, 'cause the flex resistor seems to change a little each time. They're finicky little buggers. Anyway - it worked straight out! Thanks again, Amp!

    http://www.jlrdesigns.com/two-door-1.wmv (4MB video. Pardon my mess. After several months of working on this project, the lab is looking like a tornado hit it. Several times.)
    Last edited by Adrenalynn; 01-11-2009 at 04:25 PM.
    I Void Warranties�

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •