Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By chaeplin
#50986 I got 3 ~ 4KB/s when uploading an image to twitter, using client.write.

debojitk wrote:Hi,
Thanks a lot for your help.
Just wanted to know that what might be the data transfer rate for binary stream while sending from esp module. Actually i am planning to transfer pcm audio samples from esp to android and play there. I did a poc on audio sampling using arduino and found that I can sample at 38.5 khz (using ADC interrupt- http://www.instructables.com/id/Arduino-Audio-Input/), and the sampling result is very good. I know that esp also has onboard adc so I can probably implement the same audio sampling on esp.
Can you tell me that is it really possible to capture and send data @~40kBps from esp along with doing other things.

Thanks in advance.
Debojit
User avatar
By debojitk
#51018
martinayotte wrote:I can't tell you the real throughput. I guest you will have to experiment to figure out.
BTW, the on-board ESP ADC isn't good for audio, you will have to use an external ADC.


You were absolutely right, the onboard ADC is a fancy thing! I tested the sampling speed, and its merely able to read just ~10000 samples/sec that is too low for this purpose. Is there any tweak to increase the sampling speed?
The code I used as below:
Code: Select allvoid setup() {
   // initialize serial communication at 9600 bits per second:
   Serial.begin(9600);
   Serial.setDebugOutput(true);
   ESP.wdtDisable();
}

// the loop routine runs over and over again forever:
void loop() {
   // read the input on analog pin 0:
   int sensorValue=0;
   long sTime=micros();
   ESP.wdtDisable();
   for(int i=0;i<50000;i++){
      sensorValue = analogRead(A0);
   }
   long eTime=micros();
   eTime=eTime-sTime;
   // print out the value you read:
   Serial.println(eTime);
   ESP.wdtEnable(0);
   delay(1);        // delay in between reads for stability
   yield();
}


The time elapsed is around 4.5 sec for every 50000 samples, i.e., 94 usec for every sample.

The adc max input voltage range is 1 volt, probably I can bear with that, however haven't tested yet, but the speed is the real problem.
As you suggested of using separate ADC module (probably on SPI or I2C), so can you suggest any good module with around ~100ksps sampling rate.
There is another option to use arduino as slave with esp and communicate either via rx/tx or SPI interface.
Kindly put some light on all these options and suggest an way out.
Thanks in advance.
Also if you think I am deviating from the original topic I will start another thread for the ADC discussion.
Thanks,
Debojit
User avatar
By debojitk
#51078 Hi,
Can I get some suggestion here please.
I found a great project at http://hackaday.com/2016/07/15/baby-monitor-rebuild-is-also-esp8266-audio-streaming-how-to/. Can you please suggest if I can use arduino as the ADC+DAC and communicate via Serial/SPI. Is it really possible to communicate between esp and arduino using SPI having arduino as the slave and esp as the master?

Thanks in advance.

Debojit
User avatar
By debojitk
#51121
martinayotte wrote:Of course, simply use plain TCP Client.
In ArduinoESP framework, there is an example in libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino.
Even if this example is doing a HTTP request in a Client.print() call, it doesn't need to be that request, it can be any thing that can emulate telnet client, even AT commands if you wish, all depends of the protocol used by your server's code.


Thanks for your help. The sample exactly did the thing I wanted. I got around 433 KBps speed, which is sufficient for my purpose.

Just one thing, please see the code below:
Code: Select all      for(int i=0;i<10640;i++){
         buffer[i]=65;
      }
      //yield();
      cnt++;
      int sizeSent=client.write((const uint8_t *)buffer, 10640);


Here the buffer size I am using is 10640, but at each write it can only transfer 2920 bytes. Is it the maximum that it can send in one go?Should I keep the size of the array below this to ensure all bytes in the array is sent?
Thanks,
Debojit