Searching \ for '[PIC]: 16F877 ADC Noise' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/ios.htm?key=adc
Search entire site for: '16F877 ADC Noise'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16F877 ADC Noise'
2001\04\24@164931 by Graham North

picon face
Hi, thanks for the recent ADC help. I have now managed to get it working.
But I have another problem.

I am using the ADC to measure the current consumption of a motor. At normal
load the motor pulls 9mA, at a full stall it pulls 40mA. I have attempted to
measure the voltage drop across a 0.1ohm resistor. (The resistor is placed
between a FET (the motor is being driven by PWM) and the motor. I think this
could be wrong!?!?)

I know the voltage drop across the resistor is small, so I amplified it, and
feed it into the internal ADC. I then output the 8 msb to 8 LEDs. The value
being read is however really noisy.

If I input a voltage as Vref+, will this then become the full scale of the
ADC? This way I may not need to use the amp.

Has anyone tried to measure similar small currents with the internal ADC? I
do not need great acuracy, just to tell when the motor is wearing out (EG
pulling more current).

Thanks

Graham North
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\04\24@202335 by Nicholas Irias

flavicon
face
Are you using any sort of signal conditioning?  Unless you need to measure
rapid flucuations in current, you want to put a low pass filter between the
0.1 ohm shunt and the amplifier.  THe simplest such filter that I have used
is a capacitor from the ADC pin to ground and a high value resistor between
the ADC pin and the voltage being sensed.

{Original Message removed}

2001\04\24@210624 by Olin Lathrop

face picon face
> I am using the ADC to measure the current consumption of a motor. At
normal
> load the motor pulls 9mA, at a full stall it pulls 40mA. I have attempted
to
> measure the voltage drop across a 0.1ohm resistor. (The resistor is placed
> between a FET (the motor is being driven by PWM) and the motor. I think
this
> could be wrong!?!?)
>
> I know the voltage drop across the resistor is small, so I amplified it,
and
> feed it into the internal ADC. I then output the 8 msb to 8 LEDs. The
value
> being read is however really noisy.

That makes sense because you are seeing your PWM signal in the current.  You
need to low pass filter the current sense signal.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\04\25@015901 by Roman Black

flavicon
face
Graham North wrote:
>
> Hi, thanks for the recent ADC help. I have now managed to get it working.
> But I have another problem.
>
> I am using the ADC to measure the current consumption of a motor. At normal
> load the motor pulls 9mA, at a full stall it pulls 40mA. I have attempted to
> measure the voltage drop across a 0.1ohm resistor. (The resistor is placed
> between a FET (the motor is being driven by PWM) and the motor. I think this
> could be wrong!?!?)
>
> I know the voltage drop across the resistor is small, so I amplified it, and
> feed it into the internal ADC. I then output the 8 msb to 8 LEDs. The value
> being read is however really noisy.
>


Hi Graham, looks like you're doing a few things wrong.
First, it's always easier to reference your current
sense resistor to gnd. So from top to bottom your circuit
should have:

V+ supply
motor
fet
series resistor
Gnd

Secondly, a dc motor is a nasty load to drive. You
absolutely need a flyback diode across the motor.
With PWM to the motor you may even need a special
high speed diode, especially if you expect to use
PWM over 5kHz.

Now it gets tricky, there are two ways to connect
the diode. If the diode is only across the motor and
does not include the sense R the R will not measure
average current. It will measure the peak current
and only when the fet is on. The rest of the current
will exist between the motor and diode, as current
decay when the fet is off.

To measure average current in the motor, and the only
way to get decent accuracy is to include the R in the
motor/diode path.

The best way to do this is:

v+ supply
fet
motor    } diode across both
sense R  } motor and R
Gnd

This means you need to use a fet at the top of
the circuit, maybe a p-channel. Heck for a 40mA
motor I don't know why you're not using a bipolar
transistor anyway.

Also using a 0.1 ohm R for a 40mA motor sounds
wrong. At full current you are only getting 4mV!!
Your system noise will be much more than that.
Assuming you don't need mega efficiencies I would
change that resistor to one that gives about 0.2v
or 0.4v for full current. What is your supply
voltage?

Then feed the output of the sense R into a RC
network to give average motor current.
Sorry for the long post, probably would have been
easier if you posted a circuit. :o)
-Roman

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2001\04\25@053754 by Michael Rigby-Jones

flavicon
face
I'm not surprised you are getting noise problems, a motor's current
consumption varies as the commutator rotates past the brushes.  You also say
the motor is being driven by PWM which means the current will be ramping up
and down at the PWM period. Firstly ensure you are using some kind of
flyback protection diode.  Secondly you need to low pass filter the voltage
developed accross your current sense resistor.  The corner frequency of your
low pass filter should be something of the order of ten times lower than the
PWM frequency.

You are correct about Vref.  However, there are limits to the voltages you
can use on Vref.  The 16F87x datasheet shows that Vref+ can have a value
between Vdd-2.5v and Vdd+0.3.  With a nominal 5 volt Vdd this limits you to
a Vref+ range of 2.5v to 5.3v.

40mA accross 0.1 ohms is only 40 mV.  You were presumably using Vdd as your
Vref which gives 5/1024 = 48mV resolution.  This means you will be seeing 1
bit change from no motor current to full stall current!  So, some kind of
amplification needed.  This is normally where a differential amplifier would
be used.

Hope this helps

Mike

> {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...