Hi!
So I have this transmitter circuit which generates 40 khz of pulse train through an arduino uno. (UltrasonicTransmitter2.jpg)
On the other hand, I have an LM324N op amp which I tested first (and has proven to be working properly). For the experiment, I set the op amp's gain to 3. When my input for this op amp comes from a function generator, correct values are shown in the oscilloscope.
However, if my input to the op amp is the transmitted pulses coming from my working transmitter circuit, I was not able to get my desired result.
Attached is the image of the waves I'm getting if my input is my transmitter circuit (). Take note that CH1 is the transmitted waves while CH2 is the output of LM324N. The values at the right of the picture shows that instead of the voltage being amplified, the voltage was reduced.
Can you pinpoint any mistakes that I've done here? Any suggestions? Thank you all in advance for your answers.
Hello there!
Can you post a schematic of any wiring that you are using?
I'm currently outside the laboratory right now since it's already closed. I will have to get back again tomorrow. Sorry for that 
What power supply are you using on the op-amp? Since you input is roughly +/-5V and you want a gain of 3 you will need at least a +/-15V supply. The datasheet says that the max max power supply is 32V (+/- 16V).
Indeed Sir, my supply is +/-15V coming from the trainer. I'm just wondering why when the input comes from the function generator, it works. But from the transmitter, it doesn't.
When Arduino is not driving the Digital10 pin (i.e. during and shortly after reset) the H-bridge in your amplifier will short Vcc to GND. My guess is the transistors are dead?
When Arduino is not driving the Digital10 pin (i.e. during and shortly after reset) the H-bridge in your amplifier will short Vcc to GND
Excellent point -- the "ultrasonic transmitter" is a terrible circuit.
But I'm driving my transmitter with the arduino while it is being amplified
Also, I tried not using the transmitter circuit. Instead, I generate pulses using arduino and directly connected the output to the op amp. The images attached sows the output. Wave gen.jpg shows the correct output when the gain is 3 but when arduino is connected instead of wave gen, i get that mcu.jpg in which the output voltage was reduced.
Jenifer3096:
Also, I tried not using the transmitter circuit. Instead, I generate pulses using arduino and directly connected the output to the op amp. The images attached sows the output. Wave gen.jpg shows the correct output when the gain is 3 but when arduino is connected instead of wave gen, i get that mcu.jpg in which the output voltage was reduced.
Unless I am missing something, the frequency used in in the 'correct' output is 1.6 KHz while that from the Arduino is 40 KHz. You need to have the same frequency if you are going to compare.
OMG Sorry I didn't realize that. But rest assured Sir that whether that's 40khz on the 'correct' image, the voltage output will be as is. Tried that multiple times yesterday. Sorry for the mistake Sir.
Jenifer3096:
OMG Sorry I didn't realize that. But rest assured Sir that whether that's 40khz on the 'correct' image, the voltage output will be as is. Tried that multiple times yesterday. Sorry for the mistake Sir.
I'm not sure what you are saying. The "mcu" 40.03 KHz input/output just seems to me to be a 40.03 KHz square wave passed through a low pass filter. If you set the "wave_gen" frequency to 40 KHz I would expect the input/output to look very very similar to the "mcu" input/output.
I suspect the problem is in your expectations. According to it's datasheet, the gain-bandwidth product of the LM324N is about 1 MHz . A simple amplifier of gain 3 based on the LM324N will therefore have a bandwidth of about 330 KHz which means the harmonics above 330 KHz of your 40 KHz square wave will be significantly attenuated. This will result in significant distortion of your signal. There may also be other factors but you haven't published the schematic of your amplifier and it's connection to the mcu so it is difficult to say more.
l1/ could you post your LM324 amplifier circuit?
2/ The LM324 is a very slow old opamp. You may need something with a much higher gain bandwidth product - perhaps an NE5534.. or there are much faster devices. 40kHz isn't 'very slow'.
What are you driving - ie what load? ....
Allan
@allanhurst, I'm doing a diy ultrasonic sensor. A 40khz transducer is my load
Have you looked at the HC-SR04 shield?
Allan
@jremington, Sir can you suggest a good driving circuit for the transmitter?
Try using a 74HC04 with 3 in parallel driving one side of the peizo, the other 3 in parallel driving the other side.
Connect the inputs of the 1st 3 to the 40kHz source, and the inputs of the 2nd 3 to an output of the first 3.
Gives 10v p-p with a 5v supply.
Allan
Google image search for "ultrasonic transmitter driver" for many examples.
Can I use the L293D motor driver for my transmitter as an h-bridge so I can make the 5v input a +-10V for the required 20vpp?