Baby Monitor with ESP32

 

Baby Monitor with ESP32

One of the primary uses of baby monitors is to allow attendants to hear when an infant wakes, while out of immediate hearing distance of the infant.

        A baby monitor, also known as a baby alarm, is a system used to remotely listen to sounds made by an infant. An audio monitor consists of a transmitter unit, equipped with a microphone, placed near to the child. It transmits the sounds to a receiver unit with a speaker carried by, or near to, the person caring for the infant. 


Connection of ESP32 with MIC (INMP441)


Let straight away get started so first we will see the connection of ESP32 to the mic which is nothing but INMP441 is the module which we are going to use as a mic 

So this is just to test whether if the mic is working or not so once it is working so that we can connect to the actual module with a speaker which will be tested separate least so here we are going to test my and speaker separate the first and then we are going to integrate both of them and work on the baby monitor project so first you will see the connection of iron MP 441 with the esp32 if it works then we will go to the next step so for this the our Results should be as given in the picture so according to this picture if we do whistle this is the graph which we should get it so that's the reason we are going to test it a b i n a 441 first and then we will go towards the mic.



MIC - ESP32




 VDD - 3.3V 

GND - GND 

L/R - GND 

WS - 15

 SCK - 14 

SD - 32


CODE:


#include <Arduino.h> #include <driver/i2s.h>
// you shouldn't need to change these settings
#define SAMPLE_BUFFER_SIZE 512
#define SAMPLE_RATE 8000
// most microphones will probably default to left channel but you may need to tie the L/R pin low
#define I2S_MIC_CHANNEL I2S_CHANNEL_FMT_ONLY_LEFT
// either wire your microphone to the same pins or change these to match your wiring
#define I2S_MIC_SERIAL_CLOCK GPIO_NUM_14
#define I2S_MIC_LEFT_RIGHT_CLOCK GPIO_NUM_15
#define I2S_MIC_SERIAL_DATA GPIO_NUM_32
// don't mess around with this
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
.sample_rate = SAMPLE_RATE,
.bits_per_sample = I2S_BITS_PER_SAMPLE_32BIT,
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
.communication_format = I2S_COMM_FORMAT_I2S,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 4,
.dma_buf_len = 1024,
.use_apll = false,
.tx_desc_auto_clear = false,
.fixed_mclk = 0};
// and don't mess around with this
i2s_pin_config_t i2s_mic_pins = {
.bck_io_num = I2S_MIC_SERIAL_CLOCK,
.ws_io_num = I2S_MIC_LEFT_RIGHT_CLOCK,
.data_out_num = I2S_PIN_NO_CHANGE,
.data_in_num = I2S_MIC_SERIAL_DATA};
void setup()
{
// we need serial output for the plotter
Serial.begin(115200);
// start up the I2S peripheral
i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
i2s_set_pin(I2S_NUM_0, &i2s_mic_pins);
}
int32_t raw_samples[SAMPLE_BUFFER_SIZE];
void loop()
{
// read from the I2S device
size_t bytes_read = 0;
i2s_read(I2S_NUM_0, raw_samples, sizeof(int32_t) * SAMPLE_BUFFER_SIZE, &bytes_read, portMAX_DELAY);
int samples_read = bytes_read / sizeof(int32_t);
// dump the samples out to the serial channel.
for (int i = 0; i < samples_read; i++)
{
Serial.println(raw_samples[i]);
}
}

SPEAKER - ESP32


 LRC - I026 


BLCK - I027


 DIN - I025 


GAIN - GND 


SD - - 


GND - GND


 VDD - 5V CODE



#include "AudioOutputI2S.h" #include "AudioGeneratorAAC.h"
#include "AudioFileSourcePROGMEM.h"
#include "sampleaac.h"
#define Bit_Clock_BCLK 27
#define Word_Select_WS 26
#define Serial_Data_SD 25
#define GAIN 0.125
AudioFileSourcePROGMEM *in;
AudioGeneratorAAC *aac;
AudioOutputI2S *out;
void setup(){
Serial.begin(115200);
in = new AudioFileSourcePROGMEM(sampleaac, sizeof(sampleaac));
aac = new AudioGeneratorAAC();
out = new AudioOutputI2S();
out -> SetGain(GAIN);
out -> SetPinout(Bit_Clock_BCLK,Word_Select_WS,Serial_Data_SD);
aac->begin(in, out);
}
void loop(){
if (aac->isRunning()) {
aac->loop();
} else {
aac -> stop();
Serial.printf("Sound Generator\n");
delay(1000);
}
}




CONNECTION ESP32 WITH INMP44 AND MAX987A





BCLK :The Base Clock or BCLK in a motherboard is the clock speed that drives a lot of things on the motherboard, from system RAM to the CPU, and also PCIE devices. Base Clock overclocking is where you can overclock CPUs and memory via manual manipulation of the base clock multiplier.


DIN: DIN standardized and used for digital interfaces like the musical instrument digital interface (MIDI), the IBM AT computer keyboard or mouse, and in analog video architectures.


Post a Comment

My Instagram

Made with by Pi-girl | Copyright © 2020 Pi-girl