Tuesday, July 30, 2013

Reviewing the Arduino with Analog Pressure Sensor Data


The picture above is the majority of "p.alpha.2", my second prototype... looks a bit jumbled no?

Well there's really not much to it as of yet, it's simply an Arduino Lilypad USB with the "Boston" pressure sensor leading into one of the analog ports.

I used a basic voltage splitter configuration similar to the following circuit but with the sensor at R1, a 2700 ohm resistor at R2 and roughly the 3 volts coming from the USB supply.
  

This configuration generated what looked to me to be pretty nice data when tested across a range of weight and with repetitive motion.

The following charts display the data received from the Arduino (from the Serial Monitor) across a range of weights.










Notice that for each chart, the red line is a smoothed 11 point moving average that clearly shows the repetitive motions executed during each test even for the more volatile readings at the lower end of the weight range.

Another point to make clear is that there were less repetitive motions using the heavier weight simply as a result of fatigue and is not an artifact of the metering process itself.

Note too that the smoothed data also remained relatively stable during each test with readings in fairly distinct ranges while the top chart displaying the Minimum, Median, Average and Maximum values read for each raw series.

Looking at the data from a software development perspective, I think that each individual series looks very stable and distinct, a good finding that likely means that interpreting these data will be fairly straight forward.

Best to all...

Wednesday, July 24, 2013

Dam-it! Pressure Sensor Swap


Once again I have been tripped up by my inexperience using a multimeter but at least I'm learning a heap load and in real hands-on style!

Let me explain...

In my last post, I indicate that I had decided to go with the Plusea pressure sensor for a myriad of reasons but most notably because of my perceived stability of the test measurements taken and the flexibility of being able to easily manufacture any shape and size of sensor I desired.

While I still believe that the Plusea sensor is a very stable and more linear sensor, after I hooked it up to my Arduino using a simple voltage splitter scheme ( ... I'll go into this further in my next post), it became apparent that something was up.

My assumption was that the Plusea sensor, when not under pressure, would act just like a switch switched off or a potentiometer turned all the way off, providing infinite resistance and preventing all current flow.

But, the readings from the analog port on my Arduino (and pumped to the console window of the Arduino IDE) indicated a value near the maximum reading (1023) at all times... even when not pressed!

At first I questioned my circuit design, but after a thorough tracing of the entire configuration I decided to sanity check the sensor by passing a current through it and reading the voltage and current using my multimeter.

Long story short, what I realize now is that the Plusea sensor was always allowing some degree of current through, even when not under pressure.

Switching my multimeter back to resistance, I finally noticed that, when set to a range of k-ohms, the Plusea sensor was always reading some non-infinite level of resistance.

After realizing this I became a bit stubborn and decided to see if I could manage this resistance "leakage" by swapping out the other resistor in the voltage splitter circuit to sort of counteract the leakage and I was marginally successful at bringing the default, non-pressured Arduino reading down to 300 but this still seemed unworkable.

Then, hooking the "Boston" sensor up to the same voltage splitter circuit, it was obvious that this sensor was more suitable to my application with a reading near 0 by default ( ... i.e. no pressure applied) and what appeared to be some nice range up to the heavier weights.

Looking back at my comparison matrix, I suppose I should have been able to predicted this outcome:


Notice that for the Plusea sensor, the average range of resistance was 604 ohms for the minimum weight to 144 ohms for the heaviest weight.

As it turns out this was an indication that there wasn't enough range of resistance with the minimum resistance just over 4x the maximum while the Boston sensor's rage was more like 31x.

Further, remember that I noted that the Plusea sensor was able to resolve a consistent resistance reading of a SIM card ( ... in the range of 30 k-ohms) which I delighted in at first, but looking back, that was another indication that the range was not suitable for my application.

Note that the Boston sensor required the weight of a AA battery just to register in the range of 30 mega-ohms.

I now interpret all of this to mean that the Plusea sensor was VERY sensitive to the touch with the resistance falling all the way down to 30 k-ohms with a weight of just the SIM card and registering some degree of conductance at all times (i.e. even without the presence of any pressure) while the Boston sensor provided infinite resistance when not under pressure and required 178 lbs just to get resistance down to 33 k-ohms.

Another way of looking at this is that the Boston sensor required 178lbs to get the resistance down to the same level that the Plusea sensor registered with just the weight of a SIM card.... a BIG difference indeed!

So, I'm now back fully engaged with the Boston pressure sensor again and, having learned quite a bit in process of comparing the two, feel more sure now that I'm on the right track as far as the pressure sensor is concerned.

In my next post, I will feature my split circuit Arduino configuration and summarize a sample of output data across a range of weight.

Best to all...

Wednesday, July 17, 2013

Pressure Sensor Smackdown!


After a few pretty labor intensive days of testing, I've firmly decided on the choice of pressure sensor for my project.

First, though I'd like to correct something I insinuated in the prior post, namely that the "Boston" pressure sensor required amplification in order to operate while the "Plusea" sensor did not.

As it turns out, this assertion was merely the result of my poor ( ... but steadily improving) skills at using a multimeter.

Both the "Plusea" sensor and the "Boston" sensor are perfectly capable of generating a full range of measurable resistance change correlating to the amount of pressure that the sensor is experiencing without requiring signal amplification.

The hitch is that the "Boston" sensor registers pressures in the rage of 15 mega-ohms (for the weight of a AA batter) to 33.7 kilo-ohms for about 180lbs while the "Plusea" sensor's range is more like 2 kilo-ohm to 144 ohms for the same weights.

So, initially when I hooked up the "Plusea" sensor to the multimeter, I quickly got readings in the default range that the multimeter was set to by default but for the "Boston" sensor, it took little more fiddling to get readings that were in the mega-ohm range.

But after some thorough testing I was able to establish the following comparison matrix:


Notice that for the "Maximum Measurable Resistance" item, the "Plusea" sensor was able to accurately and repeatedly measure the resistance caused by the weight of a minuscule SIM card at 30 k-ohm while the "Boston" sensor required the weight of a single AA battery to cause a measurable 15 mega-ohm response.

There's no doubt in my mind that the "Boston" sensor can accurately measure the resistance from the SIM card as well, it's just that I would need to use a more sensitive multimeter that could discern a much higher level of resistance in order to measure it.

Notice also that the "Standard", "Average" and "Delta" deviations as a percentage of the median sampled values for each weight are generally smaller for the "Plusea" sensor and, in general, for both sensors the deviations were smallest for the heaviest weight.

In my mind, this puts one major check mark in the "Plusea" column as I believe that the stability and repeat-ability of the pressure measurements is critical, though, on the other hand, both sensors performed pretty similarly.

Looking at the following box charts we can see that both sensors exhibited non-linear resistance across the range of weight and that the "Plusea" sensor had smaller and more even deviations while the "Boston" sensor had slightly larger deviations that were larger with lighter weights but eventually became very small with the highest weights.

In both charts, the top blue "whisker" indicates the "Maximum" value measures with the lower red whisker indicating the "Minimum" value.

The bottom of each both represents the 1st quartile with the bottom of the blue box portion indicating the median measured value and the top of each box indicating the 3rd quartile.



My interpretation of these charts is that the "Plusea" sensor showed a more linear response over the test range and generally showed a smaller degree of deviation for each weight while the "Boston" sensor exhibited a more consistent range with deviations that declined steadily with the application of more weight.

The final set of charts displays the "conductance" of the sensor for each weight in the test range.

Conductance, which is 1 / resistance, works to linear-ize the data and is ultimately the value I will be measuring with an un-amplified configuration for the pressure sensor.



Note that the conductance value for both series are being multiplied by a (different) factor for each sensor in order to bring the value into a integral range ( ... thus the "conductive index" terminology).

As you can see, the conductance is just a bit more linear for the "Plusea" sensor though it is important to note that there was a little range overlap with both the 2.5 and 5 lbs ranges as well as for the 25 and 35 lbs ranges while the "Boston" sensor exhibited no overlapping readings with these test weights.

In conclusion, I think that both sensors performed excellently and I'm pretty convinced that I can use either in an un-amplified arrangement ( ... thereby decreasing overall power and simplifying the circuitry) in my project.

The "Boston" sensor was a bit less linear with a more non-linear conductance curve as well, while the "Plusea" sensor was both more linear and a tad bit more stable.

The "Boston" sensors have the benefit of already being manufactured by a commercial supplier who is totally able to provide customized shapes and sizes while the "Plusea" sensor would require that I ultimately manufacturing the sensors.

Overall, there is just something that feels right about the "Plusea" sensor... its fabric, more or less trivial to construct, stable, produces a very linear conductance and is constructed of very inexpensive materials.

Further, I can experiment with all sorts of shapes and sizes and construction techniques without interacting with a third party.

So, my next steps are as follows:
  1. Produce "p.alpha.2", the second incarnation of the "alpha" prototype with the "Plusea" sensor installed and firmly affixed with Velcro. 
  2. Test the operational performance of "p.alpha.2" against the range of weights both statically and in motion. 

Best to all...

Tuesday, July 9, 2013

Setup for a Pressure Sensor Smackdown!


As an aside to my testing of the amplified pressure sensor of the prior posts, I wanted to spend some time evaluating an alternative approach which would appear to not require amplification.

Initially, when I began researching flexible pressure sensors, I came across some exceedingly interesting projects made available at Instructables by a user named Plusea.

After looking over some of the sensor related project details and watching a few of Plusea's YouTube videos, I was convinced that my project was possible.

I immediately contacted Hannah ( ... Plusea) and ordered a fabric sensor kit from her Etsy shop with high hopes that operational range of this unique dynamic resistor would fit for my application.

Given that Hannah was going to be shipping my order out from Germany, and that I was pretty impatient and wanting to get up an running on this application, I did a little more Googling for other possible approaches and found a commercial manufacturer of flexible pressure sensors right here in the Boston area.

Both sensors appeared to work similarly in that they both were effectively acting as dynamic resistors, preventing current flow with no pressure (i.e. like a switch switched to off) and then slowly allowing more and more current (i.e. less resistance) with greater and greater application of pressure.

Of course, the package of sensors I ordered from the Boston supplier came almost overnight and thus I got up and running with them first.

Right from the start, there was more to using this sensor than the simple Velostat fabric swatch of Plusea's construction.

Most notably, it was suggested by the manufacturer that the sensor be paired with an either a single or dual supply OpAmp (... as we now well know from prior posts) which took me down the path of assuming some level of circuitry allocated just for proper function of the pressure sensor. 

Mind you, my intent was to minimize this circuitry (low voltage OpAmp, probably single supply, minimal supply voltage) but I was firmly on the path of detailing amplifier circuitry and vetting power scenarios just for the pressure sensor (... remember there are other sensors as well in my project!).

Well, last night I finally got around to putting together Plusea's fabric pressure sensor and sure enough it works great!

It produced what preliminarily appears to be vary consistent readings even at very heavy loads...  I even put my whole body-weight on it ( ... about 178 lbs)... and all with only the little current put out by my digital multimeter.

One thing though, the change in resistance appears very non-linear in that there is a large change in resistance with very light weight and then progressively less and less change as you pile on more weight, but the sensor appeared to be generating some very consistent readings in any event.

So, this appears to frame a bit of a smack down of sorts... which sensor is the best option for this application given all the constraints and requirements?

Obviously, I now need to create a comparison matrix.

Best to all...   

Sunday, July 7, 2013

Testing OpAmp with Pressure Sensor (Part 2)


Building off my last test, I resolved to whip up a crude prototype ( ... very crude!) of my device with the dual-source OpAmp powered pressure sensor "installed" so I could make some preliminary measurements of its performance.

The goal of this test was to better answer questions 2 and 3 of the last post which concerned the stability, quality and repeat-ability of pressure measurements particularly with minimal amplification.

I decided to turn down the input voltage and gain to the minimal setting that allowed for a measurable response from a simple squeeze of the sensor with my fingers ( ... a ballpark estimate of the minimal functional pressure) and proceeded to sew up ( ... with my wife's sewing supplies) a prototype I call "p-alpha.1" for prototype-alpha 1.

P-alpha.1 provided, very nicely in fact, the basic foundation for putting the pressure sensor to the test under real conditions and overall, this exercise left me feeling very optimistic about the ability to make accurate measurements with my wearable device.

First, I tested the repeat-ability of the measurements by applying a basic range of weight ( ... 5 - 35lbs like the last post but not ultimately the full range required for the application) over and over again to get a "resting" measurement.

In the above graph, the green series titled "mid-measure" represents the trend of the "resting" measurement across the range of weight.

Again, as in the prior post, there was an obvious correlation between the weight applied and the output voltage but more importantly, the measurement was very repeatable and stable with each successive application of the same weight registering very nearly the same output voltage.

Then, I decided to put the device in motion and observe the range of fluctuation in the output voltage which I assumed would oscillate between some low and high value surrounding the initial "mid-measure" value.

My assumption was confirmed, there was an oscillation and it was, in my opinion, very workable.

Initially, I was concerned that this oscillation would be so sharp and severe as to make consistent analysis of pressure measurements very difficult but as it turns out the sensor, even under preliminary testing conditions, are very stable.

Looking at the chart above you can see the "high" measure in purple and the "low" measure in red.

Notice that while the spread between the "low" and "high" output voltage increased as more weight was applied to the device, there was never more than a 15% difference between low-mid or mid-high with may deltas in the range of 1-3% which ... in my book ... is very stable.

Preliminarily, I'm assuming that many values will be sampled from the sensor per second and that with lots of redundant measurements, I'll be able to perform some sort of noise reduction analysis, likely trimming errant high and low values and ultimately creating a very clean, predictable performance through the full range of motion of the device.

Next, I plan to improve p-alpha.1 ( ... to p-alpha.2) by firmly affixing the sensor to the device using a piece of Velcro and then running this test over as well as expanding the range of weight to 200 lbs.

Also, I'm putting in an order to Digi-Key for a low power OpAmp that I hope to power ( ... and maintain proper sensor function) using a single supply 3V coin battery.

Best to all...

Wednesday, June 26, 2013

Testing OpAmp with Pressure Sensor (Part 1)


After arranging all the bits of pressure sensor and dual source OpAmp configuration on the breadboard, I ran a few preliminary weight measurement tests to get some idea of the range of measurement possible with different levels of amplification (i.e. varying the input voltage and gain).

The above chart shows the output voltage for a given weight plotted for the various levels of amplification with the low end registering just about 0.5V for 35lbs while on the high end, the signal was closer to 5V for the same weight.

Note that the weight is also plotted on the secondary y-axis as reference and, taken together with the voltage trends, appears to indicate that the higher output voltage had a higher degree of direct correlation to the weight/pressure while the lower output voltage lagged a bit.

In any event, the two variables (output voltage, weight/pressure) were clearly very strongly correlated regardless of level of amplification indicating (to me at least) that reliable measurements will likely be able to be rendered with even limited amplification.

The key now is in determining:

  1. The weight/pressure range required for the application.
  2. The influence of the amplification on the stability and repeatability of the measurements.
  3. The minimum level of amplification ( ... and input voltage) required to reliably attain accurate measurements within that range.
  4. The minimum configuration (i.e. single versus dual source OpAmp, better OpAmp for lower power sources) needed to deliver said accurate measurements.

Below is a list of scatter-plots showing the (obviously) strong correlation between the weight applied to the sensor and the output voltage using LOW, MID-LOW, MID and HIGH amplification settings.

Notice that while all correlations are stronger than an r-squared of 0.90, the higher amplifications yielded near r-squared at or above 0.99.




Monday, June 24, 2013

Vetting OpAmp Options (Part 1)


Since one of the sensors in my project requires amplification, I've been spending a substantial amount of time getting down and dirty with various OpAmps in an effort to find one ( ... and a particular configuration) that meets all my criteria.

Most importantly, the sensor needs to be amplified enough to present a consistent and wide range of load measurement while not drawing/requiring too much power.

OpAmps generally allow for either "dual" or "single" supply configurations meaning that they require either one or two power supplies in order to operate.

By power supplies, I mean power sources which, in the case of my project, ultimately means batteries... and for this project I would like to keep both the overall power draw and number of replaceable or rechargeable batteries to an absolute minimum.

You would think this decision would be simple... just go with the "single" supply configuration and an OpAmp that can operate with a very low voltage.... but it's not quite that easy as there are many trade-offs and nuances.

First, generally speaking... ( ... remember this is all essentially new to me) "single" supply amps can deliver the similar dynamic range of amplification as the "dual" configuration but with the requirement of a higher single voltage.

For example, a "single" source amp might be able to take a single 5V supply and amplify the source signal within a range of 0 - 3V while a dual configuration might take two 2V supplies to create a range between -1.5V and +1.5V ... also a 3V total range.

Further... there is a the possibility of choosing an amp that supports "rail-to-rail" operation which allows either a "single" or "dual" configuration to generate an output voltage very near the input voltage which appears to me to be essential in a low power application.

Ultimately though, the configuration has to work for the application so the first order of business is test both the "single" supply and the "dual" supply configurations with the sensor across a range of voltages in order to establish the minimum voltage needed to make accurate ( ... and distinguishable) measurements across the desired range loads.

My wishful hope at this point is that I can make accurate measurements with an amplified single that ranges from 0V ( ... no load) to 1V ( ... many hundreds of pounds of load)... but I wont really know for sure until I capture and plot the output data.

Currently, I have the sensor in a "dual" configuration with two 1.5V supplies ( ... a tad under the recommended lower bound of voltage for this amp) and it appears to function pretty well but the proof has yet to be established so stay tuned!

Best to all...