CuriousScientist0 / ADS1256

An Arduino-compatible library for the ADS1256 24-bit analog-to-digital converter.
MIT License
26 stars 9 forks source link

ESP8266 and Hailege/Dollatek ADS1256 #9

Open moelfus opened 5 months ago

moelfus commented 5 months ago

Hi, first thanks for providing this library. Just in case someone else is struggeling with setting up and ADS with an ESP8266 or you want to slightly change your code to make it compatible with ESP8266. So, I'm currently working with an Wemos D1 mini ESP8266 board and connected one of those ADS1256 boards by Dollatek/Hailege/etc. The boards have no reset pin but it seems to be working with the following wiring:

ESP8266 ADS
D1 (GPIO5) PDWN
D8 (GPIO15) CS
D2 (GPIO4) DRDY
D6 (GPIO12) Dout
D7 (GPIO13) Din
D5 (GPIO14) SCLK

and changing the ESP line in your example to:

ADS1256 A(4, 5, 5, 15, 2.500); //DRDY, RESET, SYNC(PDWN), CS, VREF(float). //ESP8266

I'still don't know about the RESET pin, that is not present on the board. Furthermore I had to slightly alter line 18 in ADS1256.cpp from:

#if defined(ESP32) to #if defined(ESP32) || defined(ESP8266)

I tested the board with a (lab) waveform generator, and except the voltage level it seems to be working.
chart

CuriousScientist0 commented 5 months ago

Hi, Thanks for your contribution. I will add the ESP8266 module to the next update. I will buy the exact same board as you have and test it just to be sure that the next version I publish works fine.

Regarding reset and sync pins, I carefully discussed them in the datasheet I wrote for the library. Please check it. If your board does not have any of these pins, you need to enter 0 in the constructor instead of a legit pin number.

Regarding the voltage level, you might want to enable/disable the buffer and check for the groundings. Pay attention to the differential or single-ended modes, too!