Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Weigh - Scale Firmware

Weigh - Scale Firmware

2007-10-09 by kernels_nz

Hi there, this one is out of left field a bit (Baseball phrase ???)
but im working on a weigh-scale project that uses a 24-bit ADC and I
was just wondering whether anyone had ever written a weigh-scale
module for a 8-bit micro controller.

Im just interested to see how all the calibration etc. for finding the
actual displayed weight from having 32 bit numbers representing the
Calibration Zero and Span values and the current ADC value. Is there a
way to do all the calculations without using floating point math? 

Cheers for any information!
Hein B - Auckland, New Zealand

Re: [AVR-Chat] Weigh - Scale Firmware

2007-10-09 by Roy E. Burrage

Is it 24 bit accuracy or 24 bit resolution?  At 24 bits, 1 part in 
almost 17 million...where do we get a reference that accurate with a 
reasonable cost suitable for a weigh scale product?

I suspect 12 bit accuracy would be plenty accurate for your application 
and you wouldn't have the thermal emf problems as with 24 bits.  Just 
throw the lower bits away after you average them into your equations.

On a regular basis here, we take data points and store them in a moving 
average filter.  There's a very good application note both from Atmel 
and at AVRFreaks which describes the process.  If it were me I'd use the 
upper 16 bits of your A/D converter, store those in 2 8 bit registers, 
add that to the 2 registers you have already set up for your averaging 
filter, add the overflow bit to another register set up for that 
purpose, and then after your predetermined number of sample points take 
an average.  It's as simple as that.

You'll also have to adjust the limits of your filter to allow for wind 
gusts or other vibration sources so they don't drive your gizmo wild.


REB

kernels_nz wrote:
Show quoted textHide quoted text
>Hi there, this one is out of left field a bit (Baseball phrase ???)
>but im working on a weigh-scale project that uses a 24-bit ADC and I
>was just wondering whether anyone had ever written a weigh-scale
>module for a 8-bit micro controller.
>
>Im just interested to see how all the calibration etc. for finding the
>actual displayed weight from having 32 bit numbers representing the
>Calibration Zero and Span values and the current ADC value. Is there a
>way to do all the calculations without using floating point math? 
>
>Cheers for any information!
>Hein B - Auckland, New Zealand
>  
>

Re: Weigh - Scale Firmware

2007-10-09 by kernels_nz

Hi Roy, generally you don't need a particularly accurate reference,
just one that doesn't vary with time and environmental factors. All
measurement is done relative to a "calibrated test weight", so scales
are calibrated and do not rely on the accuracy of the reference.

In practice the weigh scale manufacturers are trying to look at 1.5uV
changes in strain-bridge output with a 5V reference, so unfortunately
you do require around 3 million counts or 22 bits.

At low sample rates (10 s/s) and good analogue design 22 bits is not
too hard to achieve, it's all about using the right parts for the job.

All that stuff is comparatively easy, the bit thats got me a bit
worried is migrating the code from the existing 32-bit processor to a
baby AVR. I was hoping someone had done something similar and could
give me some advice on how to do the calibration routines without
using floating point math!

Cheers
Hein B
Auckland, New Zealand. 

--- In AVR-Chat@yahoogroups.com, "Roy E. Burrage" <RBurrage@...> wrote:
>
> Is it 24 bit accuracy or 24 bit resolution?  At 24 bits, 1 part in 
> almost 17 million...where do we get a reference that accurate with a 
> reasonable cost suitable for a weigh scale product?
> 
> I suspect 12 bit accuracy would be plenty accurate for your application 
> and you wouldn't have the thermal emf problems as with 24 bits.  Just 
> throw the lower bits away after you average them into your equations.
> 
> On a regular basis here, we take data points and store them in a moving 
> average filter.  There's a very good application note both from Atmel 
> and at AVRFreaks which describes the process.  If it were me I'd use
the 
Show quoted textHide quoted text
> upper 16 bits of your A/D converter, store those in 2 8 bit registers, 
> add that to the 2 registers you have already set up for your averaging 
> filter, add the overflow bit to another register set up for that 
> purpose, and then after your predetermined number of sample points take 
> an average.  It's as simple as that.
> 
> You'll also have to adjust the limits of your filter to allow for wind 
> gusts or other vibration sources so they don't drive your gizmo wild.
> 
> 
> REB
> 
> kernels_nz wrote:
> 
> >Hi there, this one is out of left field a bit (Baseball phrase ???)
> >but im working on a weigh-scale project that uses a 24-bit ADC and I
> >was just wondering whether anyone had ever written a weigh-scale
> >module for a 8-bit micro controller.
> >
> >Im just interested to see how all the calibration etc. for finding the
> >actual displayed weight from having 32 bit numbers representing the
> >Calibration Zero and Span values and the current ADC value. Is there a
> >way to do all the calculations without using floating point math? 
> >
> >Cheers for any information!
> >Hein B - Auckland, New Zealand
> >  
> >
>

Re: Weigh - Scale Firmware

2007-10-09 by Graham Davies

--- In AVR-Chat@yahoogroups.com, "kernels_nz" <kernels@...> wrote:
>
> ... low sample rates (10 s/s) ...
> ... the bit thats got me a bit
> worried is migrating the code
> from the existing 32-bit processor
> to a baby AVR.

At such a low sample rate, why not stick with the floating point?  Or, 
at least run some kind of test to find out if it's possible.

Graham.

Re: Weigh - Scale Firmware

2007-10-09 by kernels_nz

Hi Graham,

Yeah, im thinking that thats probably the best way to go, I wasnt so
much worried about speed as that I dont yet have a lot of faith in the
compiler dealing with floating point numbers on the 8-bit processor. I
did get an excellent reply on the Atmel ARM forum from a guy that had
obviously done this before and he did provide me with what looks like
a good routine to do the scale calibration and weight calculation with
only integer math. Ill work through it tonight and report back
tomorrow if it works!

Thanks for the reply!
Cheers
Hein B
Auckland, New Zeland

--- In AVR-Chat@yahoogroups.com, "Graham Davies" <Yahoo37849@...> wrote:
Show quoted textHide quoted text
>
> --- In AVR-Chat@yahoogroups.com, "kernels_nz" <kernels@> wrote:
> >
> > ... low sample rates (10 s/s) ...
> > ... the bit thats got me a bit
> > worried is migrating the code
> > from the existing 32-bit processor
> > to a baby AVR.
> 
> At such a low sample rate, why not stick with the floating point?  Or, 
> at least run some kind of test to find out if it's possible.
> 
> Graham.
>

Re: Weigh - Scale Firmware

2007-10-10 by kernels_nz

Hi Tom,

