I’ve been working with a Raspberry Pi Zero. I want to set it up to automatically take pictures and will (eventually) set it up where it won’t be connected to a keyboard/mouse/monitor. I will still need to know the IP address so I can use VNC to connect to from a different computer.
So I attached a small 128x64 OLED display 1 and wrote a small Python script to write the IP address to the screen. Okay, I didn’t write the script, I learned how to do this from those great folks at Adafruit who have a nice little OLED display designed to work with the Raspberry Pi Zero. (I ended up buying two of them!)
I had to make some very slight modifications to the original script to work with my OLED display, which you can see here
Running automatically at boot
Those nice folks at Adafruit also showed how to automatically run this script at boot. Simply add:
sudo python3 /home/pi/bin/startup.py &
/etc/rc.local before the line that says
Turning off display
You don’t always want the display on. I’ll be running on battery power and the display will consume power and reduce the amount of time I can run my camera. Well, it’s pretty simple to turn the display off.
When you want to turn off the OLED display, just execute that script
$ python3 ~/bin/poweroffDisplay.py
Simple wiring diagram can be found here: https://circuitdigest.com/microcontroller-projects/ssd1306-oled-display-with-raspberry-pi. Warning: your display board may not have the terminal pins in the same order as what is used on that site. ↩