Blink out IP address for Raspberry Pi using Python

So in the final chapter of the long saga that has been connecting my Raspberry Pi to my Campus’s WiFi network, I needed a way to obtain the IP address of the Pi without using a display or a serial cable.

I’m actually pretty proud of this and I think it’s an elegant solution to a fairly annoying problem. Here’s a video of the system in action:

The program starts with three blinks. After that, the pattern goes as follows:


Etc. Four short blinks indicate a 0 and six short blinks indicate a “.”

Once the address is fully read out, three long blinks will occur.

Here’s the code:

You can make it run every time the Pi boots with:

Add the following line:

And your good to go! You can now press the button any time the pi boots to get the IP address without connecting anything!


  1. any way to make this use the onboard status LED? i know it’s possible to toggle that on and off.. just not sure how difficult that would be to do.

    1. Hey dan, thanks for commenting – I know it’s possible, but didn’t know how to do it at the time. Let me know if you try it!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.