Im still having nightmares from my uni days when I tried to do some
32-bit multiplication and division on a AVR with the Codevision
compiler and completely gave up on it. Since then I have always tried
my best to avoid floating point and "long int" math on the AVR, but I
think in this case Ill have to try it again.

It's been quite a few years since then, so im sure the majority of
problems will have been solved. Will try it tonight and report back.

Cheers
Hein B
Auckland, New Zealand

--- In AVR-Chat@yahoogroups.com, Thomas Keller <tjkeller1@...> wrote:
>
>   Oh. come on.   Unless you're using an AVR that hasn't got sufficient 
> resources,
> doing fractional math is no problem. Any of the available C compilers 
> will do a
> fine job of floating point, or fixed point math for you.
> 
>   Indeed, I saw some assembly language fixed point7.8 mat routines that 
> would
> probably be more than serviceable for this application on
avrFreaks.org, 
> just
> yesterday.
> 
> tom
> 
> kernels_nz wrote:
> >
> > Hi Graham,
> >
> > Yeah, im thinking that thats probably the best way to go, I wasnt so
> > much worried about speed as that I dont yet have a lot of faith in the
> > compiler dealing with floating point numbers on the 8-bit processor. I
> > did get an excellent reply on the Atmel ARM forum from a guy that had
> > obviously done this before and he did provide me with what looks like
> > a good routine to do the scale calibration and weight calculation with
> > only integer math. Ill work through it tonight and report back
> > tomorrow if it works!
> >
> > Thanks for the reply!
> > Cheers
> > Hein B
> > Auckland, New Zeland
> >
> > --- In AVR-Chat@yahoogroups.com <mailto:AVR-Chat%40yahoogroups.com>, 
> > "Graham Davies" <Yahoo37849@> wrote:
> > >
> > > --- In AVR-Chat@yahoogroups.com
<mailto:AVR-Chat%40yahoogroups.com>, 
> > "kernels_nz" <kernels@> wrote:
> > > >
> > > > ... low sample rates (10 s/s) ...
> > > > ... the bit thats got me a bit
> > > > worried is migrating the code
> > > > from the existing 32-bit processor
> > > > to a baby AVR.
> > >
> > > At such a low sample rate, why not stick with the floating
point? Or,
Show quoted textHide quoted text
> > > at least run some kind of test to find out if it's possible.
> > >
> > > Graham.
> > >
> >
> >
>

Re: [AVR-Chat] Re: Weigh - Scale Firmware

2007-10-10 by Thomas Keller

Oh. come on.   Unless you're using an AVR that hasn't got sufficient 
resources,
doing fractional math is no problem. Any of the available C compilers 
will do a
fine job of floating point, or fixed point math for you.

  Indeed, I saw some assembly language fixed point7.8 mat routines that 
would
probably be more than serviceable for this application on avrFreaks.org, 
just
yesterday.

tom

kernels_nz wrote:
Show quoted textHide quoted text
>
> Hi Graham,
>
> Yeah, im thinking that thats probably the best way to go, I wasnt so
> much worried about speed as that I dont yet have a lot of faith in the
> compiler dealing with floating point numbers on the 8-bit processor. I
> did get an excellent reply on the Atmel ARM forum from a guy that had
> obviously done this before and he did provide me with what looks like
> a good routine to do the scale calibration and weight calculation with
> only integer math. Ill work through it tonight and report back
> tomorrow if it works!
>
> Thanks for the reply!
> Cheers
> Hein B
> Auckland, New Zeland
>
> --- In AVR-Chat@yahoogroups.com <mailto:AVR-Chat%40yahoogroups.com>, 
> "Graham Davies" <Yahoo37849@...> wrote:
> >
> > --- In AVR-Chat@yahoogroups.com <mailto:AVR-Chat%40yahoogroups.com>, 
> "kernels_nz" <kernels@> wrote:
> > >
> > > ... low sample rates (10 s/s) ...
> > > ... the bit thats got me a bit
> > > worried is migrating the code
> > > from the existing 32-bit processor
> > > to a baby AVR.
> >
> > At such a low sample rate, why not stick with the floating point? Or,
> > at least run some kind of test to find out if it's possible.
> >
> > Graham.
> >
>
>

Re: [AVR-Chat] Re: Weigh - Scale Firmware

2007-10-10 by Roy E. Burrage

We do a little bit with measurement here, Hein.

       www.measuretech-tn.com

My experience has been that a scale, most mechanical measuring devices 
for that matter, aren't very accurate below 10% to 20% of their full 
scale range.  A set of ANSI Class 1 calibration weights is only accurate 
to something on the order of 0.25%, so how many bits does that equate 
to?  Transfer accuracy is, at best, 2:1 with 4:1 recommended...and 10:1 
optimum.  So where does that leave your bit resolution to accuracy 
ratio?  10 bit accuracy is better than this 0.25% and averaging can 
easily give you 12 to 14 bits of resolution if your A/D converter is 
linear enough.

You may be trying to resolve a couple of microvolts, but that certainly 
is only going to be right at the load cell.  Most load cell outputs are 
something on the order of 10mv to 20mV.  I suspect your 5 volt signal is 
after amplification local to the load cell to prevent thermal emfs from 
swamping out load cell output changes.  Look at the mV/degree change of 
a type T (copper/constantan, constantan being a copper alloy) 
thermocouple some time.  How many thermocouple junctions would you have 
from a load cell, a 20 foot run of cable, then some electronics?  Don't 
miscount your junctions or get dissimilar metals in there.

Make sure you aren't confusing resolution and stability with accuracy.  
There is a big difference in the 2.


REB




kernels_nz wrote:

