bonsoir Le lundi 25 juillet 2022 à 08:39:04 UTC+2, subboti...@gmail.com a écrit :
> Hi! When connected to the Arduino Uno via spi, the readings of the ADS1220 > sensor from the CJMCU are read correctly. When connecting the sensor to the > d5..d8 wemos d1 mini (using pinout), there is no connection with the sensor > (or the sensor fails). I am using d0 as drdy. I use power from a USB > computer for wemos. The sensor is connected by five wires d5...d8 and d0. I > ask for help to provide a fragment of the wemos d1 mini v3.0.0 spi setup > and a connection diagram. > > Here's my sketch. The sensor works correctly only with arduino uno. When > working with the wemos d1 mini board, it constantly restarts, and the > sensor is not initialized. I use only five wires to connect the controller > and the sensor. I think that the problem is in the settings of the SPI > interface, since the pin numbers of Uno and Wemos do not match. Please help > me figure out how to configure the Wemos d1 mini SPI interface. > > ************************************************************************** > > > */#include <ADS1220_WE.h>#include <SPI.h>**/* * > UNO Wemos d1 mini > #define SPI_CLK D13 14 > #define SPI_MISO D12 12 > #define SPI_MOSI D11 13 > */ > // for Wemos d1 mini > #define ADS1220_CS_PIN D8 // 15 chip select pin > #define ADS1220_DRDY_PIN D0 // 16 data ready pin > > // for UNO > //#define ADS1220_CS_PIN 7 // chip select pin > //#define ADS1220_DRDY_PIN 6 // data ready pin > > /* Create your ADS1220 object > > */ADS1220_WE ads = ADS1220_WE(ADS1220_CS_PIN, ADS1220_DRDY_PIN);* > > void setup(){ > > Serial.begin(115200); > pinMode(ADS1220_CS_PIN, OUTPUT); //On the ESP8266 in normal SPI mode we > need to decide on SS and set it to output. > digitalWrite(ADS1220_CS_PIN, HIGH); //deselect SPI device > SPI.begin(); > SPI.setClockDivider(SPI_CLOCK_DIV128); > Serial.print("ADS1220_CS_PIN - "); Serial.println(ADS1220_CS_PIN); > Serial.print("ADS1220_DRDY_PIN - "); Serial.println(ADS1220_DRDY_PIN); > Serial.print("D5 - "); Serial.println(D5); > Serial.print("D6 - "); Serial.println(D6); > Serial.print("D7 - "); Serial.println(D7); > delay(1000); > if(!ads.init()){ > Serial.println("ADS1220 is not connected!"); > while(1); > } > } > > void loop(){ > float result = 0.0; > ads.setCompareChannels(ADS1220_MUX_0_1); > delay(100); > result = ads.getVoltage_mV(); > delay(200); > Serial.print("AIN0 vs. AIN1 [mV]: "); > Serial.println(result); > delay(600); > } > > > -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/9da439ad-51bf-4b7f-93b5-ffc54f37afb4n%40googlegroups.com.