I want to receive data from TCP (http) and send it to a device that is an I2C slave. I am a CompSci person, very new to electronics.
Under worst case scenario I need to send 24 bytes per second over I2C, normally it`d be lesser.
To bridge the gap between http and I2C I know I need some thingy that can "listen" for data when attached to USB port and forward the bytes to the I2C slave.
The ATtiny85 does not have a USB interface, the ATmega8U2 is often used for this purpose as it does have a native USB interface, but interestingly no I2C. For that you have to go a step further up in line to the ATmega16U4, that one has both native USB and I2C available.
Note that you will have to run from a 12 MHz crystal (I also saw that in a quick skim of the documents linked to for the ATtiny85).
24 bytes per second is no more than about 300-400 bits per second including overhead, that's nothing on a standard 100 kHz I2C bus.
EVERYTHING will have latency, for the simple fact that there is protocol overhead. The question is: how much latency is acceptable for you? Is 10 ms acceptable? Or do you have to bring it down to say <100 µs?
Microchip manufactures a USB to I2C/serial device that can be bought in DIP packages. It's 5V tolerant when USB powered but can also be powered by 3,3V. Only a few external caps and a pull up resistor needed. And a USB connector of course. There's an easy to use native and managed library available for Windows. There's also a kernel module for Linux but it's a bit more involved setting up. Configuration tools are Windows only.
I have quite a few lying around since they're very useful.
A regular Arduino board can listen to USB, and communicate over I2C...
I have a Nano (v3), can you point me to code samples that show how to read (and optionally, how to write to, using C, Go, node, etc.) the data stream over USB port?
I am confused because I am reading Serial - Arduino Reference and from what I understand only Zero & Due support Serial.* functions over USB.
ggnum:
I have a Nano (v3), can you point me to code samples that show how to read (and optionally, how to write to, using C, Go, node, etc.) the data stream over USB port?
I already upload *.hex file to digispark attiny85 but after that in device manager i see i2c-tiny-usb in other devices and need a driver to work
in the github link found folder usbdriver but i don't understand how to install the driver from it