A Walkie-Talkie based around the ESP32 using UDP broadcast or ESP-NOW

Overview

Overview

We've made a Walkie-Talkie using the ESP32.

Explanatory video

Demo Video

Audio data is transmitted over either UDP broadcast or ESP-NOW. So the Walkie-Talkie will even work without a WiFi network!

I'm using my own microphone board (available on Tindie: https://www.tindie.com/products/21519/) but the code will work equally well with any I2S microphone (e.g. the INMP441) and you can easily modify it to use the built-in ADC for analogue microphones.

For output, I'm using an I2S amplifier breakout board which I'm using the drive a 4ohm speaker. Once again, you can modify the code to use the built-in DAC for output which will let you use headphones or an analogue amplifier board.

I've got a great series of videos on ESP32 Audio which are a great resource for anyone who wants to learn more about audio on the ESP32 which you can find here: https://www.youtube.com/playlist?list=PL5vDt5AALlRfGVUv2x7riDMIOX34udtKD

For this project I've 3D printed a case - you can access the Fusion 360 project here: https://a360.co/2PXgAUS

I've also created a custom PCB - you can access the schematic here: https://easyeda.com/chris_9044/esp32-walkie-talkie

The boards were manufactured by PCBWay and as always they've done a really great job. You can order the boards directly from PCBWay here: https://www.pcbway.com/project/shareproject/ESP32_Audio_Board_For_Walkie_Talkie.html

And you can help support the channel by using my referral link: https://www.pcbway.com/setinvite.aspx?inviteid=403566 for other PCBs.

However, you can also easily wire this up on breadboard - that's how I prototyped it. Everything is I2S based so it's just straightforward jumper wires.

Setup

Everything is configured from the src/config.h file. To use UDP Broadcast comment out the line:

#define USE_ESP_NOW

Make sure you update the WiFi SSID and Password:

// WiFi credentials
#define WIFI_SSID << YOUR_SSID >>
#define WIFI_PSWD << YOUR_PASSWORD >>

The pins for the microphone and the amplifier board are all setup in the same config.h file.

Building and Running

I'm using PlatformIO for this project so you will need to have that installed. Open up the project and connect your ESP32. You should be able to just hit build and run.

Obviously, you'll need two ESP32 boards and components to do anything :)

