8 Bit Sprite Clock

About: 3D printing and designing RaspberryPI projects for a few years now

Game Room Nintendo Time w/ Friendly Sprites to greet you

Step 1: Flashing RaspberriPi Hard Disk / Install Required Software (Using Ubuntu Linux)

Create your new hard disk for DashboardPI

Insert the microSD to your computer via USB adapter and create the disk image using the dd command

Locate your inserted microSD card via the df -h command, unmount it and create the disk image with the disk copy dd command

$ df -h /dev/sdb1 7.4G 32K 7.4G 1% /media/XXX/1234-5678

$ umount /dev/sdb1

Caution: be sure the command is completely accurate, you can damage other disks with this command

if=location of RASPBIAN JESSIE LITE image file of=location of your microSD card

$ sudo dd bs=4M if=/path/to/raspbian-jessie-lite.img of=/dev/sdb (note: in this case, it's /dev/sdb, /dev/sdb1 was an existing factory partition on the microSD)

Setting up your RaspberriPi

Insert your new microSD card to the raspberrypi and power it on with a monitor connected to the HDMI port

Login

user: pi
pass: raspberry

Change your account password for security

sudo passwd pi

Enable RaspberriPi Advanced Options

sudo raspi-config

Choose: 1 Expand File System

9 Advanced Options

A2 Hostname change it to "SpriteClock"

A4 SSH Enable SSH Server

A7 I2C Enable i2c interface

Enable the English/US Keyboard

sudo nano /etc/default/keyboard

Change the following line: XKBLAYOUT="us"

Reboot PI for Keyboard layout changes / file system resizing to take effect

$ sudo shutdown -r now

Auto-Connect to your WiFi

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following lines to have your raspberrypi automatically connect to your home WiFi (if your wireless network is named "linksys" for example, in the following example)

network={ ssid="linksys" psk="WIRELESS PASSWORD HERE" }

Reboot PI to connect to WiFi network

$ sudo shutdown -r now

Now that your PI is finally on the local network, you can login remotely to it via SSH. But first you need to get the IP address it currently has.

$ ifconfig Look for "inet addr: 192.168.XXX.XXX" in the following command's output for your PI's IP Address

Go to another machine and login to your raspberrypi via ssh

$ ssh pi@192.168.XXX.XXX

Step 2: Start Installing Required Packages

Start Installing required packages

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install vim git python-smbus i2c-tools python-imaging python-smbus build-essential python-dev rpi.gpio python3 python3-pip python-numpy

Update local timezone settings

$ sudo dpkg-reconfigure tzdata

select your timezone using the interface

Setup the simple directory l command [optional]

vi ~/.bashrc

add the following line:

alias l='ls -lh'

source ~/.bashrc

Fix VIM default syntax highlighting [optional]

sudo vi /etc/vim/vimrc

uncomment the following line:

syntax on

Install i2c Backpack Python Drivers

$ cd ~

$ git clone https://github.com/adafruit/Adafruit_Python_LED_Backpack

$ cd Adafruit_Python_LED_Backpack/

$ sudo python setup.py install

Install i2c Python Drivers

Install the NeoPixel Driver as follows

sudo apt-get install build-essential python-dev git scons swig

sudo pip3 install --upgrade setuptools

sudo pip3 install rpi_ws281x

cd rpi_ws281x

scons

cd python

sudo python setup.py install

cd examples/

sudo python strandtest.py

Clone the repository in your home directory for the clock to work

cd ~

git clone https://github.com/khinds10/NESClock.git

Step 3: Supplies Needed

Pi Zero W/1.3/1.2
Wifi USB (if Pi Zero 1.3/1.2)
Keyestudio I2C 8x8 LED Matrix HT16K33 (x7)
16x16 RGB LED Flexible WS2812B Matrix
Frosted Paint
12x12 Picture Frame
Cuttable thin plexi-glass sheet
12x12" 2 way mirror plexi-glass sheet
12x12" tinted plexi-glass sheet

Step 4: Building the Sprite Clock

Prepare the HT16K33 matrix units

Solder the pins on the back to assign them each a unique i2c address. There are 3 jumpers to solder or not solder in 8 combinations. I've soldered all combinations to assign each unit a different address to be accessed by the python code to show the clock time.

Step 5: Print the Project Enclosure

In the 3D print folder find the "defuser-grid-final.stl" print model to be a working pixel defuser to focus the light from each LED to a square shape to enhance the output of the sprites on the clock.

Step 6: Tape the Printed Pixel Defuser to the LED Matrix, Spray Frosted White Paint and Cut a Piece of Thin Plexi-glass to Then Tape Over the Top of the Defuser.

This will continue to scatter the light even more to improve the sprite clarity.

Step 7: Begin Wiring the Devices

HT16K33 Matrix Units

GND -> GND

DATA -> SDA

CLK -> SCL

VCC -> 5V

RGB 16x16 Unit

GND -> GND

DATA -> GPIO 18

VCC -> 5V

Step 8: Final Assembly

In place of the normal picture frame glass, replace it with the 2 way mirror (12x12" sheet) and gray tinted plastic glass (12x12" sheet).

This will conceal the components inside the frame, so you can see only the pixel light output.

Tape together the HT16K33 units in a solid row

Make sure each unit is addressed from \0x70 to \0x76 in a row for the code to work (you can adjust the code if they're out of order later)

Place the components level side the frame with the mirror and tinted glass installed.

Now you can place the back of the frame on to hold the components in place. This will be the hardest part, I was lucky to have a frame with a flexible enough back. I got everything level and it looked great.

Step 9: Startup Scripts

Set pi user crontab

Enter the following line for a minute by minute crontab

$ crontab -e

@reboot nohup python /home/pi/NESClock/MatrixClock.py > /dev/null 2>&1

Set root user crontab (RGB Sprite Panel library requires root access) Set "on reboot" to run the candle python script forever

$ sudo su

$ crontab -e

@reboot nohup python /home/pi/NESClock/SpritePanel.py > /dev/null 2>&1

Step 10: Finished!

Share

    Recommendations

    • Pets Challenge

      Pets Challenge
    • Frozen Treats Challenge

      Frozen Treats Challenge
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest

    Discussions