Analog to squared signal, need help...

Status
Not open for further replies.

I'd removed the resistors and i'd increase the gain by increasing the R5 to 100k. This seems to give smoother output (it work like a half wave rectifier without increasing the R5).

Somehow, there is an overshoot at the very first waveform which is very important (only have to considerate the first wave as thats when the axle passed). I'm trying to make adjustment now. Hoping to get the result without overshoot.

-Zane-


 
Here in Canada, we weigh only Canadian trucks.
We just assume that all trucks coming across the border from the USA are overloaded with guns and drugs.
 
Zane83 said:
I'd removed the resistors and i'd increase the gain by increasing the R5 to 100k. This seems to give smoother output (it work like a half wave rectifier without increasing the R5).
R5 doesn't change the gain. The transistor is an emitter-follower with a gain of 1.
100k is too high to provide enough base current to the transistor for it to supply a high current to the capacitor to charge it quickly. Use 1k for R5 then try 1uF and 0.1uF for the capacitor to see if the overshoot gets less or gets more.

The circuit is a half-wave rectifier. A full-wave rectifier won't work in your peak detector application.
 
Nigel Goodwin said:
110kmph is 30.55m/s - so to travel 1m takes 1/30th of a second (33mS). I'm not messing about with metres and feet, so 1/2m will take around 16/17mS..

Hmm... instead of using metres, i used mm instead as that could represent the resolution instead (mm/sec - more accurate right??) So.. the result i get is 32.73x10^-6 mm/sec and resulting 30.55kHz. i make mistake in calculation! really very sorry..


Thanks. I'd read on the data on PIC16F87x. The time to be taken for the operation to be done is fast! I think its enough for my application.

Nigel Goodwin said:
use a PIC output pin to discharge it after reading it.

Hm.. I think i'd figure out the peak-detector with audioguru help. But may i know what do you mean of the last sentence??
 
audioguru said:
Here in Canada, we weigh only Canadian trucks.
We just assume that all trucks coming across the border from the USA are overloaded with guns and drugs.

~LOL~
But somehow for what i'd read, Canada only have slow WIM system right? The fast-speed seems not really carried out yet. And the complete station in a site cost up to millions!
 

If i changed the R5 into a lower value, the output will oscillates even more. But if i change it to higher value again, the output will show more even output (althought been reducing gradually over the time).

From my observation, R5 should be higher while C1 and R3 (before output) should be greater when input signal is smaller.

If not, the output is as attached.
Null = changed to lower values.
Null1 = I think the best design???

 
I think offset of about 0.02mV could be ignored???

I'll be getting the specification of the load cell tomolo i think. Hopefully could be worked out with this peak detector...
 
Zane83 said:
Hm.. I think i'd figure out the peak-detector with audioguru help. But may i know what do you mean of the last sentence??

Simply that the peak detector output is supposed to rapidly increase to the peak voltage from the sensor, you then read that value, and to reset the circuit you need to discharge the capacitor - you could use an output from the PIC to do that - once it's taken the reading, reset the peak detector.
 

I think i get what you mean. The main thing here is to reset the circuit before the other detection start. Thanks! May i know is there any tutorial or example in you site regarding to this? I'd look into your site regarding to ADC, but somehow i can't find things regarding to this. Maybe you can point me out?

To be serious, i'm a slow coach and pictures always tell me more... thanks alot!
 

No, there's nothing on my site about it, only about how to set up the A2D in the PIC.
 
Last edited:
Nigel Goodwin said:
No, there's nothing on my site about, only about how to set up the A2D in the PIC.

Its alright sir. I think gonna work out for another problem here! Thanks for being patient on me and advices!
 
Sorry for not posting this under Microcontroller section...

Nigel Goodwin said:
The PIC A2D already includes an internal sample and hold, so no need for an external one.

Sir,

May i know how the internal sample and hold works? And can you please help me with the questions below???

For example, I set RA1/AN1 as the analog signal (from input to peak detector then PIC). The peak detector increase gradually until the peak. The signal may increase from 0V to 3mV (for example) with duration of 16us.