>Hi Roy, generally you don't need a particularly accurate reference,
>just one that doesn't vary with time and environmental factors. All
>measurement is done relative to a "calibrated test weight", so scales
>are calibrated and do not rely on the accuracy of the reference.
>
>In practice the weigh scale manufacturers are trying to look at 1.5uV
>changes in strain-bridge output with a 5V reference, so unfortunately
>you do require around 3 million counts or 22 bits.
>
>At low sample rates (10 s/s) and good analogue design 22 bits is not
>too hard to achieve, it's all about using the right parts for the job.
>
>All that stuff is comparatively easy, the bit thats got me a bit
>worried is migrating the code from the existing 32-bit processor to a
>baby AVR. I was hoping someone had done something similar and could
>give me some advice on how to do the calibration routines without
>using floating point math!
>
>Cheers
>Hein B
>Auckland, New Zealand. 
>
>--- In AVR-Chat@yahoogroups.com, "Roy E. Burrage" <RBurrage@...> wrote:
>  
>
>>Is it 24 bit accuracy or 24 bit resolution?  At 24 bits, 1 part in 
>>almost 17 million...where do we get a reference that accurate with a 
>>reasonable cost suitable for a weigh scale product?
>>
>>I suspect 12 bit accuracy would be plenty accurate for your application 
>>and you wouldn't have the thermal emf problems as with 24 bits.  Just 
>>throw the lower bits away after you average them into your equations.
>>
>>On a regular basis here, we take data points and store them in a moving 
>>average filter.  There's a very good application note both from Atmel 
>>and at AVRFreaks which describes the process.  If it were me I'd use
>>    
>>
>the 
>  
>
>>upper 16 bits of your A/D converter, store those in 2 8 bit registers, 
>>add that to the 2 registers you have already set up for your averaging 
>>filter, add the overflow bit to another register set up for that 
>>purpose, and then after your predetermined number of sample points take 
>>an average.  It's as simple as that.
>>
>>You'll also have to adjust the limits of your filter to allow for wind 
>>gusts or other vibration sources so they don't drive your gizmo wild.
>>
>>
>>REB
>>
>>kernels_nz wrote:
>>
>>    
>>
>>>Hi there, this one is out of left field a bit (Baseball phrase ???)
>>>but im working on a weigh-scale project that uses a 24-bit ADC and I
>>>was just wondering whether anyone had ever written a weigh-scale
>>>module for a 8-bit micro controller.
>>>
>>>Im just interested to see how all the calibration etc. for finding the
>>>actual displayed weight from having 32 bit numbers representing the
>>>Calibration Zero and Span values and the current ADC value. Is there a
>>>way to do all the calculations without using floating point math? 
>>>
>>>Cheers for any information!
>>>Hein B - Auckland, New Zealand
>>>


[Non-text portions of this message have been removed]

Re: Weigh - Scale Firmware

2007-10-10 by kernels_nz

Hi Rob, 

Wow, I see to be generating a bit of interest with what I viewed as a
pretty simple problem. Firstly, in practice, every trade-approved
weigh-scale that ive seen so far has used at least a 24-bit A2D
converter. The load-cells are completely passive, they are merely a
wheatstone bridge made up of four strain guages. Thus, to get 10 000
divisions from a 3mv/v load-cell with 5v excitation (15mv full scale)
output, you need 15mv / 10000 = 1.5uv resolution in your measurement
system. In reality im only looking for 3000 divisions (for trade
approved weighing), but as you stated, I need some head-room.

I would imagine that weighing systems get around the thermocouple
junction effects by running a low impedance system, load-cells are
only 300 OHM impedance. Im not sure what the reason is, but I worked
in the weighing industry for a couple of years and never had any
problem with "junctions". The 15mv can be measured at the input to the
ADC chip, most good digital weight indicators dont use any
amplification of the signal anywhere, I guess the more amplification
you have along the way the more likely you are to introduce noise. 

Yes, the number of noise free bits required would be way less if my
full-scale output voltage was closer to the reference voltage, but in
all of the scale circuits ive studied, the excitation voltage for the
load-cell is fed straight into the reference of the ADC, this then
compensates the ADC for any changes in excitation voltage. This also
means a reference voltage of 5V with a full scale signal of around
15-20mv!

The Class 3 test weights used for weights and measures tests are
accurate to 10mg in 1kg, thats way more than 0.25%, I think a
weights-and-measures inspector would laugh at me if I suggested he
used 0.25% test weights to check our equipment. Im not even sure 0.25%
weights could be sold, thats 2.5g in 1kg, ridiculous.

But alas, designing the analogue part of this system will merely be a
copy and paste operation from earlier model weigh-scales - no problem.
The bit thats got me thinking is what the best way is to do the
software calibration on a 8-bit micro controller. The one currently
used is 32 bit with a proper floating point module, and deals with the
math no-problem. I was really fishing for some integer-math-only way
of doing the calibration code and luckily one guy on the Atmel ARM
forum has given me some good pointers, so it looks like it should be
possible. The other option of course is biting the bullet and just
doing the floating point math!

Cheers
Hein B
Auckland, New Zealand



--- In AVR-Chat@yahoogroups.com, "Roy E. Burrage" <RBurrage@...> wrote:
>
> We do a little bit with measurement here, Hein.
> 
>        www.measuretech-tn.com
> 
> My experience has been that a scale, most mechanical measuring devices 
> for that matter, aren't very accurate below 10% to 20% of their full 
> scale range.  A set of ANSI Class 1 calibration weights is only
accurate 
> to something on the order of 0.25%, so how many bits does that equate 
> to?  Transfer accuracy is, at best, 2:1 with 4:1 recommended...and 10:1 
> optimum.  So where does that leave your bit resolution to accuracy 
> ratio?  10 bit accuracy is better than this 0.25% and averaging can 
> easily give you 12 to 14 bits of resolution if your A/D converter is 
> linear enough.
> 
> You may be trying to resolve a couple of microvolts, but that certainly 
> is only going to be right at the load cell.  Most load cell outputs are 
> something on the order of 10mv to 20mV.  I suspect your 5 volt
signal is 
> after amplification local to the load cell to prevent thermal emfs from 
> swamping out load cell output changes.  Look at the mV/degree change of 
> a type T (copper/constantan, constantan being a copper alloy) 
> thermocouple some time.  How many thermocouple junctions would you have 
> from a load cell, a 20 foot run of cable, then some electronics?  Don't 
> miscount your junctions or get dissimilar metals in there.
> 
> Make sure you aren't confusing resolution and stability with accuracy.  
> There is a big difference in the 2.
> 
> 
> REB
> 
> 
> 
> 
> kernels_nz wrote:
> 
> >Hi Roy, generally you don't need a particularly accurate reference,
> >just one that doesn't vary with time and environmental factors. All
> >measurement is done relative to a "calibrated test weight", so scales
> >are calibrated and do not rely on the accuracy of the reference.
> >
> >In practice the weigh scale manufacturers are trying to look at 1.5uV
> >changes in strain-bridge output with a 5V reference, so unfortunately
> >you do require around 3 million counts or 22 bits.
> >
> >At low sample rates (10 s/s) and good analogue design 22 bits is not
> >too hard to achieve, it's all about using the right parts for the job.
> >
> >All that stuff is comparatively easy, the bit thats got me a bit
> >worried is migrating the code from the existing 32-bit processor to a
> >baby AVR. I was hoping someone had done something similar and could
> >give me some advice on how to do the calibration routines without
> >using floating point math!
> >
> >Cheers
> >Hein B
> >Auckland, New Zealand. 
> >
> >--- In AVR-Chat@yahoogroups.com, "Roy E. Burrage" <RBurrage@> wrote:
> >  
> >
> >>Is it 24 bit accuracy or 24 bit resolution?  At 24 bits, 1 part in 
> >>almost 17 million...where do we get a reference that accurate with a 
> >>reasonable cost suitable for a weigh scale product?
> >>
> >>I suspect 12 bit accuracy would be plenty accurate for your
application 
> >>and you wouldn't have the thermal emf problems as with 24 bits.  Just 
> >>throw the lower bits away after you average them into your equations.
> >>
> >>On a regular basis here, we take data points and store them in a
moving 
> >>average filter.  There's a very good application note both from Atmel 
> >>and at AVRFreaks which describes the process.  If it were me I'd use
> >>    
> >>
> >the 
> >  
> >
> >>upper 16 bits of your A/D converter, store those in 2 8 bit
registers, 
> >>add that to the 2 registers you have already set up for your
averaging 
> >>filter, add the overflow bit to another register set up for that 
> >>purpose, and then after your predetermined number of sample points
take 
> >>an average.  It's as simple as that.
> >>
> >>You'll also have to adjust the limits of your filter to allow for
wind 
> >>gusts or other vibration sources so they don't drive your gizmo wild.
> >>
> >>
> >>REB
> >>
> >>kernels_nz wrote:
> >>
> >>    
> >>
> >>>Hi there, this one is out of left field a bit (Baseball phrase ???)
> >>>but im working on a weigh-scale project that uses a 24-bit ADC and I
> >>>was just wondering whether anyone had ever written a weigh-scale
> >>>module for a 8-bit micro controller.
> >>>
> >>>Im just interested to see how all the calibration etc. for
finding the
> >>>actual displayed weight from having 32 bit numbers representing the
> >>>Calibration Zero and Span values and the current ADC value. Is
there a
Show quoted textHide quoted text
> >>>way to do all the calculations without using floating point math? 
> >>>
> >>>Cheers for any information!
> >>>Hein B - Auckland, New Zealand
> >>>
> 
> 
> [Non-text portions of this message have been removed]
>

