Menu

TOF10120 rangefinder

Help
2020-12-07
2021-02-05
  • stan cartwright

    stan cartwright - 2020-12-07

    Hi. I got a TOF10120 laser range finder from a mention on picaxe forum and looked interesting so got one.
    Data sheet is mostly Chinese.
    out put is
    Gnd
    VDD
    RX
    TX
    SDA
    SCL

    I tried a uno and can't program with device tx connected to uno rx and device rx connected uno tx.
    Disconnected tx and rx and it flashes code.
    Then reconnect tx to rx and rx to tx and should get 5 bytes repeating
    ,,, but I messed up. Is it the usb port to terminal is same input port as range finder.
    Any advice would be helpful. cheers.

    ;TOF10120 Laser Range Sensor Module serial to terminal
      #chip mega328p, 16
      #define USART_BAUD_RATE 9600
      #define USART_TX_BLOCKING
    
    dim rangefinder (5)
    
    do
    HSerReceive rangefinder (1)
    HSerReceive rangefinder (2)
    HSerReceive rangefinder (3)
    HSerReceive rangefinder (4)
    HSerReceive rangefinder (5)
    
    
    HSerPrintStringCRLF rangefinder (1)
    HSerPrintStringCRLF rangefinder (2)
    HSerPrintStringCRLF rangefinder (3)
    HSerPrintStringCRLF rangefinder (4)
    HSerPrintStringCRLF rangefinder (5)
    HserPrintCRLF
    loop
    
     

    Last edit: stan cartwright 2020-12-07
  • stan cartwright

    stan cartwright - 2020-12-30

    The tof10120 has serial so I tried for lgt but same as 328 nano

        'USART settings for USART1
        #define USART_BAUD_RATE 9600
        #define USART_BLOCKING
    ;    #define USART_DELAY OFF
    #define SerInPort PORTd.0    'USART 1 Rx Pin
    Dim MyString as String
    
        'GLCD selected extension font set. ASCII characters 31-254, the extended font uses 1358 bytes of program memory
        #define GLCD_EXTENDEDFONTSET1
        GLCDfntDefaultsize = 3
        GLCDRotate ( Landscape )     ' optionally you can rotate the screen.
    
    do
      HSerGetString MyString
      GLCDPrint ( 2, 2,MyString + "  ",ILI9341_WHITE )
    ;  wait 1 s
    loop
    

    this after a minute prints 2000mm
    and that's all it does.

     
  • Anobium

    Anobium - 2021-02-03

    My analysis of the TOF10120 sensor Stan sent me.

    Summary: It is clone that does not work.


    I2C. The I2C interface is unstable and locked to a single address.

    Using the i2C Terminal from Microchip I can discover a device on 0xF4 some of the time, but mostly I get fails. The I2C bus frequency has no bearing on the failure to respond.

    Using the i2C Terminal from Microchip I tried to change the I2C address using function s7. The sensor accepted the command... but, did nothing.

    If you look at the attachment - you will see the same command work, fail, fail, work, scan fail.... something is not right.....


    Serial Interface - 9600BPS

    Use the terminal I tried to change the I2C address using "s7-168" - "fail"
    All commands to set the device respond with "fail"
    All command to read the device... no response.

    I know I have valid communications as I get "fail"... there is something there... but, I do not think it is a sensor that works.


    And, there is something odd about the sensor. When attaching there is a current surge that causes a USB reset, and, the sensor is warm.

    Operating at 3v3 or 5v0 make no difference.


    Summary - looks like a TOF10120, but, is not. This is a 3aq20 microcontroller .. but there probably no real sensor attached.

     

    Last edit: Anobium 2021-02-03
  • stan cartwright

    stan cartwright - 2021-02-03

    Nice one Evan.
    I thought it was duff or something.
    Thanks for the help, appreciated.

    so I can finally give up on this device or get another.
    the vl0x worked better. nicest I've used.
    going back to HC-SR04....using 3 and hbridge stuff...yawn
    but know it works

     
  • stan cartwright

    stan cartwright - 2021-02-04

    Anobium. I got your emails and it was like I posted "by the time you figure the device, you find it's duff and too late to send back"
    oh well, live and learn :) , cheers for testing though.

     
    • Anobium

      Anobium - 2021-02-04

      Pleasure. It is as-if the microcontroller ( the 3aq20 ) as enough code to respond to the I2C discovery, but, nothing else in terms of functionality.

      I could knock up a chip that has a bit of I2C... we could set a few million a few bucks each... and...then live off the money!

       
  • stan cartwright

    stan cartwright - 2021-02-04

    Well I'm not as optimistic as you but think if a device is faulty...like loads off fleabay,
    then you can demand your money back AND THEY PAY THE POSTAGE on the grounds that it was sold as working.
    So don't bother with the returner pays postage. They'll send you a return postage free pdf,
    if you can be bothered over a few £ device,
    but if it cost say £7.50...like this device, then contact the retailer and moan.
    They do not want their ebay rating to go down.

     
    • Anobium

      Anobium - 2021-02-04

      Yes, a real pain. I buy and test straight away... I have so many failures.. I sort of expect it.

       
  • stan cartwright

    stan cartwright - 2021-02-04

    The device. if ok., looked interesting with serial asc out and i2c.
    I'll stick with working/sorted rangefinders.... I only use them for toy robots.

     
  • stan cartwright

    stan cartwright - 2021-02-04

    @Anobium-"Yes, a real pain. I buy and test straight away... I have so many failures.. I sort of expect it."
    Pessimistic but reality. If it's not "plug n play working" out the package optimistic fools like me think it's me doing something wrong :) wiser :)

    What would be a fast enough glcd for LGT328 using touch please?
    Showing thickness but why not hwspi for ili9341 and software for the touch pins...
    like tclk not connected to clock?
    Sorry if a daft question.

     
    • Anobium

      Anobium - 2021-02-04

      You may be able to turn off the hardware SPI, then use software SPI for Touch. My guess is that is that the UNO never came across this issue.. as it 50% slower.

       
  • stan cartwright

    stan cartwright - 2021-02-04

    And there lies the rub. ili9341 drawing graphics fast with LGT328 but the touch is not hwspi so the speed advantages on creating boxes and checking them is lost ,,well drawing boxes with software spi is slow but the rest, like checking them would be 2x faster than mega328.

    it's an odd situation. the speed increase on ili glcd is so noticeable with lgt328 seems a shame to have to slow it down,
    the mega328 works display and touch hwspi fine. ili9341 include is brill.

    a lgt328 is not going to make my toy robots any better but someone else
    make a case for a 32mhz 328 ie twice as fast....and is it the fastest mcu supported by gcb?

     
    • Anobium

      Anobium - 2021-02-05

      Fast.. you need to define fast.

      • Speed of each program step/increment?
      • Speed of comms bus like serial. i2c, spi
      • Speed to move a block of RAM ?
       
  • stan cartwright

    stan cartwright - 2021-02-05

    Fast.. you need to define fast.

    Speed of each program step/increment?
    Speed of comms bus like serial. i2c, spi
    Speed to move a block of RAM ?

    Well Speed to move a block of RAM ?
    copying one array to another and Speed of each program step/increment
    seem visually faster but isn't spi speed set up in the program?

    I thought pics do an instruction every 4 clocks but mega328 does instruction every clock so a pic18fxxx, 64 would be same as a mega328,16.
    Any pics that run at18fxxx,128 or is my assumption wrong?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.