1. Will the internal holding sample for example at the time 0th microsecond once, 4th microsecond once.. till the 16th microsecond? (if holding time is 4us).
2. Is it means that the once the holding time is up, the A2D conversion is completed too?
3. Am i gonna detect the peak of the signal by keep on subtracting the previous conversion? (as i'd asked you before) If i'm gonna do this subraction, seems like the peak-detector doesn't really work for me... *puzzled*

Hope to get some ideas on this. I'm kinda feeling hopeless solving this signal problem...

-Zane83-
 

Presumably you're using an opamp to amplify this tiny signal to something useful?.

1. Will the internal holding sample for example at the time 0th microsecond once, 4th microsecond once.. till the 16th microsecond? (if holding time is 4us).

All the timings are in the datasheet, but the sample and hold freezes the sample, then the A2D reads it - next reading the same thing happens.

2. Is it means that the once the holding time is up, the A2D conversion is completed too?

Again, the datsheet explains it all, with a formula for working the time taken.

3. Am i gonna detect the peak of the signal by keep on subtracting the previous conversion? (as i'd asked you before) If i'm gonna do this subraction, seems like the peak-detector doesn't really work for me... *puzzled*

Again, were you amplifying the output of the sensor?, it's too tiny on it's own.
 
Thanks!


Thanks. I think found some information under the forum of Microcontroller. As for the timing, i think i do need some more time to understand more (in the datasheet). I'm dun think i'm gonna amplify it as afraid it'll affect the reading. I'm still waiting for the company to provide me which kind of load cell i'm using to make sure the max. output signal. I think this should be way to do it.. right? The company had kept me waiting for a week... Sigh!

I'll be completing my PIC programming soon. If got any problem, i'll post it under Microcontroller and hope to get some suggestion then. Thanks alot Nigel!

Get back to you soon once i complete this. Hope it works!

-Zane-
 
Zane83 said:
Thanks. I think found some information under the forum of Microcontroller. As for the timing, i think i do need some more time to understand more (in the datasheet). I'm dun think i'm gonna amplify it as afraid it'll affect the reading.

Why would it affect the reading? - if your electronics knowledge is really so slight I'm afraid you're biting off much more than you can chew!.
 
Nigel Goodwin said:
Why would it affect the reading? - if your electronics knowledge is really so slight I'm afraid you're biting off much more than you can chew!.

Actually i tried to get signal from a sample load cell. I get the sample readings and found that the resolution is 2kg/mV.

After knowing the max. output signal value, i can just set the Vref+ in the PIC with the max. output signal value of the sensor. If only the signal is really too small (to fit the Vref+) only i think i'm gonna amplify it.

Simulations may get the accurate amplified signal, but just afraid the real-time doesn't really work the same. Sorry for my low knowledge in it...

-Zane-
 

NO!!!! - AMPLIFY THE SIGNAL - you shouldn't wildly alter the Vref, it loses accuracy (again, check the datasheet!), a good value is 2.5V using a precision voltage reference. Either amplify, or attenuate, the signal to make it fit that range - this is the way to get the best resolution and accuracy!.

Simulations may get the accurate amplified signal, but just afraid the real-time doesn't really work the same. Sorry for my low knowledge in it...

Real time works BETTER than simulators, it's guaranteed to be real, using a correctly designed opamp circuit to amplify it will give no problems, and be FAR, FAR better than playing with Vref values.
 

I'd read about the Vref in some of the MicroChip notes. I get to find out that we could apply Vref as long it doesnt lower than the input signal or greater than 0.3V of the Vss.

For example, if the max input signal for my load cell is 3V. I should put my Vref precisely at 3V??? From the notes, i get to know that we could make the Vref precisely by adding voltage follower.

From the notes, i understand that to get more precise and accurate conversion, i have to do the conversion in sleep mode. By doing so, i need to use the internal RC oscillator (2us-6us). Since its internal, doubt that i could make changes to it? From the attached, it stated that the correct AD conversion should be 167us. This making some confusion to me.

Anyway.. i'm sure that i have to use Sleep Mode A2D conversion for better conversion.
 

3V is fine as a Vref (and you can easily adjust most precision references to be 3V), but you were talking about mV levels before - do have any idea what the levels are going to be?.


Sorry, what has sleep mode got to do with anything? - that's only to reduce power consumption when it's not being used, it won't improve conversion in any way.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…