​ ​ ​ ​ erco-laser range finder
Results 1 to 10 of 10

Thread: erco-laser range finder

  1. #1
    Senior Member
    Join Date
    Sep 2016
    Location
    United Kingdom
    Posts
    687

    Default erco-laser range finder

    Erco. I got one of these and got to make a driver. I'm on the case and will report. Sensing is 50 time a second which is a bit disappointing.
    http://www.hobbytronics.co.uk/vl53l0x
    https://github.com/pololu/vl53l0x-ar...ster/VL53L0X.h
    I done this before. You end up learning c

  2. #2
    Senior Member
    Join Date
    Jul 2011
    Location
    Los Angeles, CA
    Posts
    1,893

    Default

    Thanks for the heads-up, Stan. Think I got one of those a while back but didn't have a chance to try it out. Can't find it right now. Really looks neat, just to be safe I just ordered this $6 type from China. I gotta get in the game! http://www.ebay.com/itm/262645508970

    Please advise your findings!

  3. #3
    Senior Member
    Join Date
    Sep 2016
    Location
    United Kingdom
    Posts
    687

    Default

    10-4 Erco. Not sorted yet, back burner brisket, should get 50 ranges a second,better than sharp 180cm range finder which was too slow acquisition time for my robot. sr04 us is hard to beat from all range finding I've tried. How do you implement the data sheet init for stuff like this? The manufacture is better than 3rd party as a rule. I recently got better at trig and robot direction vectors. nice

  4. #4
    Senior Member
    Join Date
    Jul 2011
    Location
    Los Angeles, CA
    Posts
    1,893

    Default

    Any luck, Stan? After some Googling, it appears this sensor is complicated to use. Nobody in this forum has posted code. There's an Arduino library only. This same excerpt is posted on several websites:

    Sensor configuration and control
    In contrast with the information available for many other devices, ST has not publicly released a register map and descriptions or other documentation about configuring and controlling the VL53L0X. Instead, communication with the sensor is intended to be done through ST’s VL53L0X API (STSW-IMG005), a set of C functions that take care of the low-level interfacing. To use the VL53L0X, you can customize the API to run on a host platform of your choice using the information in the API documentation. Alternatively, it is possible to use the API source code as a guide for your own implementation.

    Sample Code
    We have written a basic Arduino library for the VL53L0X, which can be used as an alternative to ST’s official API for interfacing this sensor with an Arduino or Arduino-compatible controller. The library makes it simple to configure the VL53L0X and read the distance data through I²C. It also includes example sketches that show you how to use the library.

  5. #5
    Senior Member
    Join Date
    May 2010
    Location
    Newcastle Australia
    Posts
    309

    Default

    Hi erco

    is this the manual you require.

    en.DM00279088.pdf

    Bill
    "It always seems imposible until it's done" Nelson Mandela.

  6. #6
    Senior Member
    Join Date
    Jul 2011
    Location
    Los Angeles, CA
    Posts
    1,893

    Default

    Thanks Bill.b, yes, I did see that PDF. Section 3 has the user commands. Still not sure exactly how that translates to Picaxe BASIC.

  7. #7
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,403

    Default

    Quote Originally Posted by erco View Post
    Thanks Bill.b, yes, I did see that PDF. Section 3 has the user commands. Still not sure exactly how that translates to Picaxe BASIC.
    The API document describes the high level interface - eg "InitSensor()", "ReadSensor()" etc ( not actual VL53L0X API ).

    There is presumably another document somewhere which defines exactly what data transfers and data manipulations occurs for each API entry, or that has been determined by experimentation.

    The library code brings the two together allowing the main program to call API routines and doing the things required when those API routines are called.

    So to use the sensor one needs to understand the API, what the parameters and return data is for each API routine. And needs to implement that in a manner a PICAXE can use, eg #MACRO commands with calls to subroutines to do what is required.

    To interface to the sensor one needs to translate the code library into something the PICAXE understands, which delivers the same functionality as the library in some other language.

    High-level code in C might be -

    Code:
    void main()
      InitSensor();
      while(1) {
        distance = ReadSensor(RANGE_LONG);
        if distance < 100 {
          printf( "Close to wall!\n" );
        }
      }
    }
    In PICAXE Basic ...

    Code:
    main:
      InitSensor
      Do
         ReadSensor(distance, RANGE_LONG)
         If distance < 100 Then
           SerTxd( "Close to wall!", CR, LF )
         End If
      Loop
    Then you can create appropriate #MACRO templates, perhaps ...

    Code:
    #Macro InitSensor
      Gosub Do_InitSensor
    #EndMacro
    
    #Macro ReadSensor( resultVar, rangeScale )
      b0 = rangeScale
      Gosub Do_ReadSensor
      resultVar = w0
    #EndMacro
    Then one needs to create "Do_InitSensor:" and "Do_ReadSensor:" routines, perhaps ...

    Code:
    Do_Init_Sensor:
      HI2cOut $00, ($A5, $AA )
      Return
    
    Do_Read_Sensor:
      HI2cOut $0F, ( b0 )     ; Set range from 'b0'
      HI2COut $10, ( 1 )      ; Do measuring
      HI2cIn  $0C, ( b1, b0 ) ; Read distance msb first into 'w0'
      Return
    And, "Bingo!"; if that's all how it should be you're done.

    It's really just a long slog of understanding what the API is, which parts you can ignore or need for your own purposes, making that and the implementation PICAXE compatible.

    It's a bit like turning a book into a film. At the end of the day they'll be 'exactly the same' in what they convey though obviously different in how they do that.

    Perhaps more like translating a foreign book. One needs to understand both languages and their idioms, know how to map things in one language to another to mean the same though different - "Je me lève comme Zeus" can become "I'm on top of the world, ma" for example.
    Last edited by hippy; 22-07-2017 at 11:12.

  8. #8
    Senior Member
    Join Date
    Jul 2011
    Location
    Los Angeles, CA
    Posts
    1,893

    Default

    Quote Originally Posted by hippy View Post
    And, "Bingo!"; if that's all how it should be you're done.

    It's really just a long slog of understanding what the API is, which parts you can ignore or need for your own purposes, making that and the implementation PICAXE compatible.
    Therein lies the rub! Hippy, can you build these commands into the next firmware upgrade so using this sensor is as easy as using ULTRA ?

  9. #9
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,403

    Default

    Quote Originally Posted by erco View Post
    Therein lies the rub! Hippy, can you build these commands into the next firmware upgrade so using this sensor is as easy as using ULTRA ?
    And there's the rub's rub! If we knew what the commands needed to do it were; it would be easy enough to say how that would be as simple routines and macros.

    It basically needs someone to sit down and look at the API and existing library code and then do the translation, testing and debugging. Unfortunately that takes time, is best done by someone familiar with C and PICAXE, with the motivation to do it, and ideally with hardware to hand.

    Can't promise anything but I'll have a read through the datasheets and library to try and get a feel for how easy or hard it is. Presumable just measuring a distance is all that's required to start with ?

  10. #10
    Senior Member
    Join Date
    Jul 2011
    Location
    Los Angeles, CA
    Posts
    1,893

    Default

    Perfect, thanks! Nice to hear you're on the case!

Bookmarks

Posting Permissions

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