Using Arduino Micro as a USB keyboard for Raspberry Pi

Greetings from WPI! Here’s a video:

Desperate times call for desperate measures. I recently found out that a club at my school is essentially a hackerspace equipped with 3D printers so I could finally print enclosures for the PiPlanter and the DSFU. But that means I would need to finial the designs for both of them. I needed to find a way to interface with this thing here. So being the idiot that I am, I forgot a USB keyboard, I forgot an analog video cable, I forgot a monitor for the pi and forgot to update the Pi to the latest Raspian build.

What I did bring was an Easy Cap Capture Cardย in addition to my standard idea-kit which among other things consists of an Arduino Micro, some buttons, some resistors, and wire.

Essentially all I needed to do was connect the Pi to the EasyCap, and be able to send 4 different phrases to it over the keyboard. I needed to be able to send ‘pi’,’password’ (not my actual password), ‘ifconfig’ and enter. I realized that I could easily send this data to the Pi via the Micro as it has the Keyboard. functions built in.

As you can see in the video it worked! And I’m kind of stunned that it did. I can now SSH into the Pi.

Here’s the code for the Arduino:

Thanks for Reading!

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

5 Comments

  1. Hi!

    I am wanting to something like this now, when you have a moment do you think you could post a few pictures of how it’s all wired? It would be very much appreciated ๐Ÿ™‚

    Thanks,

    Robbie

  2. Thank you for your post.

    At 2:46 in your video, you unplug the USB-A connector from your laptop and plug it into something labeled “DYNEX” which is plugged into the R-Pi.
    I searched https://www.dynexproducts.com but didn’t find anything like it.
    Can you explain what the part is or provide a link to it?

    1. Hi! The Dynex device is an SD card reader, and I’m not plugging the keyboard into that, I’m plugging it into the USB port on the Raspberry Pi. Make sense?

  3. I have a question I wonder if you might be able to help me with: I am trying to get a key command into a Pi to advance videos in VLC, using an Adafruit Itsy Bitsy (Ardruino Micros were out of stock). The key commands are working just fine when the board is plugged into my laptop, but the Pi doesn’t seem to be receiving them. Any idea why that might be? Thanks!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.