1
\$\begingroup\$

(Warning, as this is a long question, asked by students that don't know what they're doing. Perhaps our questions are too general and can't be answered but at this point we'll take all the help we can get)

As a project in first year engineering, we have to send a laser to be reflected off of a mirror that is placed on a box. In this box is a speaker, making the mirror vibrate. We must collect the data from the laser with a photodiode and send it into a Python and C++ program.

We faced many, MANY problems but one of them is that we do not understand is what happens when we send the signal into the Arduino. Absolutely nothing goes through and we don't know why.

Our circuit:

our circuit

One of our hypotheses is that the impedance of the Arduino is killing the signal before it can even be analysed.

We switched to another circuit with which we flashed a DEL directly onto the photodiode, omitting the laser and the mirror completely. It gave us something that looks like this:

enter image description here

The other problem we encountered is the translation into audio files. When we eventually had a circuit that worked properly with a laser and the mirror oscillating with the music, the audio files were weirdly cropped.

Our question is: at what sampling rate should we have set our Python program in order to translate the data into audio files that we can actually listen to? Because in order for the time of the audio file to match the time of the sample of the song, the sampling frequency of the photodiode must be identical to the sampling frequency within our Python script (or so we were told).

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Your photodiode circuit doesn't look right, though you don't indicate what the terminals on each side are connected to. \$\endgroup\$
    – Hearth
    Dec 1, 2023 at 20:58
  • 1
    \$\begingroup\$ Also, what are the supply voltages and which op-amps are you using? You tell us what the sample rate should be and why. Hint: What's the bandwidth of the audio signal that you're sampling. What's your A/D reference and input range? Think about the polarity and output range of your photodiode amplifier circuit. The input impedance of the Arduino A/D is NOT your problem. \$\endgroup\$
    – John D
    Dec 1, 2023 at 21:08
  • \$\begingroup\$ @JohnD Depending on op-amp, the sampling ADC input could be a problem. The op-amp output will experience being shorted to charge a capacitor for each sample, and not all op-amps can handle being directly connected to an ADC input. \$\endgroup\$
    – Justme
    Dec 1, 2023 at 22:15
  • \$\begingroup\$ @Hearth's comment explained - Isthe leftest connection point connected to a positive voltage?! Then the output of the leftest opamp is always negative. And the output of the rightest is also negative - always. Normally a photo diode needs a regulation circuit that keeps it in the right operation point (that would compensate ambient light, drift, temperature changes). But probably with a laser the light change is so big, that it does not matter - but why you amplify the signal instead of simply make it digital by a Schmitt trigger? The laser either hits the photo diode or not (completely). \$\endgroup\$ Dec 1, 2023 at 23:10
  • \$\begingroup\$ @Justme Yes, that's true, and I'm not familiar with the Arduino's A/D, but I'm guessing it's probably routine use for people to drive it with an op-amp. There are bigger problems with the OP's approach that have to be solved before worrying about the input impedance of the A/D. \$\endgroup\$
    – John D
    Dec 1, 2023 at 23:27

1 Answer 1

2
\$\begingroup\$

When you are overwhelmed with a project, you need to break it into smaller pieces.

Test your ADC path with a simpler setup. Play some music and try to capture it directly with the Arduino. You need to bias the signal to the center of the ADC.

Note that the ADC output will be a number from 0 to the maximum value of the ADC (4095 for a 12-bit ADC, not sure what the Arduino has).

Audio files are generally 2's complement numbers. You may need to convert the data before the Arduino can play it. https://en.wikipedia.org/wiki/Two%27s_complement

schematic

simulate this circuit – Schematic created using CircuitLab

Once you are confident in the ADC, work on the other blocks. These are the blocks that you probably need.

enter image description here

This is a difficult problem for first year students. I didn't learn any circuits in my first year. This is more like a senior level project. Has your professor actually made a working version of this?

The laser will put a large bias on the signal. Since this is only a demonstration, you can adjust the gain until the transimpedance amplifier output is near 2 V. If this was a real application, you would need some type of automatic operation point adjustment (as BitLauncher discussed in their comment).

You will likely need a large amount of amplification. But, you need to remove the bias first. All of this will be simpler if your opamps have bipolar supplies.

After the amp, you need to add bias again for the ADC. This is the circuit in the first part of my answer.

The laser output probably has a gaussian distribution vs angle. Do you know if the photodiode sensor is smaller than the laser spot? Most photodiodes have a crude lens attached, this may be a detriment.

enter image description here

The mechanical configuration may make or break this project. If you assume that the mirror is a piston, you may not get enough deflection (left diagram).

If you fix the mirror on one end and cantilever the other end, you will get more deflection (right diagram).

enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ To tell you the truth I understand about 20% of your answer, it is a hard project for first years considering we haven't had any classes on circuits or on most of the concepts we're applying. Our professor hasn't made a working version, one of the goals of the class is to teach us how to manage a project, especially when we're left in the dark and don't know how to do it. To answer some of your questions: the laser spot is bigger than the photodiode and our op-amps have bipolar supply. We did try the ADC with a smaller setup and it worked but when we tried it with our regular circuit, nothing. \$\endgroup\$ Dec 2, 2023 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.