I want to connect an ADS1115 and do some data acquisition. I already have such a system under Arch linux on an HP Neoware e90 (also called CA21 for some reason) but I need to use serial port emulation over USB over I2C which is a pain. The R-Pi should cut all that out. My current software is in Java but I could switch to C.
Anyone else wanting to use I2C devices?
Andrew
-
- Posts: 1
- Joined: Thu Feb 23, 2012 6:32 pm
-
- Posts: 239
- Joined: Thu Jan 12, 2012 5:45 pm
Re: I2C bus - anyone planning to use it?
I can imagine hanging all sorts of things on the I2C bus, all manner of sensors and so on. Not least a RTC chip.
I think there's a need for an I2C patch board, with the I2C bus, 3V3 to 5V level shifters on the bus and breadboard areas that can take different ICs or breakout boards.
And maybe a serial port.
The trick may be to avoid putting too much on.
Chris
I think there's a need for an I2C patch board, with the I2C bus, 3V3 to 5V level shifters on the bus and breadboard areas that can take different ICs or breakout boards.
And maybe a serial port.
The trick may be to avoid putting too much on.
Chris
Re: I2C bus - anyone planning to use it?
Definitely.
Don't think you'll really need level conversion for I2C, it's open-collector. Most devices will run fine on 3V3, and even if they are 5V devices, they should still operate properly with 3V3 pull-ups.
If you just want I2C on your PC though, using i2c-tiny-usb is a good solution. Couple bucks in parts if you have an AVR programmer already (or want to build one), and there's a driver in mainline. http://www.harbaum.org/till/i2.....ndex.shtml
Don't think you'll really need level conversion for I2C, it's open-collector. Most devices will run fine on 3V3, and even if they are 5V devices, they should still operate properly with 3V3 pull-ups.
If you just want I2C on your PC though, using i2c-tiny-usb is a good solution. Couple bucks in parts if you have an AVR programmer already (or want to build one), and there's a driver in mainline. http://www.harbaum.org/till/i2.....ndex.shtml
Re: I2C bus - anyone planning to use it?
I2C level conversion is really easy: http://ics.nxp.com/support/doc.....n97055.pdf
Re: I2C bus - anyone planning to use it?
mistertransistor said:
Anyone else wanting to use I2C devices?
Andrew
Oh, yes. Sparkfun (and others, I"m sure) have some nice, small accelerometers, electronic gyros and other sensor modules for sale (big in the Arduino arena) that talk via I2C that I"d just *love* to interface with a Pi.
I really must research what drivers may already be out there for such devices first, but I"m ARMed (heh, heh) with a couple of Linux driver development books and ain"t afraid to get my hands dirty!
Anyone else wanting to use I2C devices?
Andrew
Oh, yes. Sparkfun (and others, I"m sure) have some nice, small accelerometers, electronic gyros and other sensor modules for sale (big in the Arduino arena) that talk via I2C that I"d just *love* to interface with a Pi.
I really must research what drivers may already be out there for such devices first, but I"m ARMed (heh, heh) with a couple of Linux driver development books and ain"t afraid to get my hands dirty!
Re: I2C bus - anyone planning to use it?
Definately, it will be the first thing I will be getting working.
I use I2C for 24x4 LCD displays, DS1307 RTC, temerature sensor IC's and I/O expanders currently all connected to an Arduino for Home automation.
Also at work I2C is the main communication between many IC's on the system boards and the method of the boads talking to PSU's and Back Planes etc in the high end servers I work on.
Due to the limited IO currently on the PI I will probably still be using a Arduino connected to the PI instead of a PC as is currently the case but moving the I2C to the PI to cut out some of the inter board comms. Looking forward to making a nice HA Desktop/TV gui and a server for my android app on my PI.
I use I2C for 24x4 LCD displays, DS1307 RTC, temerature sensor IC's and I/O expanders currently all connected to an Arduino for Home automation.
Also at work I2C is the main communication between many IC's on the system boards and the method of the boads talking to PSU's and Back Planes etc in the high end servers I work on.
Due to the limited IO currently on the PI I will probably still be using a Arduino connected to the PI instead of a PC as is currently the case but moving the I2C to the PI to cut out some of the inter board comms. Looking forward to making a nice HA Desktop/TV gui and a server for my android app on my PI.
Re: I2C bus - anyone planning to use it?
mistertransistor said:
I want to connect an ADS1115 and do some data acquisition. I already have such a system under Arch linux on an HP Neoware e90 (also called CA21 for some reason) but I need to use serial port emulation over USB over I2C which is a pain. The R-Pi should cut all that out. My current software is in Java but I could switch to C.
Anyone else wanting to use I2C devices?
Andrew
Can I ask what libraries (if any) you used to communicate with I2C from Java?
I want to connect an ADS1115 and do some data acquisition. I already have such a system under Arch linux on an HP Neoware e90 (also called CA21 for some reason) but I need to use serial port emulation over USB over I2C which is a pain. The R-Pi should cut all that out. My current software is in Java but I could switch to C.
Anyone else wanting to use I2C devices?
Andrew
Can I ask what libraries (if any) you used to communicate with I2C from Java?
Re: I2C bus - anyone planning to use it?
Simon H said:
Definately, it will be the first thing I will be getting working.
I use I2C for 24x4 LCD displays, DS1307 RTC, temerature sensor IC"s and I/O expanders currently all connected to an Arduino for Home automation.
Also at work I2C is the main communication between many IC"s on the system boards and the method of the boads talking to PSU"s and Back Planes etc in the high end servers I work on.
Due to the limited IO currently on the PI I will probably still be using a Arduino connected to the PI instead of a PC as is currently the case but moving the I2C to the PI to cut out some of the inter board comms. Looking forward to making a nice HA Desktop/TV gui and a server for my android app on my PI.
Really need an Arduino Shield adaptor for R-Pi
Definately, it will be the first thing I will be getting working.
I use I2C for 24x4 LCD displays, DS1307 RTC, temerature sensor IC"s and I/O expanders currently all connected to an Arduino for Home automation.
Also at work I2C is the main communication between many IC"s on the system boards and the method of the boads talking to PSU"s and Back Planes etc in the high end servers I work on.
Due to the limited IO currently on the PI I will probably still be using a Arduino connected to the PI instead of a PC as is currently the case but moving the I2C to the PI to cut out some of the inter board comms. Looking forward to making a nice HA Desktop/TV gui and a server for my android app on my PI.
Really need an Arduino Shield adaptor for R-Pi
Re: I2C bus - anyone planning to use it?
I plan on using i2c, i think the only 5v device i will be using is a battery backed rtc. Gotta make sure its voltage is above vbatt or it keeps running off of vbatt.
Recently bought the barometer and light sensors from adafruit for hooking up to raspberry pi actually.
Edit: i reread the datasheets for DS3231 and DS3232 not sure why i thought i had to run them at higher than vbatt. As long as vcc is above 2.73 it will run off vcc instead of vbatt.
Recently bought the barometer and light sensors from adafruit for hooking up to raspberry pi actually.
Edit: i reread the datasheets for DS3231 and DS3232 not sure why i thought i had to run them at higher than vbatt. As long as vcc is above 2.73 it will run off vcc instead of vbatt.
Re: I2C bus - anyone planning to use it?
Chris Rowland said:
I can imagine hanging all sorts of things on the I2C bus, all manner of sensors and so on. Not least a RTC chip.
I think there's a need for an I2C patch board, with the I2C bus, 3V3 to 5V level shifters on the bus and breadboard areas that can take different ICs or breakout boards.
And maybe a serial port.
The trick may be to avoid putting too much on.
Chris
I plan to use the RPi's (as I see it's abriviated to ) I2C interface, and I too have been looking for a way to interface I2C directly. I see there are some suggestions to use USB-serial adapters and microcontrolers, as intermediaries, but for my part, this is out of the question.
There is a short example/tutorial on programming the GPIO in C, and would think the procedure for I2C would be similar. There may be some info in the datasheet for the CPU, I will read it when I get home.
The RPi's low power, high performance, small footprint, and Linux and I2C support, makes this THE ideal candidate for my project.
I can imagine hanging all sorts of things on the I2C bus, all manner of sensors and so on. Not least a RTC chip.
I think there's a need for an I2C patch board, with the I2C bus, 3V3 to 5V level shifters on the bus and breadboard areas that can take different ICs or breakout boards.
And maybe a serial port.
The trick may be to avoid putting too much on.
Chris
I plan to use the RPi's (as I see it's abriviated to ) I2C interface, and I too have been looking for a way to interface I2C directly. I see there are some suggestions to use USB-serial adapters and microcontrolers, as intermediaries, but for my part, this is out of the question.
There is a short example/tutorial on programming the GPIO in C, and would think the procedure for I2C would be similar. There may be some info in the datasheet for the CPU, I will read it when I get home.
The RPi's low power, high performance, small footprint, and Linux and I2C support, makes this THE ideal candidate for my project.
Re: I2C bus - anyone planning to use it?
There is a short example/tutorial on programming the GPIO in C, and would think the procedure for I2C would be similar. There may be some info in the datasheet for the CPU, I will read it when I get home.
Here it is!
Re: I2C bus - anyone planning to use it?
johankj said:
There is a short example/tutorial on programming the GPIO in C, and would think the procedure for I2C would be similar. There may be some info in the datasheet for the CPU, I will read it when I get home.
Here it is!
The link doesn't work..
There is a short example/tutorial on programming the GPIO in C, and would think the procedure for I2C would be similar. There may be some info in the datasheet for the CPU, I will read it when I get home.
Here it is!
The link doesn't work..
Re: I2C bus - anyone planning to use it?
Maybe these can be helpful:
linux/Documentation/i2c/dev-interface
linux/Documentation/i2c/instantiating-devices
Naturally, a library could make things easier.
linux/Documentation/i2c/dev-interface
linux/Documentation/i2c/instantiating-devices
Naturally, a library could make things easier.
Re: I2C bus - anyone planning to use it?
@epam, Thanks for the links, I have come across the C interface to I2C/SMBus through my own research.
I'm curious if anyone has any plans to use Java to communicate to I2C devices. As far as I can tell, there are no Java -> I2C libraries available. (I've found some that are for "bare metal" Java - which isn't compatible with Java for Linux).
If anyone else is looking for this functionality would you be interested in collaborating to create a JNI wrapper around the C methods? It'd be my first time developing JNI - but the C interface doesn't look very complicated so I'd like to think it's a fairly manageable project.
I'd love to hear some input on Java -> I2C.
Simon
I'm curious if anyone has any plans to use Java to communicate to I2C devices. As far as I can tell, there are no Java -> I2C libraries available. (I've found some that are for "bare metal" Java - which isn't compatible with Java for Linux).
If anyone else is looking for this functionality would you be interested in collaborating to create a JNI wrapper around the C methods? It'd be my first time developing JNI - but the C interface doesn't look very complicated so I'd like to think it's a fairly manageable project.
I'd love to hear some input on Java -> I2C.
Simon
Re: I2C bus - anyone planning to use it?
johankj said:
Database Error
Error establishing a database connection
Sorry, here it is:
Database Error
Error establishing a database connection
Sorry, here it is:
Re: I2C bus - anyone planning to use it?
Well Johankj, in the link you have mentioned it reads:
The Foundation will not include an I2C driver in the initial release, we hope the community might provide one, standard linux I2C drivers should work with minimal modification.
There is a possibility that initially i2c is not fully operational but be patient. The main issue for you would be to open the i2c device and call ioctl from JNI, which probably cannot be done. However, you could create a wrapper to a complete C library, like i2c-tools, and not just to the particular functions.
Unfortunately, you have a C, C++ and Assembly fan here so good luck!
The Foundation will not include an I2C driver in the initial release, we hope the community might provide one, standard linux I2C drivers should work with minimal modification.
There is a possibility that initially i2c is not fully operational but be patient. The main issue for you would be to open the i2c device and call ioctl from JNI, which probably cannot be done. However, you could create a wrapper to a complete C library, like i2c-tools, and not just to the particular functions.
Unfortunately, you have a C, C++ and Assembly fan here so good luck!
Re: I2C bus - anyone planning to use it?
epam said:
Well Johankj, in the link you have mentioned it reads:
The Foundation will not include an I2C driver in the initial release, we hope the community might provide one, standard linux I2C drivers should work with minimal modification.
There is a possibility that initially i2c is not fully operational but be patient. The main issue for you would be to open the i2c device and call ioctl from JNI, which probably cannot be done. However, you could create a wrapper to a complete C library, like i2c-tools, and not just to the particular functions.
Unfortunately, you have a C, C++ and Assembly fan here so good luck!
So, to get I2C working, I see two options:
Interface directly with the chip, see page 28-37 here.
modify existing Linux drivers so that they are compatible with this particular chip.
I'll be doing one of the above, probably 1., as I have no experience in writing Linux drivers.
I won't be using java (I don't speak java), probably just C, so I won't be able to help with those you use java.
Well Johankj, in the link you have mentioned it reads:
The Foundation will not include an I2C driver in the initial release, we hope the community might provide one, standard linux I2C drivers should work with minimal modification.
There is a possibility that initially i2c is not fully operational but be patient. The main issue for you would be to open the i2c device and call ioctl from JNI, which probably cannot be done. However, you could create a wrapper to a complete C library, like i2c-tools, and not just to the particular functions.
Unfortunately, you have a C, C++ and Assembly fan here so good luck!
So, to get I2C working, I see two options:
Interface directly with the chip, see page 28-37 here.
modify existing Linux drivers so that they are compatible with this particular chip.
I'll be doing one of the above, probably 1., as I have no experience in writing Linux drivers.
I won't be using java (I don't speak java), probably just C, so I won't be able to help with those you use java.
Re: I2C bus - anyone planning to use it?
Is there anyone already working on developing a driver for the Broadcom BSC? I'm looking into morphing an existing i2c driver into one to support the BSC and while it doesn't look like an onerous task, but I'd hate to spend time on redundant work.
If I am the only one looking at this now and since I don't have an RPi to test with yet, is there anyone out there who's in a position to test a new I2C driver in the near term?
If I am the only one looking at this now and since I don't have an RPi to test with yet, is there anyone out there who's in a position to test a new I2C driver in the near term?
Re: I2C bus - anyone planning to use it?
I'm not aware of anyone developing a driver at this point. I hope to write a Java interface to the driver when one becomes available.
I'd be willing to help however I can with the driver development - even if it's just testing it.
I'd be willing to help however I can with the driver development - even if it's just testing it.
Re: I2C bus - anyone planning to use it?
RAThomas said:
Is there anyone already working on developing a driver for the Broadcom BSC? I'm looking into morphing an existing i2c driver into one to support the BSC and while it doesn't look like an onerous task, but I'd hate to spend time on redundant work.
If I am the only one looking at this now and since I don't have an RPi to test with yet, is there anyone out there who's in a position to test a new I2C driver in the near term?
Someone else posted here http://www.raspberrypi.org/for.....io/#p52803 that he was going to write a driver, but I don't see anything else about his progress.
I have a Pi and would be willing to test anything you have - just thought I'd do a search first before I started looking at writing one myself !
Is there anyone already working on developing a driver for the Broadcom BSC? I'm looking into morphing an existing i2c driver into one to support the BSC and while it doesn't look like an onerous task, but I'd hate to spend time on redundant work.
If I am the only one looking at this now and since I don't have an RPi to test with yet, is there anyone out there who's in a position to test a new I2C driver in the near term?
Someone else posted here http://www.raspberrypi.org/for.....io/#p52803 that he was going to write a driver, but I don't see anything else about his progress.
I have a Pi and would be willing to test anything you have - just thought I'd do a search first before I started looking at writing one myself !
Re: I2C bus - anyone planning to use it?
selsinork said:
RAThomas said:
Is there anyone already working on developing a driver for the Broadcom BSC? I'm looking into morphing an existing i2c driver into one to support the BSC and while it doesn't look like an onerous task, but I'd hate to spend time on redundant work.
If I am the only one looking at this now and since I don't have an RPi to test with yet, is there anyone out there who's in a position to test a new I2C driver in the near term?
Someone else posted here http://www.raspberrypi.org/for.....io/#p52803 that he was going to write a driver, but I don't see anything else about his progress.
I have a Pi and would be willing to test anything you have - just thought I'd do a search first before I started looking at writing one myself !
I am the "he" in the above text.
You cannot interface with a host adapter driver from Java. It is impossible, because only a I²C client device driver inside the kernel can do that.
That you can do is to create to create a generic JNI[1] Linux UIO I²C client device driver. The UIO device driver will use system calls to speak with the "i2c-dev" I²C client device driver in kernel space. The i2c-dev client device driver does not directly speak with the hardware. The host adapter driver is responsible for that, because it know how to do I²C communication with the real I²C hardware.
[1]: http://java.sun.com/docs/books/jni/
- looks like to be a download-for-free book, knowledge of the C programming language is required to create JNI interfaces.
RAThomas said:
Is there anyone already working on developing a driver for the Broadcom BSC? I'm looking into morphing an existing i2c driver into one to support the BSC and while it doesn't look like an onerous task, but I'd hate to spend time on redundant work.
If I am the only one looking at this now and since I don't have an RPi to test with yet, is there anyone out there who's in a position to test a new I2C driver in the near term?
Someone else posted here http://www.raspberrypi.org/for.....io/#p52803 that he was going to write a driver, but I don't see anything else about his progress.
I have a Pi and would be willing to test anything you have - just thought I'd do a search first before I started looking at writing one myself !
I am the "he" in the above text.
You cannot interface with a host adapter driver from Java. It is impossible, because only a I²C client device driver inside the kernel can do that.
That you can do is to create to create a generic JNI[1] Linux UIO I²C client device driver. The UIO device driver will use system calls to speak with the "i2c-dev" I²C client device driver in kernel space. The i2c-dev client device driver does not directly speak with the hardware. The host adapter driver is responsible for that, because it know how to do I²C communication with the real I²C hardware.
[1]: http://java.sun.com/docs/books/jni/
- looks like to be a download-for-free book, knowledge of the C programming language is required to create JNI interfaces.
Re: I2C bus - anyone planning to use it?
I plan to use most of the facilities on the GPIO, I2C especially. Getting a good driver going for this would be great, I'd support that effort however I could. My C is pretty rusty, but I would be willing to help out where I could.
Not, however, a big fan of Java.
Cheers,
Will
Not, however, a big fan of Java.
Cheers,
Will
Re: I2C bus - anyone planning to use it?
Hi,
I haven't found i2c examples for java (maybe my fault), so I started to play with it.
It works with the Raspian Wheezy kernel driver, tested with Adafruit 16 channel pwm/servo driver (based on PCA9685).
Java files:
http://simonp.uw.hu/linuxi2c/linuxi2c_java_v0_1.zip
Setup the i2c driver:
http://www.skpang.co.uk/blog/archives/575
Install the proper jna package on raspberry and use the jna.jar, jna-platform.jar libs for the java app from /usr/share/java folder:
apt-get install libjna-java
Peter
I haven't found i2c examples for java (maybe my fault), so I started to play with it.
It works with the Raspian Wheezy kernel driver, tested with Adafruit 16 channel pwm/servo driver (based on PCA9685).
Java files:
http://simonp.uw.hu/linuxi2c/linuxi2c_java_v0_1.zip
Setup the i2c driver:
http://www.skpang.co.uk/blog/archives/575
Install the proper jna package on raspberry and use the jna.jar, jna-platform.jar libs for the java app from /usr/share/java folder:
apt-get install libjna-java
Peter
Re: I2C bus - anyone planning to use it?
Thank you Peter! People have been looking for a Linux I2C Java binding for years and your code is the first publicly available binding, nice!rotok wrote: It works with the Raspian Wheezy kernel driver, tested with Adafruit 16 channel pwm/servo driver (based on PCA9685).
Java files:
http://simonp.uw.hu/linuxi2c/linuxi2c_java_v0_1.zip
Setup the i2c driver:
http://www.skpang.co.uk/blog/archives/575
Install the proper jna package on raspberry and use the jna.jar, jna-platform.jar libs for the java app from /usr/share/java folder:
apt-get install libjna-java
Peter
http://www.raspberrypi.org/phpBB3/viewt ... p?p=171691 - I2C with Java?
http://www.raspberrypi.org/phpBB3/viewt ... p?p=178646 - PI4J possibly a good project to host your I2C Java binding.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
twitter.com/xranby
- savageautomate
- Posts: 230
- Joined: Thu Aug 16, 2012 3:20 pm
- Location: USA
Re: I2C bus - anyone planning to use it?
I would love to have I2C Java interface in the Pi4J project. @rotok, please contact me if you would like to join the project and commit. It may be nice to avoid the JNA dependency if possible and move whatever logic is necessary into the existing JNI layer. Pi4J already includes a native library with JNI wrappers around WiringPi.
There is a direct WiringPi wrapper class for SPI here:
https://github.com/Pi4J/pi4j/blob/maste ... i/Spi.java
I was hoping to create a "Javafied" wrapper around this ... just have not had the time to do so yet.
There is a direct WiringPi wrapper class for SPI here:
https://github.com/Pi4J/pi4j/blob/maste ... i/Spi.java
I was hoping to create a "Javafied" wrapper around this ... just have not had the time to do so yet.
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com