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

Status
Not open for further replies.

#### Sputnik

##### Full Member level 3
I'm looking for a way to make my own ADC. Do you have any ideas, cause here's mine:

A PIC with an 8-bit DAC connected to op-amp starts at zero and increments one by one, when voltage created by PIC is equal to voltage being monitored, the op-amp will go high into one of the PIC pins and signal it to stop its count up and whatever the 8-bit status of the port is, will be the value corresponding to the input voltage.

Well, that's my idea at least,
Sputnik :idea:

#### flatulent

This is one common method that in general uses a DAC and a comparator.

You could hasten the convergence by using the successive approximation method. Start with all bits zero. Then from the MSB end change that bit to one. If the comparator triggers reset that bit to zero and go to the next bit. If the comparator does not trigger retain the value of the bit and go to the next bit.

Continue this process for each bit in turn until you have toggled all of the bits.

#### VVV

analog to digital converter home made

A better way is to implement a successive approximation.

You start with MSB set, the other bits 0. Then you check the voltage produced by the DAC against the input. If the voltage from the DAC is higher, clear MSB, set the next bit and try again.
If the voltage from the DAC is lower, then set next bit too and check. If it's now higher, clear the bit, set the next one to the right and so on.

In the end, you will ned 8 cycles to do the comparison.

#### Sputnik

##### Full Member level 3

Goodgrief, that sounds a lot better than my method that would have taken a maximum of 255 cycles.

But I have been thinking, I will be measuring voltages that are changing increadibly fast (Oh, lets say a composite video signal). The voltage is going to change during a conversion. Is there any way to "hold" the voltage being converted?

Sputnik :idea:

#### aryajur

You can make a sample and Hold circuit to hold the input value. Just put a buffer and a capacitive buffer (A capacitor put accross a negative gain amplifier) after a MOS switch. Close the switch when you want to sample and open it when you want to hold.

0.35/bw rise time

Hi,..

I have a project that needs an ADC0820 or ADC08061, I searched for but couldn't find it. I need to make a homemade equivalent but with the same speed and any other specifications.
https://www.geocities.com/lptscope/hw.html

Any ideas.???? Here you are the datasheet

Thanks to you all

#### Attachments

540.8 KB · Views: 19

#### Borber

You can get ADC0820 fron National Semiconductors as samples. All you should do is to pay postal expences.

Thanks for help and I don't mean to be rude, but I'm from Egypt. So, any other ideas will be appreciated Unless chipping from USA to Egypt is possible and cheap.

Thanks again

#### Sputnik

##### Full Member level 3

Okay, I've made an 8 bit DAC that connects to an op-amp. As a test rig, a simple two resistor voltage divider giving 2.5v (5v supply) is converted. By manually using the successive approximation method, the final voltage of the DAC was 2.45v (So it works ). I have written a program that reads the value present on the parallel port. Apart from being attached to the resistors, the PIC output pins are attched to a 74HC573. The inputs are latched and at the end of the routine, the LE is toggled for ±4µs. Sending the latched inputs to the output (therefore to the parallel port).

But now my problem is that the value read by the computer is "jittery". The value jumps around randomly. The PIC program runs perfectly in simulation. This happens when the PIC runs at 4MHz. I tried to lower the frequency in a highly un-scientific manner, I merely touched the Xtal input pin. The value read by the computer was stable, but not entirely. Why is the high speed a problem? Even at 2.2MHz (±600Khz internal speed) there is still problems. Does the opamps 1MHz bandwidth input have anything to do with it, what does this even mean?

Sputnik :idea:

#### Buriedcode

##### Full Member level 6

Hi,

Hopefully I've got this right....

You have a PIC micro with one port attached to an 8-bit DAC (R-2R ladder?) the output of which is connected to a comparator (or an op-amp configured as a comparator). The reference for this comparator is 5v. So comp output is connected to another PIC pin. And you turn on the MSB, check feedback (from comparator) and if 0, leave MSB on and move to next bit etc....all sounds good here. The PIC port is ALSO connected to a latch? Should be OK since latches are meant to have high-Z inputs, and anyway, I assume your PIC only latches the data when it has finished a conversion, so the port pin values cannot change after you've made a conversion.

the LE is toggled for ±4µs
Didn't know you could trigger a pulse for -4us?

Make sure you have a decoupling cap near the power pins of every IC (including the comparator). Random spikes are never helpful. They may be triggering your latch.

Start slowly. Using an RC oscillator at say, 100Khz, and work your way up to speed (4MHz good?). If its fine slow, but starts to screw up at a higher speed then there may be some time constriant in a datasheet for one of your chips thats being violated. Try latching the data with a longer strobe pulse length, say, 1ms.
Also, the speed issue, some comparators are not that fast. I read somewhere that using internal comparators in micros, or even opamps, can cause problems. Always use a LM393, tiny rise-time, and dirt-cheap.

Sorry, just noticed this:
Does the opamps 1MHz bandwidth input have anything to do with it, what does this even mean?

This may be the cause of your problems. Its easy to forget just how fast PIC's go 1Mhz bandwidth, generally means it can cope with frequencies up to 1MHz. Its limited by 'rise time'. Basically, rise-time related to the bandwidth of the opamp is given by:

BW = 0.35/risetime. so.....Rise Time = 0.35 / BW. = 350ns. This is probably fine. But rise time is the time it takes for the output to go from 10% to 90%.

Try running your PIC really slow, (20Hz) and add LEDs to the output of your latch, as well as the strobe and comparator outputs. Its like simulating it in hardware, single stepping so you can see whats going on. Always works for debugging my projects, even though its a bit crude.

I've got loads of things buzzing around in my head, since I'm always trying to work out the 'odd behavior' of the circuits I build. I hope this can help you narrow down the problem

Good luck, and sorry for the long post, brevity never was my strong point.

BuriedCode.

#### Sputnik

##### Full Member level 3

Wow, it has been so long but I've done it. I've made the entire project and it is working. I have a computer reading the data throught the parallel port and giving the corresponding voltage reading. But there is a problem, the R2R ladder only gives between and 0.91 and 3.84 volts. Ie. 0x00 = 0.00, 0x01 = 0.91 0x02 = 0.96, ... , 0xFF = 3.84. I need a comparator configuration that will allow me to slightly lower the voltage and increase its range.

Thanks,
Sputnik :idea:

Status
Not open for further replies.