I don't see how custom firmware is going to give you higher precision. The
ADC on the PIC has 10-bit resolution, which translates into 3.3mV. With
your full-range scaling of 50mV/A this would translate into about 66mA
resolution. If that's insufficient you can either:

   1. Use an external ADC with higher resolution.
   2. Sacrifice your 30A range for higher precision in the low end by
   increasing the gain (be sure to clamp at 3.3V or else you'll be damaging
   the IOIO).
   3. Dynamically change the gain under software control (e.g. by using a
   digital output to change a configuration resistor value on the op-amp).


On Wed, Jul 15, 2015 at 2:10 PM, Julio Castellanos <[email protected]>
wrote:

> Yes indeed i need to conditionate the signal, i though there were pins
> tolerant to 5 V but i just read that is only for logic input. Until now i
> was measuring currents lower than 10 A so i didn't remarked the need of the
> conditioning. Thank you for your support.
>
> Also i was already using the buffered version of AnalogInput, i did just
> like you said, i measured the peak-to-peak voltage and converted it to rms,
> then i did a simple conversion to current, that's when i got the accuracy
> of +-0.1A, but i need it to be less than that, that's why i'm looking for
> the option of doing it in the firmware. I wonder if that is possible?
>
>
>
> El miércoles, 15 de julio de 2015, 12:09:16 (UTC-5), Ytai escribió:
>>
>> I think I understand now. So:
>>
>>    1. If you're really intending to measure a signal as high as 30A, the
>>    output voltage will be around 4.5V, which exceeds the range the ADC is
>>    willing to accept (0-3.3V).
>>    2. Unless the sensor has a built-in amplifier, it is likely that it
>>    has a fairly high output impedance.
>>    3. To address both of the above problems, I recommend conditioning
>>    the signal using one of more opamp stages, so that it has about 1.5V bias
>>    and about 1.5V amplitude @ 30A (or 50mV/A).
>>    4. The IOIO samples at 1kHz. There should be no problem sampling of a
>>    60Hz signal. Moreover, since you know it is a sine wave, all you really
>>    need is measure the peak-to-peak voltage which you can then trivially
>>    convert to RMS. I suggest that you look at the buffered version of
>>    AnalogInput, so that you don't miss or depend on your application thread
>>    loop frequency.
>>
>>
>> On Wed, Jul 15, 2015 at 7:15 AM, Julio Castellanos <[email protected]>
>> wrote:
>>
>>> Hi Ytai, thank you for your help. The signal is the output of an A.C.
>>> current sensor, the frequency is the same as the network, 60 hz, and the
>>> sensor can measure up to 30 A with a sensitivity of 66 mV/A. The signal has
>>> always a D.C. value of 2.5 V so if i measure 1 A the signal will have a max
>>> of 2.566 V and a min of  2.434 V. The absolute maximum with 30 A is 4.48 V
>>> and absolute minimum of 0.52 V, so the signal is always in the range of the
>>> analog input of the ioio. I want to know the value rms of the current in my
>>> smartphone, and i tried obtaining the rms of the voltage by calculating the
>>> max value of a buffer of 1000 values and the multiplying it by 0.707. I get
>>> the value rms of the current with an accuracy of +-0.1 A, but i need it to
>>> be less than that, that's why i though it would be better to compute the
>>> rms value of the signal in hardware so i dont have to send the whole buffer
>>> of the signals.
>>>
>>> El martes, 14 de julio de 2015, 18:44:30 (UTC-5), Ytai escribió:
>>>>
>>>> Before we begin, can you please specify the signal you're trying to
>>>> measure better?
>>>> Specifically, its min and max (instantaneous) voltage, and its
>>>> bandwidth would be important.
>>>> Based on that I can recommend a way of measuring it.
>>>>
>>>> On Tue, Jul 14, 2015 at 3:06 PM, Julio Castellanos <[email protected]>
>>>> wrote:
>>>>
>>>>> Hello, i'm currently working with the IOIO analog input with a sensor
>>>>> signal that comes out as an A.C. signal in the range of 2,5 V as mean
>>>>> value. I've tried to get the voltage through the analog input and get the
>>>>> rms value in software, but the value changes to much because of the
>>>>> bandwith limit of the IOIO:Android communication. I'm now looking to get
>>>>> the RMS directly in hardware and just send that value to the software but 
>>>>> i
>>>>> gave a look at the hardware code for adc.c and i don't understand almost
>>>>> nothing, can someone point out to me a source where i can learn how does
>>>>> this code works?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "ioio-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at http://groups.google.com/group/ioio-users.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "ioio-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/ioio-users.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "ioio-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/ioio-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to