LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile
User Name
Password
Linux - Mobile This forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Sailfish OS, Replicant, Ubuntu Touch, webOS, and other similar projects and products.

Notices


Reply
  Search this Thread
Old 10-26-2021, 08:39 PM   #1
sidtupper
LQ Newbie
 
Registered: Oct 2021
Posts: 3

Rep: Reputation: Disabled
I2C through USB port on an Android phone?


How can I get data from an I2C sensor through an android phone USB port? I see that mobile Linuxes have I2C support and USB to I2C adapters exist but I haven’t found a method described for putting those together.
 
Old 10-27-2021, 12:28 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by sid@sidtupper.ca View Post
I haven’t found a method described for putting those together.
What exactly did you search for, what did you find, have you tried anything?
What is installed on the Android phone? Which version? Which device?
FWIW - and without further information - my guess is that it's largely up to Android to allow this sort of access through a USB port.
Have you looked into & dissected existing projects that achieve something similar?

BTW, if this is your email address, you might not want to make it public in this way. The whole internet can see this. Ask a mod to change your username.
 
Old 10-27-2021, 01:31 AM   #3
sidtupper
LQ Newbie
 
Registered: Oct 2021
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the suggestion to ask to have my name changed. Done.

I’m thinking about displaying CO2 sensor data and I’m looking into connecting a i2c sensor to a smartphone which would read it and write the data in large font on the screen. I haven’t got the phone yet. Since I posted my question, I’ve been doing more reading. Android Studio seems like a path to explore. It has a device emulator which includes a Samsung Galaxy Nexus image, and I can find that phone cheaply. It’s max Android 4.3.0. The Nexus USB port supports host mode so I’m looking for an Android package to write to and read the data port, connected to a usb to i2c adapter. This is my first foray into phones.

I’ve put a few hours into looking for a similar project but haven’t made the right search query yet I guess. It seems like a not uncommon application. Thanks for your response, and for any further ideas you might have.
 
Old 10-27-2021, 10:43 AM   #4
enigma9o7
Senior Member
 
Registered: Jul 2018
Location: Silicon Valley
Distribution: Bodhi Linux
Posts: 1,389

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
Depending on how tech savy you are, you might be able to get something like https://www.mcc-us.com/ (iport) to work. I'm imagining connecting a usb hub (or some other adapter) to get a "USB A" port, then yer physically connected. Supposedly driver is in linux 2.6 kernel. But their software is closed source so I guess you can't easily just recompile in termux or something.

If all you're doing is polling i2c and reporting a value on a screen, I think you'd be better off using raspberry pi than a mobile phone. I'm not experienced with this but pretty sure it has some gpio's or something you can use for i2c without an adapter and people already written working open source software... and im sure theres some kinda like LCD screens if you dont wanan use a whole monitor...
 
Old 10-28-2021, 12:04 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Oh, I assumed you want to read one of the phone's i2c sensors from your main computer.

Do you need the phone's GUI & touchscreen to see the values & give input? If not, you might be able to install some sort of simple CLI-only Linux distribution on it.

Older Android devices and older Android versions are less locked down and more hackable.

But even so, it sounds like a daunting task to hack around the Android OS to get this working; on an R-pi running a proper GNU/Linux distro you would not have this problem at all.
 
Old 10-28-2021, 12:42 AM   #6
sidtupper
LQ Newbie
 
Registered: Oct 2021
Posts: 3

Original Poster
Rep: Reputation: Disabled
Yes, that’s what first occurred to me, RPi + sensor + LCD, but I’ve done that a few times already. I have a $10 Nexus tablet + usb-i2c adapter + sensor and a sense of adventure. The plan is to learn how to make an android app and have it write to and read the USB port, and write to the screen.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ipxe smbus i2c driver i2c-i801.c toma642 Linux - Hardware 0 01-08-2019 07:45 PM
i2c-dev.h missing i2c read/write functions dbrazeau Programming 1 12-17-2015 10:40 PM
How to forward IOCTL's from i2c-dev.c to adapter driver (i2c-rt3352.c) elonica.pl Linux - Kernel 2 08-23-2011 02:03 AM
[SOLVED] No /dev/i2c-0 entry after insmod i2c-dev sajnanazeer Linux - Newbie 1 08-10-2011 07:39 AM
Help! Problems with i2c-dev. No more /dev/i2c-* em1l Fedora 0 10-28-2005 05:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile

All times are GMT -5. The time now is 07:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration