Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By RogerClark
#9358 ADC does work OK, but as you have found, the range is 0 to 1V

I'm not sure if anyone has used it to record audio. It had crossed my mind that it would be interesting to do, but you'd need to work out how to compress and stream it.

Sending uncompressed audio would probably be OK for initial testing, but I can't imagine it would be a good long term solution because of the bandwidth it consumes.
User avatar
By hreintke
#9477 LS,
You mention ADC works OK.
Does that mean there is no interference with ADC readout and wifi send/receive ?
Would I be able to read ADC "continiously" ?
Herman
User avatar
By pvvx
#9538 Change the input voltage ADC (variable resistor) - changing outvalue readvdd33:
ADC_vs_VDD.gif

readvdd33() includes a "pull-up" on the VCC and measures the voltage on the connected external resistor to the input ADC chip legs and GND:
ReadVdd.gif

Procedure uint16 system_adc_read (void) at the time of measurement off WiFi (apparently it gives interference).
system_adc_read() use: uint16 test_tout (0), in which the measurement is between pm_set_sleep_mode (4) .... pm_wakeup_init (4,0).

https://www.youtube.com/watch?v=A0AKFfFwfR4
You do not have the required permissions to view the files attached to this post.
User avatar
By pvvx
#9580 ADC based (revers) system_read_adc ():
Code: Select all/*
 * adc.c
 *
 *  Created on: 13/02/2015
 *      Author: PV`
 *
 */

#include "ets_sys.h"
#include "osapi.h"


void ICACHE_FLASH_ATTR read_adcs(uint16 *ptr, uint16 len)
{
    if(len != 0 && ptr != NULL) {
       uint32 y;
       uint16 z;
       uint16 sar_x[8];
#if (0)
      uint32 store_reg710 = READ_PERI_REG(0x60000710);
      uint32 store_reg58e = READ_PERI_REG(0x600005e8);
      uint32 store018 = READ_PERI_REG(0x3FF00018);
       if((store_reg710 & 0xfe000000) != 0xfe000000) {
          SET_PERI_REG_MASK(0x3FF00018,0x038f0000);
          SET_PERI_REG_MASK(0x60000710,0xfe000000);
          rom_i2c_writeReg_Mask(98,1,3,7,4,15);
          rom_sar_init();
          ets_delay_us(2);
          SET_PERI_REG_MASK(0x600005e8,0x01800000);
          ets_delay_us(2);
       }
       else pm_set_sleep_mode(4);
#endif
       rom_i2c_writeReg_Mask(108,2,0,5,5,1);
       SET_PERI_REG_MASK(0x60000D5C,0x00200000);
         while(READ_PERI_REG(0x60000D50)&(0x7<<24));
       while(len--) {
           CLEAR_PERI_REG_MASK(0x60000D50,2);
           SET_PERI_REG_MASK(0x60000D50,2);
             while(READ_PERI_REG(0x60000D50)&(0x7<<24));
             read_sar_dout(&sar_x[0]);
           z = 0;
           for(y = 0; y < 8; y++) z += sar_x[y];
           z += 8;
           z >>= 4;
           *ptr++ = z;
       };
       rom_i2c_writeReg_Mask(108,2,0,5,5,0);
      while(READ_PERI_REG(0x60000D50)&(0x7<<24));
      CLEAR_PERI_REG_MASK(0x60000D5C,0x00200000);
      CLEAR_PERI_REG_MASK(0x60000D60,1);
      SET_PERI_REG_MASK(0x60000D60,1);
#if (0)
      if((store_reg710 & 0xfe000000) != 0xfe000000) {
         WRITE_PERI_REG(0x600005e8,((READ_PERI_REG(0x600005e8) & 0xfe7fffff) | 0x00800000));
         rom_i2c_writeReg_Mask(98,1,3,7,4,0);
         WRITE_PERI_REG(0x60000710, store_reg710);
         WRITE_PERI_REG(0x3FF00018, store018);
      }
      else   pm_wakeup_init(4,0);
#endif
    }
}

Works. ~ 20ksps.
read_sar_dout() = 14bits. Espressif add z += 8; z >>= 4; -> 10 bits and 1024 :).