ard_K210-object detection1.K210 and Arduino communication1.1 Experimental premises1.2 Experimental wiring1.3 Main code explanation1.4 experimental phenomena
This tutorial uses arduino, and K210 requires running the program in K210-AI (stm32_pico_arduino) to start the experiment arduino *1 K210 perspective module * 1 (requires SD card (with AI model inside) and camera) USB to TTL module * 1
arduino | usb to ttl |
---|---|
TXD | RXD |
GND | GND |
arduino | K210 perspective module |
---|---|
RXD | TXD |
GND | GND |
VCC | 5V |
Wiring as shown in the diagram: |
xvoid loop()
{
while (K210Serial.available())
{
recv_k210msg(K210Serial.read());
if (k210_msg.class_n != 0)
{
if(k210_msg.class_n == 9)
{
sprintf(buff_com,"x=%d,y=%d,w=%d,h=%d\r\n",k210_msg.x,k210_msg.y,k210_msg.w,k210_msg.h);
K210Serial.print(buff_com);
sprintf(buff_com,"id = %s\r\n",k210_msg.msg_msg);
K210Serial.print(buff_com);
k210_msg.class_n = 0;
}
}
}
}
After the above program, if you are running this routine, k210_ The members of the msg structure have corresponding values and are processed through serial port printing K210_ Msg: is a structure that receives information, and its main members are
Object detection only transmits the six Member variable of k210msg, namely, x, y, w, h, id and msg. ID: The information includes (0. plane, 1. bicycle, 2. bird, 3. boat, 4. bottle, 5. bus, 6. car, 7. cat, 8. chair, 9. cow, 10. dining table, 11. dog, 12. horse, 13. motorcycle, 14. person, 15. potted plant, 16. sheep, 17. sofa, 18. train, 19. monitor)