Re: [AVR-Chat] Re: Weigh - Scale Firmware

2007-10-10 by Russell Shaw

kernels_nz wrote:
> Hi Rob, 
> 
> Wow, I see to be generating a bit of interest with what I viewed as a
> pretty simple problem. Firstly, in practice, every trade-approved
> weigh-scale that ive seen so far has used at least a 24-bit A2D
> converter. The load-cells are completely passive, they are merely a
> wheatstone bridge made up of four strain guages. Thus, to get 10 000
> divisions from a 3mv/v load-cell with 5v excitation (15mv full scale)
> output, you need 15mv / 10000 = 1.5uv resolution in your measurement
> system. In reality im only looking for 3000 divisions (for trade
> approved weighing), but as you stated, I need some head-room.

If the bridge is 15mV FSD, you should amplify it 100 so you get
more resolution.

Re: [AVR-Chat] Re: Weigh - Scale Firmware

2007-10-10 by Roy E. Burrage

It appears that most of the scale circuits you've seen are the result of 
some digital guy messing around in my world...analog.  Do it your way.  
It's unfortunate that specsmanship is becoming the norm rather than the 
exception any more, and an understanding of both conversion techniques 
and interface circuitry is becoming a lost art.

Spec for class 1 weights is 25 mg. at 1 kg, that's true and you did your 
math properly.  However, yours may be calibrated to tighter tolerances 
but how well do they maintain that accuracy with changes in temperature 
and humidity?  There's a reason we certify equipment to tighter 
tolerances than what the specification requires.

Thermal emf errors are not necessarily line impedance related.  How much 
lower resistance can a line be than 2 hunks of wire welded together?

There are a lot of methods that can be used to get around a potential 
noise problem.  It sounds like most of your "trade approved" scales are 
just using an expensive A/D converter to avoid a little analog design work.

Good luck on your project.


REB



kernels_nz wrote:

