🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Documentation to use the UART of the UnitV with raspberry pi GPIO

    Units
    3
    8
    988
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Arn_8
      last edited by

      Hi there,

      I'm looking for documentation to help me set up and use the UART between the M5Stick UnitV and the Raspberry 3B GPIO.
      Where can I find it?
      Has anyone already done this?

      Thanks a lot.

      teastainT 1 Reply Last reply Reply Quote 0
      • teastainT
        teastain @Arn_8
        last edited by teastain

        @Arn_8 There are a surprising number on UnitV products, what is the part number?
        Such as U-nnn.

        Cheers, Terry!

        100% M5Stack addict with several drawers full of product!

        A 1 Reply Last reply Reply Quote 0
        • A
          Arn_8 @teastain
          last edited by

          @teastain Oh sorry I didn't specify, I'm using the UnitV - OV7740, with a Raspberry Pi 3B+.
          I want to use face recognition and get the rectangle coordinate to control a motor with the Raspberry GPIO.

          Thanks a lot.

          teastainT 1 Reply Last reply Reply Quote 0
          • teastainT
            teastain @Arn_8
            last edited by

            @Arn_8 I am not familiar with this camera or AI. Have you been able to connect to it and read it?
            The Pi would need SoftwareSerial UART and I suppose some app on the Pi to interpret the results.
            I assume you have been to this site?
            https://github.com/m5stack/M5-ProductExampleCodes/blob/master/App/UnitV/track_ball/track_ball.ino
            Hope this helps!

            Cheers, Terry!

            100% M5Stack addict with several drawers full of product!

            A 1 Reply Last reply Reply Quote 0
            • P
              peolsolutions
              last edited by

              To use UART on a UnitV with Raspberry Pi GPIO, refer to the official documentation of UnitV for pinout details and configuration steps, then enable UART on the Raspberry Pi.

              A 1 Reply Last reply Reply Quote 0
              • A
                Arn_8 @teastain
                last edited by

                @teastain
                Hi thank you, it helped a lot to understand how to communicate!
                I have another query link to this, I tried this code which worked well and I could read the "hello_world\n" on my raspberry:

                import sensor
                import image
                import lcd
                import time
                import utime
                from machine import UART
                from Maix import GPIO
                from fpioa_manager import *
                
                fm.register(34,fm.fpioa.UART1_TX)
                fm.register(35,fm.fpioa.UART1_RX)
                uart_out = UART(UART.UART1, 115200, 8, None, 1, timeout=1000, read_buf_len=4096)
                
                while 1 :
                    uart_out.write('hello_world\n')
                    utime.sleep_ms(100)
                

                and I tried to adapt it for my application (which is face recognition) like this:

                import sensor
                import image
                import KPU as kpu
                import lcd
                import time
                import utime
                from machine import UART
                from Maix import GPIO
                from fpioa_manager import *
                fm.register(34,fm.fpioa.UART1_TX)
                fm.register(35,fm.fpioa.UART1_RX)
                uart_out = UART(UART.UART1, 115200, 8, None, 1, timeout=1000, read_buf_len=4096)
                sensor.reset()
                sensor.set_pixformat(sensor.RGB565)
                sensor.set_framesize(sensor.QVGA)
                sensor.run(1)
                task = kpu.load(0x300000)
                anchor = (1.889, 2.5245, 2.9465, 3.94056, 3.99987, 5.3656, 5.155437, 6.14367, 6.3784, 7.26)
                a = kpu.init_yolo2(task, 0.5, 0.3, 5, anchor)
                while 1 :
                        img = sensor.snapshot()
                        code = kpu.run_yolo2(task, img)
                        if code:
                            for i in code:
                                 uart_out.write(i)
                                 a = img.draw_rectangle(i.rect())
                a= kpu.definit(task)
                

                Initially it was a similar code that I used without UART on the MaixpyIDE and connected via USB which worked well.
                But when I put it in the boot.py it doesn't write the coordinate to i on the Raspberry.
                I would point that I didn't put an SD card in the UnitV-OV7740. Could it be that I don't have enough memory to run this new code?
                Thanks a lot !

                A 1 Reply Last reply Reply Quote 0
                • A
                  Arn_8 @peolsolutions
                  last edited by

                  @peolsolutions
                  Hi thanks, I used the link on the answer above and a tutorial to enable the UART!

                  1 Reply Last reply Reply Quote 0
                  • A
                    Arn_8 @Arn_8
                    last edited by

                    @Arn_8
                    Problem fixed !
                    Thanks !

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post