Armbian - Ubuntu (SOPINE) 3.10.105 [May 22] | Android 7.1 (PINE A64(+)) v0.3.5-r61 [May 15] | Android 7.1 (Pinebook) v0.3.5-r61 [May 15] | Q4OS (Pinebook) 1803 [May 15] | PINE64 Installer 2.0.0-beta.2 [May 13] | Ubuntu Mate (Pinebook) 20170505 [May 5]

Getting Started | Visit the WIKI | IRC Logs | Forum Rules/Policy


debian i2c-dev
#1
I'm new to this so please don't be too hard on me.

I'm setting up an ADS1115 and I have it connected. (nothing being measured yet)

On the pine, I when I run
sudo i2cdetect -y 1
I can see that the ADS1115 is showing up at spot 48

sudo i2cdetect -y 0
shows nothing connected, all "--"

These are my two separate busses, right?

I try to run the sample script
sudo simpletest.py
sample code that is part of the github example for the ADS1115 and it returns a runtime error -
"Could not determine default I2C bus for platform"

I'm lost at what to do to fix it.
I've tried changing the python script to look specifically at address=0x48 on busnum=1, but I get the same error.

On another note, I tried adding i2c-dev to /etc/modules so that it will load and I don't have root access and cannot determine the password - does anyone know what the root password is for debian mate on the pine from longsleep? i've tried debian, password, root and all sorts of things but can't get in to change that /etc/modules file.

Thanks for your help.
Reply
#2
As you already can see your device via i2cdetect the necessary module and device is already present. Otherwise i2cdetect wouldn't have found the necessart /dev/i2c-1 file and been able to communicate with it to find your device.

In fact if you go look with something like

ls -l /dev/i2c*

it should already show something like:

crw-rw---- 1 root i2c 89, 0 Dec 10 14:44 /dev/i2c-0
crw-rw---- 1 root i2c 89, 1 Dec 10 14:44 /dev/i2c-1

Your guess at there being two i2c-busses is correct. The i2c-1 buss is the one you find on the PI-2-bus connector pins 3 and 5, which is presumably where you connected your ADS1115.  Although the pin-out is similar to the one on the Raspberry Pi, the Pine does not have in-built pull-up resistors, but if your ADS1115 is on a breakout board such as the one that Adafruit sells, there will be pull-up resistors there, so communication will work, which is what you see here.

The other i2c buss, i2c-0, is connected to the socket labeled TP on the board, and it is meant to be used for the touchpad. It is not as easy to connect to, though there are some test pads on the bottom of the card underneath the Touchpad connector that could be accessed via fine-hand soldering. There are six of them there. Looking at the card from below, holding it so that the text («Designed in Silicon Valley, California....») is the right way (not upside down or sideways), the pads are towards the top right corner, in two rows of three, staggered.

    (GND)         (PH0/TWI0_SDA)    (PH11)
(VCC_CTP) (PH1/TWI0_SCL)    (PH4)

The middle ones thus are the SDA and SCL for the i2c-0 bus.

Back to your problem. Seeing as the kernel and hardware i2c subsystem is in order, (the i2cdetect -y 1 output indicates this), the problem could be in the python libraries used. They might contain knowledge if your device is a particular model of Raspberry Pi or some specific model of Beaglebone, but they probably don't know about the PineA64, hence they could not determine the default bus for platform, even though it would be the same (/dev/i2c-1) as Raspberry Pi has.

You don't say which github example this is, though googling returns the ones referring to the Adafruit board.  You might have to delve deeper into the library being used to find out more about the Python subsystems that use i2c.

As for the root password, since you already have sudo working (for the i2cdetect and others) you can get a root shell with
sudo su -

and while in that, you can set whatever password you like for root, with

passwd root
(then enter your new password, twice)
Reply
#3
The initial entry for the root password in /etc/shadow is *, meaning that there is no way to log-in as root initially, the only way to get a root login is to use sudo and set the password of root from that, as I showed.
Reply
#4
(12-16-2016, 05:19 AM)KnReLe Wrote: The initial entry for the root password in /etc/shadow is *, meaning that there is no way to log-in as root initially, the only way to get a root login is to use sudo and set the password of root from that, as I showed.

Ahh... So basic... I forgot to so the sudo and was just typing "su" to get into it.
Still new to the linux environment, thanks for the help.

(12-16-2016, 02:49 AM)KnReLe Wrote: As you already can see your device via i2cdetect the necessary module and device is already present. Otherwise i2cdetect wouldn't have found the necessart /dev/i2c-1 file and been able to communicate with it to find your device.

In fact if you go look with something like

ls -l /dev/i2c*

it should already show something like:

crw-rw---- 1 root i2c 89, 0 Dec 10 14:44 /dev/i2c-0
crw-rw---- 1 root i2c 89, 1 Dec 10 14:44 /dev/i2c-1

Your guess at there being two i2c-busses is correct. The i2c-1 buss is the one you find on the PI-2-bus connector pins 3 and 5, which is presumably where you connected your ADS1115.  Although the pin-out is similar to the one on the Raspberry Pi, the Pine does not have in-built pull-up resistors, but if your ADS1115 is on a breakout board such as the one that Adafruit sells, there will be pull-up resistors there, so communication will work, which is what you see here.

The other i2c buss, i2c-0, is connected to the socket labeled TP on the board, and it is meant to be used for the touchpad. It is not as easy to connect to, though there are some test pads on the bottom of the card underneath the Touchpad connector that could be accessed via fine-hand soldering. There are six of them there. Looking at the card from below, holding it so that the text («Designed in Silicon Valley, California....») is the right way (not upside down or sideways), the pads are towards the top right corner, in two rows of three, staggered.

    (GND)         (PH0/TWI0_SDA)    (PH11)