Comments
  • how to use code

    how to use code

    hello, I got into troubles when I tried to use your code and library. as it's not made as other library (just code with examples demonstrating functions of library, that you can #include in arduino IDE code). I am a bit lost in the Platformio IDE and way, how your code should be used properly. Could you explain how to use this library and how to use Platformio please? I tried to search for such a video on your ytb channel but I haven't find any yet. If you have any, it would be awesome. Can you send me a link to your or someone else's video, or some other source of information (if you know about any) that explains this issue? It would be a great help.

    Thank you very much.

    opened by MichalZima 19
  • Configuration with INMP441 microphone and DAC

    Configuration with INMP441 microphone and DAC

    Hello,

    I'm trying to make this walkie-talkie code work with another configuration: On one side I have an ESP32 emitter with a INMP441 microphone. On other side I have another ESP32 receiver with ESP32 buildin DAC + amplifier. The ESP_NOW link seems to work well. My issue is the sound is very noisy. The sound changes when I make some noise near the microphone but with some sort of saturation effect and with time I have something like an acoustic feedback effect. Do you have an idea how I could fix this ? Thanks

    opened by lcaum 8
  • Instructions for use with ADC microphone and DAC headphones

    Instructions for use with ADC microphone and DAC headphones

    Hi, On most pages you explain you can use analog components instead of I2S ones, I'd like to use this project without the I2S components. In your youtube video and hackaday I can see you using a pair of headphones. Analog components

    I think you are only using it as output since you are combining left and right audio, and nothing is connected to the microphone (sleeve). I want to use the built in analog microphone as well, since that would reduce components to what most hobbyists already have. I think you need a bias voltage though, since there is a FET inside that needs to be powered. Do you have any idea on whether this is possible, and if so how to wire it? Thanks for the cool project

    opened by Bartvelp 7
  • Question: possible to use this code with a serial connection

    Question: possible to use this code with a serial connection

    Hi,

    I really like this project and I have used it with esp-now and works okay. Now I want to use this in a house where there are old intercoms and bad reception :). I thought I maybe could reuse the original wiring and instead of esp-now use wired connection between esp's. Would this be possible?

    opened by Sennevds 2
  • Compilation for other ESP32 chips

    Compilation for other ESP32 chips

    The compilation for other ESP32 chips gives some trouble:

    1. The filename "GenericDevBoardIndicatorLed copy.cpp" cannot be compiled in another compilation environment because it contains a space character. I renamed it to "GenericDevBoardIndicatorLed.cpp"

    2. The compilation is intended for the TinyPico chip, I added another chip (lolin32) which can be used for other generic ESP32 chips as well. This compilation is no longer dependant on TinyPICO.h

    3. I added the define USE_LED_GENERIC to tell you want to use a generic led. This define is automatically added when in the lolin32 environment, but you can also add it manually in config.h

    4. In order to be able to compile it for other ESP32 chips, TinyPICOIndicatLed.cpp has to be excluded from the compilation. To do this, I use the mechanism lib_ignore in platformio.ini. I don't know a mechanism the exclude a single file. So I had to move the 2 files in another lib directory, called indicator_led_pico. I know you prefer to have it in the same directory, but I don't know a better solution.

    P.S.: After this, it is also possible to compile the project in the Arduino IDE. Just throw together all the cpp and h files in a directory WalkieTalkie and rename main.cpp to WalkieTalkie.ino. If you are using a generic ESP32 chip, remove TinyPICOIndicatorLed.* and define USE_LED_GENERIC in config.h

    opened by FedericoBusero 2
  • Simple code for sending audio that use MAX9814

    Simple code for sending audio that use MAX9814

    I want to know how to use simple code for sending audio that speak through microphone MAX9814

    Can you please check my code

    #include <driver/i2s.h>
    #define I2S_SAMPLE_RATE 16000
    #define ADC_INPUT ADC1_CHANNEL_7 //pin 35
    #include <esp_now.h>
    #include <WiFi.h>
    
    uint8_t buff_count = 0;
    #define SPKR_BUFF_SIZE 60
    uint32_t DataTransmit[SPKR_BUFF_SIZE];
    uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
    
    bool send_success;
    
    void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
     
    }
    void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
    
    }
    
    void setup() {
      pinMode(27,OUTPUT);
      Serial.begin(115200);
      esp_err_t err;
      const i2s_config_t i2s_config = {
        .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_ADC_BUILT_IN),
        .sample_rate =  I2S_SAMPLE_RATE,
        .bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
        .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
        .communication_format = I2S_COMM_FORMAT_I2S_LSB,
        .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
        .dma_buf_count = 4,
        .dma_buf_len = 64,
        .use_apll = false,
        .tx_desc_auto_clear = false,
        .fixed_mclk = 0
      };
     err =  i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
       i2s_set_adc_mode(ADC_UNIT_1, ADC_INPUT);
      i2s_adc_enable(I2S_NUM_0);
      
      
     
    
    WiFi.mode(WIFI_STA);
    
     
      if (esp_now_init() != ESP_OK) {
        Serial.println("Error initializing ESP-NOW");
        return;
      }
    
      
      esp_now_register_send_cb(OnDataSent);
      
      
      esp_now_peer_info_t peerInfo;
      memcpy(peerInfo.peer_addr, broadcastAddress, 6);
      peerInfo.channel = 0;  
      peerInfo.encrypt = false;
    
     if (esp_now_add_peer(&peerInfo) != ESP_OK){
        Serial.println("Failed to add peer");
        return;
      }
      esp_now_register_recv_cb(OnDataRecv);
    }
    
    void loop() {
      int32_t sample = 0;
       while( buff_count!=SPKR_BUFF_SIZE-1 ){
      int bytes_read = i2s_pop_sample(I2S_NUM_0, (char *)&sample, portMAX_DELAY);
      Serial.println(sample);
      if (bytes_read > 0) {
          DataTransmit[buff_count] = sample;
          buff_count++;
        }
       }
       buff_count = 0;
         esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &DataTransmit, SPKR_BUFF_SIZE*4);
    
    }
    
    opened by rachanon0807 2
  • Button ,?

    Button ,?

    Hi I have connected all the parts but I couldnt understand the connection of the transmit button :( can you explain pls thanks for this great project.

    opened by sbabadag 1
  • Compilation for ESP32 Arduino core v2 & ESP32C3

    Compilation for ESP32 Arduino core v2 & ESP32C3

    The Arduino core v2 is not yet stable, but the code can already be adapted to the new IDF version (4.4). Also some changes were done to support ESP32C3 in future.

    opened by FedericoBusero 1
  • Use Github Actions to build firmwares

    Use Github Actions to build firmwares

    Use GitHub Actions: https://docs.platformio.org/en/latest/integration/ci/github-actions.html

    See also: https://github.com/Aircoookie/WLED/blob/master/.github/workflows/wled-ci.yml

    hacktoberfest-accepted 
    opened by jamesmyatt 1
  • Improve build

    Improve build

    • The TinyPICO board definition includes a ARDUINO_TINYPICO macro, so there's no need to use another #define.

    • Support customizing the build using platformio_override.ini, which is an approach I've copied from WLED: https://github.com/Aircoookie/WLED/blob/master/platformio.ini

    • Some other minor refactors.

    hacktoberfest-accepted 
    opened by jamesmyatt 1
  • End of transmission: flush transport buffer

    End of transmission: flush transport buffer

    When ending the transmission phase, some audio samples remain in the transport buffer, so they will be transmitted at the next transmission phase, which is not correct. Solution is to flush the transport buffer when ending transmission.

    opened by FedericoBusero 1
  • 最终数据处理的原因是什么

    最终数据处理的原因是什么

    你好,在最终写入I2S设备的数据中,为什么要这样处理? 我的理解是,发送方采集128个数据转换成16bit,然后再转换成8bit,通过UDP或者ESP-NOW传输到接收方,接收方将128个8位数据经过如下处理写入到I2S设备中,但是我不理解为什么要经过这样的处理,这样处理完之后,最终写入到ESP32的数据是多少个?

    void Output::write(int16_t *samples, int count) { int sample_index = 0; while (sample_index < count) { int samples_to_send = 0; for (int i = 0; i < NUM_FRAMES_TO_SEND && sample_index < count; i++) { int sample = process_sample(samples[sample_index]); m_frames[i * 2] = sample; // left channel m_frames[i * 2 + 1] = sample; // right channel samples_to_send++; sample_index++; } // write data to the i2s peripheral size_t bytes_written = 0; i2s_write(m_i2s_port, m_frames, samples_to_send * sizeof(int16_t) * 2, &bytes_written, portMAX_DELAY); if (bytes_written != samples_to_send * sizeof(int16_t) * 2) { ESP_LOGE(TAG, "Did not write all bytes"); } } }

    opened by tsk15535904190 0
  • low latency?

    low latency?

    Hello, thank you for your fantastic projects, I learned a lot from it! I am a guitar player, and I want to build a wireless effect device. There are a lot of wireless guitar tranceiver products on the market in the low price range, ( less than 50 euro). They use he 2.4 ghz band, that's all I know, and the latency is quite good ( about12msec) with very good sound quality ( frequency S/N ratio and dynamics). What is the trick here ?? I can imagine its something like ESP32 Now under the hoods, , in conjunction with a fast compression codec. So, if you could go this route someday ( its probably the opposite to the other feature request, asking for long range with the CODEC 2), that would be great. Thanks!

    opened by mkoenings 0
  • Feature request - Codec2 compression

    Feature request - Codec2 compression

    I am following your journey on youtube and github. At some point it will be nice to implement Lora with Codec2 compression using Semtech SX1280 chip (for longer range) . Couple of links below for reference:

    https://github.com/deulis/ESP32_Codec2 https://stuartsprojects.github.io/2021/03/03/Large-Data-Transfers-with-LoRa-Part2.html

    Keep it up. Thanks.

    opened by happytm 0
Owner
atomic14
atomic14
BKM-10Rduino is an Arduino based alternative for the Sony BKM-10R control unit typically used with Sony broadcast monitors like the BVM-D20F1a/e/u

BKM-10Rduino BKM-10Rduino is an Arduino (natch) based alternative for the Sony BKM-10R control unit typically used with Sony broadcast monitors like t

Aaron Bonham 10 Apr 11, 2022
An easy to build CO2 Monitor/Meter with Android and iOS App for real time visualization and charting of air data, data logger, a variety of communication options (BLE, WIFI, MQTT, ESP-Now) and many supported sensors.

CO2-Gadget An easy to build CO2 Monitor/Meter with cell phone App for real time visualization and charting of air data, datalogger, a variety of commu

Mariete 22 Aug 5, 2022
Flutter-v2 Firebase Messaging, Foreground and Background Notifications + Topic Subscription and Broadcast Notifications Source code

Flutter Notification & FCM The repo is about flutter notification and FCM (Firebase Cloud Messaging). It is updated with Flutter v2 and new updates of

Amanullah 32 Sep 29, 2022
ESP32-Skid-Steer - Bruder Catepillar Skid Steer model converted to RC, controlled by an ESP32 with 2 analog joysticks and a receiver that is an ESP32 on the model.

ESP32-Skid-Steer Bruder Catepillar Skid Steer model converted to RC, controlled by an ESP32 with 2 analog joysticks and a receiver that is an ESP32 on

null 5 Feb 4, 2022
ESP Insights is a remote diagnostics solution that allows users to remotely monitor the health of ESP devices in the field.

ESP Insights is a remote diagnostics solution that allows users to remotely monitor the health of ESP devices in the field.

Espressif Systems 38 Oct 4, 2022
Veml7700-esp-idf - VEML7700 Light Sensor driver for ESP-IDF

VEML7700 Light Sensor driver for ESP-IDF Overview This project aims to provide a very simple interface for configuring and reading data from the VEML7

Kristijan Grozdanovski 3 Jul 29, 2022
New version of the well known ESP32 Radio. Now optional I2S output!

ESP32Radio-V2 New version of the well known ESP32 Radio. Now optional I2S output! Compile time configuration in config.h. Do not forget to upload the

Ed Smallenburg 47 Sep 19, 2022
ESP32 S2 C++ host library compatible with arduino, esp-idf.

Info I would like to announce USB host library for esp32 S2 compatible with arduino, esp-idf and PIO (when pio will be updated to most recent esp-idf)

null 15 Jun 2, 2022
To simplify the development of ESP32 in ESP-IDF, Easyio provides a complete driver library

Easyio 开源驱动库 Easyio 是一款适配于ESP-IDF框架的开源驱动库,以支持ESP32的简便开发。目的是简化乐鑫ESP-IDF开发框架的使用难度。(真要方便的话,有现成的Arduino和Platform可以用,不过实在迫于工作要求,有的开源东西不让用,同时便于对接FAE,于是就有了 E

null 182 Sep 27, 2022
Add tensilica esp32 cpu and a board to qemu and dump the rom to learn more about esp-idf

qemu_esp32 Add tensilica esp32 cpu and a board to qemu and dump the rom to learn more about esp-idf ESP32 in QEMU. This documents how to add an esp32

null 343 Sep 19, 2022
ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

esp32-internet-ota ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

Husarnet 31 Sep 22, 2022
A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.

Turbo Vision A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support. I

null 1.4k Oct 2, 2022
null 270 Sep 23, 2022
Allows for multiple SwitchBot buttons and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Meter/Temp Sensor

SwitchBot-MQTT-BLE-ESP32 Switchbot local control using ESP32. no switchbot hub used/required. works with any smarthub that supports MQTT https://githu

null 305 Oct 2, 2022
AnalogWrite for ESP32 and ESP32-S2 with LEDC PWM. Includes PWM Phase Control, DAC and Smart GPIO resource management.

analogWrite() ESP32 Installation Instructions This library was tested using using the ESP32 Arduino IDE Boards Manager installation method. Stable rel

null 30 Sep 28, 2022
around — adaptive rounding operation

around — adaptive rounding operation Attempts to perform nice rounding of a floating point number, like a human would do. Usage: around.h #include "ar

Jan Ringoš 2 Aug 18, 2022
Header only wrapper around Hex-Rays API in C++20.

HexSuite HexSuite is a header only wrapper around Hex-Rays API in C++20 designed to simplify the use of Hex-Rays and IDA APIs by modern C++ features.

Can Bölük 120 Aug 26, 2022
Growtopia internal cheat focused around enhancements and framework, that is loaded automatically. By: ama6nen

CREDITS TO AMA6NEN ORIGINAL REPO: https://github.com/ama6nen/INZERNAL INZERNAL INZERNAL has been discontinued for public usage and a private version t

TheC0mpany 11 Jul 30, 2022
Plugin wrapper around VCV Rack

DISTRHO Cardinal Cardinal, the Rack! ! THIS PROJECT IS A WORK IN PROGRESS ! This is a DPF-based plugin wrapper around VCV Rack, using its code directl

DISTRHO 864 Oct 1, 2022