This program in order to pay close attention to the current number of people infected with Corona-Virus, which displays the current statistics on the display. Datasource Data used in this project came from this Website. BeautifulSoup was used to extract the data. Make it work If you just want to print the informations on the terminal, you may just run the fetch_print.py To display it on the LCD2...
Today I will introduce a interesting LED thermometer.
It can automatically Cycle through the list of cities and show the temperature on the OLED display and LED strip. You can also use the buttons on the side to manually select the cities to display. It will turn into inactive mode if there's no action in few minutes, and turn off all the LEDs and OLED screen. Any significant light change detected will turn it back on.
Bill of materials
Raspberry Pi Zero W × 1
SD card × 1
1.5-inch OLED module × 1
5V 2.4A power supply × 1
WS2812B LED light bar 5 m (30 pcs / m) × 1
Custom PCB × 1
4mm plywood × 1
6mm plywood × 1
3mm white acrylic sheet × 1
Screws × several
Bolts × several
Washers × several
Stand × several
Soldering iron × 1
Solder × 1
Hot melt adhesive × 1
Wood glue × 1
Get free weather data from https://OpenWeatherMap.org, which provides weather data for big cities in many countries. Use as follows.
- Create a free account on OpenWeatherMap.org: https://openweathermap.org/
- Copy your apikey for later use.
- Download, unzip and open the city.list.json.gz file, search for the city you want to display, and then copy the city ID for later use.
Here's the city ID file. file
Setting Up Raspberry Pi and Coding
Connect the OLED display to the Raspberry Pi and install the library for the OLED display. Make sure the Raspberry Pi is connected to the Internet.
Install the libraries required, as described by the manufacturer, here.
You need to enable the I2C and SPI interfaces and then run update.
sudo apt-get update
Run the commands below to install the necessary libraries.
sudo apt-get install python-dev sudo apt-get install python-smbus sudo apt-get install python-serial sudo apt-get install python-imaging
Run the command below to open the configuration file:
sudo nano /etc/modules
Make sure two lines listed below are included.
Run the command below to get the repo:
git clone https:/ /github.com/Anders644PI/1.5inch-OLED-with-RPi.git
Go into the new folder, and unzip RPi_GPIO-0_6_5.zip:
cd 1.5inch-OLED-with-RPi unzip RPi_GPIO-0_6_5.zip
Run the commands below to install the library:
cd RPi_GPIO-0_6_5 sudo python setup.py install
Go back to the main folder:
Do the same for spidev-3_2.zip.
unzip wiringPi cd wiringPi
Run the following command:
chmod 777 build ./build
Use the following command to check the installation:
Go back to the main folder, and unzip bcm2835-1_45.zip
unzip bcm2835-1_45.zip cd bcm2835-1_45
Then run the following commands to install the library:
./configure make sudo make check sudo make install
Return to /home/pi/1.5inch-OLED-with-RPi/ again and run the command to test the OLED:
cd /Demo_Code/Python/ sudo python main.py
Finally, just write the code, you can refer to my code, please get it on GitHub:
Configuring the Weather API
Go to the folder LED_Thermometer_Code_and_OLED_driver:
Finally, as shown, scroll down and change api-key from openweathermap.org to your api key. Also, change the city ID and city name to the city you want.
As shown in the figure, after I figured out the required electronic components, I started to customize the PCB on the Internet. All files are available on GitHub.
The Laser Cutted Enclosure
- Use 4mm plywood and 6mm plywood to laser cut the shell. A diffuser model of a 3mm white acrylic sheet for laser cutting LEDs.
- Connect electronic equipment and LED strips to laser-cut plywood. Then assemble the case.
- 3D printed buttons and switches for matching use.
Download all 3D printed files on GitHub. You may need to shrink the SVG file to 75%.
So far, the entire project is completed.