Projects

Mini Television

I created a small television using a Raspberry Pi Zero and a small 1.3" 240x240px screen. The screen used the Serial Peripheral interface, a standard protocol for serial communication, usually used for embedded systems.

Even though the SPI protocol is standard, the method of interpreting data relative to the system clock can be different. This variation occurs because SPI can operate in one of four modes, defined by the clock polarity (CPOL) and clock phase (CPHA) settings. Each combination of CPOL and CPHA determines how the data bits are clocked in and out of the devices.

CPOL: This determines the base value of the clock signal when the SPI bus is idle.
CPOL = 0: Clock is low when idle.
CPOL = 1: Clock is high when idle.
CPHA: This determines the edge of the clock signal on which the data is sampled.
CPHA = 0: Data is sampled on the first clock edge.
CPHA = 1: Data is sampled on the second clock edge.
Therefore, the four possible modes are:
Mode 0: CPOL = 0, CPHA = 0
Mode 1: CPOL = 0, CPHA = 1
Mode 2: CPOL = 1, CPHA = 0
Mode 3: CPOL = 1, CPHA = 1

Getting to this stage took a very long time, since figuring out why the screen would not work included so many variables, so a lot of testing was required. After I had learned at a lower level how the SPI bus worked, thanks to Ben Eater's video on the SPI interface here, I consulted some issues on the GitHub page of the SPI driver and found someone else with the same screen and the same problem I had, who had fixed their problem by changing the SPI mode.

Once the correct mode was identified, I configured the SPI drivers I had installed on the Raspberry Pi to match. The drivers were very well documented and you can find them here. The drivers mirrored the HDMI output, which meant I could move on to the next step.

I soldered the screen to the pins of the Raspberry Pi and fine-tuned some settings, including continuously recompiling the drivers with different settings using trial and error to determine the maximum speed I could set the system clock to for the highest refresh rate.
Now I could move on to the last part, which was finding software that would output a video, without needing X windows. Command line VLC was a great option for this since it could use hardware acceleration, support many video formats as well as use the frame buffer to output the video. After some setup with bashrc to open and start a video file on each launch of a terminal, it was complete.

12th March 2024 - 17th March 2024

Raspberry Pi Smart Mirror

I created a smart mirror using a Raspberry Pi and Docker technology. I utilised a frameless monitor and a two-way mirror. I containerised the application and hosted it on our NAS to overcome the Raspberry Pi Model B's hardware limitations. This transformed the mirror into a dynamic dashboard displayed as a local web page.

9th January 2022

Creation of this website

I made a simple website using HTML and CSS in Notepad after completing a course on Codecademy. I bought the domain mustaali.co.uk and updated it frequently, using it to display my interests and hobbies at the time. I also presented my website to my class in primary school. Now I have refactored it and used more complex web technologies like PHP and JavaScript for my portfolio. (Picture was taken 1 August 2016).

2nd December 2014 - Present