Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please refer to the product documentation or check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

USB PTT foot-switch

Marc Lalonde
Marc Lalonde Member ✭✭
edited January 2020 in New Ideas
that something i have in my brain for some time  to build a USB PTT foot-switch

i operate remote and already have USB studio mike and not like to rely on third party application 
only for handle my "CTS"  serial port foot-switch

so i take Arduino nano and fit it  inside on treadlite II switch 

image

image

image


that beta code 

//on next version will add a time-out timer  by polling ZZTX; status and force RX if TX stay on for //longer that 180 second  (JT-65 and meteor-scatter friendly)


#include <Bounce2.h>
#define PTT 2
int PTT_State = 0;

Bounce debouncer = Bounce(); 

void setup() {
  // put your setup code here, to run once:
  Serial.begin(57600);
  pinMode(PTT, INPUT_PULLUP);
  debouncer.attach(PTT);
  debouncer.interval(5); // interval in ms
}

void loop() {
  // put your main code here, to run repeatedly:
  debouncer.update();
  
  if (debouncer.read() != PTT_State){
   if (digitalRead(PTT) == LOW) {
     Serial.println("ZZTX1;");
     PTT_State = 0; 
     delay(100); }
   else  {
     Serial.println("ZZTX0;"); 
     PTT_State = 1; 
     delay(100);
     Serial.println("ZZTX0;"); }  // just in case radio missing it 
  }
}


Next on my todo list was  Native USB  radioSport  RS60CF headset
by put mini external USB sound card inside the headset shell  
so keep analog audio line as short as possible ;-)

73!  Marc   VE2OLM






«1

Comments

  • EA4GLI
    EA4GLI Member ✭✭✭
    edited January 2017
    Very cool! Thanks for sharing!
  • K1DBO
    K1DBO Member ✭✭✭
    edited February 2018
    I did something similar a while back but I used a serial port instead of USB.  You might find this:  https://community.flexradio.com/flexradio/topics/push-to-vox-version-1-0-0-is-now-available interesting. With it you can can toggle either VOX or MOX.
  • W7NGA
    W7NGA Member ✭✭✭
    edited January 2018
    Nice work Marc! I too have been integrating the Arduino with my 6500. I use the Arduino to debounce my old Vibroplex keyers and massage the dit/dash timing, and use the new USB support to decode frequency and control bandswitching, antenna switching, SteppIR configuration, and utilize i2C bus devices to perform just about anything I desire (e.g. analog voltages for old Icom antenna tuners). Great fun ...

    W7NGA  dan
    Seaside, Oregon
  • VE2MBT
    VE2MBT Member
    edited November 2019
    Nice work Marc, this is a good idea.. let me know if you ever come down to Amos so we can meet somewere
  • W7NGA
    W7NGA Member ✭✭✭
    edited January 2018
     Serial.println("ZZTX1;");

    I can find no reference that states the TX command is supported. 
    Does this actually work on a Flex Signature radio?

    W7NGA dan
    Seaside, Oregon
  • Marc Lalonde
    Marc Lalonde Member ✭✭
    edited January 2017
    HI  that native cat command for SmartSDR  ,at least it work on my 6700 whit last software

    page 32 of  SmartSDR-CAT-User-Guide.pdf

    but may use kenwood ts-2000 if what to 

    73 Marc l. VE2OLM
  • W7NGA
    W7NGA Member ✭✭✭
    edited January 2018
    hmmm ... I can't find a SmartSDR CAT User-Guide 

    I am using the new USB cable interface and this command doesn't appear to be supported.

    I think that is the issue ... it supports a very limited subset of CAT commands.

  • Ria
    Ria Member ✭✭✭
    edited November 2019
    Outstanding. I am going to try it. 
  • Marc Lalonde
    Marc Lalonde Member ✭✭
    edited January 2017
    i take it here  www.flexradio.com/downloads/smartsdr-cat-user-guide-pdf/

    since it a FTDI chip  i assume it may work directly on radio USB port
    but for now i only try on my Desktop PC

    for kenwood CAT emulation  it TX;  or RX;

    that may tested on CAT  log..  windows  whit the test Button
  • W7NGA
    W7NGA Member ✭✭✭
    edited January 2018
    Thanks Marc. 
  • Marc Lalonde
    Marc Lalonde Member ✭✭
    edited January 2017
    HI  bit of reading and  "CAT" USB cable plug on radio not handle ZZTX; command  or TX; RX;

    but i also not a issue since it have PTT on accessory connector (DB15)
    and on mic connector on front of radio

    on my case i what to use laptop / Desktop   and my radio was remote in cabinet in the basement
    so have USB PTT take sense ;-)  same whit USB headset
  • Marc Lalonde
    Marc Lalonde Member ✭✭
    edited January 2017
    ok got my RadioSport headset from Flex today 

    so i turn it into a USB headset  for use on my remote radio  
    Think it the first USB RS-60  

    so i take a small external USB sound card on ebay  and remove all connector 
    then solder head phone wire to it  ,and use 4 pin of mini XLR for USB
    noting to complex about 45 min of work    , i lost the use of build PTT but who use it really ?

    image

    image

    first test look really good , this week-end Winter-Field day will be the real test  ;-)
  • Mark K0JM
    Mark K0JM Member ✭✭
    edited April 2018
    Just built one of the foot switches this week with a cheap Chinese nano-clone. Works great! Thanks for sharing the code.
  • Jason Frazier
    Jason Frazier Member ✭✭
    edited August 2019
    Building one of these now with a nano-clone off Amazon.  I notice there is a 3v3 pullup resistor to D2 in the first photo, but the value is hidden.  Is it even required, since the internal pullup resistor is already enabled?
  • Marc Lalonde
    Marc Lalonde Member ✭✭
    edited August 2019
    HI  value is not critical   1K  is good   , internal pull-up is very weak  so it like ti rely on external  one 

  • mlstutler
    mlstutler Member ✭✭
    edited November 2019
    Marc,

    Did you ever finalize the code.  I see your beta code posted.   Wondering if there is a GA version.

    tu
  • Marc Lalonde
    Marc Lalonde Member ✭✭
    edited November 2019
    HI normally code work and have never change   

    but cannot test i since i no longer have flex ,sine none of the radio seem to work 
    on my un-heated remote site during cold Canadian whiner 
  • mlstutler
    mlstutler Member ✭✭
    edited November 2019
    Thanks Marc...
  • mlstutler
    mlstutler Member ✭✭
    edited December 2019
    I just stuck my toe in the Arduino world for the 1st time... Downloaded the web editor and ran Marc's code.   It threw out an error on bounce2.h .  A quick google search and I learned about library manager.  I downloaded bounce2.h and ran the code again.   Success...Now I need is the nano and some solder time.  I decided to get real Arduino boards instead of knock offs.  It's not the boards I am worried about.  It's more the drivers that I suspect.   Regardless I hope to put my PTT switch together soon.

    thanks to Marc for the code...
  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin
    edited December 2019
    You can also do it without the Arduino.  It is discussed here:

    https://community.flexradio.com/flexradio/topics/remote-footswitch-how-to-lan-vpn-solution

    Mike 
  • mlstutler
    mlstutler Member ✭✭
    edited December 2019
    Update - It's working.  I used the Nano Every.  It was a tight fit but I have it in the foot switch.. I wish there was CAT command to disable DAX.  I did not see it in the log.  Then I would not have the issue where PTT is on but no audio.   Regardless having a USB PTT is cool...Thanks Marc.   



    I would have went with the rs-232 port but I plan on using this with a lap top...
  • Tim - W4TME
    Tim - W4TME Administrator, FlexRadio Employee admin
    edited December 2019
     I wish there was CAT command to disable DAX. 

    ZZDX0;
  • mlstutler
    mlstutler Member ✭✭
    edited December 2019
    Ask and you shall receive.   I did not see it in the manual .  Thanks Tim..  Going to mod the code and give her a whirl...

  • mlstutler
    mlstutler Member ✭✭
    edited December 2019
    Tim,

    Impressive...  I just coded it up and works as advertised.   Here is the revised code.  

    #include <Bounce2.h>
    #define PTT 2
    int PTT_State = 0;
    Bounce debouncer = Bounce();
    void setup() {
      // put your setup code here, to run once:
      Serial.begin(57600);
      pinMode(PTT, INPUT_PULLUP);
      debouncer.attach(PTT);
      debouncer.interval(5); // interval in ms
    }
    void loop() {
      // put your main code here, to run repeatedly:
      debouncer.update();
     
      if (debouncer.read() != PTT_State){
       if (digitalRead(PTT) == LOW) {
         Serial.println("ZZDX0;");
         Serial.println("ZZTX1;");
         PTT_State = 0;
         delay(100); }
       else  {
         Serial.println("ZZTX0;");
         PTT_State = 1;
         delay(100);
         Serial.println("ZZTX0;"); }  // just in case radio missing it
      }
    }

    I am wondering if it makes sense to do the DAX disable in the setup.  There is a slight lag due to the extra command.  Not really a big deal.  Just wondering.



  • mlstutler
    mlstutler Member ✭✭
    edited December 2019
    So I made a test and using this line of code it seems to work faster/smoother.  

    Replace 

    Serial.println("ZZTX1");

    with    

     Serial.println("ZZDX0;ZZTX1");

    Tim you da Man...
         




  • Tim - W4TME
    Tim - W4TME Administrator, FlexRadio Employee admin
    edited December 2019
    You're very welcome.  I am glad I was able to help out.
  • mlstutler
    mlstutler Member ✭✭
    edited January 2020
    Update / question ….

    I have been testing the foot switches I have made.   I have noticed that some times  SmartCAT is not able to interpret the CAT commands.    I will see ??? in the log.   I have played around with the driver properties and disabled the FIFO buffers.   It seemed to help but not always.   The usb port is configured as 57600 bps, 8 data bits, no parity and 1 stop bits.  


    When this issue occurs I am always able to see the CAT command using the Arduino serial port monitor and Putty so I am pretty sure it's not a garbled command.   


    I am just looking to understand if I can make the interface more stable.

    thx
  • mlstutler
    mlstutler Member ✭✭
    edited January 2020
    I think I found the issue.  When you configure your CAT port in SmartCAT there is no where to set the baud rate or control params.  This did not seem right to me so I went looking for a config file and found it in: 

    C:UsersMyNameAppDataRoamingFlexRadiosystems  

    I found the settings for the USB port

    &lt;PortSettings&gt;
        &lt;Protocol&gt;CAT&lt;/Protocol&gt;
        &lt;PortCommType&gt;Serial&lt;/PortCommType&gt;
        &lt;SerialPortType&gt;Existing&lt;/SerialPortType&gt;
        &lt;TCPPortNumber&gt;0&lt;/TCPPortNumber&gt;
        &lt;UDPPortNumber&gt;0&lt;/UDPPortNumber&gt;
        &lt;LifetimeSeconds&gt;0&lt;/LifetimeSeconds&gt;
        &lt;Name&gt;USB PTT Foot Switch&lt;/Name&gt;
        &lt;SliceIndex&gt;A&lt;/SliceIndex&gt;
        &lt;ExistingSerialPortName&gt;COM10&lt;/ExistingSerialPortName&gt;
        &lt;SerialPortBaudRate&gt;57600&lt;/SerialPortBaudRate&gt;
        &lt;SerialPortDataBits&gt;8&lt;/SerialPortDataBits&gt;
        &lt;SerialPortParity&gt;None&lt;/SerialPortParity&gt;
        &lt;SerialPortStopBitsStr&gt;1&lt;/SerialPortStopBitsStr&gt;
        &lt;SerialPortStopBits&gt;One&lt;/SerialPortStopBits&gt;
        &lt;SerialPortFlowControlStr&gt;None&lt;/SerialPortFlowControlStr&gt;
        &lt;SerialPortFlowControl&gt;None&lt;/SerialPortFlowControl&gt;
        &lt;SerialUseRTS&gt;true&lt;/SerialUseRTS&gt;
        &lt;SerialUseDTR&gt;true&lt;/SerialUseDTR&gt;
        &lt;SerialPinActiveLow&gt;true&lt;/SerialPinActiveLow&gt;
        &lt;AutoSwitchTXSlice&gt;true&lt;/AutoSwitchTXSlice&gt;
        &lt;AutoRemoveSplitSlice&gt;true&lt;/AutoRemoveSplitSlice&gt;
      &lt;/PortSettings&gt;

    I changed the baud rate to 57600 and now it seems stable.  I will do some more random tests to ensure that the change actually fixed it.  

    I assume that the SmartCAT must have some dynamic way of setting the baud rate because it did work most of the time.  Only on occasion did I get the erroneous CAT command in the log:

    2020-01-07 16:59:34.985 COM10 [rcvd]: ?
    2020-01-07 16:59:34.987 COM10 [rcvd]: f? f?f?~
    2020-01-07 16:59:35.988 COM10 [rcvd]: ?f
    2020-01-07 16:59:35.989 COM10 [rcvd]: ? '?f?~?
    2020-01-07 16:59:35.989 COM10 [rcvd]: f? f?f?

    I will say I am having fun with this...

    Regards

  • mlstutler
    mlstutler Member ✭✭
    edited January 2020
    So I tried it again and the errors came back.   I have 2 options in my head now:

    Throttle the usb port down to 9600 or add a delay after the daxoff cat command.  

    I tried both and they seem to work.  I set the day to 15ms before sending the pttOn cat command.  

    Btw I am testing this on 2 different 6400's so I don't think the issue is related to radio hardware.  

    I will report back in a couple of days with more testing results.

    Regards
  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin
    edited January 2020
    Mike

    If this isn't working, you can actually do the same thing by creating a SmartSDR CAT/PTT port that uses on RTS.  You pair that with a local Com port on your PC and then use a foot switch to toggle RTS high and low.  It  is documented in the communtiy.

    Don't get me wrong, I love the ingenuity of using the Nano to send a CAT command.  

    The baud rate should not matter as long as it matches, but I have found that keeping the baud rate in the 4800-9600 area is a bit more reliable and less impacted by any noise since you need less bandwidth. 

    The errors in the log do look like framing errors.  Might it be RF related?

    Mike

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.