Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Math

Status
Not open for further replies.

hjl4

Member
If I have a range of voltage, .968V to 2.273V, and I have an A/D conversion (1023) done by 12f675 , how do I get returned value as angles 0-359.9, and what accuracy can I expect? I've been on this project for a while, and I am disappointed at my math skills.
 
It depends how much accuracy you're looking for?.

For maximum accuracy you need to spread the range over the entire input range of the A2D, and use an external reference for the A2D as well. So use a precision reference for the A2D, giving an input range of 0-2.5V. Then use an opamp to scale the sensor input from the range above to 0-2.5V. This will give you just over 0.1% resolution - absolute accuracy depends on the quality of the reference, and the opamp scaling cicuit.
 
hjl4 said:
If I have a range of voltage, .968V to 2.273V, and I have an A/D conversion (1023) done by 12f675 , how do I get returned value as angles 0-359.9, and what accuracy can I expect? I've been on this project for a while, and I am disappointed at my math skills.

hi,
You show a resolution of 3600 points, the ADC has 1023 points

So actual resolution is 1023/3600 = 0.28Deg.
Rounded up say 0.3Deg.

The Vin range is 1.305Volts.
As the minimum voltage inp is 0.968V it would require this to be offset to 0V
and the Vrange * Gain = +5V input to the ADC.

You can get an offset and gain using a OPA.

Does this help?

Eric

EDIT: corrected my typo in 'rounding!'
 
Last edited:
Ok Nigel Thankx. I know about augmenting the total signal voltage so Pic A/D can occur accurately, I think minimum is 2V? for 12F675. How do you take 1023 resolution and get 360 deg? What will my accuracy be, 0.1 deg? Again thanks for all the help.
 
Thanks eric, you just answered my question. How do you implement offset range with OPA.
 
hjl4 said:
Ok Nigel Thankx. I know about augmenting the total signal voltage so Pic A/D can occur accurately, I think minimum is 2V? for 12F675. How do you take 1023 resolution and get 360 deg? What will my accuracy be, 0.1 deg? Again thanks for all the help.

No, it will be 0.1% as I said, which would be 0.36 degrees.

To convert to degrees simply multiply by 0.352 (to three decimal places) - which is 360/1023. Better to scale it up and multiply by 352, than use slow and inaccurate floating point routines. EPE has 32 bit interger maths routines which would be fine.

To offset the input to the opamp you just use a simple opamp adder - and add a negative voltage to the input.
 
Ok Nigel, sounds simple enough, I'll try that. Unfortunately, work is calling. If I have time, I will check at work if that works.
 
hi,
If you dont have a -Vs on your pcb, you could use the attched circuit.pdf..

The plot of actual OPA is shown in the gif,,, the top plot is the Vsignal [note the scale] and the bottom plot is the Vout to the ADC..

NOTE: the +Vs to the OPA.

Set up the OPA before you connect to the ADC input, if the OPA is able to exceed +5V you should fit a resistor/zener clamp [5V2]

Eric
 
Last edited:
Thanks ericgibbs, I will give it a try, and will keep you posted. It is exactly what I needed. Thanks.
 
Status
Not open for further replies.

Latest threads

Back
Top