Random Number Generator
I know it's not funny, but the only thing that's NOT working is the hardware random number generator. It turns out my analog-fu and ability to read documentation is lacking. While the current circuit does generate random noise, it's in a very narrow range (20mV peak to peak), and at a random voltage about 1V. I can't do much with it without some amplification and craziness. At least, it'll require a new PCB or some breadboarding with parts I don't have yet. The good news is that I can use the Arduino pseudo RNG TEMPORARILY as a stub until I get real random number generation working. I believe this is completely fair, as I can't have this holding up the rest of the development, and I do have prototypes that show some randomness coming out of my RNG circuit, just not good enough for digital conversion.
We had a discussion about how to get the data from the Android device to the computer. One option was having the Android device flash light, which a photodiode would detect. This turned out to be too slow for reasonable data transmission. We didn't want anything wireless, as that would cancel out the idea of the Android having all wireless completely disabled. We decided to go with USB OTG. But instead of the Android connecting to the computer directly, we wanted it to go through our trusted device. This way only one thing plugs in to the computer. To do this we added an FTDI chip; the FT231RS, which can do USB OTG to serial.
The serial was then piped into the hardware, and a new firmware mode was added to allow data coming in from the serial to be sent out through the other USB port connected to the computer as a keyboard. This way we can guarantee that no drivers are needed on the computer, and that it will only ever interface as a keyboard to anything; ensuring that data can't flow backwards into our secure device.
Implementing was a little challenging as I'm essentially out of available pins, and I think there is a conflict with one of the other libraries that prevented SoftwareSerial from working. I eventually rerouted some wires and got Serial1 working, but it was a tough half a day.
Everything Else Hardware
Everything else is working well. There was a small change necessary on the hardware to get the write protect detection working on the SD cards. Now the firmware can check on the card presence and the write protect tab to make sure that the cards are present and writable before doing anything.
The enclosure has been updated as well. It's a little prettier, smoother, curvier, and now black!
Using the newest version of the SDFatLib (https://github.com/greiman/SdFat) was a breakthrough. It has support for two cards at once, so I didn't need to rewrite the older SD library. Most of the features are now working completely, and the ones that aren't are not on the critical path for the minimum viable product. In other words, all the stuff that has to work does, and the rest is just nice to have.
To expand on that, you can now
- Create duplicate files on two SD cards of user-set size containing random data.
- Output a given section of a given file from the SD card to the keyboard.
- Receive data from the USB OTG Android device and print it out to the keyboard.
- Generate random data and print it to the keyboard.
Fun things you can do with this device
Besides its original intention, this hardware will allow you to do all kinds of things. You could write additional code to get it to have more fun features, but consider these options:
- USB Random Number Generator. These exist already as dongles (https://www.tindie.com/products/ubldit/truerng-hardware-random-number-generator/), but they're at least $30 for the cheapest I found. NSA-Away can do that and more!
- USB<->Serial. Essentially two USB->Serial ports on this one device. So many options!
- SD Card Management. You could copy any file from one to the other, or delete files, or wipe them. Go nuts!
- Generic Dev Board. It's got a battery, 16x2 LCD, 4 buttons, and a Leonardo clone. It's great for doing all kinds of things, and the BOM is just as much as an Arduino.