ADS1256 - Custom Arduino Library

Поделиться
HTML-код
  • Опубликовано: 17 июл 2022
  • Check out PCBWay's website for rapid prototyping of printed circuit boards, CNC and 3D printing services and many more! www.pcbway.com/setinvite.aspx...
    In this video, I show you my custom Arduino library for the ADS1256 24-bit 8-channel ADC. I developed this library from scratch and I made it compatible with different ADS1256 boards and different Arduino-compatible microcontrollers. I also wrote an extremely detailed documentation of the library, so please read it.
    Visit my website for all the resources regarding this library:
    curiousscientist.tech/ads1256...
    Support me on Patreon!
    / curiousscientist
    If you want to support my work, please consider buying the parts using my affiliate links:
    curiousscientist.tech/tools
  • НаукаНаука

Комментарии • 93

  • @matthiasvink6810
    @matthiasvink6810 Год назад +4

    What a tremendous amount of work put in! but thank you so much you deserve more credit sir

    • @CuriousScientist
      @CuriousScientist  Год назад

      Thank you! More will come in the future!

    • @matthiasvink6810
      @matthiasvink6810 Год назад

      @@CuriousScientist Does your library work with the arduino due?

    • @CuriousScientist
      @CuriousScientist  Год назад

      It should work with any Arduino-compatible MCU. But I haven't specifically tested it with the Due. The tested devices are listed in the documentation.

  • @StevePotter
    @StevePotter Год назад +1

    This is a great resource, the video summary of your detailed PDF, and of course, the code library! Can you please comment on the importance of a stable 5V power supply to get reproducible numbers from the ADC? It seems that Vref is just produced by dividing that in half within the ADS1256 chip, true? Or is there some sort of voltage regulator in the chip or on the board that will make a ~5.2V supply into exactly 5V? Or one that supplies exactly 2.5V?

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi, and thanks!
      I suggest you read the datasheet of the REF5025 voltage reference. There are also a lot of resources on my PCBWay project page.
      You're wrong about VREF. The VREF has its own separate circuit that consists of a voltage reference (REF5025) and an op-amp (OPA350), wired as a voltage follower, plus a few capacitors.

  • @franciscogaray2129
    @franciscogaray2129 Год назад

    Good evening: a query if it were measuring 8 analog signals at a rate of 1000 samples per second in 24 bits, in theory it would have a speed of 192000 bits per second, assuming that it sent the raw information without channel separation. I understand that native USB can do this without problems, but I understand that the ATmega32U MCU only reaches 1MIPS, if I wanted to sample at a higher speed with 8 channels I would be limited to sampling each channel at 3750SPS, is his correct?

    • @CuriousScientist
      @CuriousScientist  Год назад +1

      Hi! You actually don't even need to go "that far away" with the data transfer. What I mean is that at the end, the governing factor for the speed will be the ADS1256 when using multiple channels and using multiplexing. Due to the time required by changing inputs (syncing, settling...etc.) the max speed you would reach with multiplexing is 4374 Hz. Also, the microcontroller I use supports full speed USB (12 Mbps).

  • @7alfatech860
    @7alfatech860 2 года назад +1

    Hi, great video. You mentioned that we can purchase the completed project from you; could you please tell us how?

    • @CuriousScientist
      @CuriousScientist  2 года назад +1

      Hi, thank you very much! Just drop me an email via my website and we will discuss the rest. ;)

  • @kylewilliamoreilly1639
    @kylewilliamoreilly1639 Год назад

    Hello, thank you for this fantastic library! I sent you a small donation =]
    It took me awhile to get it working (b/c I'm a noob) but now it seems to be good. I do have a question about gains though. I currently have the system set up to a wheatstone bridge strain gauge, which I am reading with a differential measurement. I am adjusting the gain amplifier, but it doesn't appear to be doing anything at surface level. For example: I read in 0.001V, with a gain of 1. However, when I change the gain to 16 it still returns 0.001V, when I would expect 0.016V.
    Is this how it is supposed to work? Am I missing something?
    Again, thank you for making this library, all of the other ones had errors I couldn't work through, but this one is great!

    • @CuriousScientist
      @CuriousScientist  Год назад +1

      Hi and thanks!
      That's not how the gain works in this case. It seems that you haven't read the datasheet or my carefully written documentation. It is literally in the beginning, in equation (2). You always divide the LSB with the actual PGA setting. So, the voltage stays constant as you change the PGA, it just becomes more "accurate" towards the lower voltages. Which actually makes sense because despite the fact that you change the gain, the voltage source that you measure doesn't change. Imagine measuring a 1.00020 V source, and you accidentally switch to x16 gain....

  • @muhammadhabibalkhairi7946
    @muhammadhabibalkhairi7946 Год назад

    Hi, thank you for your work, is it okay if I use unsigned long variable to store A.readSingle() return value? Thank you.

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi!
      It seems that you haven't read the handbook that I wrote for the library. You can see the return type of the readSingle() function at page 27 and decide if you can store it as an unsigned long. ;)
      Also, you can just try it...

    • @muhammadhabibalkhairi7946
      @muhammadhabibalkhairi7946 Год назад

      ​@@CuriousScientist Thank you for your answer. I'll stick to the long variable.
      I've tried the code on the Arduino Mega and it runs perfectly. I also tried your example code in ESP32 Wrover B, and I could make it work in readSingle mode.
      But it only gives me 15K SPS when I measure it. If I use readSingleContinue in your code by sending the 'G' character, the code sticks, not showing anything.
      I noticed that it stuck when I ran the stopConversion function. And I tried to change the stop conversion function like this:
      void ADS1256::stopConversion() {
      Serial.println("Pass 1"); SPI.beginTransaction(SPISettings(1920000, MSBFIRST, SPI_MODE1));
      Serial.println("Pass 2");
      digitalWrite(_CS_pin, HIGH);
      Serial.println("Pass 3");
      SPI.endTransaction();
      Serial.println("Pass 4");
      _isAcquisitionRunning = false;
      Serial.println("Pass 5");
      }
      And after I ran the code, it only showed Pass 1 in the serial monitor. Can you tell me how to solve this problem? Thank you.

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi!
      I cannot really comment on the ESP32 part, because I did not really use the library with that kind of MCU. It could be that you are using the wrong pin for the chip select (CS) and you cannot toggle the pin properly. Check the other functions of the pin, maybe they are used by the MCU for some other purposes.
      Also, based on the code you copied here, you missed the most important part, the line that sends the SDATAC command to the ADS1256... It won't work if you don't send any commands.
      I suspect that you don't have the optimal connections. It is hard to say anything without seeing the circuit and the environment.

    • @muhammadhabibalkhairi7946
      @muhammadhabibalkhairi7946 Год назад +1

      @@CuriousScientist Thank you for your fast response, I delete the line: SPI.beginTransaction(SPISettings(1920000, MSBFIRST, SPI_MODE1));, and it works now, I don't know if it is a problem if Idelete the line.

  • @abraaoreis
    @abraaoreis 9 месяцев назад +1

    Thank you very much for the videos! Could you make a video testing with the ESP32? I couldn't make it work. I used the standard SPI pins of the esp32 (MOSI 23, MISO 19, CLK 18, CS 5), pin 4 for DRDY and pin 14 for PDWN. My board doesn't have a reset. I changed the code for these pins, but it doesn't work as it should.

    • @CuriousScientist
      @CuriousScientist  9 месяцев назад

      Hi! Yes, I can make a video on the requested topic, if you sponsor it. I would need to buy the mentioned microcontroller, then I would need to invest a lot of time into editing the code, recording and editing the video and so on. But if you are willing to compensate for it, I will make it of course.

    • @abraaoreis
      @abraaoreis 9 месяцев назад

      @@CuriousScientist
      I would really like to sponsor you, but I am a poor Brazilian student. I'll keep trying to understand why it doesn't work. If I manage to make it work, I will publish a video tutorial, giving you all credit for the library. Thanks!

    • @CuriousScientist
      @CuriousScientist  9 месяцев назад +1

      @@abraaoreisNo worries, and I hope you can understand that I cannot just spend my money and time on this.
      Also, if you figure things out, let me know and then I can add those details to the handbook and update my library accordingly.

  • @magalybaylon214
    @magalybaylon214 Год назад

    Hi, excuse me. I have 5v input o A0 adc channel, but the program only reads 3.5v, does it have a voltage restriction that I have to change? or what is the command to change to 5 voltage reference, because I wanna read to 0 - 5 voltage range

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi! You cannot change the voltage reference, it is a physical part of the board and not a software feature...
      Read the documentation carefully. Based on your question, you haven't done that. The program only reads 3.5 V and no more because you have the input buffer enabled. Disable it.

    • @magalybaylon214
      @magalybaylon214 Год назад

      @@CuriousScientist Thank you for your respons! could yo help me how to disable the buffer?

    • @CuriousScientist
      @CuriousScientist  Год назад

      @@magalybaylon214 It is written in the documentation how to do it, read it. I wrote a very detailed documentation and made it available publicly.

  • @theodoreburns1330
    @theodoreburns1330 Год назад

    Thank you so much for putting this together! I read through your very well written document. I'm just a little confused: what is Vref in this context?

    • @CuriousScientist
      @CuriousScientist  Год назад

      It is the value of the reference voltage.

    • @theodoreburns1330
      @theodoreburns1330 Год назад +1

      Thank you for the quick reply! I’m mainly trying to figure out where to measure or control that voltage.
      I’m using a similar board to what you have used in your “ADS1256 - Full demonstration” video. Is this fixed to 2.5v in that breakout board?

    • @CuriousScientist
      @CuriousScientist  Год назад +1

      Uhh, that's my oldest ads1256 video. Don't rely on that, use this video and resources as a reference.
      That board has a test point with a text written next to it VREF. It cannot be more obvious than that. It is right under U2 which is the VREF chip (ADR431BRZ).

    • @theodoreburns1330
      @theodoreburns1330 Год назад +1

      Excellent, thank you!

  • @russellchung1794
    @russellchung1794 Год назад

    Thank you very much for your effort on optimizing this ADs1256 library, a job well done! I tried the library on the Cortex M4 (grand Central from Adafruit) but I got strange results. Since the reset line are tied high on the Ebay type blue ADS1256 module, so that was not accessable in this case, would that change how your code would work ? I can get reading but the PGA number returns something strange on power-up, and also some of the test command will not work for me. Also, I have to fake a return integer on GPIO-read function for the library to compile with the M4, if someone runs into similar issue. Thank you for your feedback.

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi! Just to make it clear, this video is not about optimizing a library. I wrote the whole library from scratch based on a very long journey I've been spending with this ADC.
      Regarding your question. It is very clearly explained in the 4.1 section in the handbook I wrote for the library. Read it! ;)

    • @russellchung1794
      @russellchung1794 Год назад

      @@CuriousScientist Sorry, I don't mean that way, I mean the entire effort on this project, and lately for speed improvement. Thank you for the quick response and I will read 4.1 as noted. Thank you again!

    • @CuriousScientist
      @CuriousScientist  Год назад

      No worries, I did not take it as an offense or anything like that. I just wanted to clarify so that if someone else reads it, they will see my point as well.
      Have fun reading the documentation! I hope it will answer all your questions, I put a lot of work into it.

  • @takhvaaininaim7625
    @takhvaaininaim7625 Год назад +2

    hi, thank you very much for making this video. It really helps a lot for my project.
    I already tried the library and the code to run on esp32 board but when i tried case B
    in the serial monitor, the SPS doesn't appear. Any suggestions? Have you tried it on esp32?

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi! It can be many things. The code definitely works with esp32. Do the other functions work? Do you have the right wire connections?

    • @abraaoreis
      @abraaoreis 9 месяцев назад

      @@CuriousScientist I had the same problem. The other functions don't work well either. The speed test function (case B) does not crash when commenting the A.stopConversion(); line, but I was unable to identify what exactly is happening.

    • @CuriousScientist
      @CuriousScientist  9 месяцев назад +1

      As you can see, it works very well with my board, so the issue is probably not the library I wrote. I tested it with Arduino Uno/Nano, different STM32 microcontrollers, Teensy 4.0, and I built my own board based on the ATmega32U4 microcontroller. All behaved well without hiccups.
      I dug up an ESP32-WROOM-32 board (the 38 pin version). The code indeed breaks when you call the speed test function. There is something in the ESP32's SPI code that does not like my library.
      Based on your remark regarding the stopConversion() function, I checked the library. If you remove the "SPI.beginTransaction()..." (line 80, or so) from the stopConversion() function, it seems that everything works properly again. For some reason, the speed I get is the double of the SPS value I set on the register and I do not know why. Also, as an extra safety step, you can add a line that waits for the high DRDY pin. You can copy that line from one of the other functions in the library.
      Oh, by the way, I really hope that you used a logic level shifter between the ESP32 board and the ADS1256 board. The ESP32 is 3.3 V compatible, and the ADS1256 is a 5 V compatible board and it is not a good practice to feed the ESP32's pins with 5 V signals.

    • @abraaoreis
      @abraaoreis 9 месяцев назад +1

      @@CuriousScientist Thank you very much for the tips. I will implement the suggested improvements in the code, and test different SPI speeds to see if it works. I went to check the datasheet, and the ADS1256 voltage level on the IO ports was 3.3V. Then the logic level converter will not be necessary. Thank you very much again, and I'll let you know when it's working.

    • @abraaoreis
      @abraaoreis 9 месяцев назад

      @@CuriousScientist I think I figured out why the stopConversion function was failing. Researching the ESP32 SPI, I saw that the ESP32 has four SPi buses, however as of right now only two of them are available to use, HSPI and VSPI. Simply using the SPI API as illustrated in Arduino examples will use VSPI, leaving HSPI unused. However if we simply intialise two instance of the SPI class for both of these buses both can be used. Commenting the SPI.beginTransaction() line, the function worked again. However, I am also having problems with the SPS measurement. When I discover the problem I will let you know.

  • @annaoaulinovna
    @annaoaulinovna 2 года назад +1

    ads1256 and ads1262 are awesome adc chips but their analog switch inside makes some noise and slow down. a company must make a parallel high precision wide input range adc modules in one chip as this awesome adc. i loved this video

    • @CuriousScientist
      @CuriousScientist  2 года назад +1

      Thank you! While browsing Aliexpress for different AD converters some time ago, I found the ADS131E08 which is an 8 channel, simultaneous AD converter. It might have better characteristics than the ADS1256. Since it is quite expensive, I haven't yet looked at it in more detail but once I get a bit better budget, I will buy one of those circuits. It looks interesting and it might worth to develop a library for it as well.

  • @CarmeloFiorello
    @CarmeloFiorello 2 года назад

    Hello, how can I support you? Where is the link of your patreon?

    • @CuriousScientist
      @CuriousScientist  2 года назад

      Hi! It is on the webpage in the description of the video. Also, you can find it on the main page of my RUclips channel at the top right corner. Thank you!

  • @matthiasvink6810
    @matthiasvink6810 Год назад

    Did anyone use this with Teensy 3.5? The registervalues MUX PGA etc just return 0 for me, I hooked up Drdy, Pdown,CS,MOSI and MISO to pin 8-12 and I dont know what I did wrong

    • @CuriousScientist
      @CuriousScientist  Год назад

      Have you followed all instructions written in the documentation? It works with Teensy 4.0, so it should also work with 3.5 without issues.

    • @matthiasvink6810
      @matthiasvink6810 Год назад +1

      @@CuriousScientist I dit get it to work, yay! thanks again for your library and your help

    • @CuriousScientist
      @CuriousScientist  Год назад

      Great news! I hope you'll have fun using the library. Cheers!

  • @abraaoreis
    @abraaoreis 8 месяцев назад

    Dear friend, I think I discovered the acquisition rate problem in ESP32. After the DRDY pin goes low, acquisition begins and 3 bytes are transferred. The issue is that DRDY does not immediately return to a high level, on the oscilloscope I noticed that it takes about 2 us. The issue is that the ESP32 checks that the pin is at a low logic level and tries to read another sample, getting completely lost.
    I will try to improve the code by placing the acquisition called through a falling interrupt on the DRDY pin, which I believe will fix this problem.

    • @CuriousScientist
      @CuriousScientist  8 месяцев назад +1

      Hi! Thanks for the follow-up! I will check this. It is interesting, however, that the ESP32 is sensitive to this while the other microcontrollers work just fine. I will need to spend some time with the library to see how to make it work with all the microcontrollers (how to add ESP32 without destroying the compatibility with those microcontrollers that already work well).

  • @abhilashnaragund3307
    @abhilashnaragund3307 Год назад

    Greetings of the day CuriousScientist! I am happy to follow your ADS1256 playlist since I began with my Master's project. Now I am in the phase of software development for InAmp>ADS1256>ESP8266. Your videos will be very much helpful in understanding overall concept. However may I request you to let me know the resources/tutorials you had referred before creating your own library so that it will be helpful for my work ? Also could you please let me know which online schematic design tool should I use before soldering my modules (Strain gauge > InAmp > ADS1256 > Adafruit Feather HUZZAH ESP8266) ?

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi! I followed the datasheet of the ADS1256. The reason why I wrote my own library is because there was not really anything to follow. There are a few codes here and there but honestly, they are garbage. No explanation or anything provided for them. To connect those modules you mentioned doesn't really require a design tool. Read their datasheet, then pen and paper is enough. It doesn't require a circuit design tool, you are just wiring together modules if I understand correctly.
      Also, don't forget to cite my work in your project if you use any of my resources.

    • @abhilashnaragund3307
      @abhilashnaragund3307 Год назад

      @@CuriousScientist Regarding your custom library, following are the errors: \ADS1256.cpp: In member function 'int ADS1256::readGPIO(int)': ADS1256.cpp:389:1: error: control reaches end of non-void function [-Werror=return-type]. Accordingly I am trying to add return 0 statement and got succeeded in compiling..However I am afraid if something is wrong still because I am unable to test a, T,G,B commands successfully. I am testing without ADC connected to my MCU..Will it work in that case? My question might be silly but it's cruicial period for me to do test on this code..Thanks in advance!

    • @CuriousScientist
      @CuriousScientist  Год назад

      @@abhilashnaragund3307 If you modify the library, then it is your own responsibility to maintain its integrity. It sounds like you are trying to modify the library itself. I tested the code and called the readGPIO() function and it compiles and works just fine for me. The code should compile without the ADC, but it will not work without it.

    • @abhilashnaragund3307
      @abhilashnaragund3307 Год назад

      @@CuriousScientist Hello Curious Scientist, thanks for your quick response. I am not trying to modify your library instead I am connecting ESP8266 and accordingly adjusting SPI pins.. I mentioned the error I got while running your .ino file without changing any functions defined in .cpp file: ADS1256.cpp:388:1: error: control reaches end of non-void function. While debugging this error, I just added "return 0" at the end of readGPIO() function in .cpp and getting compiled successfully. Were you also testing .ino code which worked fine for you right?

  • @zereftss
    @zereftss Год назад

    Hi sir, thanks for your effort making the library. I tried the library on UNO but the PGA MUX DRATE shows different number from the code (It shows all 255) that make the acqusition gone wrong. I’m sure the pins are on correct order. Thanks for your feedback sir.

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi! If you get 255 as a response, it is almost certain that your connections are wrong.

    • @zereftss
      @zereftss Год назад +1

      @@CuriousScientist Yes, I already checked it and it was total wrong. It was fixed already and it shows correct value. Can I ask when we press 'a' command on serial monitor, it shows the single-ended value right? Is it works on any channel (A0 to A7) or we have to determine which channel to read? I put a potentiometer, when I input 'a' command and it didn't show a value, but when I input 'C' command to read all channel it shows there.

    • @CuriousScientist
      @CuriousScientist  Год назад

      If you don't use the cycling function, you have to switch to the channel of interest manually by sending the correct value to the MUX register. Read the datasheet I wrote for the library, everything is carefully explained in it with a lot of examples.

    • @zereftss
      @zereftss Год назад

      @@CuriousScientist Thank you so much sir!!!

  • @humbertosalazar7435
    @humbertosalazar7435 Год назад

    Hi Sir , excuse me , is the web page working ?

  • @humbertosalazar7435
    @humbertosalazar7435 Год назад

    excúseme what is the connection diagram for arduino?

    • @CuriousScientist
      @CuriousScientist  Год назад

      Hi! It uses the standard SPI pins, plus the pins that you define as you want (sync, pdwn, drdy). There's no diagram needed.

    • @humbertosalazar7435
      @humbertosalazar7435 Год назад

      @@CuriousScientist Sir for example if i want to use the library in arduino nano , i just need to connect pins by this code line :
      ADS1256 A(8, 10, 5, 9, 2.500); //DRDY, RESET, SYNC(PDWN), CS, VREF(float). and conect MISO and MOSI pins , or i need to declare something else , thank you so much

    • @CuriousScientist
      @CuriousScientist  Год назад

      @@humbertosalazar7435 No, it is wrong. DRDY is OK as pin 8, but SYNC cannot be pin 10 as pin 10 is the default chip select SPI pin on the Arduino Nano.
      ADS1256 A(7, 8, 9, 10, 2.500); would be better. Then MISO and MOSI go to the corresponding pins on ADS1256 DOUT and DIN.

  • @Cptnbond
    @Cptnbond 2 года назад +2

    You are lucky if you can get hold of any, e.g., Mouser has parts order but expected delivery is one year from now. Thus much time to test and debug your library. Sad that the supply chain is so stressed out because of China and their zero covid policies. Cheers.

    • @CuriousScientist
      @CuriousScientist  2 года назад +1

      I accumulated quite some parts in the recent months to be able to build multiple of my custom PCB if needed. Hopefully, it was a good investment, time will tell. The only part where I had/have issues is the OPA350 that I use as a buffer for the voltage reference. But one can buy those from Aliexpress or replace it with an alternative OP-AMP. However, buying an off-the-shelf ADS1256 circuit should not be a problem. I can find them everywhere on Aliexpress for quite a reasonable price. The library works with those boards too because I made it compatible for basically any ADS1256 + Arduino MCU combination. Cheers!

  • @ximena5544
    @ximena5544 Год назад

    Excuse me, Why don't you use the SPI library and it's settings, SPISettings, SPITransaction(), and others?

    • @CuriousScientist
      @CuriousScientist  Год назад

      What do you mean? It is used but "under the hood".

    • @ximena5544
      @ximena5544 Год назад

      @@CuriousScientistYou didn't use the SPI.begin(). What do you mean by "under the hood"?

    • @CuriousScientist
      @CuriousScientist  Год назад +1

      Everything is inside the library files.

    • @ximena5544
      @ximena5544 Год назад +1

      @@CuriousScientist Oh I see, I wasn't very clear about it and I got confused. Thank you very much for your work and excellent dedication.

    • @CuriousScientist
      @CuriousScientist  Год назад +1

      No worries! I hope you'll find the library useful. Don't forget to read the documentation on my website, too. 😉

  • @abraaoreis
    @abraaoreis 9 месяцев назад

    I tested on ESP32 WROOM and ESP32 WROVER. It didn't work on any of the cards.

    • @CuriousScientist
      @CuriousScientist  9 месяцев назад

      It should work with any larger Arduino-compatible microcontroller without issues. I can not see what could hinder it.

  • @ravirao5798
    @ravirao5798 7 месяцев назад

    Hi, Tutorial is awesome. How to Measure Analog Input Of 5 Volts using This Module. Thanks In Advance. Ravi

    • @CuriousScientist
      @CuriousScientist  7 месяцев назад

      Hi! You connect the voltage source to the input and measure it.

  • @abraaoreis
    @abraaoreis 8 месяцев назад

    Dear friend, hello again. I believe I managed to fix the library to work perfectly on the ESP32. I made two changes. I will describe each of them below.
    1 - I modified the stopConversion() function, removing the SPI.beginTransaction call (as you suggested).
    2 - In the readSingleContinuous() function, I added another while, waiting for the DRDY state to change from high to low level.

    • @abraaoreis
      @abraaoreis 8 месяцев назад +1

      The stopConversion() function looked like this:
      void ADS1256::stopConversion() //Sending SDATAC to stop the continuous conversion
      {
      // SPI.beginTransaction(SPISettings(1920000, MSBFIRST, SPI_MODE1));
      SPI.transfer(B00001111); //Send SDATAC to the ADC
      digitalWrite(_CS_pin, HIGH); //We finished the command sequence, so we switch it back to HIGH
      SPI.endTransaction();

      _isAcquisitionRunning = false; //Reset to false, so the MCU will be able to start a new conversion
      }
      Removing line 80 (SPI.beginTransaction(SPISettings(1920000, MSBFIRST, SPI_MODE1));) does not interfere with the code, since in the readSingleContinuous() function on line 490 the SPI.beginTransaction function is called, and as long as you do not stop acquiring SPI communication will remain active. When opening a second instance of SPI.beginTransaction on the ESP32 it initializes the other SPI2 bus (HSPI), and loses communication with SPI1 (VSPI).

    • @abraaoreis
      @abraaoreis 8 месяцев назад +1

      The readSingleContinuous() function looked like this:
      long ADS1256::readSingleContinuous() //Reads the recently selected input channel using RDATAC
      {

      if(_isAcquisitionRunning == false)
      {
      _isAcquisitionRunning = true;
      SPI.beginTransaction(SPISettings(1920000, MSBFIRST, SPI_MODE1));
      digitalWrite(_CS_pin, LOW); //REF: P34: "CS must stay low during the entire command sequence"
      while (digitalRead(_DRDY_pin)) {}
      SPI.transfer(B00000011); //Issue RDATAC (0000 0011)
      delayMicroseconds(7); //Wait t6 time (~6.51 us) REF: P34, FIG:30.

      }
      else
      {
      while (!digitalRead(_DRDY_pin)) {}
      while (digitalRead(_DRDY_pin)) {}
      }


      _outputBuffer[0] = SPI.transfer(0); // MSB
      _outputBuffer[1] = SPI.transfer(0); // Mid-byte
      _outputBuffer[2] = SPI.transfer(0); // LSB

      _outputValue = ((long)_outputBuffer[0]

    • @abraaoreis
      @abraaoreis 8 месяцев назад +1

      I tested the readSingleContinuous() function at all acquisition rates (30KSPS, 15KSPS, 7.5KSPS, 3.75KSPS, 2KSPS, 1KSPS, 500SPS, 100SPS, 60SPS, 50SPS, 30SPS, 25SPS, 15SPS, 10SPS, 5SPS and 2SPS ), and it worked very well.
      I intend to test it on another microcontroller, I will try to borrow an Arduino, but I believe it will work on all microcontrollers compatible with Arduino.

    • @abraaoreis
      @abraaoreis 8 месяцев назад +1

      As a curiosity, I'm doing a job where I need to make acquisitions at 30KSPS for 10 seconds, for this reason I'm using the ESP32 WROVER, which has 4MB of PSRAM, which makes it possible for me to make acquisitions and store the values for up to 34 seconds by saving in the float format, or 46 seconds saving the read bytes.
      The ESP32 S3 can have up to 8Mb of PSRAM, making it possible to double the capacity mentioned above.
      After acquisitions I save the data on the SD card.
      Here's a tip that can be used in any of your projects in the future.
      Thank you my friend!

    • @abraaoreis
      @abraaoreis 8 месяцев назад +1

      And please forgive my English mistakes. My native language is Portuguese.