Improved keyboard wedge

The trinkets use a USB serial as their default serial device so software serial should work but you might have to modify various bits and pieces first

1 Like

Thanks, i tried it, but all the functions are print to serial only.
Managed to extrat teh UID bit by bit, then convert convert them to string, then make a complete UID string …
But for some reasons, it extracted in decimal, not hex. … well, same same … I can make it work …

Also shouldn’t need software serial if you are using pn532 in i2c or spi mode are you trying to use hsu?

I am using SPI, but of course the IDE will still try to compile the whole library anyway and fails with the same error.

I have however stumbled upon another issue regarding this project: Keyboard layouts!

I have been pondering how to generate passwords and it seems to be a fairly hard problem.
I set up a Linux mint VM using the Password zaäaäAB98HbvC§(.
At least, that is how my Machine (german layout) interprets it.
LUKS seems to handle the keypresses differently. After a reboot I can no longer unlock the encrypted test VM.

I am curious how the following sample code works on your machines. Also does anyone have an idea, if there is maybe a safe set of characters, that can be used for this?

Click to expand!
#include <Keyboard.h>

void setup(void) {
  delay(2000);
  uint8_t whatever[16] = { 'ä', 'Ä', 97, 0x27, 0x61, 'ü', 'A', 'B', '9', '8', 'H', 'b', 'v', 'C', '#', '*' };
  Keyboard.begin();
  for (uint8_t i = 0; i < 16; i++) {
    Keyboard.write(whatever[i]);
  }
  Keyboard.end();
    
}
void loop(void) {
  delay(2000);
}

Easy fix… Find the Keyboard.begin() and replace it with
Keyboard.begin(layout)

You can find the appropriate layout in the Arduino reference page

1 Like

Devilclarke’s repo works great.
The PN532 is far superior to the MFRC522. I’ve created the code for ESP32 and PN532 using Devilclarke’s lib. This one uses I2C instead of SPI, saving some cables. I’ve not bothered with the array password, since I am not going to use it, but it should be easy to add it. It works a lot better than my MFRC522-code.
My wedge is now working exactly as I want, now I only need to make an eclosure.
If anyone else is using ESP32, feel free to steal and modify:

5 Likes

Thank you for this.

Awesome, thanks.
Ill give it a go, if i can make it work ill make a 3D printed case and publish it somewhere.

Edit: ESP32 is on its way …

1 Like

Merry Christmas everyone!
I have developed my own little keyboard wedge. It is still somewhat rough around the edges, but I consider it ready for publishing.
Take a look:

5 Likes

Well it’s been a while…

I’m afraid I was having to deal with the black dog, and while the new meds seem to be helping with that they also left me feeling like I couldn’t be bothered doing anything for a while.

So, I have just ignored most of my last rewrite which was non functional, and ported release one over to platformio as a development platform.

My current plan is to add the following features…

  1. (Completed) XOR the password with the UID and store the encrypted password in the array. If the UID can decrypt that entry we can use that (advantage, no clear text passwords or UIDs are stored on the controller. The encryption is not strong though, this will not slow down a determined attacker). This could be modified to search the chip for the encrypted password but I am not sure why you would want to do this, garbage on your chip would look suspicious.

  2. (Completed) Configurable headers and footers for the password stored on the chip itself. If you want to use PASS^ and ^ respectively you can. The Password cannot contain the footer though. PASS^^^ would be a null password not a single ^.

  3. (Completed) Add support for the reader to “press” the F15 key every 5 minutes. This is because my laptop goes to sleep in long meetings and cuts me off. I want to add this as I already have this microcontroller connected, so making it do double duty.

  4. Add support for a PN532 reader.

  5. (Completed) Configurable keyboard layout. The Keyboard library supports multiple languages, so we should be able to change that and send it other characters.

The new code including a UF2 file for a trinket is at (https://GitHub.com/zwack-am/ZKBW2/) I will make this a bit more obvious when I have completed item 1. Item 4 will be the next release, and then porting to the pico.

6 Likes

This sounds awesome!

there are great library for the PN532 out there (and they work).
Ive been looking at teh PN5180, it is suposed to get even better reads, but i cannot make it work … at all … (might make a dedicated thread for it)

1 Like

I am very familiar with that feeling. I feel like I have lost years to that limbo state.
Its really good to hear you are fighting the black dog.

Also, I had not heard of platformio, until now. It looks pretty cool.

I have found another useful thing(and tested it) for supported boards

If the board has a USB interface, and supports UF2 I don’t need to worry about distributing source code and having people fail to flash their board properly.

I have already tested this but I can compile a .bin file for the board and then convert it to a UF2 file (you need the python script from the utils directory of https://github.com/microsoft/uf2)

The end user just needs to press the reset button twice, and the board will mount itself as a USB drive. If they then upload the .uf2 file to that drive it will reboot and come up with the new code running.

The supported chips do include the Atmel SAMD21 (Trinket m0), the raspberry pi rp2040 (pico) and various ESP32 chips.

This means that I can develop in platformio, or Arduino, or avr-dude or… And users do not need to use a similar development environment, or separate flasher to install the working code. As long as they load the correct uf2 file for their board it will work for them.

3 Likes

Release 1.0 is here…

GitHub site

This includes an easy upgrade mechanism IF you don’t mind using my Config.h.

If you are using a trinket m0 you can just grab the uf2 file. Press the reset button on the trinket twice and you will see a new USB device (TRINKET_BOOT). Drop the uf2 onto that device, wait for it to reboot and you will have upgraded.

If you want to use your own configuration you will need to modify config.h and use platformio to build a new version.

Remaining planned tasks…

  1. Add support for a PN532

  2. Port it to the Raspberry Pico

I will start on those once I have got the initial working version of my next project done.

5 Likes

image

200w (1)

Ho, dam … Forgot about coming back to this …

The read range with a full card is about 1/2" but I can’t pick up the implanted NExT …
I really love the code @Zwack made, it’s “simple”, does what it’s supposed to do perfectly and is easy to use …

I’m trying to get my pn5180 to work to test out some of the other wedges that popped up but I’m not having any success with it … I’m getting discouraged about my inability to make this work …

2 Likes

I’m
Interested in maybe making one of these, assuming I understand the concept

Where do I even start?

There are basically two main hardware components to this.

The microcontroller (atsamd 21) and the NFC frontend (PN532).

For the microcontroller I like to use the Seeeduino XIAO, because its small and it has a USB type C port.

For the PN532 most people recommend the elechouse PN532 (PN532 NFC RFID module V4 - ELECHOUSE), due to its good coupling with X series implants.

The PN532 seems to be getting phased out by NXP. However there aren’t as many nice libraries for the alternatives.

Once you have the required components, you need to solder them together. The firmware will contain info on where the wires go.

Then flash the firmware and perhaps 3D print a case for the whole thing.

When it comes to picking firmware you can either use mine (Schlaf / Yet Another Keyboard Wedge · GitLab) or Zwack’s (GitHub - zwack-am/ZKBW2: Second Generation Keyboard Wedge using Platformio for development).

Both projects are in a bit of a jank state. Feel free to ask if you run into issues.

You probably also want to write passwords to your NFC chip. My project doesn’t have an easy way of doing that right now. Might polish up the code for that, and make it more usable.

Also, I made 3D printable case for my design. It has holes that are sized for Ruthex M2.5 threaded inserts.
YAKW2 (another copy).stl (139.0 KB)

Ok, I might pull the trigger on this

First step, order the parts, then figure it out as I go I guess, I have a friend IRL who apparently does arduino stuff, assuming that’s what this is…. So I can lean on him if it goes really poorly

For the pn532, the one linked is like 35$ instead of like 3-5$ is it really worth the difference?

1 Like

I thinks it’s close to $50 with shipping and tax. I’ve ordered a couple of them. From everything I’ve read, the v4 is the best for the form factor and code/libraries that exist for it. I am able to scan my xseries implant through a 3d printed case using the v4 reader.

1 Like