>Hi Rob, 
>
>Wow, I see to be generating a bit of interest with what I viewed as a
>pretty simple problem. Firstly, in practice, every trade-approved
>weigh-scale that ive seen so far has used at least a 24-bit A2D
>converter. The load-cells are completely passive, they are merely a
>wheatstone bridge made up of four strain guages. Thus, to get 10 000
>divisions from a 3mv/v load-cell with 5v excitation (15mv full scale)
>output, you need 15mv / 10000 = 1.5uv resolution in your measurement
>system. In reality im only looking for 3000 divisions (for trade
>approved weighing), but as you stated, I need some head-room.
>
>I would imagine that weighing systems get around the thermocouple
>junction effects by running a low impedance system, load-cells are
>only 300 OHM impedance. Im not sure what the reason is, but I worked
>in the weighing industry for a couple of years and never had any
>problem with "junctions". The 15mv can be measured at the input to the
>ADC chip, most good digital weight indicators dont use any
>amplification of the signal anywhere, I guess the more amplification
>you have along the way the more likely you are to introduce noise. 
>
>Yes, the number of noise free bits required would be way less if my
>full-scale output voltage was closer to the reference voltage, but in
>all of the scale circuits ive studied, the excitation voltage for the
>load-cell is fed straight into the reference of the ADC, this then
>compensates the ADC for any changes in excitation voltage. This also
>means a reference voltage of 5V with a full scale signal of around
>15-20mv!
>
>The Class 3 test weights used for weights and measures tests are
>accurate to 10mg in 1kg, thats way more than 0.25%, I think a
>weights-and-measures inspector would laugh at me if I suggested he
>used 0.25% test weights to check our equipment. Im not even sure 0.25%
>weights could be sold, thats 2.5g in 1kg, ridiculous.
>
>But alas, designing the analogue part of this system will merely be a
>copy and paste operation from earlier model weigh-scales - no problem.
>The bit thats got me thinking is what the best way is to do the
>software calibration on a 8-bit micro controller. The one currently
>used is 32 bit with a proper floating point module, and deals with the
>math no-problem. I was really fishing for some integer-math-only way
>of doing the calibration code and luckily one guy on the Atmel ARM
>forum has given me some good pointers, so it looks like it should be
>possible. The other option of course is biting the bullet and just
>doing the floating point math!
>
>Cheers
>Hein B
>Auckland, New Zealand
>
>
>
>--- In AVR-Chat@yahoogroups.com, "Roy E. Burrage" <RBurrage@...> wrote:
>  
>
>>We do a little bit with measurement here, Hein.
>>
>>       www.measuretech-tn.com
>>
>>My experience has been that a scale, most mechanical measuring devices 
>>for that matter, aren't very accurate below 10% to 20% of their full 
>>scale range.  A set of ANSI Class 1 calibration weights is only
>>    
>>
>accurate 
>  
>
>>to something on the order of 0.25%, so how many bits does that equate 
>>to?  Transfer accuracy is, at best, 2:1 with 4:1 recommended...and 10:1 
>>optimum.  So where does that leave your bit resolution to accuracy 
>>ratio?  10 bit accuracy is better than this 0.25% and averaging can 
>>easily give you 12 to 14 bits of resolution if your A/D converter is 
>>linear enough.
>>
>>You may be trying to resolve a couple of microvolts, but that certainly 
>>is only going to be right at the load cell.  Most load cell outputs are 
>>something on the order of 10mv to 20mV.  I suspect your 5 volt
>>    
>>
>signal is 
>  
>
>>after amplification local to the load cell to prevent thermal emfs from 
>>swamping out load cell output changes.  Look at the mV/degree change of 
>>a type T (copper/constantan, constantan being a copper alloy) 
>>thermocouple some time.  How many thermocouple junctions would you have 
>>from a load cell, a 20 foot run of cable, then some electronics?  Don't 
>>miscount your junctions or get dissimilar metals in there.
>>
>>Make sure you aren't confusing resolution and stability with accuracy.  
>>There is a big difference in the 2.
>>
>>
>>REB
>>
>>
>>
>>
>>kernels_nz wrote:
>>
>>    
>>
>>>Hi Roy, generally you don't need a particularly accurate reference,
>>>just one that doesn't vary with time and environmental factors. All
>>>measurement is done relative to a "calibrated test weight", so scales
>>>are calibrated and do not rely on the accuracy of the reference.
>>>
>>>In practice the weigh scale manufacturers are trying to look at 1.5uV
>>>changes in strain-bridge output with a 5V reference, so unfortunately
>>>you do require around 3 million counts or 22 bits.
>>>
>>>At low sample rates (10 s/s) and good analogue design 22 bits is not
>>>too hard to achieve, it's all about using the right parts for the job.
>>>
>>>All that stuff is comparatively easy, the bit thats got me a bit
>>>worried is migrating the code from the existing 32-bit processor to a
>>>baby AVR. I was hoping someone had done something similar and could
>>>give me some advice on how to do the calibration routines without
>>>using floating point math!
>>>
>>>Cheers
>>>Hein B
>>>Auckland, New Zealand. 
>>>
>>>--- In AVR-Chat@yahoogroups.com, "Roy E. Burrage" <RBurrage@> wrote:
>>> 
>>>
>>>      
>>>
>>>>Is it 24 bit accuracy or 24 bit resolution?  At 24 bits, 1 part in 
>>>>almost 17 million...where do we get a reference that accurate with a 
>>>>reasonable cost suitable for a weigh scale product?
>>>>
>>>>I suspect 12 bit accuracy would be plenty accurate for your
>>>>        
>>>>
>application 
>  
>
>>>>and you wouldn't have the thermal emf problems as with 24 bits.  Just 
>>>>throw the lower bits away after you average them into your equations.
>>>>
>>>>On a regular basis here, we take data points and store them in a
>>>>        
>>>>
>moving 
>  
>
>>>>average filter.  There's a very good application note both from Atmel 
>>>>and at AVRFreaks which describes the process.  If it were me I'd use
>>>>   
>>>>
>>>>        
>>>>
>>>the 
>>> 
>>>
>>>      
>>>
>>>>upper 16 bits of your A/D converter, store those in 2 8 bit
>>>>        
>>>>
>registers, 
>  
>
>>>>add that to the 2 registers you have already set up for your
>>>>        
>>>>
>averaging 
>  
>
>>>>filter, add the overflow bit to another register set up for that 
>>>>purpose, and then after your predetermined number of sample points
>>>>        
>>>>
>take 
>  
>
>>>>an average.  It's as simple as that.
>>>>
>>>>You'll also have to adjust the limits of your filter to allow for
>>>>        
>>>>
>wind 
>  
>
>>>>gusts or other vibration sources so they don't drive your gizmo wild.
>>>>
>>>>
>>>>REB
>>>>
>>>>kernels_nz wrote:
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>Hi there, this one is out of left field a bit (Baseball phrase ???)
>>>>>but im working on a weigh-scale project that uses a 24-bit ADC and I
>>>>>was just wondering whether anyone had ever written a weigh-scale
>>>>>module for a 8-bit micro controller.
>>>>>
>>>>>Im just interested to see how all the calibration etc. for
>>>>>          
>>>>>
>finding the
>  
>
>>>>>actual displayed weight from having 32 bit numbers representing the
>>>>>Calibration Zero and Span values and the current ADC value. Is
>>>>>          
>>>>>
>there a
>  
>
>>>>>way to do all the calculations without using floating point math? 
>>>>>
>>>>>Cheers for any information!
>>>>>Hein B - Auckland, New Zealand
>>>>>
>>>>>          
>>>>>
>>[Non-text portions of this message have been removed]
>>
>>    
>>
>
>
>
>
> 
>Yahoo! Groups Links
>
>
>
>
>
>  
>


[Non-text portions of this message have been removed]

RE: [AVR-Chat] Re: Weigh - Scale Firmware

2007-10-10 by larry barello

You can use fixed point math.  For example, treat a 32 bit number as 24.8
bits.  You can work through the math to get the rules: add and subtract
numbers.  Right shift 8 when you want the results.  Fixed point routines can
be faster than floating point, but the real gain is in potential accuracy
and resolution.  For lots of pointers/examples Google "fixed point binary
math".

OTOH, if getting quick low NRE results is the goal, switch to GCC and use
it's very impressive floating point library.  The cycle count for doing
floating point operations is roughly equivalent to 32 bit math mult/div
operations.  Naturally, transcendental functions take longer...  It doesn't
even cost much in code space ~1kb.  One still needs to keep in mind the
limitations of FP to make sure you don't build in errors into your
calculations.

For the AVR I estimate ~1.6 kflops/mhz for general purpose stuff (add/mul).
Show quoted textHide quoted text
-----Original Message-----
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of kernels_nz
Sent: Wednesday, October 10, 2007 4:51 AM
To: AVR-Chat@yahoogroups.com
Subject: [AVR-Chat] Re: Weigh - Scale Firmware

Hi Rob, 

Wow, I see to be generating a bit of interest with what I viewed as a
pretty simple problem. Firstly, in practice, every trade-approved
weigh-scale that ive seen so far has used at least a 24-bit A2D
converter. The load-cells are completely passive, they are merely a
wheatstone bridge made up of four strain guages. Thus, to get 10 000
divisions from a 3mv/v load-cell with 5v excitation (15mv full scale)
output, you need 15mv / 10000 = 1.5uv resolution in your measurement
system. In reality im only looking for 3000 divisions (for trade
approved weighing), but as you stated, I need some head-room.

I would imagine that weighing systems get around the thermocouple
junction effects by running a low impedance system, load-cells are
only 300 OHM impedance. Im not sure what the reason is, but I worked
in the weighing industry for a couple of years and never had any
problem with "junctions". The 15mv can be measured at the input to the
ADC chip, most good digital weight indicators dont use any
amplification of the signal anywhere, I guess the more amplification
you have along the way the more likely you are to introduce noise. 

