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.

[SOLVED] ADC conversion problem- PIC16F877A

Status
Not open for further replies.
Hey, due to conversation with one guy something came to my mind. What if, after instrumentation amp, I put only RC filter (R goes to GND like on schematic few posts above) without op amp and bring coupled signal through 270 ohm resistor directly to ADC.
RC filter will bring AC signal from VGND to GND by clearing DC component. Clamp diodes on input to ADC will block -2.5 V and I'll have 0-2.5V AC signal to ADC. Then I can rise peak of signal amplitude with instrumentation amplifier to 5 V (now changes from 0-5 V). So due to that, I'll have better ADC 'cause now I can use all 1024 levels between 0-5 V and not only half as before. I'm only interested in max peak. So, I don't really need anything on the negative side.
I think this is the easiest way to test. With opamp I wanted to add DC component. Now with clamp diodes I don't have to. Or, eventually opamp does play some rule in this AC coupling even if I don't use it for adding DC component?

- - - Updated - - -

The MC34063A is a cheap and stable, it can be configured to give regulated step up or step down voltages and with either output polarity. You could use one for the +12V supply as well as it will dissipate less heat than a linear regulator.

If you have some configurations with MC34063A please reffer me to some point where I can find them.

The most precise mid-voltage will come from an op-amp splitter but you need one which can supply enough output current and at the same time be stable while driving a capacitive load. The resistor in series with the output pin in the schematic is to isolate it from the direct connection to capacitors on the + and - supply halves but as it appears in series with the virtual ground output it also limits the current you can pass through it. There are many high current 'buffer amplifiers' you can use, they are basically unity gain power amplifiers that are happy to drive capacitive loads, they do not need isolating resistors but they are considerably more expensive.

You are talking about capacitors at the output. Are you taking about Wien's capacitors or should I put some capacitors at the +-12V node like you did on TLE2426?

Also about 47R resistor at the output. Why is resistor before opamp feedback junction and not after if you know what I mean?

I'm trying to find some opamps you mentioned. Can you please name few. The local dealer's webshop page is very very bad. It gives only names of opamps and you can not filter it to get what you want. So I must search and examine every each of one and this is being frustrating... You don't have sub-categories like op amps, differential amps, PIC's and so on. Everything is under one category named IC's so I don't know what is what. Sometimes I open an comparator sometimes an opamp. Really terrible.

Due to problems with 78xx regulators you explained, I'll not use this method.
 

Hy. I have succeeded to filter DC signal, and now I'm able to measure my max amplitude :) :)

Inductive sensor can measure between 0-100 mm and throught some formulas, I have managed to connect relationship between max amplitude and lenght displacement.
Voltage, according to sensor datasheet, should change linearly. My formula also describes linearity and according to that I get mm displacement on LCD.
The problem is that at the output of instrumentation amplifier, signal, while changing the sensor, does not change linearly.

I can mesuare voltage every 5 mm, then make an interpolation and decribe this curve (voltage change) with appropriate formula, and use it in program for PIC.

But I want to know why I'm not getting linear change at the instrumentation amp output?

Here are sensor specs:

Senzor.jpg

PS: Every time I turn on power, I must make additional adjustement on Wien oscillator 'cause I'm not getting the output that I had before turning the power of (though, frequency is always the same, voltage is every time different) Also, voltage jumps 100 mV up and down. It's not so stable. What can I do to solve this problem?
 

I'm not sure why the variation in readings although 5KHz is pushing the limit of the ADC if you are measuring the AC amplitude.

I do not know how 'fixed' the design is but I would make some suggestions:

The 16F877A has a built-in PWM module which you can set to 50/50 mark/space ratio so it produces a square wave at a frequency close to 5KHz, you could use an LPF if necessary to make it closer to a sine wave and it would eliminate the whole Wien oscillator circuit.

You could also turn the output of the sensor into a DC voltage by making U4 a precision rectifier circuit so the ADC gets a steady voltage without having to add the offset.

I suspect what is happening at the moment is a combination of the drive voltage to the sensor not staying constant and the ADC sampling different parts of the AC waveform.

Brian.
 

Since I must use Wien oscillator due to project task, I will not change it. Is there any element for stabilization like LM7805 but for AC?

My ADC works fine enough. With 7000 samples it gives good results every time I do the ADC (+-1mm error),of course only for the voltage that is supposed to be linear. For example, for the half voltage it gives 50 mm like it's expected due to formula given in PIC. But the problem is that on the 'real' 50 mm I get 40mm 'cause signal is not changing linearly and formula should be changed. ADC though is quite good. Error is not that big.

I thought about rectifying voltage. I didn't want to use Graetz because of non-linearity of diodes and voltage drops. I can use precision rectifier though.

I want to ask if this rectifier adds some non-linearity to signal?
Since I have never use it, I also want to know if this is the real schematic of it (I have found few of them on internet):

300px-Op-Amp_Precision_Rectifier_(Improved).svg.png

Should I add something to stabilize voltage (get rid of ''hills'' if you not what I mean)?
 

Most Wien oscillators use a non-linear stabilization device to keep their outputs constant. Often this is a bead thermistor in the feedback path that heats and changes value with only a few mW of power being dissipated. Some designs use semiconductors to do the same thing. Your design has three potentiometers, two of which (RV3, RV4) have to be set to the same value to ensure the correct phase shift and reliable oscillation. You adjust the feedback with RV2 which I suspect does nothing except at the very end of it's adjustment. You could try increasing the value of R20 to allow you better feedback control. There is no equivalent regulator to the DC types that work on AC I'm afraid.

The precision rectifier schematic should be OK. The idea is the diode in the feedback path of the op-amp exactly compensates for the one in series with the output. The amp provides an offset equal to the diode voltage drop thus keeping it's characteristic linear. You must use two diodes of the same type for it to work properly. I think by 'hills' you mean the half cycle signal from the rectifier. You can use a simple capacitor and resistor in parallel to level the voltage "flatten the hills!". As it drives the ADC which only needs a small input current, you can use a small value capacitor (~100nF) and a resistor of say 100K across it. The resistor is to keep a small leakage current flowing to stop the capcitor charging to peak voltage and staying there even when the signal is removed.

You could consider a full-wave precision rectifier but they are more complex and to be honest, I doubt you would see any improvement. If you use the rectifier and capacitor idea you should eb able to reduce your ADC samples from 7000 down to just 2 or 3.

Brian.
 

Great.

I will be using LM358. Since I have added RC high pass filter to bring my virtual ground to ground now I must use single supply opamp. Can this rectifier work with only single supply or it must have + and - voltage?
 

You can use single or split supplies with that circuit. Although the LM358 can use a single supply, there is no reason why you can't use a split supply instead. If you use a single supply, capacitively couple the signal to it's input or you will have to offset it to half positive supply and then remove the offset again before feeding it to the ADC. Remember that with a single supply you can't allow voltages below ground!!

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top