Using I2C with an Uno and Digispark for virtual keyboard

Hello,

The setup that I am trying to make is having an Uno that is connected to a computer, using USB, that can send serial commands to the Uno. The Uno is connected to the Digispark, through I2C, to relay the serial commands from the first computer. Finally, the Digispark's USB would be plugged into a second computer, that would receive keystrokes from the Digispark using Digikeyboard.

           USB     I2C          USB
  Computer1 -> Uno -> Digispark -> Computer2

The purpose of this setup is to be able to have a program on Computer1 send a serial signal that will result in Computer2 having a keyboard button pressed.

I know that Computer1 to Digispark will work. As seen in below link. But, can a Digispark receive a serial signal over I2C while also sending signals over USB?

RodFab_W14 (fabacademy.org)

Thank you in advanced for any insights!

I'm sure there are far simpler ways of doing this. :thinking:

What is the benefit of using I²C since the distance is limited to half a meter or so? :face_with_raised_eyebrow:

Welcome to the forum.

I agree with Paul_B, your goal should be a working project and it is better to start with something that will work.

Can you install sofware that uses ethernet ? Or software that uses a bridged USB cable ?
You can also connect two usb-serial modules to each other and have software running on both sides that use the serial (serial over usb).

Suppose you really want to use keyboard strokes for the second computer, then I suggest to start with a normal Arduino board, such as the Arduino Leonardo / Micro or a MKR Zero.
Those boards have a spare serial port, so add a usb-serial module for the first computer.
No need to use the I2C bus. The I2C bus is not good for communicating between Arduino boards anyway, projects fail because of that.
There are USB cables of 10 and 15 meters, they work well if both sided have their own power.

The DigiSpark is a ATtiny85. The ATtiny85 is well known by many of us. That is a great chip, but it is not an official Arduino board, and if you have trouble, we might not know all the ins and outs of specific things of the DigiSpark board.

1 Like

Didn't notice that. So does it function as a USB HID?

@Paul_B Yes. It works as a USB HID.

@koepel I like the idea of using a Leonardo to accomplish this. I have been looking and it looks like using a Leonardo with one of these: RS232 Shield for Arduino (Assembled) - RobotDyn would allow for me to communicate between my PC and the Leonardo, using serial, without interfering with the Leonardo's USB port. Am I correct that this would work, and would a wise way to do this?

Uhm, no.

For uploading a sketch, and for debug messages, the "Serial" port of the Leonardo is a USB device inside the microcontroller.
Pin 0 and 1 have Serial1, and that is a spare hardware serial port.
https://www.arduino.cc/reference/en/language/functions/communication/serial/

So all you need is a usb-to-serial module: https://www.sparkfun.com/products/12731. Most of those chips have 3.3V RX and TX signals, but they often work with a 5V Arduino board as well.
There are many others. The common modules run without installing something in linux, but you need a driver in Windows.

If it is used in a industrial environment, and you must use the RS-232 of the computer, then you can buy a RS232-to-ttl-level-module, but not a "shield", because I don't know if it will work with a Leonardo.

2 Likes

Pro Micro would be a more practical version. :thinking:

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.