Documentation to use the UART of the UnitV with raspberry pi GPIO
-
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.
-
@Arn_8 There are a surprising number on UnitV products, what is the part number?
Such as U-nnn. -
@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.
-
@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! -
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.
-
@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 ! -
@peolsolutions
Hi thanks, I used the link on the answer above and a tutorial to enable the UART! -
@Arn_8
Problem fixed !
Thanks !