Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noise when using wi-fi #1

Open
SharkSharp opened this issue Apr 24, 2019 · 16 comments
Open

Noise when using wi-fi #1

SharkSharp opened this issue Apr 24, 2019 · 16 comments

Comments

@SharkSharp
Copy link

First of all I would like to congratulate you for the work, a good idea implemented in a simple and effective way.

I'm putting some variations of the code for other applications and I ended up with a noise that arises when using the driver and the wifi library together. I could not find any reference and nothing connecting the two, but I suspect they share the same communication bus. Do you have any idea of what could be and how could be corrected or mitigated?

I'm using the Espressif ESP32 Dev Module and the Wi-Fi libraries

  1. #include <WiFi.h>
  2. #include <WiFiUdp.h>

Thanks.

@elshnkhll
Copy link

I can confirm. Simultaneous use of WiFi connection and ULPSound creates loud "clicks". First I sought it is due to power drop since WiFi uses too mach of it. But after stabilizing power source "clicks" remained. Now I suspect that process is being interrupted.

@SharkSharp
Copy link
Author

I don't believe that the noise is due to an process interruption. As the sound is managed by ULP, it works independently of the two main processors. Through my extensive tests I still believe that the problem is a lack of power supply.

@w3llschmidt
Copy link

w3llschmidt commented May 7, 2020

I cant confirm! I have here NodeMCU-ESP32, with

  • GPIO (blink alive LED)
  • SSD1306 I2C OLED (status Display)
  • WIFI (WLAN)
  • NTP (networktime)
  • UDP Server (for controlling the PWM via network)
  • PWM (controlling DC motor)
  • ULPSOUND (for generating locmotive modell sound)
  • ADC1 (Battery monitor)

works all parallel like a champ with 44100Hz ULP sound. All within own tasks, for sure.

ESP-IDF: v4.1-dev-1086-g93a8603c5-dirty

@SharkSharp
Copy link
Author

Okay, I expressed myself poorly in the first message. The noise appears when there is data traffic over the wifi. I'm trying to do voice transmission from a computer to esp via wifi, and whenever there is network traffic, it produces a noise, in my case it is constant because the data transmission is constant. I did a test with a simple program that combines ULPSoundESP32 and a web server that just returns a string to me. Whenever I make a request to the web server, it introduces noise into the sound. Maybe, @w3llschmidt , you don't hear the noise because your network traffic is very low.

@w3llschmidt
Copy link

w3llschmidt commented May 10, 2020

Hmm, even if i fire dozen of packets toward the ESP, there is no change in the sound.

https://pbs.twimg.com/media/EXrwKA8X0AEy3sJ?format=jpg&name=small

To be fair, my ULPSOUND plays out of a static wavetable.h

@SharkSharp
Copy link
Author

I am using the Arduino's IDE and libraries to program. I noticed here that the arduino-esp32 library uses version IDF 3.2:
https://github.com/espressif/arduino-esp32/releases
Maybe that version is the cause the noise.
@w3llschmidt , could you send an example of how you handle network connection in the ESP-IDF: v4.1?
So that I can test using the IDF and see if this is the problem.
Thank you for your help.

@w3llschmidt
Copy link

w3llschmidt commented May 14, 2020

Quite simple. I work with the examples all the time:

https://github.com/espressif/esp-idf/tree/master/examples/wifi/getting_started/station

I put this in a wifi.c, create a wifi.h;

#ifndef WIFI_H
#define WIFI_H

#include "esp_event.h"
void initialise_wifi();

#endif // WIFI_H

And call it in main.c > initialise_wifi();

BTW: im not a fan of Arduino, i do it all with VIM an ESP IDF pure C.

@SharkSharp
Copy link
Author

SharkSharp commented May 15, 2020

Unfortunately, it didn't work for me. I downloaded the development sdk from esp-idf and did everything the old school way. I used the sample codes as a base and assembled a simple firmware that has ULPSound and an httpServer, the same noise appears whenever my esp sends a network packet. I'm starting to think it might be my hardware. I am using an ESP32 DEVKIT V1, I noticed that it is already in version 4, it may be the source of the problem.

@bitluni
Copy link
Owner

bitluni commented May 17, 2020

hmmmm,
might be a buffer underrun. You have to make sure that fill samples is called often enough. This can be done using a priority timer. usually wifi is handled on the other core but if further data processing is done in the main loop the ULP buffer underruns and a typical stuttering might happen.

@SharkSharp
Copy link
Author

@bitluni , I already made sure that the buffer was working properly. The audio flows continuously, but there is a click embedded in. I made a program that always reproduced an empty buffer (128) and that sent me a small message whenever I made an HTTP request. The result of the audio output whenever I made the http request was this:
7d465cb4-09a9-44de-a257-423f76ea6f7c
I'm using this development kit:
IMG_20200518_021432
IMG_20200518_021439

@bitluni
Copy link
Owner

bitluni commented May 18, 2020

That's really sketchy it would mean somehow the configuration is changed or the DAC register is set to anything != 128 temporarily.

I can only imagine the error happening while the buffer is filled OR the ULP being buggy while setting the bits.

The first one can be tested if you can still observe the clicks while not updating the buffer in the loop at all. the ULP should loop the values it already has.

@SharkSharp
Copy link
Author

@bitluni , I did as suggested and removed all the buffer update code, the ULP uses only the fixed values initially set to 128, but the noise remains. Another point that makes me believe even more that it is a hardware problem, the noise decreases if i set the wifi max tx power to 10db. I have 3 development boards like this one and in all of them the problem occurs.

@bitluni
Copy link
Owner

bitluni commented May 18, 2020 via email

@ens4dz
Copy link

ens4dz commented Sep 2, 2020

I think it is hardware issue (06:00):
https://youtu.be/pPh3_ciEmzs

@kotXio
Copy link

kotXio commented Nov 16, 2020

It's not related to the sound issue, but I have found this thread by searching for my problem. Actually, with active WiFi usage ESP32-CAM in my case make a lot of noises over the power line. Which even make small servos to shake. I have spent a lot of time searching for the problem, with different ESP32 modules and power supplies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants