NFC EInk Writer
An Android app to generate images for, and flash to, WaveShare Passive NFC Powered (aka parasitic) EInk displays, like this one:
With this app you can flash images, custom text, or even free-form graphics to a WaveShare NFC EInk device:
- Text: Use the built-in generator tool to create a bitmap from any text you want. Even supports Emoji
- Images: Select a picture saved on your phone to crop and flash, or capture a new one with your camera.
- Graphics: Draw something on your phone and have it ready to flash in seconds. Uses JSPaint as the WYSIWYG editor.
This app should support all screen sizes supported by the WaveShare SDK, but has only been tested with the 2.9" so far. The app will remember the last used size on startup.
Flashing a local image file:
Creating and flashing with a WYSIWYG editor:
NFC can be a little finnicky, and especially with these EInk displays. Depending on the power and capabilities of your phone, it may take time perfecting the exact distance and position to hold your phone in proximity to the EInk display in order to get successful flashes.
On certain Android phones, you might also see a high rate of your NFC radio / chipset randomly "dying". This happens at a lower level of system APIs, so it is really hard for my application to detect or attempt to recover from.
When detected by the lower-level APIs, Android will throw this as a
android.os.DeadObjectException, with the entry:
NFC service dead - attempting to recover. You can see the internal recovery efforts here.
Additionally, sometimes you might see corrupted writes, where something goes wrong during the transceiving process and the display ends up with random noise:
Building this project was my first time touching Kotlin, Java, or Android APIs, of which this project uses all three. I opted to go this route (native Android dev) instead of React Native or Flutter, because I knew I was going to need access to a lot of lower level APIs, and saw it as an opportunity to learn some new skills.
This project uses a bunch of different technologies, and takes some interesting "shortcuts":
- For the custom image generation options - both the text editor or WYSIWYG editor - I used WebView so that I could use HTML + JS + Web Canvas, and pass back the bitmap data to Android
- The text editor is a custom tiny webpage I put together that renders the text to a Canvas element, and then captures the raw bitmap data
- The local image option uses CanHub/Android-Image-Cropper for cropping and resizing
- By using scoped storage and the right APIs, no special permissions (other than NFC and Internet) are required from the User.
- For actually sending the bitmap data over the NFC protocol, this uses the WaveShare Android SDK, and the JAR file that they provided.
- Kotlin coroutines are used throughout, as there are a lot of operations that are blocking in nature (the main transceive operation is basically one long blocking sequence).
If you are interested in the WaveShare module itself, I will likely have a blog post coming soon with some more details.
Where to Get It
Currently, this is not published to the App Store. If I have time, I might work on that avenue. For now, I'm side-loading it after building it, which anyone else is free to as well.
- Mirror tag write exceptions to UI (right now just in console)
- Look for better recovery methods for NFC adapter dying
- When saving generated image, prefix or suffix with resolution, and then only allow cached image for re-flashing if saved resolution matches
- App Icon
- Publish and/or provide sideload instructions
More About Me (Joshua Tzucker):