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.

PTT CAT control using USB Arduino Nano Every

Options
Mick  W8BE
Mick W8BE Member ✭✭

I had developed a CAT control interface utilizing a USB Arduino Nano Every and I had issues with stability. Last week I operated in the VA QSO party and used the PTT SmartCAT interface with my foot switch. It is a Linemaster industrial foot switch and the bounce effect when using the switch was very noticeable. This got me thinking about my CAT control interface. I went back and used Wireshark to examine my FlexControl. I noticed the commands were sent very quickly to the radio. I had the Arduino Nano Every set to 9600 baud. I decided to change the baud and after experimenting I was able to get the device to act in a stable manor. I have updated the repository. I find using the CAT control is very quiet and so far I have had no stability issues Here is the link to the repository.

https://github.com/w8be/usb-ptt-arduino-nano-every/tree/main

Comments

  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Very cool Mick. One trick that I use is to attach an interrupt to the input pin. In the ISR, I immediately disable that interrupt, service the interrupt, and set a timer (20 ms or whatever I need to get past the bouncing). When the timer expires, I enable the interrupt again. This makes sure that I get the earliest possible "make" contact and that additional bounces don't chatter relays and that kind of thing.

    For this scheme, I usually attach the interrupt using CHANGE so that I can use the same technique on the break. I often wind up with a different break timeout than make timeout. It mostly depends on the switch and how fast I want to be able to cycle it. PTT will usually have longer time constants than a dot paddle, for example.

  • Mick  W8BE
    Mick W8BE Member ✭✭
    Options

    Thanks Len,

    I am including a bounce function from the libraries. I currently have the bounce timer set to 200ms.

    Regards

  • Mick  W8BE
    Mick W8BE Member ✭✭
    Options

    Here are a couple pics.



  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Very clean installation!

  • Mick  W8BE
    Mick W8BE Member ✭✭
    Options

    Ken,

    Can you share your ISR code. It may very well be worth switch too.

    Thanks

  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Hi Mick, The full source for my TeensyMaestro is out on GitHub. With everything going on, it will be a challenge to filter out what you need.

    Here is a real quick sample:

    /*
      Sample Interrupt-driven input
      Len Koppl, KDØRC 
      03/26/24 
      Teensy 4.1(with built - in Ethernet)
    
    */
    // Includes
    
    // Constants
    const byte BUTTON_PIN = 0;
    const int DEBOUNCE = 20;  // debounce time in ms
    
    // Global Variables
    IntervalTimer debounceTimer;
    
    void setup()
    {
      attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), buttonISR, FALLING);
    }
    
    void loop()
    {
      // looping code here
    }
    
    // Subroutines
    
    // Interrupt Service Routines
    void buttonISR()
    {
      detachInterrupt(BUTTON_PIN);  // stop button interrupt to prevent multiple hits (bounce)
      // quick stuff here like setting a variable.  Do not do massive processing in the interrupt service routine.
    
      debounceTimer.begin(debounceISR, DEBOUNCE);
    }
    
    void debounceISR()
    {
      debounceTimer.end();
      attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), buttonISR, FALLING); // allow button pushes again after debounce period
    }
    

    Hopefully, this helps.

  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Well, I'm an idiot... That sample code is for a Teensy 4.1, not a Nano Every. If I get a chance, I will see if there is a timer library for the Nano Every. If not, then it might not be worth the effort to do what I am suggesting.

  • Mick  W8BE
    Mick W8BE Member ✭✭
    Options

    Thanks...no rush

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.