using library to create esp32 to esp32 over bluetooth #421
-
I am a bit of a rookie to all this, but I want to create two identical unit cor communicating within the house. Each would have an esp32-Wroom,an IMNP441 microphone, a PAM8403 audio amp with volume control and 8 ohm speaker and a push button switch to enable talking or just receive. TIA |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 1 reply
-
A2DP is not suited for this purpose, but you can use any other network protocol instead. I suggest that you have a look at the communicagtions-examples. Streaming audio is quite challanging and I would not recommend this as your first project! |
Beta Was this translation helpful? Give feedback.
-
I suggest to use the default pins but you can change them as well. |
Beta Was this translation helpful? Give feedback.
-
There is a lot of good stuff on your wiki. But, contrary to your earlier
suggestion, I am still looking for something that will take sound from an
INMP441 and transmit it to a receiver over bluetooth. And in the same app,
have it receive over blue tooth and feed the sound to a PAM8403 AUDIO AMP.
A single channel (left) is good enough.
Martyn
…On Mon., Oct. 24, 2022, 8:01 a.m. Phil Schatzmann, ***@***.***> wrote:
I suggest to use the default pins but you can change them as well.
Just read the Wiki!
—
Reply to this email directly, view it on GitHub
<#421 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZH5LC3ZV43PHYZUXGLPIZLWEZ275ANCNFSM6AAAAAARMBAYWQ>
.
You are receiving this because you authored the thread.Message ID:
<pschatzmann/arduino-audio-tools/repo-discussions/421/comments/3949968@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
PS: I am using the wifi mac address as a unique bluetooth name.
On Mon., Oct. 24, 2022, 2:47 p.m. Martyn Griffin, <
***@***.***> wrote:
… There is a lot of good stuff on your wiki. But, contrary to your earlier
suggestion, I am still looking for something that will take sound from an
INMP441 and transmit it to a receiver over bluetooth. And in the same app,
have it receive over blue tooth and feed the sound to a PAM8403 AUDIO AMP.
A single channel (left) is good enough.
Martyn
On Mon., Oct. 24, 2022, 8:01 a.m. Phil Schatzmann, <
***@***.***> wrote:
> I suggest to use the default pins but you can change them as well.
> Just read the Wiki!
>
> —
> Reply to this email directly, view it on GitHub
> <#421 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AZH5LC3ZV43PHYZUXGLPIZLWEZ275ANCNFSM6AAAAAARMBAYWQ>
> .
> You are receiving this because you authored the thread.Message ID:
> <pschatzmann/arduino-audio-tools/repo-discussions/421/comments/3949968@
> github.com>
>
|
Beta Was this translation helpful? Give feedback.
-
My answer is still the same: Bluetooth is not the right way and you need to dig into other protocols. If you don't know anthing about communication protocols you need to do quite some learning first! |
Beta Was this translation helpful? Give feedback.
-
I will take your advice and consider using UDP. Was looking at the
communication examples and example-udp-send.ino with
example-udp-receive.ino and also the communication.h file.
On the send example i need to get sound from my i2s mike instead of sine
wave. That will be my first attempt.
Again, any and all help would be greatly appreciated.
TIA
Martyn
…On Mon., Oct. 24, 2022, 2:57 p.m. Phil Schatzmann, ***@***.***> wrote:
My answer is still the same: Bluetooth is not the right way and you need
to dig into other protocols. If you don't know anthing about communication
protocols you need to do quite some learning first!
You would stream the input data via a communication protocol to an output
device.
Try first to have each step working and tested first before you put the
different pieces together as suggested in
https://github.com/pschatzmann/arduino-audio-tools/wiki/It's-not-working
—
Reply to this email directly, view it on GitHub
<#421 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZH5LC2G67C56CFMNKGB7IDWE3L2VANCNFSM6AAAAAARMBAYWQ>
.
You are receiving this because you authored the thread.Message ID:
<pschatzmann/arduino-audio-tools/repo-discussions/421/comments/3954096@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
God, i wish i could write and understand a fraction of what you do!!🙃
On Mon., Oct. 24, 2022, 7:59 p.m. Martyn Griffin, <
***@***.***> wrote:
… I will take your advice and consider using UDP. Was looking at the
communication examples and example-udp-send.ino with
example-udp-receive.ino and also the communication.h file.
On the send example i need to get sound from my i2s mike instead of sine
wave. That will be my first attempt.
Again, any and all help would be greatly appreciated.
TIA
Martyn
On Mon., Oct. 24, 2022, 2:57 p.m. Phil Schatzmann, <
***@***.***> wrote:
> My answer is still the same: Bluetooth is not the right way and you need
> to dig into other protocols. If you don't know anthing about communication
> protocols you need to do quite some learning first!
> You would stream the input data via a communication protocol to an output
> device.
> Try first to have each step working and tested first before you put the
> different pieces together as suggested in
> https://github.com/pschatzmann/arduino-audio-tools/wiki/It's-not-working
>
> —
> Reply to this email directly, view it on GitHub
> <#421 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AZH5LC2G67C56CFMNKGB7IDWE3L2VANCNFSM6AAAAAARMBAYWQ>
> .
> You are receiving this because you authored the thread.Message ID:
> <pschatzmann/arduino-audio-tools/repo-discussions/421/comments/3954096@
> github.com>
>
|
Beta Was this translation helpful? Give feedback.
-
The IMNP441 is using I2S so you would just replace the GeneratedSoundStream with an I2SStream as described in https://github.com/pschatzmann/arduino-audio-tools/wiki/External-ADC |
Beta Was this translation helpful? Give feedback.
-
I hope this is close to right!!
/**
* @file example-udp-send.ino
* @author Phil Schatzmann
* @brief Sending audio over udp
* @Version 0.1
* @Date 2022-03-09
*
* @copyright Copyright (c) 2022
*
* ATTENTION: DRAFT - not tested yet
*/
#include "AudioTools.h"
#include "AudioLibs/Communication.h"
// Connections to INMP441 I2S microphone
#define I2S_WS 35 // purple
#define I2S_SD 33 // blue
#define I2S_SCK 32 // grey
uint16_t sample_rate = 44100;
uint8_t channels = 2; // The stream will have 2 channels
I2SStream i2sStream; // Access I2S as stream
UDPStream udp;
Throttle throttle;
IPAddress udpAddress(192, 168, 0, 255);
const int udpPort = 7000;
StreamCopy copier(udp, i2sStream); // copies sound
const char *ssid = "GRIFFIN";
const char *password = "roadkill";
void setup() {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Info);
auto cfg = i2sStream.defaultConfig(RX_MODE);
cfg.i2s_format = I2S_STD_FORMAT;
cfg.bits_per_sample = 16;
cfg.channels = 2;
cfg.sample_rate = 44100;
cfg.is_master = true;
cfg.use_apll = false; // try with yes
//?????????????????????????
auto i2s_pin_config_t pin_config = {
.bck_io_num = I2S_SCK,
.ws_io_num = I2S_WS,
.data_out_num = -1,
.data_in_num = I2S_SD
};
//?????????????????????????
i2sStream.begin(cfg);
// connect to WIFI
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(WiFi.macAddress());
Serial.println(WiFi.localIP());
// Define udp address and port
udp.begin(udpAddress, udpPort);
auto cfg = throttle.defaultConfig();
cfg.channels = channels;
cfg.sample_rate = sample_rate;
throttle.begin(cfg);
}
void loop() {
throttle.startDelay();
int bytes = copier.copy();
throttle.delayBytes(bytes);
}
Martyn T. Griffin
…On Mon, Oct 24, 2022 at 10:35 PM Phil Schatzmann ***@***.***> wrote:
The IMNP441 is using I2S so you would just replace the
GeneratedSoundStream with an I2SStream as described in
https://github.com/pschatzmann/arduino-audio-tools/wiki/External-ADC
—
Reply to this email directly, view it on GitHub
<#421 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZH5LCYJBHPJRZKBIYJLVYDWE5BQ5ANCNFSM6AAAAAARMBAYWQ>
.
You are receiving this because you authored the thread.Message ID:
<pschatzmann/arduino-audio-tools/repo-discussions/421/comments/3956432@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Ignore the previous msg, I will try this one:
#include "AudioTools.h"
#include "AudioLibs/Communication.h"
// Connections to INMP441 I2S microphone
#define I2S_WS 35 // purple
#define I2S_SD 33 // blue
#define I2S_SCK 32 // grey
uint16_t sample_rate = 44100;
uint8_t channels = 2; // The stream will have 2 channels
I2SStream i2sStream; // Access I2S as stream
UDPStream udp;
Throttle throttle;
IPAddress udpAddress(192, 168, 0, 255);
const int udpPort = 7000;
StreamCopy copier(udp, i2sStream); // copies sound
const char *ssid = "GRIFFIN";
const char *password = "roadkill";
void setup() {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Info);
auto cfg = i2sStream.defaultConfig(RX_MODE);
cfg.i2s_format = I2S_STD_FORMAT;
cfg.bits_per_sample = 16;
cfg.channels = 2;
cfg.sample_rate = 44100;
cfg.is_master = true;
cfg.use_apll = false; // try with yes
auto i2s_pin_config_t = i2sStream.defaultConfig();
i2s_pin_config_t.pin_bck = I2S_SCK;
i2s_pin_config_t.pin_ws = I2S_WS;
i2s_pin_config_t.pin_data = I2S_SD;
i2s_pin_config_t.sample_rate = 44100;
i2s_pin_config_t.channels = 2;
i2s_pin_config_t.bits_per_sample = 16;
i2sStream.begin(i2s_pin_config_t);
// connect to WIFI
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(WiFi.macAddress());
Serial.println(WiFi.localIP());
// Define udp address and port
udp.begin(udpAddress, udpPort);
auto cfg2 = throttle.defaultConfig();
cfg2.channels = channels;
cfg2.sample_rate = sample_rate;
throttle.begin(cfg2);
}
void loop() {
throttle.startDelay();
int bytes = copier.copy();
throttle.delayBytes(bytes);
}
And this was logged:
14:45:43.867 -> [I] I2SConfig.h : 98 - rx/tx mode: TX_MODE
14:45:43.867 -> [I] I2SConfig.h : 99 - port_no: 0
14:45:43.867 -> [I] I2SConfig.h : 100 - is_master: Master
14:45:43.867 -> [I] I2SConfig.h : 101 - sample rate: 44100
14:45:43.867 -> [I] I2SConfig.h : 102 - bits per sample: 16
14:45:43.867 -> [I] I2SConfig.h : 103 - number of channels: 2
14:45:43.867 -> [I] I2SConfig.h : 104 - i2s_format: I2S_STD_FORMAT
14:45:43.914 -> [I] I2SConfig.h : 106 - auto_clear:1
14:45:43.914 -> [I] I2SConfig.h : 113 - buffer_count:10
14:45:43.914 -> [I] I2SConfig.h : 114 - buffer_size:512
14:45:43.914 -> [I] I2SConfig.h : 118 - pin_bck: 32
14:45:43.914 -> [I] I2SConfig.h : 119 - pin_ws: 35
14:45:43.914 -> [I] Ib⸮
Martyn T. Griffin
On Tue, Oct 25, 2022 at 1:55 PM Martyn Griffin ***@***.***>
wrote:
… I hope this is close to right!!
/**
* @file example-udp-send.ino
* @author Phil Schatzmann
* @brief Sending audio over udp
* @Version 0.1
* @Date 2022-03-09
*
* @copyright Copyright (c) 2022
*
* ATTENTION: DRAFT - not tested yet
*/
#include "AudioTools.h"
#include "AudioLibs/Communication.h"
// Connections to INMP441 I2S microphone
#define I2S_WS 35 // purple
#define I2S_SD 33 // blue
#define I2S_SCK 32 // grey
uint16_t sample_rate = 44100;
uint8_t channels = 2; // The stream will have 2 channels
I2SStream i2sStream; // Access I2S as stream
UDPStream udp;
Throttle throttle;
IPAddress udpAddress(192, 168, 0, 255);
const int udpPort = 7000;
StreamCopy copier(udp, i2sStream); // copies sound
const char *ssid = "GRIFFIN";
const char *password = "roadkill";
void setup() {
Serial.begin(115200);
AudioLogger::instance().begin(Serial, AudioLogger::Info);
auto cfg = i2sStream.defaultConfig(RX_MODE);
cfg.i2s_format = I2S_STD_FORMAT;
cfg.bits_per_sample = 16;
cfg.channels = 2;
cfg.sample_rate = 44100;
cfg.is_master = true;
cfg.use_apll = false; // try with yes
//?????????????????????????
auto i2s_pin_config_t pin_config = {
.bck_io_num = I2S_SCK,
.ws_io_num = I2S_WS,
.data_out_num = -1,
.data_in_num = I2S_SD
};
//?????????????????????????
i2sStream.begin(cfg);
// connect to WIFI
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(WiFi.macAddress());
Serial.println(WiFi.localIP());
// Define udp address and port
udp.begin(udpAddress, udpPort);
auto cfg = throttle.defaultConfig();
cfg.channels = channels;
cfg.sample_rate = sample_rate;
throttle.begin(cfg);
}
void loop() {
throttle.startDelay();
int bytes = copier.copy();
throttle.delayBytes(bytes);
}
Martyn T. Griffin
On Mon, Oct 24, 2022 at 10:35 PM Phil Schatzmann ***@***.***>
wrote:
> The IMNP441 is using I2S so you would just replace the
> GeneratedSoundStream with an I2SStream as described in
> https://github.com/pschatzmann/arduino-audio-tools/wiki/External-ADC
>
> —
> Reply to this email directly, view it on GitHub
> <#421 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AZH5LCYJBHPJRZKBIYJLVYDWE5BQ5ANCNFSM6AAAAAARMBAYWQ>
> .
> You are receiving this because you authored the thread.Message ID:
> <pschatzmann/arduino-audio-tools/repo-discussions/421/comments/3956432@
> github.com>
>
|
Beta Was this translation helpful? Give feedback.
A2DP is not suited for this purpose, but you can use any other network protocol instead. I suggest that you have a look at the communicagtions-examples.
Streaming audio is quite challanging and I would not recommend this as your first project!