GravityUNIHIKER

SEN0539:A continuous wake state without a wake word

userHead Ian.ZHENG 2024-09-13 23:49:23 2379 Views8 Replies

I want to set up the DF2301Q voice recognition module so that it enters a continuous wake state without a wake word once the program is running, and remains continuously sensitive to command words. How can I do this? (I couldn't find any information in the documentation about keeping the module always on or idle, or methods to disable sleep mode or enable continuous listening.)

I'm connecting to the module's I2C interface via Unihiker and compiling with the Python language.

2024-12-08 06:34:18

set wake on at start can be done in i2c mode not in uart/ serial mode. 
in i2c mode the command is: set_wakeup(), I tried  self.setting_CMD( DF2301Q_UART_MSG_CMD_SET_ENTERWAKEUP, 0) with 0,1,2,3 none of them works.. 
but you can do the following in uart/serial
say wake word(hello robot),  receive cmdid = 2, then call set_wake_time(255) immediately and every 200 secs after. That will keep awake in ON mode for ever.
 

userHeadPic karl.wachs
Takahiro.Maruhashi wrote:

That's so Great!!

Please provide a detailed sample code…

2024-12-16 22:49:12
karl.wachs wrote:

the command is:

set_wakeup()

if you are using the i2c class in python

2024-12-20 07:13:27
tom.gerrish wrote:

I've played with this voice recognition module for a couple of weeks. 
I never changed the default "Hello Robot" wake command.
The module is located about 1.5 ft from my mouth and when I'm surfing the net and make a "sigh" or grunting sound when I can't find what I'm looking for - it wakes up and says "I'm here". My "sigh" sounds nothing like "hello robot".
At first I thought that it would be a good idea to extend the "wait" time, but now I have a different opinion.
It's probably a good idea to have it need 2 commands in order to get it to control devices. Having it turn on lights or motors with a stray grunting noise is probably not a good idea. For $20 I probably shouldn't have expected too much.
But it is kinda fun to play with this toy.

 

Here's the micropython code I'm using:

"""
1-28-25
voice recognition test - using DFROBOT DF2301QG
controlled by Heltec HTIT-WB32LAF ESP32-S3 microcontroller module
Micropython V1.24.1 installed.
Chose 100k Hz as I2C frequency to prevent microcontroller from crashing.
The default I2C frequency of 400k Hz caused the program to crash after a few minutes.
The last 2 lines are to determine how long it runs before crashing.
"""
import machine
from machine import SoftI2C, Pin
import time
from time import localtime, sleep_ms

Custom5 = b'\x05' # up1 -- the voice command I use to turn on an led
Custom6 = b'\x06' # down1 -- the voice command I use to turn off the led
start_time = time.ticks_ms()
led = Pin(35, Pin.OUT) # flash led briefly to indicate startup
led.value(1)
sleep_ms(100)
led.value(0)
sleep_ms(3000) # time chosen to cause volume level to work
i2c = SoftI2C(scl=Pin(7), sda=Pin(5), freq=100000)
i2c.writeto_mem(0x64, 5, b'\x03') # volume level
i2c.writeto_mem(0x64, 6, b'\xff') # wake time max is 4 minutes
print("Waiting for voice command...")

while True:
   readback = i2c.readfrom_mem(0x64, 0x02,1)
   sleep_ms(200)
   i2c.writeto_mem(0x64, 6, b'\xff') # keep telling it to stay awake    
   # but neither address 6 nor address 84 (UART) command works to do that
   i2c.writeto_mem(0x64, 0x84, b'\xff') # keep telling it to stay awake
   if (not readback == 0):        
           
       if readback == Custom5: # Up1 -- decimal 22
           led.value(1)             
           
       elif readback == Custom6: # Down1 -- decimal 23     
           led.value(0)
           
       else:
           sleep_ms(1)

   delta_time = (time.ticks_diff(time.ticks_ms(), start_time))/1000
   print(f'Delta Time(secs) =  {delta_time:.2f}', "   ", f'Minutes= {delta_time/60:.2f}')
 

2025-01-29 15:25:53
3 Replies
2024-11-19 23:54:28

None of these responses answer the question. I am curious about the same topic. 

userHeadPic The_Inevitable_Man_17235
2024-11-18 11:22:12

i am also wondering how to achieve this. wake once and stay listening

userHeadPic jennapark86
2024-11-16 08:43:03

Did you find a way to do this?

Every forum post on this topic gets a referral to
 https://www.dfrobot.com/forum/topic/332598
… which does NOT address the question, at all.

userHeadPic bradjshannon
2024-09-20 07:56:09

xingzhao.zhu's reply in the following topic might be helpful.

 

https://www.dfrobot.com/forum/topic/332598

userHeadPic Yeez_B