# 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:

$T_c = (N_l + N_h) T_s$

The total charge leaving the capacitor during the conversion time is:

$I_o = \frac{V_p}{2} (\frac{1}{R} + \frac{1}{R})$

The total charge entering the capacitor during the conversion time is:

$I_i = V_i (\frac{1}{R}) + V_p (\frac{N_h}{N_c})(\frac{1}{R})$

Setting the two equal to each other and rearranging, we get the the relationship:

$\frac{V_i}{V_p} = \frac{N_l}{N_c}$

Looking at this relationship, we can draw a few conclusions:

1. 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.

2. Resolution of the A2D depends exponentially on conversion time (each additional bit of resolution doubles the conversion time).

3. 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.

DuWayne's Place

Computers, Electronics, and Amateur Radio from KC3XM

QRP HomeBuilder - QRPHB -

Computers, Electronics, and Amateur Radio from KC3XM

Open Emitter

Computers, Electronics, and Amateur Radio from KC3XM

Ripples in the Ether

Emanations from Amateur Radio Station NT7S

m0xpd's 'Shack Nasties'

Computers, Electronics, and Amateur Radio from KC3XM