> ina300
> - no Analog output pin ?
The picture show to optional to use a DAC from MCU, so I guess you can make sweeps.
Or leave the Prop1 counter Duty (+R/C) at a value you like for the moment it to be compared against.
Thanks for those kind words Dr_Acula. Those resistor values are a pretty good compromise between current draw, impedance matching, and response time when using an MCP3208 or several other adc's.
good choice of values as that also limits the current into the propeller pin should you put more than 16V on the input. (Consider a hypothetical where you chose 150R and 33R - same ratio but would feed too much current and zap the chip, plus draw too much wasteful current from the battery). And at the other extreme, 1.5M and 330K would not match the imput impedence of a sigma delta, unless maybe you used an op amp voltage follower. 15K and 3K3 is a good choice.
Reach,
I think all misunderstand what you require and you explanation is not quite right.
For voltage on a boat, you do not have to be accurate to mV. So you can read voltage to maybe 100mV using a voltage divider with high value >50K 1% resistors.. There are formulae and suggested values in the sigma delta or adc app note for the prop. Presuming a max 16V then the divider should give less than 3v3. I would set the 50% point at 12V to divide to 1.65V.
Now for current (for you non-boaties) it is typical to place the current shunt on the low side ie in the gnd return leg. Shunts used typically give ~50mV max for the max current rating of the shunt. This is where an amp circuit is necessary to boost the 0-50mV to be within the 0-3V3 range so you would probably aim for 25mV to give 1.65V and range this to be maybe a little less gain giving the range maybe 0.3V-3.0V. Once you have this, you can read the voltage with sigma delta on the prop.
Alternately you could use an ATTiny that has an inbuilt analog amp - see Atmel app notes. You could output the resultsby serial or i2c or spi to the prop if you wish.
All this, together with a smart regulator for my externally regulated alternators to charge AGM or LiPO4 batteries, are on my big to do list.So I am willing to help you with this.
Yes, you could use an external op amp, or you could make a Prop DAC with a resistor and a cap, and use that as a source to bias the summing junction of the Prop's Sigma Delta to shift its zero range.....
All very simple:
DAC: one resistor and a cap
Sigma Delta : two resistors and a cap.
Bias shift: one resistor.
Cost : Prop plus 4 resistors, 2 caps ...... 10 cents in total plus a dozen lines of PASM and..... a lot of fun.
Of course, more complex (i2c comms) and more expensive approaches are possible if you wish.
pjv,
The reason to use an amp is to amplify the 0-50mV range to something that can be usefully read by the sigma delta. So we would need at least a x50 amp.
AFAIK you cannot do this the way you are suggesting. Please enlighten me if you know a way - analog is my weak point and I am always eager to learn new tricks.
pjv,
The reason to use an amp is to amplify the 0-50mV range to something that can be usefully read by the sigma delta. So we would need at least a x50 amp.
AFAIK you cannot do this the way you are suggesting. Please enlighten me if you know a way - analog is my weak point and I am always eager to learn new tricks.
I think that Shunt will actually be -50mV, (minus 50mV), as usually global GND is on the other side of the shunt.
That minus voltage is ok, as most good opamps can sense around gnd, and Minus needs just 2 resistors minimum, or 4 with a sensible low pass and feed to the Prop SDM. (see below)
As the Sense pulls negative, the Opamp output goes positive, OP(+) is simply grounded.
If you want precision, a 5mV offset opamp is 10% error, whilst a 500uV offset opamp is 1%, (etc) and those sub-mV offsets are why a direct-prop solution will struggle.
pjv,
The reason to use an amp is to amplify the 0-50mV range to something that can be usefully read by the sigma delta. So we would need at least a x50 amp.
AFAIK you cannot do this the way you are suggesting. Please enlighten me if you know a way - analog is my weak point and I am always eager to learn new tricks.
Yes, provided you are not looking to track rapidly changing signals, this works very well. I have used the technique for reliably measuring thermistors, And have also used it with some other tricks for wheatstone bridge pressure sensors. I also had a go at thermocoulples, but thermistors replaced those in the project..
I would suggest that a 10 mV range is about the low end limit one could go with reasonable repeatability when employing adequate averaging. Hence the speed issue.
I'm a minimalist at heart, and try very hard to achieve my designs with a minimum of external fuss. And sometimes that works out very well. Lots of interesting analog tricks can be done with the Propeller.
On a boat we typically need the full shunt range. I forgot that this is also directional, so we would be seeing the range +50mV to -50mV. This is because we also charge the battery. On my boat, the 50mV = 200A.
Obviously some decent amplification will be required to boost +-50mV to 3V centered around ~1.6V.
I forgot that this is also directional, so we would be seeing the range +50mV to - 50mV. This is because we also charge the battery. On my boat, the 50mV = 200A.
Obviously some decent amplification will be required to boost +-50mV to 3V centered around ~1.6V.
If you need bi-directional readings, then the OpAmp (+) ip in the circuit I gave, needed to be lifted to ~ +50mV
The 'zero' is now nominal and set by the bridge of 4 resistors.
If a more precise Zero is needed, or you want different gains for Charge/Discharge, or even 2 shunts (one for load, one for charger sources) then a second Opamp and Dual ADCs could be used.
Another design approach would use a chopper-based ADC, using an open drain pin (nearest GND?).
This modulates the +/-50mV signal, at say 1~10ms, and takes two alternating readings, one for Shunted 0.0mV and one for Vi, and the difference determines the signal.
This auto-zeros and is bi-directional, but needs more SW and 1 more pin.
It can likely eliminate the OpAmp.
This Doc shows you how to extend the range of a Sigma-delta Analog to Digital Conversion. The example provided ranges 0 to 10 V but can be extended.
Go down to ; Extended Voltage Ranges
Extended Voltage Ranges
The sigma-delta converter’s input range can be extended by choosing a larger input resistor
and/or by adding some biasing via a pull-up or pull-down resistor. In the “standard” circuit
with the 150 k input resistor, the nominal input voltage range (without considering offsets,
etc.) is -0.825 V to +4.125 V. Notice that this range centers around the input logic
threshold, which is nominally 1.65 V (Vdd/2) when Vdd is 3.3 V. To shift the center of the
range, it is necessary to add some biasing. For example, suppose the desired input range
were 0 to +10 V, which centers on +5 V. This would entail using a pull-down resistor on the
summing junction to re-center the range to 1.65 V, as shown in Figure 10.
Yes, larger voltages, like Battery Vin, are relatively easy to scale - just choose resistors.
The important detail is Notice that this range centers around the input logic threshold, which is nominally 1.65 V (Vdd/2) when Vdd is 3.3 V.
note that threshold is imprecise, and also varies slightly with temperature.
'nominal' may be Tolerable on a 15V signal, but 50mV is a rather different ball game.
Comments
> - no Analog output pin ?
The picture show to optional to use a DAC from MCU, so I guess you can make sweeps.
Or leave the Prop1 counter Duty (+R/C) at a value you like for the moment it to be compared against.
I think all misunderstand what you require and you explanation is not quite right.
For voltage on a boat, you do not have to be accurate to mV. So you can read voltage to maybe 100mV using a voltage divider with high value >50K 1% resistors.. There are formulae and suggested values in the sigma delta or adc app note for the prop. Presuming a max 16V then the divider should give less than 3v3. I would set the 50% point at 12V to divide to 1.65V.
Now for current (for you non-boaties) it is typical to place the current shunt on the low side ie in the gnd return leg. Shunts used typically give ~50mV max for the max current rating of the shunt. This is where an amp circuit is necessary to boost the 0-50mV to be within the 0-3V3 range so you would probably aim for 25mV to give 1.65V and range this to be maybe a little less gain giving the range maybe 0.3V-3.0V. Once you have this, you can read the voltage with sigma delta on the prop.
Alternately you could use an ATTiny that has an inbuilt analog amp - see Atmel app notes. You could output the resultsby serial or i2c or spi to the prop if you wish.
All this, together with a smart regulator for my externally regulated alternators to charge AGM or LiPO4 batteries, are on my big to do list.So I am willing to help you with this.
Yes, you could use an external op amp, or you could make a Prop DAC with a resistor and a cap, and use that as a source to bias the summing junction of the Prop's Sigma Delta to shift its zero range.....
All very simple:
DAC: one resistor and a cap
Sigma Delta : two resistors and a cap.
Bias shift: one resistor.
Cost : Prop plus 4 resistors, 2 caps ...... 10 cents in total plus a dozen lines of PASM and..... a lot of fun.
Of course, more complex (i2c comms) and more expensive approaches are possible if you wish.
Cheers,
Peter (pjv)
The reason to use an amp is to amplify the 0-50mV range to something that can be usefully read by the sigma delta. So we would need at least a x50 amp.
AFAIK you cannot do this the way you are suggesting. Please enlighten me if you know a way - analog is my weak point and I am always eager to learn new tricks.
I think that Shunt will actually be -50mV, (minus 50mV), as usually global GND is on the other side of the shunt.
That minus voltage is ok, as most good opamps can sense around gnd, and Minus needs just 2 resistors minimum, or 4 with a sensible low pass and feed to the Prop SDM. (see below)
As the Sense pulls negative, the Opamp output goes positive, OP(+) is simply grounded.
If you want precision, a 5mV offset opamp is 10% error, whilst a 500uV offset opamp is 1%, (etc) and those sub-mV offsets are why a direct-prop solution will struggle.
Yes, provided you are not looking to track rapidly changing signals, this works very well. I have used the technique for reliably measuring thermistors, And have also used it with some other tricks for wheatstone bridge pressure sensors. I also had a go at thermocoulples, but thermistors replaced those in the project..
I would suggest that a 10 mV range is about the low end limit one could go with reasonable repeatability when employing adequate averaging. Hence the speed issue.
I'm a minimalist at heart, and try very hard to achieve my designs with a minimum of external fuss. And sometimes that works out very well. Lots of interesting analog tricks can be done with the Propeller.
Cheers,
Peter (pjv)
Obviously some decent amplification will be required to boost +-50mV to 3V centered around ~1.6V.
If you need bi-directional readings, then the OpAmp (+) ip in the circuit I gave, needed to be lifted to ~ +50mV
The 'zero' is now nominal and set by the bridge of 4 resistors.
If a more precise Zero is needed, or you want different gains for Charge/Discharge, or even 2 shunts (one for load, one for charger sources) then a second Opamp and Dual ADCs could be used.
Another design approach would use a chopper-based ADC, using an open drain pin (nearest GND?).
This modulates the +/-50mV signal, at say 1~10ms, and takes two alternating readings, one for Shunted 0.0mV and one for Vi, and the difference determines the signal.
This auto-zeros and is bi-directional, but needs more SW and 1 more pin.
It can likely eliminate the OpAmp.
Go down to ; Extended Voltage Ranges
Extended Voltage Ranges
The sigma-delta converter’s input range can be extended by choosing a larger input resistor
and/or by adding some biasing via a pull-up or pull-down resistor. In the “standard” circuit
with the 150 k input resistor, the nominal input voltage range (without considering offsets,
etc.) is -0.825 V to +4.125 V. Notice that this range centers around the input logic
threshold, which is nominally 1.65 V (Vdd/2) when Vdd is 3.3 V. To shift the center of the
range, it is necessary to add some biasing. For example, suppose the desired input range
were 0 to +10 V, which centers on +5 V. This would entail using a pull-down resistor on the
summing junction to re-center the range to 1.65 V, as shown in Figure 10.
http://www.parallaxsemiconductor.com/sites/default/files/appnotes/AN008-SigmaDeltaADC-v1.0_0.pdf
The important detail is
Notice that this range centers around the input logic threshold, which is nominally 1.65 V (Vdd/2) when Vdd is 3.3 V.
note that threshold is imprecise, and also varies slightly with temperature.
'nominal' may be Tolerable on a 15V signal, but 50mV is a rather different ball game.