Yes, the number of noise free bits required would be way less if my
full-scale output voltage was closer to the reference voltage, but in
all of the scale circuits ive studied, the excitation voltage for the
load-cell is fed straight into the reference of the ADC, this then
compensates the ADC for any changes in excitation voltage. This also
means a reference voltage of 5V with a full scale signal of around
15-20mv!

The Class 3 test weights used for weights and measures tests are
accurate to 10mg in 1kg, thats way more than 0.25%, I think a
weights-and-measures inspector would laugh at me if I suggested he
used 0.25% test weights to check our equipment. Im not even sure 0.25%
weights could be sold, thats 2.5g in 1kg, ridiculous.

But alas, designing the analogue part of this system will merely be a
copy and paste operation from earlier model weigh-scales - no problem.
The bit thats got me thinking is what the best way is to do the
software calibration on a 8-bit micro controller. The one currently
used is 32 bit with a proper floating point module, and deals with the
math no-problem. I was really fishing for some integer-math-only way
of doing the calibration code and luckily one guy on the Atmel ARM
forum has given me some good pointers, so it looks like it should be
possible. The other option of course is biting the bullet and just
doing the floating point math!

Cheers
Hein B
Auckland, New Zealand



--- In AVR-Chat@yahoogroups.com, "Roy E. Burrage" <RBurrage@...> wrote:
>
> We do a little bit with measurement here, Hein.
> 
>        www.measuretech-tn.com
> 
> My experience has been that a scale, most mechanical measuring devices 
> for that matter, aren't very accurate below 10% to 20% of their full 
> scale range.  A set of ANSI Class 1 calibration weights is only
accurate 
> to something on the order of 0.25%, so how many bits does that equate 
> to?  Transfer accuracy is, at best, 2:1 with 4:1 recommended...and 10:1 
> optimum.  So where does that leave your bit resolution to accuracy 
> ratio?  10 bit accuracy is better than this 0.25% and averaging can 
> easily give you 12 to 14 bits of resolution if your A/D converter is 
> linear enough.
> 
> You may be trying to resolve a couple of microvolts, but that certainly 
> is only going to be right at the load cell.  Most load cell outputs are 
> something on the order of 10mv to 20mV.  I suspect your 5 volt
signal is 
> after amplification local to the load cell to prevent thermal emfs from 
> swamping out load cell output changes.  Look at the mV/degree change of 
> a type T (copper/constantan, constantan being a copper alloy) 
> thermocouple some time.  How many thermocouple junctions would you have 
> from a load cell, a 20 foot run of cable, then some electronics?  Don't 
> miscount your junctions or get dissimilar metals in there.
> 
> Make sure you aren't confusing resolution and stability with accuracy.  
> There is a big difference in the 2.
> 
> 
> REB
> 
> 
> 
> 
> kernels_nz wrote:
> 
> >Hi Roy, generally you don't need a particularly accurate reference,
> >just one that doesn't vary with time and environmental factors. All
> >measurement is done relative to a "calibrated test weight", so scales
> >are calibrated and do not rely on the accuracy of the reference.
> >
> >In practice the weigh scale manufacturers are trying to look at 1.5uV
> >changes in strain-bridge output with a 5V reference, so unfortunately
> >you do require around 3 million counts or 22 bits.
> >
> >At low sample rates (10 s/s) and good analogue design 22 bits is not
> >too hard to achieve, it's all about using the right parts for the job.
> >
> >All that stuff is comparatively easy, the bit thats got me a bit
> >worried is migrating the code from the existing 32-bit processor to a
> >baby AVR. I was hoping someone had done something similar and could
> >give me some advice on how to do the calibration routines without
> >using floating point math!
> >
> >Cheers
> >Hein B
> >Auckland, New Zealand. 
> >
> >--- In AVR-Chat@yahoogroups.com, "Roy E. Burrage" <RBurrage@> wrote:
> >  
> >
> >>Is it 24 bit accuracy or 24 bit resolution?  At 24 bits, 1 part in 
> >>almost 17 million...where do we get a reference that accurate with a 
> >>reasonable cost suitable for a weigh scale product?
> >>
> >>I suspect 12 bit accuracy would be plenty accurate for your
application 
> >>and you wouldn't have the thermal emf problems as with 24 bits.  Just 
> >>throw the lower bits away after you average them into your equations.
> >>
> >>On a regular basis here, we take data points and store them in a
moving 
> >>average filter.  There's a very good application note both from Atmel 
> >>and at AVRFreaks which describes the process.  If it were me I'd use
> >>    
> >>
> >the 
> >  
> >
> >>upper 16 bits of your A/D converter, store those in 2 8 bit
registers, 
> >>add that to the 2 registers you have already set up for your
averaging 
> >>filter, add the overflow bit to another register set up for that 
> >>purpose, and then after your predetermined number of sample points
take 
> >>an average.  It's as simple as that.
> >>
> >>You'll also have to adjust the limits of your filter to allow for
wind 
> >>gusts or other vibration sources so they don't drive your gizmo wild.
> >>
> >>
> >>REB
> >>
> >>kernels_nz wrote:
> >>
> >>    
> >>
> >>>Hi there, this one is out of left field a bit (Baseball phrase ???)
> >>>but im working on a weigh-scale project that uses a 24-bit ADC and I
> >>>was just wondering whether anyone had ever written a weigh-scale
> >>>module for a 8-bit micro controller.
> >>>
> >>>Im just interested to see how all the calibration etc. for
finding the
> >>>actual displayed weight from having 32 bit numbers representing the
> >>>Calibration Zero and Span values and the current ADC value. Is
there a
> >>>way to do all the calculations without using floating point math? 
> >>>
> >>>Cheers for any information!
> >>>Hein B - Auckland, New Zealand
> >>>
> 
> 
> [Non-text portions of this message have been removed]
>




 
Yahoo! Groups Links

Re: {Disarmed} [AVR-Chat] Re: Weigh - Scale Firmware

2007-10-10 by Manuel Gonzalez

Would you provide us with that routine? I'm very interested!

Thanks,

    Manuel Gonzalez


> Hi Graham,
>
> Yeah, im thinking that thats probably the best way to go, I wasnt so
> much worried about speed as that I dont yet have a lot of faith in the
> compiler dealing with floating point numbers on the 8-bit processor. I
> did get an excellent reply on the Atmel ARM forum from a guy that had
> obviously done this before and he did provide me with what looks like
> a good routine to do the scale calibration and weight calculation with
> only integer math. Ill work through it tonight and report back
> tomorrow if it works!
>
> Thanks for the reply!
> Cheers
> Hein B
> Auckland, New Zeland
>
> --- In AVR-Chat@yahoogroups.com, "Graham Davies" <Yahoo37849@...> wrote:
>>
>> --- In AVR-Chat@yahoogroups.com, "kernels_nz" <kernels@> wrote:
>> >
>> > ... low sample rates (10 s/s) ...
>> > ... the bit thats got me a bit
>> > worried is migrating the code
>> > from the existing 32-bit processor
>> > to a baby AVR.
>>
>> At such a low sample rate, why not stick with the floating point?  Or,
>> at least run some kind of test to find out if it's possible.
>>
>> Graham.
>>
>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Re: Weigh - Scale Firmware

