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

Distance Calculation with Ultrasonic Sensor
Easy
  • 499
  • 9

Full instructions

Ultrasonic distance sensors are designed to measure distance between the source and target using ultrasonic waves.

Cheapest Smart Home for $38
Easy
  • 2,149
  • 10

Full instructions

Use Raspberry Pi Zero W to make the cheapest and easiest yet very useful smart home automation for $38 only and no skills needed!

Controlling Raspberry Pi's Terminal Using Android Phone
Easy
  • 802
  • 9

Full instructions

Controlling the terminal window of the Raspberry Pi 3 using Android Phone via SSH.

Using Android Phone as Raspberry Pi's Display
Easy
  • 660
  • 7

Full instructions

Project using Android Phone as Raspberry Pi's display via SSH through VNC Viewer.

PIR Motion Sensor with Raspberry Pi
Easy
  • 637
  • 11

Protip

Quick project to interface PIR sensor to Raspberry Pi.

SMART HOME SECURITY SYSTEM
Easy
  • 2,441
  • 19

Full instructions

Detects intrusion and notifies house owner. The owner remotely watches the house and if any theft is suspected will turn on the buzzer.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback