Breaking

Wednesday, January 8, 2020

Tutorial: Op-amp circuit for force sensor signal conditioning--- make money online

Tutorial: Op-amp circuit for force sensor signal conditioning--- make money online
hey everyone in this video I'm going to
show you a circuit that you can use to
interface this force sensor with a
microcontroller or some other analog
input device so this is a flexi force a

4:01 force sensor and it's a sort of
like a variable resistor so let me zoom
in and show you how to how to make this
circuit okay so this force sensor is
built by laminating two pieces of
plastic with some conductive ink on the
inside so the ink is facing the two
inked surfaces are facing each other so
when you apply force this way on the
sensor the two conductive inks are
pressed together and the resistance goes
down so if we wanted to interface this
with a microcontroller 18 mega or an
Arduino or any other sort of analog
capture device we need to figure out how
to get this signal into the analog
digital converters so you might be
thinking well if it's a variable
resistance we can just draw that as a
resistance that's variable and to
measure this variable resistance what we
could do is just add another fixed
resistor to ground and put this up to
some plus voltage source and then take
our output here so we have a voltage
divider but there's a problem
this sensor actually has a curve that
looks like this so if this is force and
this is resistance the the graph
actually looks like this so if we were
if we were to make a voltage divider
like this it would work we could measure
the voltage using a simple divider like
this but in our software in the firmware
we have to compensate for this
weird-lookin curve so if we actually
wanted to make real meaningful force
values force measurements with this
sensor we'd have to compensate for the
this strange-looking curve however lucky
for us here's there's a way to get
around this so the manufacturer of the
sensor has given us this helpful chart
showing us that here's there's the
resistance curve and if we happen to
take one over the resistance well
we get is this line which is nice and
linear so one over R is the conductance
of the sensor and the conductance is
actually very linearly related to the
applied force so as we add more and more
force the conductance goes up linearly
so the trick is how do we make a circuit
that will actually measure the
conductance of that force sensor that
way we can just sample the output
voltage or sample the conductance and
have a linear representation of how much
force is being applied so again lucky
for us the manufacturer has given us
this little chart here or this little
diagram and this is a very simple op-amp
circuit if you're familiar with op amps
this is a non-inverting amplifier and
what they've done is put the variable
resistance of the force sensor between
the inverting input and a negative
voltage source now in this example they
show the feedback resistor being
variable but it could be fixed and they
even helpfully say the feedback resistor
should be about 1k to 100k and the
reason for that is when the force sensor
is getting near its limit in terms of
how much force you can apply the
resistance across the sensor will be you
know in the range of 10 to 20 kilo ohms
so you want to get this value fairly
close to this value when it's at its
maximum and the reason for that is this
formula here so the output voltage is
equal to negative VT which is this
negative voltage that we're applying
times our feedback over our series so if
the feedback resistor and the series
resistor are about the same value then
we're just going to get this negative
voltage times negative 1 so a positive
voltage coming out here so let me hook
the sensor up to the meter and show you
this ok so when no load is applied to
the sensor it's essentially open more
than 40 mega ohms on this meter and if
we apply some force to the sensor the
resistance comes down so we've got about
800 K there and if I push really hard
the resistance goes down further now
we've got about 80 K and if I use a
bigger area the resistance also goes
down so for the same force that spread
over a bigger area there will also be a
lower resistance if I use my thumb to
push this down and I'm pushing pretty
hard I'd say I've got maybe 20 pounds of
force on there it's down to maybe 50 K
if I push really hard 30 K so it's tough
to get it below 30 K let's say with
finger pressure so one way to build this
circuit would be to desire like a 0 to 5
volt analog output so if your if we were
using an AVR chip with a 5 volt supply
rail it's analog/digital converter would
be comfortable with with input voltages
between 0 and 5 volts so let's just say
we want an output range of 0 to 5 and we
know that the sensor gets down to maybe
30 K ohms when it's fully depressed when
it's when it's experiencing the maximum
load for our application and also let's
just say that our negative supply
voltage here is negative 5 so if we
write out this equation we've got let's
go for the high case so let's say at
maximum we've got 5 volts out is equal
to negative times negative 5 volts in
times our feedback over the sensor
resistance and we just said that's about
30 K for for maximum load so if we look
at this obviously our feedback is also
going to be 30 K so we can cancel the
fives out and there you go so to give
this a little bit more Headroom I'm
going to choose a slightly lower value
so what would happen if this if this
were exactly 30 K and you pushed harder
on the sensor there would be no
additional output swing so you would
sort of top out and we don't want to run
out of measurement room so by charging
it by choosing a lower feedback resistor
the sensor will be
sure not to run out of a measurement
room here so I want to pick a value of
22 K for the feedback resistor 22 K ohm
the next question is where do we get
negative 5 volts now if we're building
this circuit and it's going to be
powered by USB or powered by a standard
wall wart type thing where do we get the
negative 5 volts one option is to use a
part like this this is a self-contained
DC to DC converter and it is part number
sr9851 of course Newark or mouse or any
of these other guys have it too and
inside here this is basically a 5 volt
to 5 volt converter but the the nice
thing is that the output is isolated so
if you put 5 volts in you can connect
the positive output to the negative
input and then get negative 5 volts out
so in my circuit I use this to supply
the negative 5 volts that we need to put
in over here okay so now we know the
feedback resistance that we want we know
how to get the negative 5 volts and
we've got the basic overall circuit
layout from from the manufacturer and
they recommended that we use an MCP 6004
or op amp which might be fine i've never
used one of those before i don't know
what the details are I actually happen
to like LM 324 s and I read somewhere on
the forums that someone said this is
like the worst op-amp that's still in
production today or whatever I I don't
know if that's true or not but I will
tell you why I like using this chip for
this application I'm going to be
measuring forces that are essentially
not changing I mean an AC is not really
a concern in this circuit I basically
just want to measure constant force
value and any rapidly changing forces
are not going to be an issue so this
op-amp I don't think has very great AC
characteristics but as far as DC
voltages it's fine and there's a couple
of the nice things about it one is that
the output can go all the way to zero
volts so if we're supplying the op-amp
with
v+ and zero the outputs will actually
get all the way down to zero which is
very handy if you started to work with
op amps you might have been you might
have realized that a lot of them require
very high voltages on the supply rails
both positive and negative and so having
an op amp it's able to go down to ground
is helpful
now the outputs won't go up to the v+
the I think they speck at it a volt and
a half under yeah so the output swing is
zero volts to V plus minus 1.5 volts so
for supplying the op amp with 5 volts
the output will never be higher than 3
and a half which is a problem because
we'd be losing signal you know this
thing would never supply a full 5 volt
signal to our ADC to our 18 mega or
whatever we're feeding so one solution
is to have a few different voltage
regulators in your circuit and you can
feed this chip 6 volts and the rest of
the circuit 5 you know five for the AVR
and that way you can get up to four and
a half volts out on this or use an 8
volt regulator or whatever you want just
just so it's able to have a 5 volt
output swing another benefit of this
op-amp is that it's a quad and it's
available in all kinds of different
packages you can still get this easily
in dip packages and I like through-hole
parts so that's that's nice and you know
it's reasonably okay I don't think it's
that bad of an op-amp but everyone has
their own opinions you can put that in
the comments now there's one more
addition to this circuit since I said
that I'm mostly interested in just
measuring steady-state force values I'm
not really interested in in high
frequency anything we're going to add
some low-pass filters to this circuit
and the easiest way to do that is to put
a capacitor here now what this does is
it creates a single pole low-pass filter
again not the greatest performing thing
but in this case we can really wipe out
I mean lots of stuff so I'm going to but
let's figure out the value so let's say
we wanted to wipe out most of the AC we
particularly want to wipe out 60
curves because this system is going to
pick up 60 Hertz noise from all the the
wiring it's actually going to have
fairly long wires on it and the
frequency that this is going to start
cutting is given by the formula 1 over 2
pi RC so RS here C is here and this this
formula will give us the cut frequency
in Hertz so the cut frequency looks kind
of like this if we had a frequency here
and gain or amplitude here and this is a
log-log scale
I think the curve would look something
like this and this is going to go down
it guy forget 10 DB per decade or
something I don't know you can look it
up single pole filter but it's going to
come on the specific frequency and this
frequency is the cut frequency given by
1 over 2 pi RC so if we were really
concerned about exactly what frequency
we wanted we could figure out exactly
what capacitor should be used there but
in this case we're kind of limited by
what capacitors are available so I'm
just going to say let's use 1 over 2 PI
R which is 22 K and C is going to be 0.1
micro farad's so 0.1 e negative 6 and
this comes out to be 72 Hertz so it's
not quite below 60 so ideally this
should actually be a little bit higher
we could have you know I don't have
anything quite bigger than this that
isn't already 1 micro farad and for
reasons that I'll get into later it
shouldn't be an electrolytic okay so I
did some testing and it looks like the
60 Hertz noise is not a problem so I'm
going to stick with this and maybe add
another capacitor between the inputs on
the op-amp if necessary so if you're new
to op amps you might be thinking well
what we could do to add some more
filtering is just
from the output here just you know add a
capacitor going right to ground like
that no you cannot do this most op amps
will freak out majorly if you do this
and the reason is that the output here
sets up an oscillating circuit with this
capacitor this op-amp does not have zero
output impedance like you would expect
from the theory I mean if you spend a
long time looking at op amp Theory you'd
figure well sure this would be okay but
the problem is that there's actually
output impedance with it with any op amp
with any real op amp and if you add a
capacitor here you there's a really good
chance you're going to set up a resonant
circuit so at the very best what you
could do is add a resistance and then
you basically have another single pole
low-pass filter here just like you have
here so if you add them together I think
then you have a two pole filter and you
can have them at the same cut frequency
or even different cut frequencies then
the only problem is your output
impedance going this way is going to be
affected by how big that resistor is so
in this case I don't want to do this I'm
just going to take the output straight
from the straight from the op-amp so
that I have a fairly good output
impedance and do all the filtering here
or even before ok just like on a cooking
show here's one that I've made
previously this actually has 10 channels
to it but it's the same circuit over and
over again just you know done 10 times
and these long cables are just that I
can have the four sensors relatively far
away from this circuit this is going
into a much larger installation and the
four sensors are going to be some
distance away from this circuit so
there's our negative 5 volt generator
and you might be thinking well this is
no good because it's it's i think the
switching frequency on that's 40
kilohertz or something and all that
noise is going to propagate right into
our output signal but actually if you
don't load this at all heavily the
output noise is very very low these
things will get noisy if you start
loading up the output but when they're
unloaded it's actually quite clean so
I'm going to feed this whole circuit
with an analogue a linear
wallboard I have had problems using
switching power transformer switching
power supplies with analog circuitry and
I would pretty much universally
recommend against that those those
switch mode power converters are great
for digital circuits but are really
terrible for anything analog so in this
case I have unregulated 9 volts coming
in from the wall wart and I've got a 5
volt regulator here which just drives
gives this power and I've got an 8 volt
regulator here which gives the op amps
power so 8 volts going to the op amps
means that the output can swing up to
six and a half volts so the output will
always be between zero and six and a
half volts and normally that would not
be preferable for interfacing to
something like an AVR because this thing
will freak out if you give it more than
five and you might run into some current
dissipation issues but in this case this
will actually be connected to this which
can handle negative 10 to +10 on its
inputs I would actually not recommend
this for hobby use just because it's
kind of overkill this is going into a
much larger installation with with many
other pieces but for hobby use National
Instruments makes a USB 6008 which costs
$150 and more or less has half the
functionality it's basically half of one
of these okay so let's plug it in and
try it out so here's the the power
supply that I'm going to use it's just a
9 volt unregulated 500 milliamp supply
okay plug that in and that's 2.1
millimeter barrel connector plug that in
and I've got the output from this
circuit wired to the scope and here's
the force sensor plugged into my three
miles of wire there so when I press on
the force sensor you can see the output
on the scope so the scope is in free run
mode and if I push on the sensor you can
see what the waveform looks like the
force waveform and if I tap on the
sensor like this you can see the the
step response there so what we could do
is measure that waveform and see how the
step response is um not quite ideal some
of that smoothing is happening because
my finger is soft and my step on this
thingy the force is not increasing
instantly fast but there's also some
smoothing that's happening because of
the filter that we implemented so step
responses on the force sensor will not
be perfectly square because that
low-pass filter is going to start
smoothing things down so if I just press
on this and hold it steady you can see
there I think I have it set for a volt
per division on the oscilloscope you can
see the response is pretty good it's
working normally so one other tests to
make is to switch this to AC coupling
and I'm going to press the auto setup
button just to see what we can see so
there is some noise on the on the output
what's happened here is I've switched to
AC coupling and it's the scope
automatically chose 5 millivolts for
division which is
as low as this thing can go and we've
got maybe you know 5 10 so 20 20
millivolts peak peak noise on there
which is you know not great but not bad
either
I've noticed in a lot of circuits just
adding the oscilloscope to to the
circuit introduces quite a bit of
measurement noise
however this spiking here is most likely
from the 5 volt 5 volt converter if we
had a true linear supply you could
probably get some of that noise down
here's the signal at 20 millivolts per
division and if I you know tap on the
sensor you can see how big the signal is
come here I'm just pushing on a sensor
very lightly you can see how big the
signal is compared to the noise so you
know the noise signal-to-noise ratio in
this system is quite high I could do a
measurement but just looking at it
graphically is usually the best way you
can tell that it's quite good
[Music]
okay well I hope that was helpful I'm
definitely not an op-amp expert but if
this was at all useful to you guys maybe
I'll do another one on on op amps that
are actually working in AC circuits
instead of just more or less a DC

conversion okay see you next time bye best way to earn money online, make money from home, make money online free, money making sites, earn from home, real ways to make money from home, online income ideas, make real money online, top online earning websites, earn money online fast, top 10 money earning websites, earn money without investment, earn money online for students, best sites to earn money, make money online 2019, earn easy money online, earn money online instantly, real money earning sites, make money from home online, make money online fast, earn dollar online free, online earning ways, best online money earning, earn money online with surejob, make money online, online money making sites, best sites to make money online, earn money online paypal, online earn money by typing, best survey sites, ways to earn money online, ways to earn money from home, make money online without investment, make money online surveys, 
s

No comments: