Interfacing variable voltage a/c signal with a uC

Thread Starter

gte

Joined Sep 18, 2009
357
Thank you for the reply, I will try that. I was playing it safe and making sure I didn't overload the zener, but I guess it can handle the 5 to 15v, which will put it at around 30mA, no problem.

My uC didn't read the signal correctly either and was reading exponentially high, maybe the distortion was causing this and maybe I'll need some hysteresis? Or maybe once I have a clean sign wave, I won't need the hysteresis after all?
 

Thread Starter

gte

Joined Sep 18, 2009
357
I had a total circuit resistance value of 4.5k and then later on 7.3k.

Are you alluding that my 466 ohm value was not high enough? Resistor2 is being eliminated per wayne's suggestion, which seems to be contradictory to what I think you are suggesting.

As I see it, this circuit fails the basic tenant of electronics instrumentation. Your instruments should be as invisible as possible to the circuit under test. wayneh alluded to this earlier when he told you to keep your input resistance high.
 
Last edited:

Thread Starter

gte

Joined Sep 18, 2009
357
Wayne,

There must be something goofy with this zener or I am overlooking something obvious and need to sleep on it. I've tried the following two diagrams and in both the zener will not give more than 1.8 to 2v.

I'm going to try tomorrow with a 5.1 zener and just connect the scope, not the uC and see what happens, and then start looking at the datasheet of my 3.3 zener and try to figure out what is going on.


http://img809.imageshack.us/img809/7350/cranksignalconditioning.jpg


http://img96.imageshack.us/img96/7350/cranksignalconditioning.jpg
 

CDRIVE

Joined Jul 1, 2008
2,219
Wayne,

There must be something goofy with this zener or I am overlooking something obvious and need to sleep on it. I've tried the following two diagrams and in both the zener will not give more than 1.8 to 2v.

http://img96.imageshack.us/img96/7350/cranksignalconditioning.jpg
What you're experiencing sounds like "Circuit Loading" and is what I was alluding to earlier. Scope the input node of the limiting resistor and post the results.
 

CDRIVE

Joined Jul 1, 2008
2,219
Here's and example of circuit loading using a DC source and a 3.3V Zener Diode. The source (V1) is swept from 0 to +15V. The internal resistance of V1 = 100k. You will note that the voltage at VF2 never gets above 2.06V, so the Zener voltage (Zbv), measured at VF1, is never reached.

Note that since you stated that your source voltage is derived from an inductive pickup your source resistance is actually a source 'impedance'.
 

Attachments

Thread Starter

gte

Joined Sep 18, 2009
357
Thanks for that diagram, it is awesome, did you make that? That appears almost exactly what I was seeing. Would you mind explaining why that diagram has the curve that it has?

What would you do to alter the circuit you posted to have it work correctly?

With the requested scope, would you like me to scope both sides of the resistor since I have 2 channels?

I scoped the 5.1 zener today before work, for informational purposes, here is the result

http://img214.imageshack.us/img214/9343/cranksignalconditioned4.jpg
 

CDRIVE

Joined Jul 1, 2008
2,219
Yes, measure the input side of the resistor. Note that with your 5V Zener the signal still doesn't reach 5 volts. If it did the positive peaks of the perturbations would flat top when Zvb is reached. I don't see that happening there.
 

Thread Starter

gte

Joined Sep 18, 2009
357
Yes, I noticed that too, it only gets to about 4.7 or 4.8v .

I'll post my results this evening, thanks!
 

wayneh

Joined Sep 9, 2010
17,496
So, if the source has a high internal impedance, then couldn't we just use the zener as protection for the input voltage, and eliminate everything else (the current limiting resistor)? This would "over" load the source signal at voltages above the zener cutoff, but maybe that's OK?

If not, we're back to looking at an input buffering op-amp?

Or, go back to a purely resistive voltage divider to protect the input, and use software to do the peak detection. Without knowing more about what's going on, I'd lean towards software instead of hardware.
 

Thread Starter

gte

Joined Sep 18, 2009
357
Hello,

I scoped the circuit before and after the resistor, for clarity's sake, the circuit is currently

5-10v ac signal ---> diode ---> 466Ω resistor ---> zener ---> ground

Here is the comparison on each side of the 466Ω resistor (channel 2 is before, channel 1 is after)

3.3 zener
http://img441.imageshack.us/img441/7043/cranksignalconditioned5.jpg



5.1 zener
http://img31.imageshack.us/img31/7043/cranksignalconditioned5.jpg


And here are two samples on the scope with the schmitt trigger as part of the circuit, one at idle (ac motor 900rpm) and one at ac motor 4000rpm. Channel 2 is the signal going into the schmitt, channel 1 is the signal coming out of the schmitt.

ac motor 900rpm
http://img827.imageshack.us/img827/7043/cranksignalconditioned5.jpg



ac motor 4000rpm

http://img192.imageshack.us/img192/7043/cranksignalconditioned5.jpg


What do you think, does the schmitt output need a resistor divider to call it a day? :)
 
Last edited:

CDRIVE

Joined Jul 1, 2008
2,219
Yes Wayneh, I'm thinking a buffer may be in order here. If it is a source Zo issue I think a voltage follower would be apropos. I can't help but hearken back to what I said earlier about instruments being as invisible to the circuit under test as possible.

Chris
 

CDRIVE

Joined Jul 1, 2008
2,219
gte, could you please post waveforms with nothing connected to the source except the scope. Make your measurements using the 10x probe.
 

Thread Starter

