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

Thread: Not receiving data from RPLidar to Teensy 3.6

Hybrid View

  1. #1
    Junior Member
    Join Date
    Nov 2019

    Not receiving data from RPLidar to Teensy 3.6

    Hi everyone, I've been struggling for some days in a project I'm doing. Bascially I'm trying to do a MicroMouse robot with a Teensy 3.6 and a RPLidar a1m8 from Slamtec.
    I can move the Lidar motor but I'm not able to recieve the data of the angle and the distance.

    I've connected Rx Lidar to Tx Teensy 3.6, and Tx Lidar to Rx Teensy 3.6 with a downgrade of voltage to 3.3V (I've been wondering if this might be the problem). I've checked the connections thousands of times and I believe everything's OK. They share common GND, I supply the Teensy with 3.3V and the Lidar with 5V.
    // Read data from Robo Peak 360 Degree Scanning Lidar
    // Outputs A###R#####\n      A = angle 0-359    R = range in mm
    // Serial1 incoming data from RP Lidar
    #include <RPLidar.h>
    RPLidar lidar;
    #define RPLIDAR_MOTOR_PIN  5       
    // Setup                       
    void setup() 
      Serial.begin (115200);
    float distance;   //distance value in mm unit
    float angle;      //angle value in degree
    bool  startBit;   //whether this point is belong to a new scan
    byte  quality;    //quality of the current measurement
    // Main Loop                      
    void loop() 
      if ( IS_OK(lidar.waitPoint()) ) 
        distance = lidar.getCurrentPoint().distance;   //distance value in mm unit
        angle    = lidar.getCurrentPoint().angle;      //angle value in degree
        startBit = lidar.getCurrentPoint().startBit;   //whether this point is belong to a new scan
        quality  = lidar.getCurrentPoint().quality;    //quality of the current measurement
        if (lidar.getCurrentPoint().startBit)     
          Serial.print ("A");Serial.print (distance); 
        Serial.print ("R"); Serial.print (angle);
        Serial.print ('\n');
        analogWrite(RPLIDAR_MOTOR_PIN, 0);         // Stop motor
        rplidar_response_device_info_t info;       // Check Status
        if (IS_OK(lidar.getDeviceInfo(info, 100))) 
           lidar.startScan();                      // Start Scanning
           analogWrite(RPLIDAR_MOTOR_PIN, 255);    // Start Motor

  2. #2
    Junior Member
    Join Date
    Jan 2021
    I've the same problem with this thing

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Are you using the library:

    It looks like your code is pretty close to their example: simple_connect?

    If I am looking at their documents correctly:

    It looks to me like their UART is already 3.3v. (Page 10 of the above document).

    I was sort of wondering that by the name RPI... So it probably needs 5v power to run it... But it looks like RX/TX are 3.3v.

Posting Permissions

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