Over the past few months Andrew has been working on a new circuit for a custom home alarm system to replace our current hardwired commercial alarm.
For the display panel on the new alarm we are going to be using a e-ink display to show the status of the alarm and the sensor status for each door and window.
We sourced a basic 2.9 inch e-ink display from ebay and it is a 296x128 pixel back and white display and a SPI interface from https://www.waveshare.com/wiki/2.9inch_e-Paper_Module
The display uses an array of bytes to write to the display panel with each byte controlling 8 pixels. You can either write the entire display each time or select a starting x and y location and write the data as required.
The manufacturer has a windows application to convert images into the data format required but it is all in Chinese and we couldn’t get it to work.
I wrote a simple Windows form application which opens a bitmap file and then loops though each row and column and gets the hex value for each pixel. If the pixel is black it then returns “0” for a black pixel or “1” for a white pixel.
Each row is then combined into a series of 1’s and 0’s and converted into a byte array which is then saved into a StringBuilder and formatted as HEX values with comma separators.
The resulting text output can then be saved into text file and used on the panels control software to write to the display via the SPI bus.
Converting the above 16px x 16px image results in the following code with each row of pixels being converted into two byte values per line.
The image below shows a converted photo of me into a 1 bit BMP file and then converted into the byte array for the display.
The source code for the app can be downloaded from https://github.com/briandorey/BitmapToByteArrayConverter
18 December 2019 at 8:46 pm
That explains why the CrystalFontz converter is giving me trouble. :)
Leave a reply
Your email address will not be published. Required fields are marked *