From 太極
Jump to navigation Jump to search



  • Wifi has to be connected once. If pi is far from the wifi router, move it closer to the router to make sure Pi can connected to wifi at least once. After that, we can move Pi to the location we want.
  • "sudo raspi-config" -> Interface Options -> I4 SPI -> Enable.
  • Weather Station with ePaper and Raspberry Pi 2020
    • Waveshare hardware connection from Github (4 SPI pins are needed). The first number (eg RES white -> 11) below is from a continuous sequence order (physical location) and the 2nd number (eg BCM: 17) is GPIO number (or BCM pin number).
          EPD         =>  Raspberry Pi
        * VCC  red    ->  3.3
        * GND  black  ->  GND
        * DIN  blue   ->  19 MOSI
        * CLK  yellow ->  23 SCLK
        * CS   orange ->  24 (Physical, BCM: CE0, 8)
        * D/C  green  ->  22 (Physical, BCM: 25)
        * RES  white  ->  11 (Physical, BCM: 17)
        * BUSY purple ->  18 (Physical, BCM: 24)
      vcc red 1 3v3
      gnd black 6 ground
      rst white 11 gpio17
      busy purple 18 gpio24
      din blue 19 gpio10 (spi mosi)
      dc green 22 gpio025
      clk yellow 23 gpio11 (spi sck)
      cs orange 24 gpio08 (spi ce0)
  • E-ink calendar using a Raspberry Pi Zero
  • Raspberry Pi: an E-Paper display with Widgets Waveshare® 7.5" E-ink Screen.
  • Comparison of different e-inks from Waveshare.net. Note the 7.5 inch epaper has a resolution 640x384 (cf 7 inch 800x400 official raspberry pi display).
  • Aliexpress
  • You can build a DIY E Ink “magic mirror” for under $100
  • Build an e-paper to-do list with Raspberry Pi 2020
  • Raspberry pi e-paper dashboard with R. It works on Raspberry Pi zero and 4.2" e-paper with appropriate changes. The following provides a solution to create a slideshow on the epaper.
    # infinite loop; require many many times of Ctrl+C to stop the execution 
    while true; do for f in *.jpg; do echo $f; convert -monochrome -resize 400x300\! \
          $f screen-output.bmp; python3 display.py; done; done
    # 2 loops. Not stable even on the 1st iteration. 
    # The 'python3 display.py' may not do anything (according to ''htop'').
    for i in {1..2}; do echo iteration $i; for f in *.jpg; do echo $f; \
          convert -monochrome -resize 400x300\! $f screen-output.bmp; \
          python3 display.py; done; done
    # R. Works fine even with iterations
    for(i in 1:4) for(f in list.files(pattern = "*.jpg")) { 
      cat(f, "\n")
      system(paste("convert -monochrome -resize 400x300!", f, "screen-output.bmp"))

    Unfortunately the Chinese characters appear blurry compared to the ones generated from Python code.

    If we save the R script to a file, we can launch it by "Rscript XXXX.R" . We can send the job to the background (Ctrl+z, bg) and then quit the ssh connection.

  • E-paper Weather Display on 7.5 inch display. The code is simple. See my mod for 4.2 inch display. The free plan on openweathermap allows 60 calls per min.
  • WeatherBit.io is used by inxi -W command
  • SystemSix: a love letter letter to old Macs for your desk

2.7 inch

  • Test Waveshare ePaper (eInk) 2.7” inch 264×176 SPI screen on Raspberry Pi in Python. Refresh time 6s.
  • https://www.waveshare.com/wiki/2.7inch_e-Paper_HAT and github example. Five steps were needed to show a screen. 1. Reverse 2. White 3. Black 4. Reverse 5. Normal.
  • Raspberry Pi eInk Smart Screen still works (2024/1/7). wiringPI is not needed. Note that since I have changed my username, the "epaper-clock.service" file has to be modified to use the correct user/group and ExecStart path. If we messed up, we need to disable, stop, start, and enable the service. For some reason, the service throws an error (self.SPI = spidev.SpiDev(0, 0), FileNotFoundError: [Errno 2] No such file or directory) after reboot (not sure if it is related to my non-default username). So I need to ssh to it and run sudo systemctl start epaper-clock.service manually.
  • Clock and weather display for E-Paper 2.7 inch display from Waveshare for Raspberry Pi 3. The screen will refresh every minute (use CPU). It does work but the temperature is in C not F. To fix that, open "epaper.py" file, change the variable "DARK_SKY_UNITS" from "si" to "auto"; see Doc from darksky.net. The cpu and memory usage shown on the screen is different from what I saw from the result of 'htop' (over estimate). Note that darksky.net web information is incredible friendly already. Apple acquires Dark Sky weather app (3/30/2020).
    sudo apt-get install libjpeg-dev
    pip install -r requirements.txt
    chmod +x run.sh
    ./run.sh  # DO NOT ADD sudo
    # terminal will show messages from the code. For example, press button 4
    # [Button] Btn #4 pressed
    # [Button] Btn press handled.
    # App is shuting down.
    # Display shutdown icon ...
    # [Epaper] Display.
    # ... done.
    # calling exit 0
  • Once we put the program in a service, it is tricky to change the settings. It is best to stop the service before doing any change; sudo systemctl stop epaper.service . Then we need to delete all auto-generated *.pyc file; find . -iname "*.pyc" -delete. Now we can start the service again; sudo systemctl start epaper.service .
  • If the program was run through the service, press button 4 will shut down the code but the script will be launched again.
  • Understand the code. Search shutting_down, shutdown_hook, pressed keywords

4.2 inch

Waveshare ePaper 4.2 inch 400 × 300. Refresh time 4s. But it took 12.7 seconds to display a bmp file from my observation. The image does not disappear after one year without power:)

  • https://github.com/waveshare/e-Paper/tree/master/2.7inch_e-paper_code/RaspberryPi/python3 shows what software we need to install.
    sudo apt-get install python-pip 
    sudo pip install RPi.GPIO
    sudo pip install spidev
    sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
  • http://www.waveshare.net/wiki/4.2inch_e-Paper_Module. Click on 示例程序 to download 4.2inch_e-paper_code.7z.
    wget http://www.waveshare.net/w/upload/8/80/4.2inch_e-paper_code.7z
    mkdir 4.2inch_e-paper_code
    cd 4.2inch_e-paper_code
    sudo apt-get install p7zip-full
    # It seems the "e" option from 7za will not keep the directory structure properly
    # We need to use the "x" option.
    7za x ../4.2inch_e-paper_code.7z # https://superuser.com/a/379594
    cd RaspberryPi/python3
    Then follow the 用户手册/manual (useful) to install required software and run the demo. Note when installing the Pillow library (sudo pip3 install Pillow), I got an error: The headers or library files could not be found for jpeg. To fix the problem, try
    # The original instruction in the manual does not help
    # sudo apt install libopenjp2-7-dev 
    sudo apt-get install libjpeg-dev
    Don't forget to enable SPI (sudo raspi-config) before running "sudo python main.py". I actually got another error complaining font24 = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', 24). Follow the suggestion 2.13 epaper display problem and install the required font by sudo apt-get install fonts-wqy-microhei, I am able to run the demo program.
    In order to resize an image to 400x300 and monotone scale (see the last page of the manual), we can use
    sudo apt-get install imagemagick
    wget http://worldartsme.com/images/spring-charlie-brown-clipart-1.jpg -O spring.jpg
    convert spring.jpg -format bmp -resize 400x300! -monochrome 4in2_spring.bmp
    cp 4in2.bmp 4in2_original.bmp
    cp 4in2_spring.bmp 4in2.bmp
    sudo python3 main.py
    # notice the exclamation mark, "!". 
    # See http://www.imagemagick.org/script/command-line-processing.php#geometry


ESP32 E-Paper Weather Display


Dark Sky

Dark Sky Is Now WeatherKit, Android Apps Could Come Soon

Weather data: OpenWeatherMap