You may have seen on my posts on Twitter about my project “Digital Zoetrope”. It is going to be a true zoetrope, with 12 Adafruit OLED displays connected to a single Raspberry Pi via SPI. The first hurdle is that the Raspberry Pi has only two CS lines, after talking with my friends at Makespace, Cambridge’s maker/hack space. I decided that the displays would be daisy chained together with custom daughter PCBs controlling the CS line and isolating any other data lines as required, they will also buffer the signals. The PCBs will act as shift register, passing the signals on to the next screen. I also have plans for creating a Raspberry Pi video camera for recording short films to download to the zoetrope. I hope to have the above, all ready for the UK Makerfaire in Newcastle and a pro-type running at the Raspberry Pi birthday bash. I would also like to thank Pimoroni for their support in the making of this project.
I have been working on this project since the start of the year, first thing I did was select the display I would be using, the reason, I selected the Adafruit OLED is the bright image, and also that there was code written for the Arduino by Adafruit, first job was converting the Adafruit C code into python, I needed a library for controlling the display over SPI, I found and followed a “how too” on the Raspberry Pi Spy blog site, and installed the py-spidev library.
I wrote a number of test programs and was able to write directly to the screen memory and was able to update the screen in less than 0.03 of a second, result. Due to a limitation with the SPI library write function, I had to break each frame into 8 blocks.
Next job was writing a single frame from a video to the display, for this purpose I installed the python library SimpleCV, with the library, I was able to convert a MP4 formatted video to single frames, and read the RGB value of each pixel. The next step was to convert the RGB value to the 565 colour space and load the pixels into blocks and then each block of pixels into a single list for each frame. The frames are stored in another list. At the end of this I was finally able to display images on the display! You can find the code on my Github account.
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!