Subject: HuskyLens V2 - I2C playMusic() returns "No ACK" / Fail during Object Tracking (ESP32)

userHead Mrrobot 2026-01-04 07:06:02 56 Views3 Replies

Hi DFRobot Team and Community,

 I am working on a project using the HuskyLens V2 connected to an ESP32
 (Waveshare General Driver for Robots board) via I2C.
 My goal is to track an object using the ALGORITHM_OBJECT_TRACKING and play a
 sound file (01.wav) from the SD card when the object is detected.

 Setup:
  * Board: ESP32-WROOM-32UE (Waveshare General Driver for Robots)
  * Core: Arduino ESP32 Core v2.0.11 (via PlatformIO espressif32 @ 6.4.0)
  * Communication: I2C (SDA=32, SCL=33), 100kHz clock.
  * Library: DFRobot_HuskylensV2 (latest version)
  * HuskyLens Firmware: Latest V0.5.1a (checked via update tool)
  * SD Card: FAT32, contains 01.wav (PCM 16kHz Mono) in root directory.

 The Problem:
 The object tracking works perfectly. I can receive coordinates and control my
 servos.
 However, when I try to call huskylens.playMusic("01.wav", 100) while tracking
 is active, the function always returns false.

 If I debug the return value, it indicates a failure to communicate (No ACK
 received from HuskyLens for the command).

 Code Snippet:

  void loop() {
      huskylens.getResult(TRACKING_ALGO);
      
      if (huskylens.available(TRACKING_ALGO)) {
          // ... tracking logic ...
          
          // Try to play sound on detection
          if (!wasObjectDetected) {
               bool success = huskylens.playMusic("01.wav", 100); 
               if (success) Serial.println("ACK Received");
               else Serial.println("No ACK / Failed"); // <--- This always 
  happens
          }
      }
  }

 Troubleshooting steps taken:
  1. Isolated Test: I created a minimal sketch doing ONLY playMusic() in a loop
     (no tracking algorithm active). Result: Still fails (No ACK).
  2. File Format: Tried 01.mp3 (44.1kHz) and 01.wav (16kHz PCM). Same result.
  3. Bus Reset: Added delays and Wire resets. No change.
  4. Wiring: Checked SDA/SCL. Tracking works fine, so I2C connection is good.
  5. Protocol: Verified HuskyLens is set to "I2C" mode in settings.

 Question:
 Does HuskyLens V2 support receiving the ACTION_PLAY_MUSIC (0x2A) command via
 I2C while an algorithm is running?
 Is there a specific timing requirement or a known bug where the audio command
 is ignored on the I2C bus?

 Any help or workaround would be appreciated!

 Thanks.
 

2026-01-08 19:02:12

It looks like the issue is that HuskyLens V2 only plays audio files stored on its internal eMMC memory, not from an external SD card. To fix this, you’ll need to copy your sound files (like 01.wav) to the eMMC via the HuskyLens software tool. Once the file is on eMMC, the playMusic() command should return ACK successfully, even while running object tracking.

userHeadPic Hung.dol
2026-01-08 11:22:40

It sounds like you've made great progress on your project with the HuskyLens V2! Object tracking is a fantastic application. Have you considered checking the wiring or the I2C communication settings? Sometimes simple issues can cause the ACK failure. Also, if you’re looking for a fun way to unwind after coding, you might enjoy trying out the game Crazy Cattle 3D. Best of luck with your troubleshooting!
 

userHeadPic Decatura.Muller
2026-01-04 17:03:58

Ok, i figured it out.

It reads the files from emmc only, not from sd-card.

userHeadPic Mrrobot