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.

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

Running Native .NET Core Apps on Raspberry Pi (ARM)
Easy
  • 2,801
  • 28

Protip

Finally you can run your .NET Core apps on ARM versions of Ubuntu 16.04, 14.04 and Windows 10 IoT. We'll be making a Pi calculation app.

ExaGear Desktop Virtual Machine for Raspberry Pi
Easy
  • 105
  • 3

Full instructions

Make common solutions for PC work on ARM-based for any purpose and level of difficulty.

The $10 RPi Zero W - First Impressions (updated)
Easy
  • 7,150
  • 15

Protip

Seriously, can a $10 Raspberry Pi Zero-W actually perform useful work? I'm typing this while the "W" is streaming YouTube to my HDMI 4K TV.

PlatformIO for Visual Studio Code
Easy
  • 1,158
  • 9

Protip

PlatformIO is an open source ecosystem for IoT development. And now, PlatformIO for Visual Studio Code is coming!

Network Monitoring using R-Pi and Node Red
Easy
  • 1,899
  • 11

Work in progress

Using the R-Pi 3 and Node Red I created a simple network monitoring appliance.

Windows 98 Wrist Watch
Easy
  • 3,962
  • 25

Full instructions

Everyone's favourite Operating System. On your wrist!

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback