Reading sine wave output using arduino analogread()

Thank you for your reply.

Yes. For the purposes of my project , I only need to read and find this peak negative voltage value at the start of the program (and when it loops back to the start). So I think I should be able to just trigger the peak detector circuit when I need to at the start?

From what I read online, the peak detector circuit seems to work to save the values of the peak values in the positive cycle, due to the diode being in forward bias. Is it possible to make it work for my case whereby I need the peak negative values?

Thank you, sorry if my questions are stupid.

You were told earlier about biasing the input to a mid range value. So do that and then your problem becomes finding the minimum positive value.

Turn the diode arround and have the capacitor connected to this mid range value instead of the ground.
You might want to put a transistor across the capacitor so you can short it out at the beginning of your measurement cycle.

No stupid question.
Its simple to invert the signal.
Without looking at the circuit again, I would:

AC couple (i.e. through a capacitor) to a voltage divider at around mid powersupply.

Either invert the signal or invert the peak and hold.

Just out of idle curiosity, what is the signal, that you are looking at, derived from ?
You've mentioned an amplifier but the frequency appears outside the audio range. Is the original source of the signal some sort of sensor?. Why also are you interested only in negative peaks ?

Yes, I said before, "it depends on the nature of the signal". Posting a full explanation of your project, the signal, and what you expect to do with it, will rapidly expedite this conversation.

Mathematically, a maximum is undefined unless the range is defined.

thank you for your reply.

basically the signal that I’m trying to read is coming from a hydrophone (that measures ultrasonic waves that are emitted by my arduino)

So I need to measure the peak negative voltage from this signal in order to perform some calculations and measure the intensity of this ultrasonic waves. It will then act as a feedback system for me to adjust my gain (using my dig amplifier accordingly)

Unless your equipment is quite non-linear, the negative and positive peaks are identical.
Paul

Are you talking about 1Mhz Automatic Gain Control mplifier ?
MC1350

or you want to measure intensity of the signal ?

Just thinking...

How granular can your reading be? Could you get what you need with 4 comparators at different levels? Or even 8. (comparators are usually 4 to a package.
It would be much easier for someone with no experience with opamps to implement.

Thank you for you and everyone else’s reply. Apologies for my late response, the arduino website has banned my acc from having too many replies per day (since it is a newly created account)

Thanks to all your suggestions, so far I have constructed a peak inverter circuit, and managed to hold the positive part of my input sine wave. Now I’m working on implementing a transistor to invert the signal before passing it through my peak inverter circuit.

Thanks again!

When you finish, it would be nice if you post details of the solution for any interested third parties that are reading, or will later read, this thread.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.