Operation of the 1bit A2D Converter
Every once in a while I run across a mention of the 1 bit A2D converter. I’ve seen it with PIC microcontrollers and it’s even been integrated into the Parallax Propeller Demonstration Board. However, while I’ve seen code explaining how to use the circuit, the only mention of how it works I’ve seen is a mention that it works using charge transfer.
The figure below shows a typical setup used with a microcontroller:
P1 is configured as an input and periodically sampled. When high, P0 is set low; when low, P0 is set high. The idea is to keep the voltage across the capacitor set to approximately 1/2 the supply voltage.
To see how this converts an analog voltage to its digital representation, consider the simplified circuit shown below:
If you let Ts represent the sample time, Nl represent the number of low samples, Nh represent the number of high samples, then the conversion time Tc can be calculated as:
The total charge leaving the capacitor during the conversion time is:
The total charge entering the capacitor during the conversion time is:
Setting the two equal to each other and rearranging, we get the the relationship:
Looking at this relationship, we can draw a few conclusions:
- The specific values of R and C do not appear to matter. However, the since operation of the A2D converter depends upon the voltage at P1 being maintained at 1/2 the supply voltage, they should be chosen to keep the voltage across the capacitor approximately constant during the conversion time.
- Resolution of the A2D depends exponentially on conversion time (each additional bit of resolution doubles the conversion time).
- Resolution is not limited to powers of 2 and can be tailored to the application. For example, if you have a signal whose value you would like to display as a percentage, set Nc = 100. Then Nl is the value as a percentage of the supply voltage.
If you use this circuit in one of your projects, keep in mind that Nl represents the number of counts that P0 is low. Since P0 and P1 have the opposite state (P0 goes low when P1 is high), Nl represents the number of times P1 is sampled as high. You’ll have to keep this straight in your code.
- Posted in: Uncategorized