Hooking up I2C sensors is something which is generally associated with microcontrollers and SBCs, yet it’s very easy to use such I2C sensors from basically any system that runs Linux. After all, I2C (that is, SMBus) is one of the interfaces that is highly likely to be used on your PC’s mainboard as well as peripherals. This means that running our own devices like the well-known BME280 temperature, pressure and humidity sensor, or Si1145 light sensor should be a piece of cake.
In a blog post from a few years ago, [Peter Molnar] explains in detail how to wire up a physical adapter to add a USB-connected I2C interface to a system. At its core is the ATtiny85 AVR-based MCU, which provides a built-in USB interface, running the I2C-Tiny-USB firmware.
The essential part here is that the MCU shows up to the Linux kernel as an i2c device, requiring the i2c-dev
driver to be loaded. After this the I2C device that is connected to the adapter MCU’s I2C bus can be used via the Linux module’s API calls, either directly or via existing drivers. [Peter] found that the BMP280 driver came with Debian Sid, for example.
On most non-Apple *Nix computers, you can also use the i2c lines in the VGA, DVI or HDMI plug, which normally are used by the system to either read a ROM chip in the monitor that contains compatible resolutions and refresh rates, or for bi-directional communication between monitor and computer.
Though a few gpu drivers were clunky at permitting that though, but that’s not so relevant nowadays.
You can also program chips through a VGA port!
https://nitter.net/magnetic_tape/status/1333911626534236162
https://github.com/ghent360/RTD-2660-Programmer
ive used the i2c port on the raspberry pi to expand the io capabilities and add analog sticks via a tiny85. linux makes these things stupid easy. on windows you can spend all day downloading sdks and stll cant get it to work.
> At its core is the ATtiny85 AVR-based MCU, which provides a built-in USB interface
The T85 does not have a built in USB interface.
> came with Debian Sid
Which Sid? Sid was Sid decades ago and Sid is Sid now.
>> At its core is the ATtiny85 AVR-based MCU, which provides a built-in USB interface
> The T85 does not have a built in USB interface.
Correct, it was done in software here.
>> came with Debian Sid
> Which Sid? Sid was Sid decades ago and Sid is Sid now.
Correct, the author maybe wanted to express that Sid underwent that change at some point in time already. The i2c-tiny kernel driver was included from 2.6.22 (roughly 2007) onwards, bmp280 driver was introduced in late 2014.
OP could maybe have done their research.
>The T85 does not have a built in USB interface.
True, but T85 has a working well enough USB implementation in software. Hence the Digispark T85 boards that are both programmable via USB and usable as USB peripherals (micro keyboards / stream decks, for example).
The I2C system in Linux does not allow using I2C EEPROM larger than 256B without special tricks. This should be changed.
I get that this website is about hacking things together, but if all you want to do is use I²C sensors with linux, then a USB to I²C master adaptor like the CP2112 should be plug and play or the CH341T (little cheaper) with special drivers work fine for me.
So this is basically a subset of the classic Bus Pirate?
And why can’t cheap USB-TTL adapters be coaxed into talking I2C, if even at a weird transfer rate?
The same concept, although using a Raspberry Pico was covered previously here: https://hackaday.com/2022/10/31/need-an-usb-i2c-adapter-use-your-pico/
This is exactly what I was looking for that brought me to this article in the first place!
I used FTDI FT232H. Please refer to : https://github.com/Wei1234c/Bridges/blob/master/notebooks/readme/Bridges_readme_en.md