1609 views|3 replies

109

Posts

8

Resources
The OP
 

[Automatic clock-in walking timing system based on face recognition] K210 MAIXBIT uses QR code recognition as user information [Copy link]

 

Debug Target

  • Considering that the K210 has relatively few interactive interfaces, the user information entry method is considered to be a QR code. The ID name can be scanned once, and then the user is prompted by voice that the entry is successful.

Debugging preparation

  • Based on the previous post about the playback of wav voice, you first need to use GoldenWav CN software to convert text to speech and prepare a "successful recognition" voice file.
  • Use the grass QR code (https://cli.im/text) to convert a QR code containing the following information: "eeworld,123654,01:02:03:04:05:06,cs".

Debugging Code

import sensor
import image
import lcd
import time

from fpioa_manager import *
from Maix import I2S, GPIO
import audio

def audio_init():
    # register i2s(i2s0) pin
    fm.register(34, fm.fpioa.I2S0_OUT_D1, force=True)
    fm.register(35, fm.fpioa.I2S0_SCLK, force=True)
    fm.register(33, fm.fpioa.I2S0_WS, force=True)

    # init i2s(i2s0)
    wav_dev = I2S(I2S.DEVICE_0)
    print("i2s init")
    return wav_dev

def audio_play(wav_dev, volume):
    # init audio
    player = audio.Audio(path="/sd/2.wav")
    player.volume(volume)
    print("audio init")

    # read audio info
    wav_info = player.play_process(wav_dev)

    # config i2s according to audio info
    wav_dev.channel_config(wav_dev.CHANNEL_1, I2S.TRANSMITTER, resolution=I2S.RESOLUTION_16_BIT,
                       cycles=I2S.SCLK_CYCLES_16, align_mode=I2S.RIGHT_JUSTIFYING_MODE)

    wav_dev.set_sample_rate(wav_info[1])

    # loop to play audio
    while True:
        ret = player.play()
        if ret == None:
            print("format error")
            break
        elif ret == 0:
            print("end")
            break
    player.finish()

#-----------------------------------------------------------

clock = time.clock()
dev = audio_init()

lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_vflip(1)
sensor.run(1)
sensor.skip_frames(30)
while True:
    clock.tick()
    img = sensor.snapshot()
    res = img.find_qrcodes()
    fps =clock.fps()
    if len(res) > 0:
        img.draw_string(2, 2, res[0].payload(), color=(0,128,0), scale=2)
        print(res[0].payload())
        audio_play(dev, 50)
    lcd.display(img)

Debugging results

  • When the QR code is presented on a mobile phone, a string of characters will appear on the interface and a voice prompt will be played, indicating successful recognition!

This post is from DigiKey Technology Zone

Latest reply

Understand Understand  Details Published on 2022-9-29 10:10
 
 

6593

Posts

0

Resources
2
 

Finally, a voice prompt can be played, proving that it is successful

This post is from DigiKey Technology Zone
 
 
 

1127

Posts

1

Resources
3
 
Awesome! Thanks for sharing!
This post is from DigiKey Technology Zone
 
 
 

11

Posts

0

Resources
4
 
Understand Understand
This post is from DigiKey Technology Zone
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list