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
  Debian installer on Pine A64+ but no hdmi mrwick 1 5,893 07-28-2020, 01:49 PM
Last Post: kuleszdl
  Debian Pine64 h264/5 Video under vlc ozcy 6 14,114 04-15-2020, 05:27 AM
Last Post: dmitrymyadzelets
  OMV/debian/systemd: how to start the network kittyland 0 3,267 12-10-2019, 05:29 PM
Last Post: kittyland
  Debian 10 (Buster) in deep freeze - includes support for Pine64+ amp 5 11,229 07-22-2019, 09:29 PM
Last Post: amp
  Pine64 Debian Stretch/mainline [4.14.7] CallMeFoxie 50 130,791 07-22-2019, 09:24 PM
Last Post: amp
  Installing Debian with the Debian Installer (Buster RC1) amp 1 5,214 06-28-2019, 12:35 PM
Last Post: Kaarme42
  Script to build pure Debian images for Pine64+ amp 1 4,664 05-01-2019, 09:09 PM
Last Post: tllim
  Debian (Stretch) for Pine64-LTS wgray 2 6,998 04-04-2019, 09:54 PM
Last Post: wgray
  Is there just one fuctioning Debian Desktop image? KNERD 7 14,481 03-29-2019, 02:00 AM
Last Post: desai_amogh
  (ARCHIVED) Debian Jessie Images (3.10.102 BSP Kernel) New Release lenny.raposo-pine64.pro 259 509,047 05-21-2018, 06:30 AM
Last Post: Luke

Forum Jump:


Users browsing this thread: 1 Guest(s)