QuestionsCategory: General QuestionHow to connect an ADC4-20ma to an ESP8266?
Richard Willian Correa asked 2 months ago

Hi, I’m trying to connect an ADC4-20ma in an ESP8266 nodeMCU. I’m using the library Nanoshield.h, but I didn’t get any answer from the shield. I connected pin SDA (from ADC4-20ma) to pin 4 (ESP8266) and pin SCL (from ADC4-20ma) to pin 5 (ESP8266), according to the data sheet. I don’t know if it is necessary to put pull-up resistors between communication pins. I’m using 5Vcc to supply ADC4-20ma.
The code I’m using is showing below:
#include <Wire.h>
#include <Nanoshield_ADC.h>
Nanoshield_ADC adc(0x48);
int channel1 = 0;
int channel2 = 1;
int channel3 = 2;
int channel4 = 3;

void setup()
{
  Serial.begin(9600);
  Serial.print(“16-bit ADC Nanoshield Test – Read 4-20mA sensor (channel A”);
 
  Serial.println(“)”); 
  adc.begin();
  Wire.begin(4,5);
  // Adjust gain to two (2.048V range) to get maximum resolution for 4-20mA range
  adc.setGain(GAIN_TWO);
}
void loop()
{
  Serial.print(“TEMPERATURA “);
  Serial.print(adc.read4to20mA(channel1), 6);
  Serial.print(“°C”);
  Serial.print(“\t”);
  Serial.print(“FLUXO “); 
  Serial.print(adc.read4to20mA(channel2), 6);
  Serial.print(“l/h”);
  Serial.print(“\t”);
  Serial.print(“NÍVEL “);  
  Serial.print(adc.read4to20mA(channel3), 6);
  Serial.print(“%”);
  Serial.print(“\t”);
  Serial.print(“pH “); 
  Serial.print(adc.read4to20mA(channel4), 6);
  Serial.println();
 
  delay(1000);
}
When I used the same code with an Arduino UNO (without the line “Wire.begin(4,5)) it worked perfectly, because for Arduino que have specific pins to connect this shield.
Could you help me on this topic?
Thank you!

Captcha loading...

Your Answer

16 + 2 =