Hello!
When connected to the Arduino Uno via spi, the readings from the ADS1220 sensor from CJMCU are read correctly. When connecting the sensor to the d5..d8 wemos mini (by pinout), the sensor fails. I use d0 as drdy. I ask for a fragment of the spi setup of the wemos d1 mini v3.0.0 board and the connection diagram. And I connect the sensor and the wemos mini directly, is that correct? no resistors needed?
One 3.3V power supply to wemos and to the sensor, nothing else is connected. Suppose that I connected/programmed the pins incorrectly. But how can a five - volt sensor fail after connecting to a 3.3 Volt board ?
I guess the sensor doesn't fail but the Wemos Mini does. But that depends largely on the wiring you used. As you failed to provide a wiring diagram we cannot help you. Also provide a link to the breakout board you use (this is a surface mountable device so you most probably don't use it directly)!
That depends on the breakout board you use and how you wired it.
That's a wide voltage range sensor (2.3V to 5.5V) so it's not a 5V sensor. Depending on the used circuit this might make sense but as I wrote: you failed to provide the information.
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.
/***************************************************************************
- Example sketch for the ADS1220_WE library
- This sketch shows how to change channels and get data. The sketch uses the
- the default settings, e.g. the internal voltage reference. This limits the
- maximum voltage that can be measured to 2.048 volts.
- Further information can be found soon on:
- https://wolles-elektronikkiste.de/ (German)
- Wolles Elektronikkiste • Die wunderbare Welt der Elektronik (English)
**************************************************************************/
#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);
/ Alternatively you can also pass the SPI object as reference */
// ADS1220_WE ads = ADS1220_WE(ADS1220_CS_PIN, ADS1220_DRDY_PIN, &SPI);
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_DIV8);// works ok with the UNO but using a conservative slower speed.
SPI.setClockDivider(SPI_CLOCK_DIV128); //experiments indicate SPI.setClockDivider(SPI_CLOCK_DIV8) works
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);
}
Where exactly?
Can't find an ADS1220 in the index either.
Note that an ESP8266 is 3.3volt-logic, and an Uno is 5volt-logic.
You can't just switch to a different processor without making sure the sensor matches logic levels.
Leo..
Thanks. According to the specification, the ads1220 power supply range is from 2.3 to 5.5 V. I think the problem is in the connections and spi settings
Still no wiring diagram! Remember if you connect the sensor wrongly you may damage the D1 Mini.
So you have a bare ADS1220 chip, not mounted on a module with supporting parts?
Leo..
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.