I do not think you can do a proper average on a +3V +/-1V whichever
"software tricks" you'll do.
Which amplitude do you want to measure on that signal, V+, V-, Vpp? Perhaps
an oscilloscope capture would help for a better answer.

On Wed, Aug 31, 2022 at 7:32 PM flyway38 <[email protected]> wrote:

> Hi Vasile,
>
> Yes understand your point and thank you for your input.
> But, my problem is cannot change the hardware design. Maybe in near
> future...
> Also, it's not AC signal what I need to smooth. Its a positive oscillating
> signal, like 3V, +/-1V.
> Thanks anyways.
>
> Cheers,
> Filipe Santos.
>
> On Wednesday, August 31, 2022 at 4:26:29 PM UTC+1 vasile wrote:
>
>> :) "precision rectifier" or "zero voltage drop rectifier" not "zero
>> precision rectifier" :P
>>
>> On Wed, Aug 31, 2022 at 6:22 PM vsurducan <[email protected]> wrote:
>>
>>> Felipe, in my opinion you have two variants:
>>> 1. the easiest one: use a zero precision rectifier with operational
>>> amplifiers, there are several versions, then your problem will be measuring
>>> a DC signal. Beware of using adequate bandwidth OA and use precise
>>> resistors for positive and negative slopes ( if your signal is alternately).
>>>
>>>
>>> https://www.google.com/search?q=precision+rectifier&tbm=isch&ved=2ahUKEwiHoc6_r_H5AhUThxoKHbi-Au4Q2-cCegQIABAA&oq=precision+rectifier&gs_lcp=CgNpbWcQAzIFCAAQgAQyBQgAEIAEMgUIABCABDIFCAAQgAQyBQgAEIAEMgUIABCABDIGCAAQHhAHMgYIABAeEAcyBggAEB4QBzIGCAAQHhAHUOCWAliipAJgo6oCaABwAHgAgAGaAYgBlwuSAQQwLjEymAEAoAEBqgELZ3dzLXdpei1pbWfAAQE&sclient=img&ei=FnsPY4e-PJOOarj9ivAO&bih=815&biw=1537&client=firefox-b-d
>>>
>>> 2. the complicated one which will not work with jal library: sense the
>>> zero cross of the signal (if there is any), add a precise delay until
>>> you'll sample the top of the rectangular signal or the Vmax of the
>>> sinusoidal shape and sample it. You'll have to process data later. You can
>>> not sample, format and display in a loop since the time consumed by last
>>> two is much longer than the signal period.
>>>
>>> best wishes
>>>
>>>
>>> On Wed, Aug 31, 2022 at 3:13 PM flyway38 <[email protected]> wrote:
>>>
>>>> Hey Guys,
>>>>
>>>> My bad. Sorry to make this mistaken post.
>>>> *10bit ADC is working fine.*
>>>> Problem is my code. Am trying to smooth the sinal that is read by the
>>>> ADC.
>>>> Its a fast (100KHz) oscillating signal (with vpp around 1V) that am
>>>> trying to read it like DC... Not easy I know.
>>>> My code is currently reading some hundreds times the signal, then finds
>>>> the median of all readings and then discard the final reading (make it
>>>> equal to last median value) if it changes by a small divergence (like 2
>>>> bits) from last median value.
>>>> This is what lead me to think (wrongly) that ADC was converting at 8bit.
>>>> Sorry again for posting a wrong question.
>>>>
>>>> But now this raises new question;
>>>> How to smooth an oscillating signal and make it DC reading just like a
>>>> DC-Voltmeter would do?
>>>> (Using only code... cannot change my design)
>>>> Thank you once again.
>>>>
>>>> Best regards,
>>>> Filipe Santos.
>>>>
>>>>
>>>> On Wednesday, August 31, 2022 at 9:26:23 AM UTC+1 Rob Hamerling wrote:
>>>>
>>>>>
>>>>>
>>>>> On 31/08/2022 10.21, Rob Hamerling wrote:
>>>>>
>>>>> adc_read_high_res() returns a word, but your AdcChnn is a byte...
>>>>>
>>>>> Sorry, that 'AdcChnn' is a byte isn't the relevant here. Maybe AdcData
>>>>> is a byte, but I cannot find that in the code you showed.
>>>>>
>>>>>
>>>>> --
>>>>> *Rob H*amerling, Vianen, NL
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "jallib" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jallib/68dfd26e-07d1-4ba5-bf02-f41aee02c29bn%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/jallib/68dfd26e-07d1-4ba5-bf02-f41aee02c29bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jallib/d81e0cf6-5487-4186-a961-01fbd5ba6ec4n%40googlegroups.com
> <https://groups.google.com/d/msgid/jallib/d81e0cf6-5487-4186-a961-01fbd5ba6ec4n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAM%2Bj4qtS%2BBC25ty-Y_K3P6nOAxiVr_9a_%2BCjdz8fzSMjf_L7DA%40mail.gmail.com.

Reply via email to