Hello everyone. I took EE / circuits for a couple semesters in college out of high school 25+ years ago. So I know enough to get me in trouble. I do computer programming for a living now...
My little project is to listen to the audio on on an aircraft frequency. A number of microphone key clicks will turn on a relay to turn on landing lights at a small grass air strip.
I have written a program in Python for the Raspberry Pi 4B that I have attached a relay hat to.
Right now I am monitoring a button that I am pushing manually to count the number of 1/2 second long button presses. I am looking for 5 clicks in 10 seconds and turning on the relay. This is working nicely...
Here is the schematic for the button. The way I understand the drawing, the GPIO18 line is high (3.3 V) with the button open. When the button closes the 3.3 V goes to ground and the GPIO18 goes low. So low on / high off.
I want to replace that button with a circuit to take the 3.3 V to ground when the audio out comes on.
I found a circuit described on the internet to do this. Here is the updated circuit that I came up with.
Wil this work? What does the yellow highlighted line / arrow represent? Maybe a capacitor???
I copied the NPN transistors part numbers. Not sure that they are correct yet...
Any recommendations, suggestions, corrections or better ideas how to do this?
Thanks!
Nathan
Learning... I had them in the original submission, but they did not show up. I then added them as replies. I th I thought that they were waiting on approval.
Here is the original circuit...
Here is my modified circuit...
Thanks!
Basically, it should work, but:
1. Your signal on GPIO pin when audio comes in will be some stream of peaks, you will have to use a little software filtration in Rasp.PI
2. You need an audio amplitude signal of at least 1.4V to switch the transistor (0.7V 1n4148 + 0.7V Vbe).
3. The yelow part is a potentiometer (variable resistor) to adjust sensitivity to input audio.
In a base of transistor should be placed safety 1k resistor, to not damage transistor when potentiometer is fully turned.
According to me, i would use a RC harware filtration to have less work in Rasp.PI.
And also, i would change resistors to 4k7 between 3v3 and colector, and 22k between GPIO an colector.
Thanks for the feedback Michal.
For #1 - The GPIO DLL will only report On / Off (1 / 0) so I will have to see what the results are.
Can you point me to a picture of what you mean by "RC Hardware filtration"?
Found an online circuit drawing tool. Here is a better drawing. I have added the push button back in the circuit to give manual input (testing).
I think that I made your suggested changes correctly...
For now the circuit diagram looks good.
What I need to know is:
Is the audio totaly clean when you are not transmitting? No noticable noise?
What kind of sound are you going to transmit? (To have better imagine about "A number of microphone key clicks")
What is the receiver, some radio?
I tried to put RC filter into base of transistor:
I got an nice square wave at the collector (blue), the green is voltage across C2.
The input is sine wave +-5V, 1khz fed in 0.5s intervals. However, the speech is much poor in power then sine, so you probably dont get 7V at filter.
There is no transmitting.
The receiver is a radio.
On the radio there is a squelch circuit for the output audio. When a signal is heard on the frequency it has to be a certain power level to "break the squelch" on the radio and the audio is heard. That is adjustable with a knob on the radio. So you get audio only when the signal is strong enough.
Something like this? I removed the 1k resistor at the base of the transistor. It was missing from your drawing...
Thanks!!!!!
Made the changes that you gave.
I added an LED with a resistor in line to give an indication that I am getting the signal through the transistor or the push button. Will that work? I know that I have to pair the resistor and the LED based on the voltage and LED value.
The Led with resistor cannot be there.
You can place it across 4k7, then change Led resistor to 330ohm. (330 to make it lighter, less draw current)
Or like this, when you can use Led with higher power consumption:
For the 20k Variable resistor, would that be a potentiometer? Tryin to find the right part.
I tried to include an Amazon link yesterday. Maybe that is why the posts did not go through...
Amazon description: E-Projects - 20k Ohm Variable Resistor Trimmer Pot, Top Adjustment Potentiometer (Pack of 25)
Modified circuit.
Thanks again for the help...
Yes, it is a potentiometer. The one you choose is ok. It is better to connect it this way:
And remember , the red selected 1uF capacitor was designed for a sine wave. In case of audio signal (peaks less offen), you will maybe find to use 2u2 or 4u7, especially when potentiometer is set to high sensitivity (resistance near 0ohm) to hold the voltage stable all 0.5s interval.
One thing I realize, how do you configure GPIO? Internal pull-up, pull-down, high impedance? For this design the best is high impedance, let me know.
In case of internal pull-up it can cause trouble.
I am not sure exactly what you are asking or suggesting.
For the GPIO, GPIO18 in this case, the DLL will give me an indication on a transition from high to low or low to high. I basically get a 1 or 0 from the GPIO of the Raspberry Pi telling me the status.
I dont work with Rasp_PI, but i think there is a function to configure the gpio to be pulled up or down via 50k resistance, or dont use this option(see internal circuit i uploaded).
Finally got all of the pieces together. Created the circuit on a breadboard. Images below.
Michal - On your circuit diagram it looks like you are connecting the left connector of the potentiomitor (variable resistor) to both the left and center "wiper" pins and then the right pin to the right side wire. Is that correct? That is not how I wired it in the breadboard below. But I will change it!!!!
Hi, viper connect to the left pin of pot.
Right pin of pot. to the 1k.
But it should work as you did also.
And one advice I can get you, be carefull regarding to protection of GPIO. Input signal or voltage across C2 can reach more than 3v3, so in case of connection this part to GPIO, you may destroy it.
I would use a 3V3 zener diode just for sure.
Thanks! I was actually worried about that. I will order some of those also...
Nathan Jaynes
PermalinkCurrent Circuit
- Log in or register to post comments
Joined November 14, 2020 13Saturday at 08:28 AM