The hardware side of this project is quite simple really, There is a ssd1306 OLED screen to display your status a WS2812 8 LED ring and a few buttons.
Software
Before we get started we need to install a few things. I followed the install instructions on the links below
- Install BMP180 python library and setting up I2C - https://learn.adafruit.com/using-the-bmp085-with-raspberry-pi/overview
- Pimoroni unicorn hat library for the WS2812. Copy and paste this command into your terminal - curl -sS get.pimoroni.com/unicornhat | bash
- Install ssd1306 OLED screen library - https://learn.adafruit.com/neopixels-on-raspberry-pi/overview
I've had to split the code into 2 camps. If you are using a raspberry pi zero you will know that you have to run raspbian jessie but if your using a raspberry pi original or 2then there's a good chance your still using raspbian wheezy. To check what version your running run this command
cat /etc/debian_version
If it returns 7.x then your on wheezy, If it returns 8.x then your on jessie
Rasbian jessie code
If you are running jessie on your raspberry pi then you will need to follow these steps
Since the release of jessie raspbian has moved over to systemd which changes the way you start code at startup.
Shutdown button code needs to run all the time because it needs to always check to see if the shutdown buttons been pressed. This script will be set up separate from the status screens script. The shutdown button code can be found on my github page.
- Place pishutdown.py in '/home/pi/shutdown'
- Make script executable with 'sudo chmod +x pishutdown.py'
- Move pishutdown.service to /etc/systemd/system/
- Enable service 'sudo systemctl enable pishutdown.service'
- Run service at boot 'sudo systemctl start pishutdown.service'
Weather display code updates every 15 minutes and 1 minute after boot. The code can be found on my github page. You need to register as a developer on weatherunderground.com and add your api key to the code.
- Move 'jessie_weather_screen.py' to /home/pi/
- Make script executable with 'sudo chmod +x jessie_weather_screen.py'
- Move both weather_screen.service and weather_screen.timer to /etc/systemd/system/
- Enable it with 'sudo systemctl enable weather_screen.timer'
- Start at boot with 'sudo systemctl start weather_screen.timer'
- Reboot when done
Temperature logging code also runs every 15 minutes and 1 minute after boot. The code can be found on my github page. You will need to sign up to be a developer on thingspeak.com and add your api key to the code for it to work.
- Move templogger.py to /home/pi
- Make script executable with 'sudo chmod +x templogger.py'
- Move templogger.service templogger.timer to /etc/systemd/system/
- Enable service 'sudo systemctl enable templogger.timer'
- Run service at boot 'sudo systemctl start templogger.timer'
Rasbian wheezy code
If you are running wheezy on your raspberry pi then you will need to follow these steps
Shutdown button code needs to run all the time because it needs to always check to see if the shutdown buttons been pressed. This script will be set up separate from the status screens script. The shutdown button code can be found on my github page.
- Place pishutdown.py in '/home/pi/shutdown/'
- Make script executable with 'sudo chmod +x pishutdown.py'
- Edit '/etc/rc.local' as root aka 'sudo vi /etc/rc.local'
- Add 'sudo python /home/pi/shutdown/pishutdown.py' before the 'exit 0' line
- Save file and reboot pi
Weather display code runs every 15 minutes.The code can be found on my github page. You need to register as a developer on weatherunderground.com and add your api key to the code.
- Move 'wheezy_weather_screen.py' to /home/pi/
- Make script executable with 'sudo chmod +x wheezy_weather_screen.py'
- Edit crontab with 'EDITOR="vi" crontab -e'
- Add this line to end of file '0,15,30,45 * * * * sudo python /home/pi/wheezy_weather_screen_bmp.py'
- Reboot for good measure
Temperature logging code also runs every 15 minutes and 1 minute after boot. The code can be found on my github page. You will need to sign up to be a developer on thingspeak.com...
Read more »
what library are you using for the ws2812? I'm using the pimoroni unicorn hat library found here https://github.com/pimoroni/unicorn-hat If you look in my code there is a section called "LED_BRIGHTNESS = 127" where you can adjust the brightness from 0 -255