This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1015-Q1: How to reach 4x3300 SPS with four ADCs on an ESP32?

Part Number: ADS1015-Q1
Other Parts Discussed in Thread: ADS1015, , ADS131B04-Q1

Hi!

I want to use an ESP32-S2 to read 4 differential signals simultaneously at 3.3 kHz. I was thinking about using 4 ADS1015 on one I2C bus running at 400 kHz. However, I am not able to reach the 3300 SPS, not even in continuous mode (I think 400 kHz is not enough speed, but I can not find documentation nor examples on the ESP32 high speed I2C mode. I tried at 1 MHz, which is the highest value accepted, but is actually performing slower than at 400 kHz). I was searching for an alternative ADC that does 4 differential conversions in parallel and next read 4 sample values in one go, but I can not find it. What would you suggest? My specs are: at least 3.3 kHz, at least 12 bits, 4 simultaneous differential ADC conversions, preferably one I2C bus at max 400 KHz. If needed I will change to the ESP32-S3 which has two I2C busses available. An example of how to use the ESP32 bus at 2.4 MHz together with 4 ADS1015s would also be very nice!. A better suited ADC would also be an option.

Best, Jeroen

  • Hi Jeroen D,

    Due to the holiday week here in the US, please expect a response during the week of January 2. Thanks for your patience

    -Bryan

  • Jeroen,

    However, I am not able to reach the 3300 SPS, not even in continuous mode (I think 400 kHz is not enough speed

    400kHz should be more than enough speed to read all four ADS1015-Q1 devices. The ADS1015 does also support high-speed mode if you need it but it should not be necessary. If you need help troubleshooting the I2C communication I will need to look at an oscilloscope or logic analyzer shot of the bad communications.

    The bigger problem with using this device is that the ADS1015-Q1 is not capable of simultaneous sampling. The closest you can get to simultaneous sampling with this ADC is to start their single-shot conversions close together, and this will be limited by how fast you can perform the necessary communications to start the conversion.

    We don't have an I2C device that will simultaneously sample four different channels, so would recommend using an SPI device. The ADS131B04-Q1 matches your description and also has an onboard oscillator like the ADS1015-Q1, so you would not need to provide a clock signal.

    Let me know if you have any more questions for me,

    Levi DeVries

  • Hi Levi, thank you for your response! Unfortunately the ESP32 does not seem to support high-speed mode, although I am not 100% sure. So assuming fast mode now.

    Looking at the ADS1015 datasheet at 7.6 Timing Requirements I indeed believe that in fast mode there is enough time to read four ADC's over one I2C bus. But in practice with the ESP32-S2 I need to select 500 kHz to read only TWO ADC's because 400 kHz is too slow (and at 700 kHz I get read errors, but that is another issue).

    Since the ESP32 core uses an interrupt in the core library I can not use the interrupt generated on the RDY signal to read the data. Instead I resume a FreeRTOS task from the interrupt to read the sample. That works fine again for two ADS1015 on one I2C at 3300 SPS but I can not get it going with three. Any suggestions on this would be very welcome!

    For simultaneous sampling my plan is now to use one RDY pin to generate an interrupt, resume the read task and read all four ADC's. Depending on the drift between the different ADC's I might miss a sample or doubly read a sample every now and then I expect, but I think this is less important for my use case.

    I am going to check the ADS131B04-Q1 datasheet. I hope it has an internal reference voltage too :). Do you expect the read out over SPI to be substantially faster?

    Best regards, Jeroen

  • Hi Jeroen,

    Looking at the ADS1015 datasheet at 7.6 Timing Requirements I indeed believe that in fast mode there is enough time to read four ADC's over one I2C bus. But in practice with the ESP32-S2 I need to select 500 kHz to read only TWO ADC's because 400 kHz is too slow (and at 700 kHz I get read errors, but that is another issue).

    Could you give me more details about the problems you are seeing here? If you are reading from four ADCs you should have 121 I2C clock cycles every sample (3.3kSPS) which means that each ADC is allotted 30.3 clocks to do a read. You should be able to do repeated reads of the same register in 27 bits (one address byte plus two result bytes) and still have 3 cycles to perform the start and stop. If your microcontroller is using 400kHz, I would expect it should be able to do at least 3 ADCs, but if you don't have a good control of the timing you might be operating too slow to read from 4. Make sure you aren't writing the address pointer register repeatedly as it will waste your clock cycles:

    There is a small section describing high-speed operation in this document you may find useful: https://www.ti.com/lit/an/sbaa565/sbaa565.pdf

    Also, keep in mind that the part is only supposed to operate up to 400kHz in fast mode, running beyond that may lead to communication errors.

    Since the ESP32 core uses an interrupt in the core library I can not use the interrupt generated on the RDY signal to read the data. Instead I resume a FreeRTOS task from the interrupt to read the sample. That works fine again for two ADS1015 on one I2C at 3300 SPS but I can not get it going with three. Any suggestions on this would be very welcome!

    I don't know much about the specific hardware/software setup you are quoting, but this is probably something on the microcontroller side that you are doing. If you have a logic analyzer or an oscilloscope it would be easy for you to check if the I2C communication and see if the output is wrong.

    For simultaneous sampling my plan is now to use one RDY pin to generate an interrupt, resume the read task and read all four ADC's. Depending on the drift between the different ADC's I might miss a sample or doubly read a sample every now and then I expect, but I think this is less important for my use case.

    This will work, but it really isn't "simultaneous" in any sense of the word since the samples could potentially be a full conversion (303 µS in your case) apart in the worst case scenario.

    I am going to check the ADS131B04-Q1 datasheet. I hope it has an internal reference voltage too :). Do you expect the read out over SPI to be substantially faster?

    Yes, the ADS131B04-Q1 has an internal reference voltage. SPI generally has a higher ceiling on the speeds it is rated for, and can operate at 25MHz on the ADS131B04-Q1.

  • Hi Levi, thank you very much for the comprehensive reply, this is very much appreciated! 

    I am using functions of the ESP32 HAL (Hardware Abstraction Layer). I time the micro seconds needed for reading one register (and that function does send the address pointer each time), and I time calling this function twice (one time for each ADS) for 3300 samples at 500 kHz. This takes 1015 ms or so. The 15 ms is for printing the results I think. When I do the same but this time reading 3 ADS it takes 2015 ms. So what I am almost sure at is: because 3 reads take too much time, I miss the RDY flag set by the interrupt and so I miss a full cycle, resulting in twice the expected time. The same happens when reading two ADS at 400 kHz

    What I am going to test next, thanks to all your advice, is to call the driver directly. This gives the opportunity to repeatedly only read the I2C bus without resending the address pointer. I am very curious about what this wlll show in durations.

    I think the root cause of my bad results is something in the stadard ESP core libraries. I found a forum thread somewhere on the internet reporting of an unnecessary wait for a FreeRTOS tick. This might also well be the cause of my problems. By using the low level driver functions I am hoping to avoid these issues.

    I have an oscilloscope but I am not very experienced in it. Also I am affraid that it will lead to the same conclusion: there is an unneeded wait. And then again I still need to find or avoid that wait...

    I am aware of the possibility of the samples being one full conversion apart. Is there a way to synchronize them? I am affraid there isn't. The best I can do is to start them as short after eachother as possible. But even then the ADS's will drift a little bit among eachother. Any ideas on how to snchronize the four ADS are very welcome!

    Since sampling 3 phases of power is a relatively general use case, maybe a ADC that does 3 samples in sync might be an idea for a new product for TI?

    I took a quick glance at the ADS131B04-Q1 datasheet. It has better specs then the ADS1015, but for now I first try to solve the timing for the ADS1015

  • Hello Jeroen,

    I think the root cause of my bad results is something in the stadard ESP core libraries. I found a forum thread somewhere on the internet reporting of an unnecessary wait for a FreeRTOS tick. This might also well be the cause of my problems. By using the low level driver functions I am hoping to avoid these issues.

    If you want to get this level of performance out of a microcontroller you will most likely have to familiarize yourself with the device's capabilities, in particular the peripherals, and write code that takes advantage of any hardware acceleration the microcontroller offers.

    I have an oscilloscope but I am not very experienced in it. Also I am affraid that it will lead to the same conclusion: there is an unneeded wait. And then again I still need to find or avoid that wait.

    This isn't necessary for what you are troubleshooting currently, but it is a useful debug tool that you will probably find useful before you are done. And it is a sure-fire way to check the output since all the communication must be present on the I2C lines out of necessity.

    Any ideas on how to snchronize the four ADS are very welcome!

    There really isn't a way with this device. There is no "sync" signal you can send to force all the devices to collect together.

    Since sampling 3 phases of power is a relatively general use case, maybe a ADC that does 3 samples in sync might be an idea for a new product for TI?

    We actually do offer multichannel devices like this- the ADS131B04 is a 4 channel-simultaneous sampling ADC and we offer similar 8 channel devices. We have devices with exactly 3 channels, but the 4-channel ADS131B04 is a better fit for your use case in my estimation.

    Let me know if you have any more questions,

    Levi DeVries

  • Hello Levi, thank you again :). Does TI offer any 4 differential channel simultaneous ADC's with the same specs for speed and resolution as before? Best regards, Jeroen

  • Jeroen,

    As stated in the datasheet, the ADS131B04 is a differential part with 4 simultaneous-sampling input channels.

    When searching through our catalog, you can filter by characteristics such as the input architecture as well as all the other characteristics you have mentioned before. Here is an example of a search through the catalog you may find useful: https://www.ti.com/data-converters/adc-circuit/precision-adcs/products.html#84=12%3B32&776=Differential&1028=3%3B16&3091=Simultaneous%20Sampling&157max=3.3%3B8000&sort=1130;asc&

    Let me know if anything is unclear,

    Levi DeVries

  • Hi Levi,

    Everything is clear now. I have made a test PCB with two ADS1015's on one I2C bus, at address 0x48 and 0x49. I receive those by the end of the week. I am going to focus on that first. Maybe, if still needed, I am going to investigate further the ADS131B04. Thank you very much again for all of your insights!

    Best regards, Jeroen