Max9814 script or settings with rpi pico.Regards!

Howdy! I’m a beginner. I’m starting more than Elon Mask on his first electric car. I have MAX 9814 and rpi pico, I want to implement 3-8 voice commands ( only one for the moment :))) ) that will close and open io-s. I registered the development board on the platform but I don’t know how to implement the microphone. Default doesn’t see it, I don’t know how to add it to the library and configure it on port 26. Analog ,rpi pico default.Or more simply, I can modify the max9814 hardware to be recognized by the default settings made here? I repeat, I am very very beginner. Thank you very much! mail: cristianiftodexyz@gmail.com

Hi @CristiI

Welcome!

If you’re a beginner to electronics i suggest: how2electronics.com they are in the references below for ADC. If you’re a beginner to ML then our docs For beginners | Edge Impulse Documentation :smiley:

For integrating the MAX9814 microphone module with a Raspberry Pi Pico, you’ll primarily need to focus on the I2S (Inter-IC Sound) protocol, as the Pico supports I2S via its SDK. The MAX9814 outputs an analog signal, so you would ideally convert this to digital using an ADC (Analog to Digital Converter) before processing. The Raspberry Pi Pico has built-in ADCs, but they’re not directly suitable for audio due to their sampling rate. Therefore, you might need an external I2S-compatible ADC or consider a different microphone module that supports digital output directly compatible with I2S. Once you have the digital data, you can process it for voice commands using appropriate libraries or algorithms in the Pico’s development environment.

ADC - pico

Microphone MAX9814 with pi pico discussion:

Best

Eoin



I have i2c INMP441 digital microphone now. Problem: One value is full all the time.When i spoke worlds value full go empty and other value is full ( 0,9 to 1) .No recognition.Only some change in value as you have pictures.You have in email comlete code.Somthing is no good, prabably clasification or noise level…

main.c code is: #include “edge-impulse-sdk/classifier/ei_run_classifier.h”
#include <hardware/gpio.h>
#include <hardware/uart.h>
#include <pico/stdio_usb.h>
#include “Microphone/machine_i2s.c”
#include <stdio.h>
#include “pico/multicore.h”
#include “hardware/irq.h”

#define SCK 18
#define WS 19
#define SD 20
#define BPS 32
#define RATE 10989
const uint LED_PIN = 17;
#define SAMPLE_BUFFER_SIZE 10989

float features[SAMPLE_BUFFER_SIZE];
ei_impulse_result_t result = {nullptr};

int inference();

void core1_sio_irq() {
while (multicore_fifo_rvalid()) {
int core1_rx_val = multicore_fifo_pop_blocking();
printf(“%d \n” ,core1_rx_val);
int output = inference();

}
multicore_fifo_clear_irq();

}

void core1_entry() {
multicore_fifo_clear_irq();
irq_set_exclusive_handler(SIO_IRQ_PROC1, core1_sio_irq);
irq_set_enabled(SIO_IRQ_PROC1, true);
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
while (1)
tight_loop_contents();
}

int raw_feature_get_data(size_t offset, size_t length, float *out_ptr) {
memcpy(out_ptr, features + offset, length * sizeof(float));
return 0;
}

int main() {
stdio_usb_init();
stdio_init_all();
printf(“Hello, multicore_fifo_irqs!\n”);
multicore_launch_core1(core1_entry);
machine_i2s_obj_t* i2s0 = machine_i2s_make_new(0, SCK, WS, SD, RX, BPS, MONO, SIZEOF_DMA_BUFFER_IN_BYTES, RATE);
int32_t buffer[I2S_RX_FRAME_SIZE_IN_BYTES /4];
while (1) {
for(int i = 0; i < SAMPLE_BUFFER_SIZE; i++) {
machine_i2s_stream_read(i2s0, (void*)&buffer[0], I2S_RX_FRAME_SIZE_IN_BYTES);
features[i] = buffer[0]/2000;
}
multicore_fifo_push_blocking(123);
sleep_ms(10);
}
}

int inference() {
ei_printf(“Edge Impulse standalone inferencing (Raspberry Pi Pico)\n”);
if (sizeof(features) / sizeof(float) != EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE) {
ei_printf(“The size of your ‘features’ array is not correct. Expected %d items, but had %u\n”,
EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE, sizeof(features) / sizeof(float));
return 1000;
}
gpio_put(LED_PIN, 0); // Se stinge LED-ul înainte de a efectua inferența
signal_t features_signal;
features_signal.total_length = sizeof(features) / sizeof(features[0]);
features_signal.get_data = &raw_feature_get_data;
EI_IMPULSE_ERROR res = run_classifier(&features_signal, &result, false);
ei_printf(“run_classifier returned: %d\n”, res);
if (res != 0)
return 1000;
ei_printf(“Predictions (DSP: %d ms., Classification: %d ms., Anomaly: %d ms.): \n”,
result.timing.dsp, result.timing.classification, result.timing.anomaly);
ei_printf(“[”);
for (size_t ix = 0; ix < EI_CLASSIFIER_LABEL_COUNT; ix++) {
ei_printf(“%.5f”, result.classification[ix].value);
if (ix != EI_CLASSIFIER_LABEL_COUNT - 1) {
ei_printf(“, “);
}
}
ei_printf(”]\n”);
// Verificăm dacă probabilitatea pentru “deschide” este semnificativ mai mare decât celelalte etichete
float deschide_probability = result.classification[2].value;
float max_other_probability = 0.0f;
for (size_t ix = 0; ix < EI_CLASSIFIER_LABEL_COUNT; ix++) {
if (ix != 2 && result.classification[ix].value > max_other_probability) {
max_other_probability = result.classification[ix].value;
}
}
// Verificăm dacă probabilitatea pentru “deschide” este de cel puțin 2 ori mai mare decât cea mai mare probabilitate pentru alte etichete
if (deschide_probability > max_other_probability * 2) {
gpio_put(LED_PIN, 1); // Aprindem LED-ul
return 2; // Returnăm indicele pentru “deschide”
} else {
return 0; // Returnăm indicele pentru necunoscut sau zgomot
}
}

Apreciat your andwer an i pay subscrition for your help.need to complete this project.Few world recognition. Best regards! Cristian tehnicdti@gmail.com