Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1,124 Views

Programming ADS 1115 with Intel Edison Breakout Board

Hi,

I am trying to program ADS 1115 Analog to Digital Converter with Intel Edison Breakout Board. I made the connections like this:

ADS SCL - Edison SCL (J18-6 or J17-7)

ADS SDA - Edison SDA (J17-8 or J17-9)

and I am trying to measure 3.3V from A0.

It is working with Edison Arduino board and shows 3.3V in serial monitor but when I connect to Breaout Board, A0 pin shows -1 constantly. How can I solve this?

Here is the code:

# include

# include

Adafruit_ADS1115 ads(0x48);

float Voltage = 0.0;

void setup(void)

{

Serial.begin(9600);

ads.begin();

}

void loop(void)

{

int16_t adc0; // we read from the ADC, we have a sixteen bit integer as a result

adc0 = ads.readADC_SingleEnded(0);

Voltage = (adc0 * 0.1875)/1000;

Serial.print("AIN0: ");

Serial.print(adc0);

Serial.print("\tVoltage: ");

Serial.println(Voltage, 7);

Serial.println();

delay(1000);

}

Thanks in advance!

0 Kudos
4 Replies
Highlighted
Community Manager
22 Views

Hello GCay,

 

 

Thank you for your interest in the Intel® Edison Edison Breakout Board Kit.

 

 

The reason behind the different outputs can be explained through a couple of paragraphs from the available documentation, please check the following:

 

 

Intel® Edison Breakout Board – Hardware Guide ( https://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonbreakout_hg_331190006.pdf):

 

 

The Intel® Edison Breakout Board is designed to expose the native 1.8 V I/O of the Intel® Edison module.

 

 

Intel® Edison Kit for Arduino* - Hardware Guide ( http://download.intel.com/support/edison/sb/edisonarduino_hg_331191007.pdf):

 

 

The Intel® Edison kit for Arduino* 1.8 V I/O are translated to 3.3 or 5 V using SN74LVC1T45 dual supply bus transceivers with 3 state outputs.

 

 

So, what is happening is that in order to obtain the same outputs, you'll need to incorporate a level shifter to your system, you may also be interested in checking this community thread:

 

 

Intel Edison with BNO055 Adafruit Module via I²C

 

https://communities.intel.com/thread/110132 https://communities.intel.com/thread/110132

 

 

If you have any update or question, don't hesitate to contact us.

 

 

Have a nice day.

 

 

Regards,

 

Andres V.
0 Kudos
Highlighted
Beginner
22 Views

I am using this https://www.adafruit.com/product/757 https://www.adafruit.com/product/757 as level shifter but the result is same.

0 Kudos
Highlighted
Community Manager
22 Views

Hello GCay,

 

 

In order to gain a better understanding of the issue you are experiencing, could you please share an image of your setup? Please make sure that the different connections are clearly visible.

 

 

I'll be waiting for your response.

 

 

Have a nice day.

 

 

Regards,

 

Andres V.
0 Kudos
Highlighted
Beginner
22 Views

It has been solved in my second try. I think it might because of losing some connections.

Now, the problem is different. I am trying to program Edison with MRAA library. I downloaded Adafruit ADS1x15 library for Python from here:https://github.com/adafruit/Adafruit_Python_ADS1x15 GitHub - adafruit/Adafruit_Python_ADS1x15: Python code to use the ADS1015 and ADS1115 analog to digital converters with … and install in Edison. But when I run it, it gives me this error.

[b]root@gozdewbl:~# python ads1115.py

Traceback (most recent call last):

File "ads1115.py", line 7, in

adc = Adafruit_ADS1x15.ADS1115()

File "/usr/lib/python2.7/site-packages/Adafruit_ADS1x15-1.0.2-py2.7.egg/Adafruit_ADS1x15/ADS1x15.py", line 319, in __init__

super(ADS1115, self).__init__(*args, **kwargs)

File "/usr/lib/python2.7/site-packages/Adafruit_ADS1x15-1.0.2-py2.7.egg/Adafruit_ADS1x15/ADS1x15.py", line 82, in __init__

self._device = i2c.get_i2c_device(address, **kwargs)

File "/usr/lib/python2.7/site-packages/Adafruit_GPIO/I2C.py", line 63, in get_i2c_device

busnum = get_default_bus()

File "/usr/lib/python2.7/site-packages/Adafruit_GPIO/I2C.py", line 55, in get_default_bus

raise RuntimeError('Could not determine default I2C bus for platform.')

RuntimeError: Could not determine default I2C bus for platform.[/b]

This is my code:

import Adafruit_ADS1x15

import mraa

import time

import numpy

led = mraa.Gpio(20)

adc = Adafruit_ADS1x15.ADS1115()

GAIN = 1

value = led.read()

adc0 = adc.read_adc(0, gain=GAIN)

voltage = (adc0 * 0.1875)/1000

while True:

led.write(1)

print "led: ", value

print "voltage: ", voltage

time.sleep(0.50)

led.write(0)

print "led: ", value

print "voltage: ", voltage

time.sleep(0.5)

0 Kudos