gte

Joined Sep 18, 2009
357
 
Last edited:

CDRIVE

Joined Jul 1, 2008
2,219
These traces pretty much confirm what I've suspected. Post the schematic of the Schmitt trigger that you used in your last post.
 

CDRIVE

Joined Jul 1, 2008
2,219
Hi Pilko,

I only want to measure when the voltage eclipses 1.65v. To be more specific, the voltage is generated by <snip> crank sensor and trigger wheel.

I measure time differences between peaks as well as peaks per other time period.

My uC does many different things and calculations with the information.
Hi,

Thanks for the response, if I understood your post correctly my proposed interface is far from optimal ... how would you interface the uC with the signal then?

Logically I'm trying to filter out the negative half of the wave and limit the peak voltage ceiling to 3.3v, while keeping voltage floor above 1.65v with my resistor values.
I took the liberty of reading back over your previous posts in this thread and found these. Up until now I've been laboring under the impression that your feeding this signal into a uC ADC input. After re-reading this I see I was in error.

Do I understand the following correctly?

(1) Capturing the varying signal level (sensor Vout level) that changes with RPM is not required for this project.

(2) If (1) is true then this signal is being inputted to a uC digital input, not an ADC input.

(3) If (1) & (2) are true then the uC is preferably measuring data on a purely digital signal.

If all of the above is true then why is it imperative to keep the signal floor above +1.65V? It would seem to me that the following are the requirements I'd want.

A: A pure as possible square wave uC input signal.
B: The signal should be uC compatible, ie 0 to +3V.
C: Bandwidth >= than the highest freq developed at high RPM.
D: Hi Z input that will not effect the existing circuit being measured.

I was putting together, what I thought was, a good solution to a uC ADC input. It used a single ended OpAmp that scaled the input signal by 10:1, has an input Z of >100KΩ, more than sufficient bandwidth and provides a signal that never goes below zero. While I was designing this I was also trying to accurately reproduce the positive going waveform, which seems to be contrary to your requirements, as I see it, as you need a digital signal.

If the above are all true I will take a totally different tac.
 

Thread Starter

gte

Joined Sep 18, 2009
357
Hi,

I am not feeding it into an ADC, but instead a single pin on the uC, sorry that wasn't very clear.

1) Yes, I do not need to know the voltage level of the signal, I only need to know that the sinusoidal or square wave (depending on which hardware we go with) is positive in voltage and above 1.65v, which is the threshold that triggers my uC to see a "high" . It is a 3.3v uC, and so anything greater than 1.65v is a high and anything less is a low.

2) Correct

3) Yes, currently my code counts frequency and time in between each frequency, from this is can calculate rotations per second


The signal floor only has to be above 1.65v when it is increasing, I need it to go to 0 or close to 0 when it is falling so that the uC can tell the difference between the peak and valley of the wave.

A, B, C and D all seem very ideal and would allow me to calculate rpm well I think. Thanks for sticking with me on this, if there is any additional information I can provide that would help, into a condensed post or something, let me know.



I took the liberty of reading back over your previous posts in this thread and found these. Up until now I've been laboring under the impression that your feeding this signal into a uC ADC input. After re-reading this I see I was in error.

Do I understand the following correctly?

(1) Capturing the varying signal level (sensor Vout level) that changes with RPM is not required for this project.

(2) If (1) is true then this signal is being inputted to a uC digital input, not an ADC input.

(3) If (1) & (2) are true then the uC is preferably measuring data on a purely digital signal.

If all of the above is true then why is it imperative to keep the signal floor above +1.65V? It would seem to me that the following are the requirements I'd want.

A: A pure as possible square wave uC input signal.
B: The signal should be uC compatible, ie 0 to +3V.
C: Bandwidth >= than the highest freq developed at high RPM.
D: Hi Z input that will not effect the existing circuit being measured.

I was putting together, what I thought was, a good solution to a uC ADC input. It used a single ended OpAmp that scaled the input signal by 10:1, has an input Z of >100KΩ, more than sufficient bandwidth and provides a signal that never goes below zero. While I was designing this I was also trying to accurately reproduce the positive going waveform, which seems to be contrary to your requirements, as I see it, as you need a digital signal.

If the above are all true I will take a totally different tac.
 

CDRIVE

Joined Jul 1, 2008
2,219
OK then. The 1.65V is the minimum requirement for a logic 1 (High). That's a horse of a different color. I will work with that information. I'll be going for a digital reproduction swinging from 0 to +3V, as producing a logic 1 that's just above the minimum of 1.65V isn't advisable.

Should have something for you soon. In the interim this is what I worked up before we solidified the requirements. It won't be useful to you here but it may be for something else in the future. It has a negative gain of -10, so +10V will output +1V, does not output the negative half, Hi Input Z and linear to ~10KHz.

Please note that while I've got a lifetime of electronics under my belt, OpAmps aren't my strong suit. I'm hopelessly outdated in my choice of chips and my designs can probably be improved by senior members that work them more than me. That said, they generally do work!
 

Attachments

Thread Starter

gte

Joined Sep 18, 2009
357
Thanks.

Out of curiosity, what do you think of the current circuit? I would think with a 4000/6000Ω resistor voltage divider on the signal out pin, that I'm golden. I'd give me 2.7v peak at 4.5v and 3.3v peak at 5.5, and since my schmitt trigger is powered by 5v, it shouldn't ever eclipse Vcc, correct?

Since I'm a hobbyist, there is a good chance I'm overlooking something :D
 
Top