ESP8266 port
Opened this issue · 7 comments
great job though , the base lib suffer form low calculation capability of Aruino boards (16Mhz ) , as you may aware, today's, many Arduino fan migrated to magnificent ESP8266 module with 160 Mhz or ESP32 with 320 Mhz , do you have any plan to port this lib to ESP core module ?
Cheers! The ESP8266 is pretty great but the onboard ADC isn't that good. It has a measurement range of 0-1V (fine for an electret microphone) but can only sample at 2.5kHz using analogRead() apparently (source: http://www.esp8266.com/viewtopic.php?f=13&t=7033). Most of the base code for this however should be relatively easy to port though I haven't got any plans to port anytime soon.
thanks @pyrohaz , so what do you suggest to using the ESP8266 ? should I use external ADC for sampling combined by microphone circuit (I don't mind) ?
So in my port, I was sampling at 10kHz so realistically any ADC that can sample at that frequency. If you're happy soldering SOT23 packages, you could look at the ADC081 which can easily sample at a fast enough rate. If you just want an easy DIP package, you could try the Microchip MCP3001. Both of these work through SPI which can be either bit-banged by the ESP8266 or you could use the dedicated peripheral. Quite a few people seem to have used an external ADC on the ESP8266 so I definitely think its achievable! To port the STM32 port to the ESP8266 (without creating a class), you will need to rewrite "uSpeech_hwInit" to initialize the external ADC. You will also need to replace "US_RdSample" with a function capable of sampling the ADC at a 10kHz rate. This could be done by figuring out how long it takes to sample the ADC and using delayMicroseconds to delay for the amount of time required to bump this time up to 100us. For example, if the ADC takes 10us to grab a sample, you will want to delay for 90us to make sure the total time between samples (excluding overhead) is 100us.
The ESP8266 however is pretty jittery so I don't know how good it will be at consistently sampling at roughly 10kHz.
thanks @pyrohaz for helpful tip , I'm gonna first make combined circuit of microphone & ADC081
http://www.ti.com/graphics/folders/partimages/ADC081S101.jpg
I'll let you know any progress , thanks
Good luck! :)
thanks , do you have any suggestion for selection part for ADC and microphone circuit for 3.3 v ESP ttl level ?
http://www.ti.com/product/ADC081S101
As ADCs generally have reasonably low input impedances (proportional to sample rate), its a good idea to buffer it. Sampling at 10kHz equates to an input impedance of around 3.3meg (if I've got my calculations right!) so you'll only need to really add voltage gain. You could use a simple transistor circuit though an op amp based circuit would probably be easier to design like so: http://www.fiz-ix.com/2013/04/simple-electret-microphone-and-band-pass-amplifier-circuit/ remember you want to use it at 3.3V so you don't overload the ADC input. If you find that the output of your electret microphone is hot, you could probably just get away with connecting the microphone directly to the ADC.
Any electret microphone should do, here is an example: http://uk.rs-online.com/web/p/products/7717020/?grossPrice=Y&cm_mmc=UK-PLA-_-google-_-PLA_UK_EN_Passive_Components-_-Sounder_And_Buzzer_And_Microphone_Components&mkwid=sEJ1rBfza_dc|pcrid|88057073283|pkw||pmt||prd|7717020&gclid=CjwKEAjwxurIBRDnt7P7rODiq0USJADwjt5DLnNrom7q2WPTV8-4m6qh4mg_4lUXoj0VPTZz93w4JBoCOK7w_wcB