Things used in this project

Hardware components:
475267 240424 01 front zoom kankcmvqdh
Raspberry Pi Zero Wireless
×1
Pimoroni Unicorn pHAT
×1
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Code

ip.pyPython
import socket 
import time 
import unicornhat as unicorn 

# From http://commandline.org.uk/python/how-to-find-out-ip-address-in-python/ 
def getNetworkIp(): 
   s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 
   s.connect(('google.com', 0)) 
   return s.getsockname()[0] 

# Prepare the Unicorn pHAT display
unicorn.set_layout(unicorn.PHAT) 
unicorn.rotation(0) 
unicorn.brightness(0.5) 

# Obtain our IP address and split it into the 4 components ("octets")
ip = getNetworkIp() 
octets = ip.split('.') 

# Render the binary representation for each octet
y = 0 
for octet in octets: 
 bits = '{0:08b}'.format(int(octet)) 
 x = 0 
 for b in bits: 
   if int(b): 
     unicorn.set_pixel(x, y, 0, 0, 128) 
   x += 1 
 y += 1 

# Render the display
unicorn.show() 

# Keep the LEDs lit for 30 seconds
time.sleep(30) 

Credits

202034
Colin O'Dell

Lead Web Developer at Unleashed Technologies. Author of league/commonmark. Conference speaker. Arduino enthusiast.

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Physical Computing - Scratch 2.0 for Raspberry Pi
Easy
  • 124
  • 5

Full instructions

This is my 3rd tutorial with a focus on Scratch and Physical Computing using RPi. Here we will explore the new version of Scratch, the 2.0.

Break your heart - IoT Project - IoT Blocky
Easy
  • 24
  • 2

Full instructions

Using this project to control the LEDs on the Raspberry Pi Sense HAT

Hey Mycroft, Where Is the International Space Station?
Easy
  • 1,887
  • 37

Full instructions

Developing my first skill with the Mycroft.ai open source voice assistant on a Raspberry Pi 3 - aka Picroft!

Sound Detector with Visual Alerts
Easy
  • 2,197
  • 3

Full instructions

Create a WiFi-enabled sound detector that sends your phone notifications using Prowl and Python!

Measure Plant Growth
Easy
  • 1,184
  • 16

Find out how much plants grow without killing the plant.

Raspberry Pi RGB Console with SwishPi pHAT
Easy
  • 73
  • 1

Full instructions

Build a Python single page app to control an RGB LED using the SwishPI pHAT.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login