Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Tennsy Serial to HID Problems

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    2

    Tennsy Serial to HID Problems

    Hello all, I have spent hours combing through posts on translating Serial commands output from one device into HID Keyboard input to another device, but haven't seen anything showing the same problems I am having.

    What I am trying to do:
    1) Through authentic (not prolific) FTDI cable, send Serial data to Serial3 hardware input on Teensy from my laptop via PuTTY/Arduino IDE.

    2) Have that serial data translated into an HID Keyboard input sent via USB to my Desktop PC. (I send 'f' to Serial3, it outputs 'f' on the Desktop PC like it's a keyboard.)

    End Goal: Be able to type characters on my laptop, have those characters print on my Desktop PC in notepad.

    The Problem: (See attached diagram for more explanation for below)

    1) When I have both the USB mini cable and FTDI cable attached to my laptop from the Teensy, sending characters through PuTTY using the FTDI com port works perfectly. I set a 5 second delay between printing each character, type a string of characters and send them to the teensy, switch to Notepad, they all print no problem.

    2) When I keep FTDI plugged into my laptop, plug the USB mini cable into my desktop and open Notepad on my desktop, no characters print when Serial data is sent to Serial3. The Serial3 COM port monitor in the Arduino IDE starts returning the characters I send in addition to a bunch of weird extra characters. Nothing outputs on my Desktop. If I type lots of characters at once (~40) and send to Serial3, sometimes I get output on the desktop, but it's usually an unrelated character like a single 'w', '{', '}', or 't'.

    What I have tried:

    1) Just outputting a string of text repeatedly every five seconds using Keyboard.write("Hello World"). When I plug into the desktop, prints without a problem in notepad, or any other text application.

    2) Sent/Received (echoed) data from Serial3 to show Serial3 is working as expected.

    Both of these work on their own as expected, it is only when they are combined they do not work.

    The attached diagram shows how my Teensy 3.2 is set up, below is my source code just trying to print the letter f to start:

    void setup() {
    Serial3.begin(9600);
    }

    void loop() {
    while (Serial3.available()) {
    int ch = Serial3.read();
    delay(10);
    Serial3.println(ch);
    if (ch == 102)
    {
    delay(2000);
    Keyboard.print('f');
    }
    }
    }


    Any ideas? Thank you all !


    Click image for larger version. 

Name:	Quick Layout Teensy.jpg 
Views:	4 
Size:	48.8 KB 
ID:	17071

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,303
    Maybe you're missing a GND wire between the Teensy and the FTDI serial cable?

    When connected to the same PC, the missing GND connection (far from ideal) would be provided through the USB cable GND.

  3. #3
    Junior Member
    Join Date
    Jul 2019
    Posts
    2
    THANK YOU, I can't believe it was that simple!

    Works perfectly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •