How to Interface 4-20mA with Galileo board


#1

Hey I wanted to interface sensor with my new board Intel Galileo, with the help of pin diagram I am able to connect sensor(link) with the Galileo Board using I2C based 2 Wire current loop receiver
I have installed the main opkg git library.
Is there any library present for ADS1115(link)?
And before or after installing ADS1115 library do we have to install any other libraries to check the senor output??


#2

Hello @catchy85,

I will assume that you are using Arduino IDE provided by Intel, but could be fine if you can specify the OS or the framework that you are using. So, retrieve data from the ADS1115 could be quite easy using Arduino Wire.h and this library: Link

this library includes an example code, that shows how to retrieve data from each ADS port and how to read two differential voltages. So you should be able to work with this to read the STS ATM measures with this code:

#include "ADS1115.h"

ADS1115 adc0(ADS1115_DEFAULT_ADDRESS); 

float READ_VALUE;

void setup() {                
    Wire.begin();  // join I2C bus
    Serial.begin(19200); // initialize serial communication 
    Serial.println("Initializing I2C devices..."); 
    adc0.initialize(); // initialize ADS1115 16 bit A/D chip
    
    Serial.println("Testing device connections...");
    Serial.println(adc0.testConnection() ? "ADS1115 connection successful" : "ADS1115 connection failed");
      
    // To get output from this method, you'll need to turn on the 
    //#define ADS1115_SERIAL_DEBUG // in the ADS1115.h file
    adc0.showConfigRegister();
    
    // We're going to do continuous sampling
    adc0.setMode(ADS1115_MODE_CONTINUOUS);
}

void loop() {

    // Sensor is on P0/N1 (pins 4/5)
    adc0.setGain(ADS1115_PGA_1P024);
  
    int sensorOneCounts=adc0.getConversionP0N1();  // counts up to 16-bits  
    Serial.println(sensorOneCounts);

    // To turn the counts into a voltage, we can use
     READ_VALUE= sensorOneCounts*adc0.getMvPerCount();
      
   
}

Then, send the processed data to Thinger.io is easy, including the main Thinger.io client code lines, that you can find in our examples, and using an output resource in your setup function, like this:

Thing["pressure"]>>OutputResource(READ_VALUE);

hope it helps


#3

Hey will this link will run successfully and can please you tell how should i check the address of the I2C device connectivity with galileo board ?


#4

Hello @catchy85,

Yes, this code should works for you (if you are using arduino framework). The I2C address is defined by hardware. There is one ADR pin in the shield, that allows you to select between two different address:
0x48 (1001000) ADR -> GND
0x49 (1001001) ADR -> VDD


#5

Your info was very much helpful and one more thing i need to know is possible to make GUI for Galileo board using java or pyhton ?