2007-10-11 by Graham Davies

--- In AVR-Chat@yahoogroups.com, "kernels_nz" <kernels@...> wrote:

> Wow, I see to be generating a bit of interest ...

Although I share Roy's distaste for allowing the wrong skill set to 
control a design approach, I can see reasons why what Hein describes 
could be optimum.  I think we're looking not only to resolve 10,000 
steps in 15 mV, but to have comparable total accuracy also.  Or, if 
we're going to calibrate, at least have sources of inaccuracy that are 
constant and stable in between calibrations.  So, to amplify the 
signal, and thus allow a less accurate A-to-D to be used, we'd need 
around 0.01% accuracy in the amplifier.  I'm not saying that can't be 
done, but that's not the question.  Can it be done more cheaply that 
using a mass-market delta-sigma A-to-D converter?  The accuracy of 
these converters is pretty much guaranteed by the conversion 
technique.  Using the load cell excitation voltage as the reference and 
having no analog gain eliminates a whole raft of error sources.  I 
think this is the right approach.

Also, I think the thermocouple effects are a red herring.  Indeed, you 
can't mitigate with low impedance because the source is low impedance.  
But it is normal to use wiring with the same material on the signal and 
ground side (or the two sides of a differential connection), not the 
differing materials of a thermocouple junction.  You're also not going 
to use materials chosen to produce the maximum thermoelectric effect.  
Probably the only part of the current path that isn't copper will be 
the load cell itself.  As long as both connections to that are at the 
same temperature, there should be no problem.

Graham.

Power supply dynamic range.

2007-10-12 by Alexandre Guimaraes

Hi,
 
	I have an application where a simple and cheap zener regulator with
emitter follower would be my best ( cheap) option for powering a Atmega168
with the AD converter using the internal 1.1 volts reference. As the input
voltage range is way to big, from about 5 volts up to 40 volts, the
regulation will not be too good because the zener current will vary too
much.
 
	I did not find any references if I will get into trouble varying the
supply at the AVR in the range of 3 to 5 volts. Does anyone have references
or opnions about this ? Would the AD suffer from those variations in supply
voltage even using the internal bandgap as a reference ? I just need 8 bit's
out of the AD...
 
	I would appreciate any insight. I always try to make the power
supply as stable as possible and letting it out to the microcontroller with
such a big variation feels really weird to me... But I looked around all I
could and did not find anywhere saying that I could not do it with a micro
that is specified for this full range !
 
	Thanks in advance...
 
Best regards,
Alexandre Guimaraes

Re: [AVR-Chat] Power supply dynamic range.

2007-10-13 by Roy E. Burrage

Talk about unregulated supply voltages...

Have you looked at a switchmode regulator like the MC34063, Alexandre?  
Some, like the '063, will withstand up to 50 volt supply voltages and 
won't cost a lot to build...perhaps a couple of bucks for parts and some 
assembly time, but it depends upon how critical your circuit is.  You 
could set your regulator output for something less than your minimum 
input voltage, like 4 volts, and then you'd be good to go.  Build up a 
prototype and check to see how it behaves.

Doesn't the bandgap reference get fed by a constant current source?  
That being the case, the supply voltage shouldn't make that much 
difference so long as it's kept within the parameters specified for your 
controller.  Look at the reference variation with supply voltage 
specification in your datasheet.  It should tell you if you can maintain 
8 bit accuracy.


REB


Alexandre Guimaraes wrote:

> 
>Hi,
> 
>	I have an application where a simple and cheap zener regulator with
>emitter follower would be my best ( cheap) option for powering a Atmega168
>with the AD converter using the internal 1.1 volts reference. As the input
>voltage range is way to big, from about 5 volts up to 40 volts, the
>regulation will not be too good because the zener current will vary too
>much.
> 
>	I did not find any references if I will get into trouble varying the
>supply at the AVR in the range of 3 to 5 volts. Does anyone have references
>or opnions about this ? Would the AD suffer from those variations in supply
>voltage even using the internal bandgap as a reference ? I just need 8 bit's
>out of the AD...
> 
>	I would appreciate any insight. I always try to make the power
>supply as stable as possible and letting it out to the microcontroller with
>such a big variation feels really weird to me... But I looked around all I
>could and did not find anywhere saying that I could not do it with a micro
>that is specified for this full range !
> 
>	Thanks in advance...
> 
>Best regards,
>Alexandre Guimaraes
>  
>


[Non-text portions of this message have been removed]

Re: Power supply dynamic range.

2007-10-13 by Graham Davies

--- In AVR-Chat@yahoogroups.com, "Alexandre Guimaraes" <listas@...> 
wrote:
>... simple and cheap zener regulator with
> emitter follower ... Atmega168 with the
> AD converter using the internal 1.1 volts
> reference. As the input voltage range is 
> ... from about 5 volts up to 40 volts ...
> ... get into trouble varying the supply
> at the AVR in the range of 3 to 5 volts.
> ... Would the AD suffer ...

I don't think you could have looked very hard for your references.  On 
the front page of the data sheet, you can read that the ATmega168 will 
operate from 2.7 to 5.5 volts as long as you don't expect to clock 
faster than 10 MHz.  In Figure 28-36 there is a graph of the bandgap 
reference voltage as a function of VCC and temperature.  It seems to 
vary by less than 0.3% over the full range.  This may be characterized 
and not tested, but you will probably be OK for 8-bit accuracy.  On the 
other hand, note that in Table 27-7 the reference voltage is given as 
1.0 V min and 1.2 V max.  So, although the supply voltage variation you 
expect won't mess you up, the variability in the reference might.

Graham.

Re: [AVR-Chat] Power supply dynamic range.

2007-10-13 by Ralph Hilton

On Fri, 12 Oct 2007 19:39:20 -0300  you ("Alexandre Guimaraes"
<listas@logikos.com.br>) wrote:

Seems risky to me. Its going to depend a lot on the nature of this wildly
fluctuating supply and short term changes in voltage. Is the cost of a $0.50
regulator with 20 volt zener on the input via a resistor really excessive?

