10 years ago.

adc conversion

Hi, I am using analog input of KL25Z to sense the current using ACS712. Can any one tell me how to do the adc conversion, i think kl25z uses 16bits for conversion any suggestions ???

3 Answers

9 years ago.

I was wondering if anyone knew whether the ADC in the KL25Z was linear. I am trying to use the outputted value between 0-1 to get back the voltage. I was either going to use a linear conversion or I was also looking to see if there is some command to get the voltage directly. The closest I could find was ADC_GetConversionValue() but it doesn't seem to work.

Any suggestions?

I tried to find the conversion factor first. I gave the known amount of current say 3.4A to the circuit and noted down the corresponding analog value say .6, then i figured it out that what could be the max value of current because at that value analog sensor was supposed to give max value of 1, say 5.6A. so it means conversion rate is x=.6/3.4 which gives .17. so i need to divide the analog value with .17 in order to get the correct value of current. So if the analog value is .8, it means current value is .8/.17=4.7A if the analog value is .4, actual current would be .4/.17=2.35A and so on

posted by zain aftab 26 Mar 2015
9 years ago.

Hi,
What I'm doing in my Oscilloscope is something like

<<code>>

float vref = 3.28 ; Analog Reference Voltage
float vinf ;
input voltage

float u2v(uint16_t uvalue) { return( vref * (float)uvalue / 65535.0 ) ; }

vinf = u2v(ain.read_u16()) ;

<<\code>>

For exact measurements you may need to provide in->out table,
but for my use, this seems to be good enough.

moto

10 years ago.

Just AnalogIn? http://mbed.org/handbook/AnalogIn

Yeap,analogin is enough to read the value from the Vo of current sensor.actually current is flowing across the Ip+ and Ip- of the current sensor (acs712)which is connected in series in the circuit, and we read the value from the Vo, which goes to the AnalogIn of the KL25Z. Vo is actually the output generated by the current sensor. I hope you got my explaination !! Thanks in advance

posted by zain aftab 21 Mar 2014