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

Thread: Serial UART connect Teensy - NodeMCU

  1. #1
    Junior Member
    Join Date
    Jul 2021
    Posts
    14

    Serial UART connect Teensy - NodeMCU

    Hi,

    I'm trying to build a connect between the Teensy and a Nodemcu for a webhook towards a server. the connection is meant for sending only data (char or byte) when a Teensy audio mode is changed (0, 1, 2 or 3). Mode changes only take place approx 10-20 times a day, so there is a very limited data send.

    I'm using Teensy HWserial pin 0 (RX) and pin 1 (TX) and on the NodeMCU I use GPIO5 (TX) and GPIO4 (RX).

    The problem is that I do not get any data on the NodeMCU. I did test the Teensy (cross connected RX with TX and tested succesfully transmission between TX and RX). I checked multiple times that RX is connected with TX. Changed from char to bytes. Changed baudrates.

    Does someone help me to understand this problem?

    I attached the Teensy ino file and NodeMCU ino file and a overview picture.

    Lolin_WebhookHomeyv4.inoSD_readwrite.inoClick image for larger version. 

Name:	IMG_4810.jpg 
Views:	17 
Size:	128.9 KB 
ID:	25703

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,767
    As far as I can tell your SD_readwrite.ino does not output anything to Serial1...

    Everyplace Serial1 and HWSERIAL are referenced are commented out:
    //#define HWSERIAL Serial1
    // HWSERIAL.begin(9600);
    //HWSERIAL.write(0);
    ...

  3. #3
    I was doing nearly the same exact thing. My Teensy 3.2 was processing sensor data, talking to displays and getting data wirelessly, then sending data to and ESP8266 for web serving (as an access point). I was passing a struct from the teensy to the ESP ( 58 bytes every second), and could not get data to read reliably on the ESP. I turned out different MCU's pack data differently hence causing data corruption--I've yet to understand why, but my only fix was to use a special library that sends data so other MCU's can read it.

    For the ESP8266
    #include <SoftEasyTransfer.h> // needed to transfer structs between different MCU's

    For the teensy
    #include <EasyTransfer.h> // needed to handle serial transmission between different MCU

    The lib had enough examples for me to implement a workable solution. A different lib needs to be on the teensy as it uses a hardware serial.

    Not sure the will help, but passing along my experience, maybe it will help you..

  4. #4
    Junior Member
    Join Date
    Jul 2021
    Posts
    14
    Quote Originally Posted by KurtE View Post
    As far as I can tell your SD_readwrite.ino does not output anything to Serial1...

    Everyplace Serial1 and HWSERIAL are referenced are commented out:
    //#define HWSERIAL Serial1
    // HWSERIAL.begin(9600);
    //HWSERIAL.write(0);
    ...
    Sorry Kurt,

    I send the wrong version, please check the latest one. not much difference but I removed the "comment" operator.
    SD_readwrite.ino

    thanks

  5. #5
    Junior Member
    Join Date
    Jul 2021
    Posts
    14
    Hi Kris,

    thanks and as you suceeded it must be a good direction. I found many "working" cases (UNO - MCU) but never from a Teensy to an MCU, so I hope someone from the community can still shine some light on this.

    As I send only data from the Teensy to the NodeMCU, i will check the EasyTransfer.lib.

  6. #6
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    9,439
    #define HWSERIAL Serial

    This is the USB Serial. You just dont use hardware serial.

  7. #7
    Junior Member
    Join Date
    Jul 2021
    Posts
    14
    Tx Frank,

    indeed that was the issue and I corrected it to Serial1.
    After some iterations, I was able to interpreting the data send from byte to char and send a webhook with the data.

    Appreciated all the feedback received.

Posting Permissions

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