Create usb keyboard recorder?


I am researching potential hardware platforms for this simple idea I’d like to create:

  • Attach a usb keyboard into self powered device
  • All typing is recorded to a file
  • Device plugs into computer
  • User can pull the text file from device
  • User cannot see any other files or interfere with the system

Is this something that can happen with photon and how?

Thank you

If this is intended to for dubious purposes, we don’t want to be part of that.

If you can give some insight into your intended use, we might consider tossing some suggestions :wink:

1 Like

Hi. Thank you for responding. :smile:

I can appreciate what you’re saying.

If I wanted a keylogger, there are many already available, and they’re almost perfect, but I want them to be self powered without having to be connected to a computer.

This is for creative writing.

I am the creator of and am looking into hardware now.

Many thanks,

I see.

Currently Particles don’t support USB Host mode without additional hardware, but it has been discussed and should be possible (some time).
But I’ve (re)written a (base)library for PS/2 devices like keyboards (quite a few USB keyboards still feature this legacy protocol).
Pass through PS/2 -> Photon -> Serial/USB HID keyboard/WiFi can be done with this too.

To store your data to a file, you could use an SD card for which there is a library already too.

The upload to your computer can be done via USB Serial, or by just taking the SD card, or also via WiFi (which is the main domain of Particle Photon - 2G/3G would be Electron)

The last point is a bit nebulous, what kind of interference do you expect or want to prevent? How techy will your average user be?
If you only store one file on your SD card there wouldn’t be anything else to see than it :wink:

The options above are just a subset of what’s possible :sunglasses:


Thank you for your answers :slight_smile:

The user experience I am wanting is as simple as possible, meaning on the file side of things, they see nothing but their output file so they can’t possibly mess anything up that the system might depend on.

Being able to use any standard usb keyboard is a essential to this, though a ps2 might be okay for a prototype.

Can you please tell me what I would need to build a prototype for this idea, including a ps2 port and sd card slot?

I have never created hardware before and am at the very start of my learning curve.

Thank you very much,

Depending if you need keyboard pass-through or not, you might also like to look at this thread.
Photon - USB Host Mode
If you don’t this might solve the USB side of things.

For prototyping the PS/2 side you’d just use something like this

And for SD card something like this

The rest is software.

1 Like

Thank you very much!

I think that USB keyboard passthough is not important because I imagine a different use case for this. This device is to be self-contained and used on the go…

From what I understand, to create this, I need something like this to test the PS/2 side, even though it looks like it s a USB port:

Would I need to have an SD card, if there is some writable space on the board?

In other words, can the board be programmed to allow a file to be written to it, through some filesystem, and when the board is plugged into a computer, only show that datafile, and none of the system files?

I imagine this scenario:

The user takes the device, plugs it into the USB port of their computer, and they see a drive, as if a USB memory stick, and on that memory stick is a text file with the things they have written in writing mode… And writing mode is:

Having the device not connected to the computer, just by itself. Plug a USB or PS/2 keyboard into it and power it up. Now we only have the device and the keyboard and nothing else. The user types. As they type, the system keeps appending to the text file. If for whatever reason the file isn’t there to append it, it creates a new file and then continues to append to it.

I appreciate your help with this and your patience with me as I try to begin to understand this world… It’s new to me :smile:

All the best,

The Photon only has a 2KB emulated EEPROM flash area for application use, which could be used.
For a selfcontained device I’d guess this is a bit small.

And currently there is no USB HID mass storage profile implemented on the Particle devices, so even with an SD card, you’d need a program to pull the data off the device, if you don’t want to pull the SD card out of the device.

Plans are to implement more USB HID profiles, but with no ETA what so ever.

BTW: Would your device not need any kind of display to reflect what the user was typing?
If so, there are several LCDs featuring on-board SD card slots too.


I think for the first version(s) the LCD wouldn’t be needed, but eventually I’d build up to that, though intend to keep it simple, simple, simple… Can you please point me at the LCD’s with SD cards your’re referring to?

There are several like

I just chose Adafruit for the convenience, but you’ll find such boards all over the place

Wow, so much to see and learn :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Thank you very much, I’ll start studying!

1 Like