Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to add support for ADC when that option is not available in uC

Status
Not open for further replies.

titusece

Newbie level 4
Joined
Sep 20, 2022
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
66
Hello,
I have a requirement to read analog voltage from Microprocessor LINEIN pin (Line Input for audio jack)
As i.MX8 doesn't have ADC i would like make use LINEIN pin to send analog voltage (0 to 3.3) and want to get as digital value by reading codec registers.
Is it possible ? sharing any insights would be great.
Thanks for the help.
 

Hi,

I would start with reading the datassheet.

You did not say whether you did. Please do so. Tell us what you understand and tell us what is unclear.

Klaus
 

Thanks for your replies.
Actually most of the microprocessor doesn't have support for ADC interfaces like microcontroller does.
These uC does have CODEC on it to do audio input/output processing to connect Line Input & Output for headphone jack connections, and not for just ADC/DAC purpose. but CODEC will make use of ADC & DAC to achieve the audio thing.
Now my question is that whether we can achieve to read analog voltage level from this interface or not.
Thanks again.

1663701344771.png


Ex: One of external audio codec:
1663701454035.png
 

Hi,
A CODEC includes an ADC... besides MUX, DAC and more.
Since there an ADC... use it.

You gave no requirements.
So I don't know what to recommend.

Klaus
 

The IMX8 shows it as having 2 12 bit ADC s -


Note there are a number of methods for an ADC less processor to easily manage an
external ADC solution, from single slope to SAR and beyond.


Regards, Dana.
Thanks Dana. I am using i.MX8M Mini SOC and unable to see ADC in there.
 

Hi,
A CODEC includes an ADC... besides MUX, DAC and more.
Since there an ADC... use it.

You gave no requirements.
So I don't know what to recommend.

Klaus
Thanks Klaus.
My requirement is that my SOC doesn't have a ADC on it but it has audio interface to connect external i2c+i2s based CODEC, so am thinking of using LINEIN pin of CODEC to feed the voltage and read CODEC register to get the digital value of my analog voltage.
Hope you get it. :)
Thank you.
 

in the IMX8MMRM.pdf manual there is no reference to codec of to LINEIN pin ?

And you need to establish if the codec in any part can handle DC as an legit
input for measurement.

Super simple methods of doing A/D conversion, look at

https://archive.org/details/bitsavers_nationaldabook_39221290 pages 2-60 and 2-212



Regards, Dana.
 

There's a lot of serial-interface ADCs out there (your mention
of I2C?) that might do the job.

I don't believe CODECs are necessarily hardware or including
the ADCs that turn audio / video into bit streams. I have a copy
of a video viewer that's pretty helpless until you download a
package of various CODECs (therefore an existence proof
that a CODEC "can" be software-only). Of course a standalone
CODEC hard product might well incorporate more of the signal
chain, if the end application values this integration.
 
Thanks Dana for your reference and really helpful.
Can you also pls suggest available low cost SPI/I2C based ADC or simple Op-amp based ?
My requirement is that would like to measure voltage of Rechargeable Lithium-ion Polymer Battery 3.7V

1664301669631.png


There's a lot of serial-interface ADCs out there (your mention
of I2C?) that might do the job.

I don't believe CODECs are necessarily hardware or including
the ADCs that turn audio / video into bit streams. I have a copy
of a video viewer that's pretty helpless until you download a
package of various CODECs (therefore an existence proof
that a CODEC "can" be software-only). Of course a standalone
CODEC hard product might well incorporate more of the signal
chain, if the end application values this integration.

Thanks for your response.
 
Last edited by a moderator:

If you look at page 2-60 in my prior link this is pretty much all you
need (ignore the xtal, the COP becomes you IMX) :

1664315063294.png


A comparator, preferably RR single supply, and a RC network, and an internal
PWM. And some code. You ramop the PWM duty cycle which ramps DC level out
of the RC LPF, until comparator trips. More effective is do a binary search algorithm,
like used in a SAR, to do the conversion.

Its not precise, but monitoring a battery V does not need high precision.

Or go to digikey.com, do a search for an 8 or 10 bit A/D with reference, 8 pins,
I2C or SPI or One Wire, plenty of offerings.

Regards, Dana.
 
Last edited:
Another way to do this (with the same circuit) is to just set the output high and count how long it takes to trip the comparator. It's, again, not too accurate, but you haven't said what you need for accuracy.

But, if it was me, I'd go with a serial ADC. Same space as an opamp and way more accurate.
 
Another way to do this (with the same circuit) is to just set the output high and count how long it takes to trip the comparator. It's, again, not too accurate, but you haven't said what you need for accuracy.

But, if it was me, I'd go with a serial ADC. Same space as an opamp and way more accurate.
2-212 has a RC exponential converter with just R and C -

https://archive.org/details/bitsavers_nationaldabook_39221290 pages 2-60 and 2-212


Regards, Dana.
 
Thanks Dana and Barry.
Those are really helpful and appreciate that.
Currently my team also wants to explore without ADC and Comparator but just use bunch of resistors and switch FETs (simple circuit and very minimal space) and need to find 25%, 50%, 75% and 100% of battery level (3.7V)
Any help ?

GPIO DC characteristics of imx6 mini:
Vil -> -0.3 to 0.9
Vih -> 2.3 to 3.6
 

Hi,

battery level...
It´s not accurate at all to just measure the voltage of a battery. nd even wors when using a low reesolution ADC.

--> I recommend to use a battery fuel gauge IC with I2C interface.
Simple circuit, minimal space: TI´s BQ27421 comes in 1.6mm x 1.6mm package. Small enough?

Klaus
 
Hi Klaus, thanks for your suggestion, actually fuel gauge was designed and doesn't support battery level reading but charge status and no i2c interface.

Thanks Dana, yes I have seen that it needs timer capture to measure pulse, I have done something below using voltage divider based on i.MX DC characteristics of GPIO, I derived resistor values and used to get different level of voltages from three pins. And also with P-MOSFET I can send signal from MCU to this enable the divider to read voltages of battery whenever needed so that power leakage can be avoided.
Does it makes sense ?

PS: I am not into HW design, used to work on SW side.
thanks for your help & insights so far! Really appreciate that.

1664626695094.png
 

Hi
Hi Klaus, thanks for your suggestion, actually fuel gauge was designed and doesn't support battery level reading but charge status and no i2c interface.
What exactly do you mean with "battery level"?
The BQ27421 can read voltage, several currents, charging state and many more...

Klaus
 

Hi Klaus, thanks for your suggestion, actually fuel gauge was designed and doesn't support battery level reading but charge status and no i2c interface.

Thanks Dana, yes I have seen that it needs timer capture to measure pulse, I have done something below using voltage divider based on i.MX DC characteristics of GPIO, I derived resistor values and used to get different level of voltages from three pins. And also with P-MOSFET I can send signal from MCU to this enable the divider to read voltages of battery whenever needed so that power leakage can be avoided.
Does it makes sense ?

PS: I am not into HW design, used to work on SW side.
thanks for your help & insights so far! Really appreciate that.

View attachment 178852

Relying on threshold V of inputs as a Vref is very poor accuracy. The threshold shifts
substantially with T. and we arer not even discussing yet device to device variation.
I would urge you NOT to use this technique.


Regards, Dana.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top