lidar lite v3



  • Hi all,
    can I connect this Lidar to M5Stick grove connector?
    if yes, I need a voltage divider for SDA and SCL?

    tanks a lot



  • @cepics said in lidar lite v3:

    Hi all,
    can I connect this Lidar to M5Stick grove connector?
    if yes, I need a voltage divider for SDA and SCL?

    tanks a lot

    Technically yes as its i2c but no code will exist.



  • Can I try this one?

    
    #include <Wire.h>
    #include <LIDARLite.h>
    
    LIDARLite myLidarLite;
    
    void setup() {
    
     myLidarLite.begin(0, true); // Set configuration to default and I2C to 400 kHz
    
      /*
        configure(int configuration, char lidarliteAddress)
        Selects one of several preset configurations.
        Parameters
        ----------------------------------------------------------------------------
        configuration:  Default 0.
          0: Default mode, balanced performance.
          1: Short range, high speed. Uses 0x1d maximum acquisition count.
          2: Default range, higher speed short range. Turns on quick termination
              detection for faster measurements at short range (with decreased
              accuracy)
          3: Maximum range. Uses 0xff maximum acquisition count.
          4: High sensitivity detection. Overrides default valid measurement detection
              algorithm, and uses a threshold value for high sensitivity and noise.
          5: Low sensitivity detection. Overrides default valid measurement detection
              algorithm, and uses a threshold value for low sensitivity and noise.
        lidarliteAddress: Default 0x62. Fill in new address here if changed. See
          operating manual for instructions.
      */
      myLidarLite.configure(1); // Change this number to try out alternate configurations
    }
    
    void loop() {
    
      // Take a measurement with receiver bias correction and print to serial terminal
      Serial.println(myLidarLite.distance());
    
    delay(50);
    }
    

    best regards



  • @ajb2k3 Hi, trying the sketch above, the serial monitor say:

    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    >nack
    

    the same sketch on esp8266 works!!

    ideas??

    tnks a lot



  • hello, gpio sda:21 scl:22, in m5stack red grove



  • @heybin which is the difference between the red I2C (M5Stack) and the white one (M5Stick) ??

    I'm trying on M5Stick....



  • Hi, all
    connecting the lidar lite to M5Stick on grove connector makes m5Stick burn!!!

    this is the sketch:

    
    
    #include <Arduino.h>
    #include <U8g2lib.h>
    
    U8X8_HAVE_HW_SPI
    #include <SPI.h>
    #include <Wire.h>
    #define LedPin 19
    #define IrPin 17
    #define BuzzerPin 26
    
    #define BtnPin 35
    
    int x = 870; 
    int cm;
    int feet;
    int inches;
    int INCHES;
    bool unit = 0;
    
    #include "MPU9250.h"
    
    U8G2_SH1107_64X128_1_4W_HW_SPI u8g2(U8G2_R1, /* cs=*/ 14, /* dc=*/ 27, /* reset=*/ 33);
    
    // an MPU9250 object with the MPU-9250 sensor on I2C bus 0 with address 0x68
    MPU9250 IMU(Wire, 0x68);
    //MPU9250 IMU(Wire,0x71);
    int status;
    int orienta;
    
    unsigned long pulseWidth;
    
    void setup() {
      Serial.begin(115200);
      u8g2.begin();
      status = IMU.begin();
    
      
      pinMode(25, OUTPUT); // Set pin 2 as trigger pin
      digitalWrite(25, LOW); // Set trigger LOW for continuous read
    
      pinMode(13, INPUT); // Set pin 3 as monitor pin
    
      pinMode(BtnPin, INPUT_PULLUP);
      pinMode(BuzzerPin, OUTPUT);
      digitalWrite(BuzzerPin, LOW);
    
      if (digitalRead(BtnPin) == 0) {
        unit = !unit;
    
        //bounce sound
        for (int f = 0; f < 500; f++) {
          digitalWrite(BuzzerPin, HIGH);
          delay(1);
          digitalWrite(BuzzerPin, LOW);
          delay(1);
        }
      }
    
    
    }
    
    void loop() {
        pulseWidth = pulseIn(13, HIGH); // Count how long the pulse is high in microseconds
    
      // If we get a reading that isn't zero, let's print it
      if(pulseWidth != 0)
      {
        pulseWidth = pulseWidth / 10; // 10usec = 1 cm of distance
        Serial.println(pulseWidth); // Print the distance
      }
      
    
      cm = (pulseWidth) / 10;
    //  inches = (myData.time + x) / 74 / 2;
      feet = inches / 12;
      INCHES = inches % 12; //es x = 7% 5; // X ora contiene 2
    
      if (unit) {
        stampaCM();
      } else {
        //stampaFT();
        stampaCM();
      }
    
      if (digitalRead(BtnPin) == 0) {
       // x = 5800 - myData.time ;
      }
    
      IMU.readSensor();
      orienta = IMU.getAccelY_mss();
      Serial.println("orienta = ");
      Serial.println(orienta);
      if (orienta < 0) {
        u8g2.setFlipMode(1);
      } else {
        u8g2.setFlipMode(0);
      }
      delay(50);
    }
    
    void stampaCM() {
      u8g2.firstPage();
      do {
        u8g2.setFont(u8g2_font_7Segments_26x42_mn);
    
        if (cm < 10) {
          u8g2.setCursor(70, 52);
          u8g2.print(cm);
        }
        if (cm < 100 && cm >= 10) {
          u8g2.setCursor(40, 52);
          u8g2.print(cm);
        }
    
        if (cm >= 100) {
          u8g2.setCursor(20, 52);
          u8g2.print(cm);
        }
      } while (u8g2.nextPage());
    }
    
    void stampaFT() {
      u8g2.firstPage();
      do {
        u8g2.setFont(u8g2_font_7Segments_26x42_mn);
        u8g2.drawDisc(63, 52, 2, U8G2_DRAW_ALL);
    
        if (feet < 10) {
          u8g2.setCursor(30, 52);
          u8g2.print(feet);
        } else {
          u8g2.setCursor(1, 52);
          u8g2.print(feet);
        }
    
        if (INCHES < 10) {
          u8g2.setCursor(75, 52);
          u8g2.print(INCHES);
        } else {
          u8g2.setCursor(60, 52);
          u8g2.print(INCHES);
        }
      } while (u8g2.nextPage());
    }
    

    alt text

    what is this??
    can I repare it??



  • m5stick grove is different, pin is gnd, vcc, 25, 13, those can be viewed from the back of the stick


登录后回复
 

与 M5Stack Community 的连接断开,我们正在尝试重连,请耐心等待