Eink: Difference between revisions
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
= Waveshare = | = Waveshare = | ||
<ul> | |||
<li>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. | |||
<li>"sudo raspi-config" -> Interface Options -> I4 SPI -> Enable. | |||
<li>[https://www.hackster.io/sridhar-rajagopal/weather-station-with-epaper-and-raspberry-pi-c26a70 Weather Station with ePaper and Raspberry Pi] 2020 | |||
<ul> | <ul> | ||
<li>[https://github.com/waveshare/e-Paper/tree/master/4.2inch_e-paper_code/RaspberryPi/python3 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). | <li>[https://github.com/waveshare/e-Paper/tree/master/4.2inch_e-paper_code/RaspberryPi/python3 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). | ||
Line 72: | Line 75: | ||
|} | |} | ||
</li> | </li> | ||
</ul> | |||
<li>[https://github.com/aceisace/Inky-Calendar/blob/master/README.md E-ink calendar using a Raspberry Pi Zero] | |||
<li>[https://lemariva.com/blog/2019/08/raspberry-pi-e-paper-display-widgets Raspberry Pi: an E-Paper display with Widgets] Waveshare® 7.5" E-ink Screen. | |||
<li>[http://www.waveshare.net/shop/7.5inch-e-Paper.htm 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). | |||
<li>[https://waveshare-developmentkit.aliexpress.com/store/group/e-Paper-Display/216233_212201817.html?spm=2114.12010612.0.0.28bf6c53qbEYgj Aliexpress] | |||
<li>[https://liliputing.com/2019/05/you-can-build-a-diy-e-ink-magic-mirror-for-under-100.html You can build a DIY E Ink “magic mirror” for under $100] | |||
* [https://maker-tutorials.com/waveshare-e-paper-python-demo-code-raspberry-pi-3-installieren-raspbian/ Waveshare e-Paper python demo code to install on the Raspberry Pi 3 - raspbian eink] | |||
<li>[https://www.raspberrypi.org/blog/build-an-e-paper-to-do-list-with-raspberry-pi/ Build an e-paper to-do list with Raspberry Pi] 2020 | |||
<li>[http://blog.schochastics.net/post/raspberry-pi-e-paper-dashboard-with-r/ 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. | |||
<pre> | |||
# 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")) | |||
py_run_file("display.py") | |||
} | |||
</pre> | |||
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 [[Linux#job:_How_do_I_send_an_already-running_process_into_the_background|send the job to the background]] ('''Ctrl+z, bg''') and then quit the ssh connection. | |||
</li> | |||
<li>[https://github.com/AbnormalDistributions/e_paper_weather_display E-paper Weather Display] on 7.5 inch display. The code is simple. See my [https://github.com/arraytools/epaper_weather_pi mod] for 4.2 inch display. | |||
The [https://openweathermap.org/price free plan] on openweathermap allows 60 calls per min. | |||
</li> | |||
<li>[https://www.weatherbit.io/ WeatherBit.io] is used by '''inxi -W''' command | |||
<li>[https://www.raspberrypi.com/news/systemsix-a-love-letter-letter-to-old-macs-for-your-desk/ SystemSix: a love letter letter to old Macs for your desk] | |||
</ul> | |||
== 2.7 inch == | |||
<ul> | |||
<li>[https://diyprojects.io/test-waveshare-epaper-eink-2-7-spi-screen-raspberry-pi-python/ Test Waveshare ePaper (eInk) 2.7” inch 264×176 SPI screen on Raspberry Pi in Python]. Refresh time 6s. | <li>[https://diyprojects.io/test-waveshare-epaper-eink-2-7-spi-screen-raspberry-pi-python/ Test Waveshare ePaper (eInk) 2.7” inch 264×176 SPI screen on Raspberry Pi in Python]. Refresh time 6s. | ||
<li>https://www.waveshare.com/wiki/2.7inch_e-Paper_HAT and [https://github.com/waveshare/e-Paper/tree/master/2.7inch_e-paper_code/RaspberryPi github] example. Five steps were needed to show a screen. 1. Reverse 2. White 3. Black 4. Reverse 5. Normal.</li> | <li>https://www.waveshare.com/wiki/2.7inch_e-Paper_HAT and [https://github.com/waveshare/e-Paper/tree/master/2.7inch_e-paper_code/RaspberryPi github] example. Five steps were needed to show a screen. 1. Reverse 2. White 3. Black 4. Reverse 5. Normal.</li> | ||
<li>[https://github.com/emanueleg/rpi-eink-clock 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. | |||
<li>[https://github.com/Neophytez/raspberry-waveshare-clock-weather 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 [https://darksky.net/dev/docs#forecast-request 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 [https://darksky.net/details/39.1532,-77.0668/2019-7-16/us12/en darksky.net] web information is incredible friendly already. [https://www.macworld.com/article/3535217/apple-acquires-dark-sky-weather-app.html Apple acquires Dark Sky weather app] (3/30/2020). | <li>[https://github.com/Neophytez/raspberry-waveshare-clock-weather 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 [https://darksky.net/dev/docs#forecast-request 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 [https://darksky.net/details/39.1532,-77.0668/2019-7-16/us12/en darksky.net] web information is incredible friendly already. [https://www.macworld.com/article/3535217/apple-acquires-dark-sky-weather-app.html Apple acquires Dark Sky weather app] (3/30/2020). | ||
{{Pre}} | {{Pre}} | ||
Line 98: | Line 154: | ||
</li> | </li> | ||
</ul> | </ul> | ||
</li> | </li> | ||
</ul> | </ul> | ||
== 4.2 inch == | |||
[http://www.waveshare.net/shop/4.2inch-e-Paper.htm 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:) | |||
<ul> | |||
<li>https://github.com/waveshare/e-Paper/tree/master/2.7inch_e-paper_code/RaspberryPi/python3 shows what software we need to install.<syntaxhighlight lang='bash'> | |||
sudo apt-get install python-pip | sudo apt-get install python-pip | ||
sudo pip install RPi.GPIO | sudo pip install RPi.GPIO | ||
Line 107: | Line 168: | ||
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei | sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<li>http://www.waveshare.net/wiki/4.2inch_e-Paper_Module. Click on 示例程序 to download 4.2inch_e-paper_code.7z. <syntaxhighlight lang='bash'> | |||
wget http://www.waveshare.net/w/upload/8/80/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 | mkdir 4.2inch_e-paper_code | ||
Line 120: | Line 182: | ||
# sudo apt install libopenjp2-7-dev | # sudo apt install libopenjp2-7-dev | ||
sudo apt-get install libjpeg-dev | sudo apt-get install libjpeg-dev | ||
</syntaxhighlight> 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 [https://www.raspberrypi.org/forums/viewtopic.php?p=1427208 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. | </syntaxhighlight> 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 [https://www.raspberrypi.org/forums/viewtopic.php?p=1427208 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. <br> | ||
In order to resize an image to 400x300 and monotone scale (see the [http://www.waveshare.net/w/upload/a/a7/4.2inch-e-paper-module-user-manual-cn.pdf#page=26 last page of the manual]), we can use <syntaxhighlight lang='bash'> | |||
sudo apt-get install imagemagick | sudo apt-get install imagemagick | ||
wget http://worldartsme.com/images/spring-charlie-brown-clipart-1.jpg -O spring.jpg | wget http://worldartsme.com/images/spring-charlie-brown-clipart-1.jpg -O spring.jpg | ||
Line 131: | Line 194: | ||
# See http://www.imagemagick.org/script/command-line-processing.php#geometry | # See http://www.imagemagick.org/script/command-line-processing.php#geometry | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</ul> | </ul> | ||
= ESP32 = | = ESP32 = |
Latest revision as of 17:12, 7 January 2024
Resources
- https://twitter.com/hashtag/epaper
- https://github.com/topics/eink
- Using E Ink displays with a Raspberry Pi
- PaPiRus: ePaper Screen HAT for your Raspberry Pi
- Your next smart home device is a $30 used Kindle
- Share Messages via Kindle on Fridge
- 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)
- 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).
- 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")) py_run_file("display.py") }
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 usesudo 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
Misc
Dark Sky
Dark Sky Is Now WeatherKit, Android Apps Could Come Soon
Weather data: OpenWeatherMap
- https://openweathermap.org/api 1,000 API calls per day for free
- How to Fetch Live Weather Data Using Python Using Web Scraping OR OpenWeatherMap API
- PyOWM: Accessing Weather Data Through a Python Library