Supernatural Six

This is page for the The Diana Initiative 2021 maker village kit, featuring the Raspberry Pi Pico and a .96″ OLED screen it functions as an amusing desk toy or feel free to experiment with the 6 LEDs, input button and that sweet OLED screen. Add your own components with with the three accessible GPIO pins and add add portability with a suggested power solution.

Supernatural Six desk toy on a 3D printed stand

BOM

  1. One Custom PCB
  2. Four 68 Ω resistors
  3. Two 10Ω resistors
  4. Six 5mm LEDs
    1. Two Red
    2. Two Green
    3. Two Blue
  5. Two 12x12mm buttons with caps (white,black)
  6. Two 1X20 Female headers
  7. Two 1×20 Male Headers
  8. one Raspberry PI pico
  9. one .96 inch OLED
Part Location
68Ω ResistorR3,R4,R5,R6
10Ω ResistorR1,R2
OLEDOLED1
Blue LEDLED1, LED2
Green LED LED3, LED4
Red LED LED5, LED6
12×12 ButtonU1, U3
Rpi PicoU2 (back of PCB)

Assembly Notes

The two strips of female headers are optional, if you choose to use them they go on the PCB, while the two strips of male headers go on the Rpi pico.

Code

I like the Mu editor for CircuitPython. Download it here. However any text editor will get the job done, just save the file to the Pico as Code.py

The SN6 is programmed in CircuitPython. Here’s an article from adafruit on how to set up a Rpi Pico to use Circuit Python

Libraries

To use the OLED screen you will need the library for it. Here is a for more info and to make things easier here’s a copy of the lib folder I’m using

the other libraries listed, are included with circuitPython

Code.py

# Adapting from
# https://learn.adafruit.com/adafruit-oled-featherwing/python-usage
# to use with Raspberry Pi Pico and CircuitPython
import time
import board
import busio
import displayio
import terminalio
import adafruit_displayio_ssd1306
import digitalio
from adafruit_display_text import label
import random
import microcontroller

led1 = digitalio.DigitalInOut(board.GP28)
led2 = digitalio.DigitalInOut(board.GP1)
led3 = digitalio.DigitalInOut(board.GP18)
led4 = digitalio.DigitalInOut(board.GP10)
led5 = digitalio.DigitalInOut(board.GP21)
led6 = digitalio.DigitalInOut(board.GP9)
led1.direction = digitalio.Direction.OUTPUT
led2.direction = digitalio.Direction.OUTPUT
led3.direction = digitalio.Direction.OUTPUT
led4.direction = digitalio.Direction.OUTPUT
led5.direction = digitalio.Direction.OUTPUT
led6.direction = digitalio.Direction.OUTPUT

displayio.release_displays()

led2.value = True
led1.value = True
time.sleep(0.25)
led3.value = True
led4.value = True
time.sleep(0.25)
led5.value = True
led6.value = True
time.sleep(0.25)

i2c = busio.I2C(scl=board.GP17, sda=board.GP16)  # This RPi Pico way to call I2C

display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)  # The address of my Board

display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64)
splash = displayio.Group(max_size=10)
display.show(splash)

color_bitmap = displayio.Bitmap(128, 64, 1)  # Full screen white
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF  # White

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)

# Draw a smaller inner rectangle
inner_bitmap = displayio.Bitmap(124, 60, 1)
inner_palette = displayio.Palette(1)
inner_palette[0] = 0x000000  # Black
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=2, y=2)
splash.append(inner_sprite)

# Draw a label
text = "SN 6 Ball says:"
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=15)
splash.append(text_area)
# small funtions to draw the different sides of the virtural die
def side1():
    text = "This isn't a bug, "
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
    text = "its a feature"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=45)
    splash.append(text_area)
def side2():
    text = "Test via cable, "
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
    text = "not WIFI"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=45)
    splash.append(text_area)
def side3():
    text = "Squirrels!!!"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
def side4():
    text = "Bad Patch Cable"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
def side5():
    text = "No budget"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
def side6():
    text = "Legal said NO"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
def side7():
    text = "Out of scope"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
def side8():
    text = "Acceptable Risk"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
def side9():
    text = "Backups?!?! "
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
    text = "what backups?"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=45)
    splash.append(text_area)
def side10():
    text = "It is not "
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
    text = "publicly exposed"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=45)
    splash.append(text_area)
def side11():
    text = "Works Fine For Me"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
def side12():
    text = "Not My Department"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
def side13():
    text = "Needs Director  "
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
    text = "Level Approval"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=45)
    splash.append(text_area)
def side14():
    text = "Move It To "
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=35)
    splash.append(text_area)
    text = "The Cloud"
    text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=5, y=45)
    splash.append(text_area)
# this is were a side is chosen
roll = random.randrange(1, 15)  # 2nd number needs to be the number of sides +1

# woulda used a case, but python and this was the easist for me to wrap my head around
if roll == 1:
    side1()
elif roll == 2:
    side2()
elif roll == 3:
    side3()
elif roll == 4:
    side4()
elif roll == 5:
    side5()
elif roll == 6:
    side6()
elif roll == 7:
    side7()
elif roll == 8:
    side8()
elif roll == 9:
    side9()
elif roll == 10:
    side10()
elif roll == 11:
    side11()
elif roll == 12:
    side12()
elif roll == 13:
    side13()
elif roll == 14:
    side14()
time.sleep(3)  # 3 seconds before light go blinky

while True:
    wait = 0.2
    temp = microcontroller.cpu.temperature
    led3.value = False
    led1.value = True
    time.sleep(wait)
    led1.value = False
    led2.value = True
    time.sleep(wait)
    led2.value = False
    led4.value = True
    time.sleep(wait)
    led4.value = False
    led6.value = True
    time.sleep(wait)
    led6.value = False
    led5.value = True
    time.sleep(wait)
    led5.value = False
    led3.value = True
    time.sleep(wait)


pass
# Write your code here :-)
 

Extras

I’ve posted a simple 3D printed stand to Thingiverse. No 3D printer? Check with your local library, many have 3D printers for patron use. Find the file here

The SN6 can be made portable by adding either a 3xAAA battery holder or a 3.7 liPo battery (not included)