(VCC_CTP) (PH1/TWI0_SCL)    (PH4)

The middle ones thus are the SDA and SCL for the i2c-0 bus.

Back to your problem. Seeing as the kernel and hardware i2c subsystem is in order, (the i2cdetect -y 1 output indicates this), the problem could be in the python libraries used. They might contain knowledge if your device is a particular model of Raspberry Pi or some specific model of Beaglebone, but they probably don't know about the PineA64, hence they could not determine the default bus for platform, even though it would be the same (/dev/i2c-1) as Raspberry Pi has.

You don't say which github example this is, though googling returns the ones referring to the Adafruit board.  You might have to delve deeper into the library being used to find out more about the Python subsystems that use i2c.

As for the root password, since you already have sudo working (for the i2cdetect and others) you can get a root shell with
sudo su -

and while in that, you can set whatever password you like for root, with

passwd root
(then enter your new password, twice)

Thanks for explaining the other bus on the TP connection.

Yes - the ls -l /dev/i2c* output was exactly as you showed.

I used the Adafruit github like you guessed.
https://github.com/adafruit/Adafruit_Python_ADS1x15

Nothing special or out of the ordinary - just going from the pine to a t-cobbler to breadboard.

Pine Ground --> ADS1115 Ground
Pine 5v --> ADS1115 VCC
Pine SCL --> ADS1115 SCL
Pine SLA --> ADS1115 SLA

Jumper from ADS1115 Ground to ADS1115 Addr (tried without jumper, too, same result)

I also tried feeding an input of 3.3v back into the A0-A3 inputs on the ADS1115 board and it never got past the bus identification error.

I greatly appreciate the help you have given.

I'm going to do a cleanup of my Pi 2 and try it with that instead. I was just hoping to used the Pine instead.

For what it is worth the application is intended to be a standalone data logger for a machine output - It is very appealing for many reasons to have a device like this completely separate from the control system, aside from reading a voltage output.
Reply
#5
Hardware-wise you seem to be OK. The problem is with high-level software (the python library that talks to the /dev/i2c-1 device).

You might want to check out the RPi.GPIO-PineA64 library that was linked to by martinayotte on this thread;

http://forum.pine64.org/showthread.php?tid=2935

I haven't done that much with this myself, but the idea is to provide a similar utility library for the PineA64 as is seen on Raspberry Pi machines.
Reply
#6
(12-16-2016, 08:06 AM)KnReLe Wrote: Hardware-wise you seem to be OK. The problem is with high-level software (the python library that talks to the /dev/i2c-1 device).

You might want to check out the RPi.GPIO-PineA64 library that was linked to by martinayotte on this thread;

http://forum.pine64.org/showthread.php?tid=2935

I haven't done that much with this myself, but the idea is to provide a similar utility library for the PineA64 as is seen on Raspberry Pi machines.

Will do - I was just in the process of digging through the ADS1x15 python code to try to understand it a little better.

Thanks!

-Adam
Reply
#7
Big Grin 
(12-16-2016, 08:09 AM)pine.adam Wrote:
(12-16-2016, 08:06 AM)KnReLe Wrote: Hardware-wise you seem to be OK. The problem is with high-level software (the python library that talks to the /dev/i2c-1 device).

You might want to check out the RPi.GPIO-PineA64 library that was linked to by martinayotte on this thread;

http://forum.pine64.org/showthread.php?tid=2935

I haven't done that much with this myself, but the idea is to provide a similar utility library for the PineA64 as is seen on Raspberry Pi machines.

Will do - I was just in the process of digging through the ADS1x15 python code to try to understand it a little better.

Thanks!

-Adam

Was messing with the pine today and realized I didn't need the ADS1115. Used my arduino uno instead.
Successfully measuring 0-5v through the analog input and python code watching the the arduino output connected through the usb/serial.
Even better, writing to a .csv file 

had a 3.3v through a 10k ohm potentiometer watching the outputs change.

Had to leave some work for Monday - add 1min delay in voltage print loop, add date/time stamp, and write to a new line in the .csv instead of overwriting first line in every instance.
should be pretty simple. 

Happy to be doing this on the pine.

Thanks!
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Question Debian Jessie with 4.x.y kernel and complete hardware support? Spark 2 448 04-24-2017, 09:56 PM
Last Post: Spark
  Debian Jessie Images (3.10.102 BSP Kernel) New Release lenny.raposo-pine64.pro 257 66,308 04-12-2017, 10:54 AM
Last Post: dontpostalot
  Debian Mate (3.10.102 BSP) janeku 18 1,948 01-15-2017, 01:48 PM
Last Post: mcrognale
Music Getting analog audio/sound to work (headphones socket) on debian pfeerick 7 2,897 12-30-2016, 07:37 AM
Last Post: Birneklub9
  Gambas3 installation on Debian image linusky 0 364 11-29-2016, 11:10 AM
Last Post: linusky
  Debian Base (3.10.102 BSP 2) won't boot without monitor Scion 7 1,244 09-16-2016, 03:58 PM
Last Post: Scion
  Tor on debian philips 1 384 09-11-2016, 02:31 AM
Last Post: Ghelorn
  Debian and Prolific pl2303 Castle 3 753 08-21-2016, 03:16 AM
Last Post: Castle
Question RetroPie on Pine64 debian hunsoul 4 940 08-16-2016, 08:31 AM
Last Post: MarkHaysHarris777
  Debian do not remember my time setting. Wolfenstein 9 470 08-12-2016, 01:28 PM
Last Post: hpitcher

Forum Jump:


Users browsing this thread: 1 Guest(s)