Hi, as the topic says. Virtual PTT from arduino to Baofeng UV-5RE
I am doing a small project which includes using a Baofeng UV-5RE + Arduino Uno board + a relay bard to see if I can activate the PTT function on my radio by just using programming and that relay.
I guess the relay will act as a switch connected to one of the pins and ground.
The radio has a seperate mic input and audio output. I already demostrated how to get a transmission from another radio and take that signal that comes from the aduio and control a relay. That part is done.
The radio has a Earpiece PTT mic cable which has the mic and audio jacks molded in one piece. But I am using seprate cables. The aduio jack is 2.5mm and the mic is 3.5mm.
Now I am wondering how I can transmit something from the radio by connecting a mic cable through a relay. And make the relay act as a physical switch in order to transmit. But with just code, not pushing the PTT button as this is not what I want to do.
Basicly I do not want po hold and push the PTT button myself,
I would like to use that relay to do the job for me with coding. I do not have any actual microphone to speak into the radio when the relay is activating the PTT. I will instead send voice message of some kind also with coding.
Any tips and tricks on how to achieve this?
Yes I do have that plug from the picture inside that link you posted. But this is not what I am trying to do.
I only use the mic input, not the audio output. My desire is to plug a mic cable (TRS) So middle ring is mic + and the end ring is shield or ground which normally is connected to a PTT button which I dont have.
But instead of using a button I want to use a relay which can simulate that button by coding. So I need help with that coding and maybe a drawing.
Anyway, is it possible to use a relay as a pushbutton to simulate a PTT key and key the radio?
Can someone help with a small code if that is possible?
A relay is just a switch, but electrically operated. Use the relay contacts exactly as you would switch contacts.
Google "arduino relay" for many, many tutorials and example relay boards.
You could probably also use a small transistor or optocoupler, which would be much cheaper and less power hungry. Google "arduino remote camera trigger" for ideas.
The link that I posted (found via a Google search in 15 seconds) has a diagram that suggests the PTT 'switch' needs to be wired between the screens of the mic and earphone sockets.
If the diagram is correct, how do you intend to connect the 'switch' via only the mic connector ?
The radio has a Earpiece PTT mic cable which has the mic and audio jacks moulded in one piece. But I am using separate cables. The audio jack is 2.5mm and the mic is 3.5mm.
Generally a bad idea for many reasons.
Only one of which is that as explained, in this case you need to connect the PTT between the two plugs.
The combined cables are pretty cheap and keep all the wiring neatly together. The cheapest may be to get a programming cable and chop off the USB interface, but if not, just get a full cable which appears to have all six wires.
Yeah that cable looks very nice and cheap aswell. I do have one extra programming cable with USB hanging around so I can probably use that.
I have another issue: So my arduino with DTMF decoder is connected to the speaker output and I can receive audio tones to the radio coming form another radio.
The problem is that is that when I connect the mic, just two wires MIC PTT and ground to arduino it starts to transmit automatically as if the PTT button is always pushed in. If I disconnect audio speaker jack it stops transmitting.
when I connect the mic, just two wires MIC PTT and ground
Obviously, that is not the way to make the connection.
You'll want to carefully study the link in reply #1.
And you will need to give us a full schematic of what you are doing. You refer to "I can receive audio tones to the radio coming form another radio". This suggests you have may something else connected to the PTT "sleeve" terminal.