> 
>Hi,
> 
>	I have an application where a simple and cheap zener regulator with
>emitter follower would be my best ( cheap) option for powering a Atmega168
>with the AD converter using the internal 1.1 volts reference. As the input
>voltage range is way to big, from about 5 volts up to 40 volts, the
>regulation will not be too good because the zener current will vary too
>much.
> 
>	I did not find any references if I will get into trouble varying the
>supply at the AVR in the range of 3 to 5 volts. Does anyone have references
>or opnions about this ? Would the AD suffer from those variations in supply
>voltage even using the internal bandgap as a reference ? I just need 8 bit's
>out of the AD...
> 
>	I would appreciate any insight. I always try to make the power
>supply as stable as possible and letting it out to the microcontroller with
>such a big variation feels really weird to me... But I looked around all I
>could and did not find anywhere saying that I could not do it with a micro
>that is specified for this full range !
> 
>	Thanks in advance...
> 
>Best regards,
>Alexandre Guimaraes
>
>
>
> 
>Yahoo! Groups Links
>
>
>

--
Ralph Hilton
http://www.ralphhilton.org
C-Meter: http://www.cmeter.org
FZAOINT http://www.fzaoint.net

RES: [AVR-Chat] Power supply dynamic range.

2007-10-14 by Alexandre Guimaraes

Hi, Roy
 
	Thanks for the prompt answer..

	Nice part ! Cheap and quite easy to use. I think I got a simpler
option for my project but I will keep it for future projects.

	The bandgap reference was not my main concern but the effect of fast
fluctuation on the supply voltage. It is "noise" that may induce into the
measurements in many unknown ways. The more I think about it the less I like
it. 
 
	I am finishing some worst case calculations but I will probably go
with a 2 stage shunt regulator. I will post the details afterwards.
 
Best regards,
Alexandre Guimaraes


-----Mensagem original-----
De: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] Em nome de
Roy E. Burrage
Enviada em: 12 October 2007 22:14
Para: AVR-Chat@yahoogroups.com
Assunto: Re: [AVR-Chat] Power supply dynamic range.

Talk about unregulated supply voltages...

Have you looked at a switchmode regulator like the MC34063, Alexandre?  
Some, like the '063, will withstand up to 50 volt supply voltages and won't
cost a lot to build...perhaps a couple of bucks for parts and some assembly
time, but it depends upon how critical your circuit is.  You could set your
regulator output for something less than your minimum input voltage, like 4
volts, and then you'd be good to go.  Build up a prototype and check to see
how it behaves.

Doesn't the bandgap reference get fed by a constant current source?  
That being the case, the supply voltage shouldn't make that much difference
so long as it's kept within the parameters specified for your controller.
Look at the reference variation with supply voltage specification in your
datasheet.  It should tell you if you can maintain
8 bit accuracy.


REB


Alexandre Guimaraes wrote:

> 
>Hi,
> 
>	I have an application where a simple and cheap zener regulator with 
>emitter follower would be my best ( cheap) option for powering a 
>Atmega168 with the AD converter using the internal 1.1 volts reference. 
>As the input voltage range is way to big, from about 5 volts up to 40 
>volts, the regulation will not be too good because the zener current 
>will vary too much.
> 
>	I did not find any references if I will get into trouble varying the

>supply at the AVR in the range of 3 to 5 volts. Does anyone have 
>references or opnions about this ? Would the AD suffer from those 
>variations in supply voltage even using the internal bandgap as a 
>reference ? I just need 8 bit's out of the AD...
> 
>	I would appreciate any insight. I always try to make the power
supply 
>as stable as possible and letting it out to the microcontroller with 
>such a big variation feels really weird to me... But I looked around 
>all I could and did not find anywhere saying that I could not do it 
>with a micro that is specified for this full range !
> 
>	Thanks in advance...
> 
>Best regards,
>Alexandre Guimaraes
>  
>


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

RES: [AVR-Chat] Re: Power supply dynamic range.

2007-10-14 by Alexandre Guimaraes

Hi, Graham
 
	I would not ask the question without looking at the datasheet ! I
was probably not clear enough about my concerns. The variation on the
bandgap reference is ok to me and the part will definitely operate on the
supply range, but will it operate properly with the power supply varying
dynamically ?

	My real and main concern is to have a power supply that could vary
rapidly from 3 to 5 volts. That is something that I have never done or have
seen done. I did not find any specs about having the supply change
dynamically with the chip running. I was looking for someone to tell me that
I am Nuts trying it or someone that has already tried it with success. It
sounds so much like the tests I make injecting "noise" on the supply lines
that the though about doing it makes me shiver :-(
 
	It would be interesting to be sure that parts with wide voltage
ranges could be used with the supply varying all over the place as long as
the voltage limits are respected. I am not sure that this is true.. 
 
Best regards,
Alexandre Guimaraes


-----Mensagem original-----
De: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] Em nome de
Graham Davies
Enviada em: 13 October 2007 09:59
Para: AVR-Chat@yahoogroups.com
Assunto: [AVR-Chat] Re: Power supply dynamic range.

--- In AVR-Chat@yahoogroups.com, "Alexandre Guimaraes" <listas@...>
wrote:
>... simple and cheap zener regulator with  emitter follower ... 
>Atmega168 with the  AD converter using the internal 1.1 volts  
>reference. As the input voltage range is  ... from about 5 volts up to 
>40 volts ...
> ... get into trouble varying the supply  at the AVR in the range of 3 
>to 5 volts.
> ... Would the AD suffer ...

I don't think you could have looked very hard for your references.  On the
front page of the data sheet, you can read that the ATmega168 will operate
from 2.7 to 5.5 volts as long as you don't expect to clock faster than 10
MHz.  In Figure 28-36 there is a graph of the bandgap reference voltage as a
function of VCC and temperature.  It seems to vary by less than 0.3% over
the full range.  This may be characterized and not tested, but you will
probably be OK for 8-bit accuracy.  On the other hand, note that in Table
27-7 the reference voltage is given as 1.0 V min and 1.2 V max.  So,
although the supply voltage variation you expect won't mess you up, the
variability in the reference might.

Graham.




 
Yahoo! Groups Links

RES: [AVR-Chat] Power supply dynamic range.

2007-10-14 by Alexandre Guimaraes

Hi, Ralph 

>Seems risky to me. Its going to depend a lot on the nature of this wildly
fluctuating supply and short term changes >in voltage. Is the cost of a
$0.50 regulator with 20 volt zener on the input via a resistor really
excessive?

	I am also too worried to try it at something that needs to be fail
proof. I will probably go with a 2 stages shunt supply. A resistor and a
Zener on the first stage and a TL431 on the second one. I will sleep easier
having a "clean" power supply !
 
	But... I will still make some tests with the first board to see what
happens to the poor AVR with the power supply "jumping" all over the place
:-)

Best regards,
Alexandre Guimaraes

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.