Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
51fb08b
Reorganize the hardware to include the waveshare manuals
joaocolaco Aug 29, 2024
dd09e96
Updat einstruction for version 1.75 of BCM2835
joaocolaco Aug 29, 2024
ed699fa
Add the waveshare git as a submodule and link to lib
joaocolaco Aug 29, 2024
f665b11
Make the waveshare submodule be auto fetched
joaocolaco Aug 29, 2024
1c7199d
Updated spidev to be installed for python3
joaocolaco Aug 29, 2024
047cd31
Python venv support
joaocolaco Aug 29, 2024
f60d335
Update code to support PILLOW 10
joaocolaco Aug 29, 2024
db457d6
Update requirements
joaocolaco Aug 29, 2024
b0573cb
Cast image nparray type to uint8
joaocolaco Aug 29, 2024
c297298
Insert in the readme a note about the locales install
joaocolaco Aug 29, 2024
3f282a2
Typo correction
joaocolaco Aug 29, 2024
05087aa
Change the name for the test images
joaocolaco Aug 29, 2024
989afcb
Add support for multiple calendars
joaocolaco Aug 31, 2024
a18e66e
Will filter the dates after the current with icalevents
joaocolaco Aug 31, 2024
0f48936
Update the readme file
joaocolaco Aug 31, 2024
be5b4d4
Display weekends days in red
joaocolaco Aug 31, 2024
e2fce09
Test halftoned text
joaocolaco Aug 31, 2024
aea6d90
Filter the events before the current hour
joaocolaco Aug 31, 2024
283368b
Makes the aperture logo and images optional
joaocolaco Sep 1, 2024
87d9e8e
Makes the aperture logo and images optional
joaocolaco Sep 1, 2024
498e49a
Fiz merge text
joaocolaco Sep 1, 2024
5787526
Optimize fonts, calendar name on the bottom
joaocolaco Sep 1, 2024
7fa2a23
Bug fix (select event to the end date)
joaocolaco Sep 2, 2024
c79cc5e
Fixes font rendering
joaocolaco Sep 3, 2024
fa89dd3
Draws the calendar
joaocolaco Sep 4, 2024
9952235
Adjust Calendar
joaocolaco Sep 4, 2024
d6b8701
Holiday support
joaocolaco Sep 4, 2024
85132be
Update Readme file with the new setting FIRST_WEEKDAY_IS_SUNDAY
joaocolaco Sep 4, 2024
2c76362
Not show the calendar name when there is only one
joaocolaco Sep 5, 2024
a3fdb83
Weather
joaocolaco Sep 6, 2024
6cd81cd
Start support fo rWitty Pi L3V7
joaocolaco Sep 7, 2024
3c1b425
Change Tomorrow IO API
joaocolaco Sep 7, 2024
fd8e96c
Footnote for last update
joaocolaco Sep 7, 2024
68c80bd
Witty pi schedule support
joaocolaco Sep 8, 2024
f25be41
Start adding support for reading battery levels
joaocolaco Sep 9, 2024
aba586e
Draws batteries
joaocolaco Sep 9, 2024
1a9b50c
Custom battery icon for empty battery
joaocolaco Sep 11, 2024
34957f1
Bug fix when a calnedar has an error
joaocolaco Sep 13, 2024
9ef567f
weather emojis update
joaocolaco Sep 15, 2024
02790a1
New case supporting pi zero and a backcover
joaocolaco Sep 17, 2024
6812f0c
Fix a bug when there was no connection to weather
joaocolaco Sep 18, 2024
44f719d
Updated readme
joaocolaco Sep 18, 2024
d28ae87
Change settings to using lad/long
joaocolaco Sep 23, 2024
cec9459
Updated bill of materials.
joaocolaco Sep 23, 2024
38ade5b
Draw lines for each new calendar event
joaocolaco Sep 23, 2024
7bb5050
Correct the lines vertical placement
joaocolaco Sep 23, 2024
0cedd01
Improved the scheduling scripts and updated the readme
joaocolaco Sep 28, 2024
5d1603a
Change font height calculations
joaocolaco Sep 29, 2024
20d27de
Adjust vertical lines positions
joaocolaco Sep 29, 2024
3086a00
Fix a bug drawing calendar lines between days
joaocolaco Nov 1, 2024
7f43a9a
Pattern Draw for Calendar Lines
joaocolaco Nov 2, 2024
0c87bc2
Line weight of 1
joaocolaco Nov 2, 2024
137254a
increase line thickness
joaocolaco Nov 3, 2024
6ad8670
Merge branch 'calendar_lines'
joaocolaco Nov 3, 2024
7d254e9
Merge pull request #1 from 13Bytes/main
joaocolaco Nov 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ EXPORT-red.bmp
*.cache/*
settings.py
info.log
eInk_env/*
eInk_env/*
venv/*

4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "submodules/waveshare_e-paper"]
path = submodules/waveshare_e-paper
url = https://github.com/waveshareteam/e-Paper
fetchrecursesubmodules = true
191 changes: 155 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
<h3 align="center">Portal eInk Calendar</h3>

<p align="center">
A small desk-calendar with the theme of a <a href="https://store.steampowered.com/app/620/Portal_2/">portal</a> chamber info.
A small battery powered desk-calenda with the theme of a <a href="https://store.steampowered.com/app/620/Portal_2/">portal</a> chamber info.
<br />
It displays the current date, the next few events in your calendar and whether a person in your contact list has a birthday (inc. their name).
It displays the current date, the next few events from one or more calendars, the current weather, a rotating quote and whether a person in your contact list has a birthday (inc. their name).
<br />

</p>
</div>

Expand Down Expand Up @@ -48,7 +50,12 @@ The finished project on my desk:
The pie is displayed when a person in your contacts has a birthday (along with the name below it).
The other three icons are currently displayed randomly.

<p align="right">(<a href="#top">back to top</a>)</p>

### Battery
The device will power itself on regularly (by default 6/6h but this can be changed on the file `~/wittypi/schedule.wpi`) to update the screen and then shutdown, preserving battery life.

When battery is near depleting it will display a red empty battery icon on the upper left corner. On that state it will still power-up for a good number of cycles, but could be a good idea to charge the battery to preserve its health.

<p align="right">(<a href="#top">back to top</a>)</p>

Expand All @@ -62,11 +69,17 @@ I used the following hardware:
* [Waveshare 800×480, 7.5inch E-Ink display (13505)](https://www.waveshare.com/product/displays/7.5inch-e-paper-hat-b.htm)
* [Raspberry Pi 3b](https://www.raspberrypi.com/products/raspberry-pi-3-model-b/)\
(The Raspi is a bit overkill if you only want to update the calendar. But since it's powered on anyways, I use it to host many other things as well. If you only want to use it for the calendar, you should take a look at the Raspberry Pi Zero series)
<p align="right">(<a href="#top">back to top</a>)</p>

* [Witty Pi 4 L3V7](https://www.uugear.com/product/witty-pi-4-l3v7/)
* L3V7 Battery (Samsung inr18650-35e) and connectors, if needed, for the Witty Pi.
* [External panel button](https://www.amazon.es/dp/B09MBDMPDT) for for powering up and down.
* [External USB-C panel extension port](https://www.amazon.es/dp/B0D17K3CCY) for battery charging.


<p align="right">(<a href="#top">back to top</a>)</p>

<!-- GETTING STARTED -->

## Getting Started

### Prerequisites
Expand All @@ -79,23 +92,48 @@ The prerequisites are based on [this](https://www.waveshare.com/wiki/7.5inch_e-P
```
* Install BCM2835 libraries
```sh
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
tar zxvf bcm2835-1.60.tar.gz
cd bcm2835-1.60/
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.75.tar.gz
tar zxvf bcm2835-1.75.tar.gz
cd bcm2835-1.75/
sudo ./configure
sudo make
sudo make check
sudo make install
```
* Install wiringPi libraries
* sudo apt-get install openssl


* Install Witty Pi software

See instructions on the [product description](https://www.uugear.com/product/witty-pi-4-l3v7/) or in the [manual](https://www.uugear.com/doc/WittyPi4L3V7_UserManual.pdf), also available in the hardware section of this repository.

```sh
sudo apt-get install wiringpi
wget https://www.uugear.com/repo/WittyPi4/install.sh
sudo sh install.sh
```

This script will also install wiring pi so you can skip the next step.

#For Pi 4, you need to update it:
To update this software repeat these steps.

**Note:** When assembling the hardware, the Raspberry pi would only boot, when both the Witty Pi and the e-Paper driver HAT are connected, after installing this software.


* Install wiringPi libraries
They will allow the use of the `gpio` command, used all over the place by witty. The most current version can be found in the [github repo](https://github.com/WiringPi/WiringPi) in the [releases folder](https://github.com/WiringPi/WiringPi/releases).
Download:
```sh
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
wget [insert link to arm.deb file here eg: https://github.com/WiringPi/WiringPi/releases/download/3.8/wiringpi_3.8_arm64.deb]
sudo dpkg -i wiringpi-[insert file version here].deb
```


* Install the locales
```sh
sudo dpkg-reconfigure locales
```
Make sure that later in settings the locale is one of the selected here (and include the .utf8 if is in the name).

### Installation

Expand All @@ -108,46 +146,117 @@ The prerequisites are based on [this](https://www.waveshare.com/wiki/7.5inch_e-P
```sh
sudo apt-get update
# requirements by waveshare
sudo apt-get install python3-pip python3-pil python3-numpy RPi.GPIO python-spidev
sudo apt-get install python3-pip python3-pil python3-numpy RPi.GPIO python3-spidev
# requirements by this repo
sudo python3 -m pip install -r requirements.txt
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
#old: sudo python3 -m pip install -r requirements.txt
```
3. Create config-file
3. Create a config-file
```sh
cp settings.py.sample settings.py
```
Now edit `settings.py` and set all your settings:

`LOCALE: "en_US"` (or e.g. `en-GB.UTF-8`) Select your desired format and language.
It needs to be installed on your device (which 95% of time is already the case - as it's you system-language.
- `LOCALE: "en_US"` (or e.g. `en-GB.UTF-8`) Select your desired format and language.
It needs to be installed on your device (which 95% of time is already the case - as it's you system-language).
You can list all installed local-packages with `locale -a`.
If the desired one is missing, add it in this menu `sudo dpkg-reconfigure locales` (for Raspberry Pis) or take a look at the general [Debian Wiki](https://wiki.debian.org/Locale)).
Used for generate the text for the interface but also for selecting the holidays.

- `WEBDAV_CALENDAR_URLS The calendars to be displayed:
```python
WEBDAV_CALENDAR_URLS = [
{
"url": "webcal://...",
"calendar_name": "a name",
"is_apple": True,
"pattern_fill": "DIAGONALSTRIPESUPPERRIGHT",
"pattern_red_stripes": False
},
{
"url": "webcal://...2",
"calendar_name": "a name2",
"is_apple": True,
"pattern_fill": "VERTICALSTRIPES",
"pattern_red_stripes": False
},
]
```

Is a list of dicts, at least one must be filled, where the keys are:
- `URL` is the URL for the calendar (should be public)
- `calendar_name` is the name for displaying the calendar on the screen and
- `is_apple` is to indicate that Apple iCal is the provider of the url (solves some issues).
- `pattern_fill` can be BLACK, RED, VERTICALSTRIPES, HORIZONTALSTRIPES, DIAGONALSTRIPESLOWERRIGHT, DIAGONALSTRIPESUPPERRIGHT and will fill rectangle near the calendar appointments
- `pattern_red_stripes` when true a red color will be used in the striped patterns instead of white


`WEBDAV_CALENDAR_URL = "webcal://p32-caldav.icloud.com/published/2/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"` The address of your shared wabdav calendar. (It needs to be publicly accessible by this URL)

`WEBDAV_IS_APPLE = True` Is the calendar hosted on icloud?

`CALDAV_CONTACT_USER = "louis"` Username for logging into your CALDAV contact-list.

- `CALDAV_CONTACT_USER = "louis"` Username for logging into your CALDAV contact-list.

`CALDAV_CONTACT_PWD = "secret"` Password for logging into your CALDAV contact-list.
- `CALDAV_CONTACT_PWD = "secret"` Password for logging into your CALDAV contact-list.

`ROTATE_IMAGE = True` This will rotate the image 180° before printing it to the calendar. `True` is required if you use my STL, as the dipay is mounted upside-down.
- `APERTURE_DECORATIONS = True` Will show the aperture science decorations and logo. If false will hide them (and gain some space).

- `SHOW_QUOTES = True` Will show a random quote from [quotable.io](https://api.quotable.io).

- `ROTATE_IMAGE = True` This will rotate the image 180° before printing it to the calendar. `True` is required if you use my STL, as the dipay is mounted upside-down.

4. Add the start-script to your boot-process:\
(You might need to adapt the path `/home/pi/eInkCalendar/run_calendar.sh` acordingly)
- `FIRST_WEEKDAY_IS_SUNDAY = True` Will start the week in sunday on the calendar if true. Otherwise it will be Monday.

- `TOMORROWIO_API_KEY = "[insert api key here]" For accessing the weather please go to (tomorrow.io)[https://tomorrow.io/] register for a free account and insert the key here. When empty or commented will make not show the weather.

- `WEATHER_LOCATION = "53.551086,9.993682"` Location for weather forecast. Empty or commented so to not showing the weather. A latitude-longitude pair of numbers according to ISO 6709, separated by , in query parameters. See also [tomorrow.io api formats](https://docs.tomorrow.io/reference/api-formats#locations). Note: This example is for Hamburg DE.

- `TEMPERATURE_UNIT = "C" ` Temperature Units (can be C for Celsius or F for Fahrenheit)

- `RECHARGE_VOlTAGE = 3.5 ` Voltage when the device will notify for a recharge in Volts. 3.5V is about 25% of charge for the battery that I'm using (samsung inr18650-35e), but this will change. Please see your battery datasheet.


4. Configure Witty Pi enviroment (settings and scripts). Use the `wittyPi.sh`:
1. Configure the white blink light to disabled (to strong and repetitive).

2. Configure the Witty Pi so it won't boot when charging with `Auto-On when USB 5V is connected` to `No`. The default state of this device is off and it don't need to be power on to charge the battery:
3. Also on these settings choose `Synchronize with network time`and `Write RTC time to system`.

4. The software installs a webserver for configuring the Witty (the script ./wittyPi.sh seems to have the same functionality). The configuration for the server assumes that is installed in /home/pi/uwi, if not please change `~/uwi/uwi.conf`.

Note that if you don't want a "public" webserver without user access control you can **remove it** by running this command and restarting your device:
```sh
sudo update-rc.d -f uwi remove
```

Make `run_calendar.sh` executable
```sh
chmod +x /home/pi/eInkCalendar/run_calendar.sh
```
and add it to crontab, as follows:
```sh
crontab -e
```
and add following line:\
```@reboot sleep 60 && /home/pi/eInkCalendar/run_calendar.sh```

5. In the startup the witty pi script `afterStartup.sh` should run the `/home/<insert user here>/eInkCalendar/run_calendar_witty.sh` on the background with this line:

```sh
/home/<insert user here>/eInkCalendar/run_calendar_witty.sh &
```

This will run the `run_calendar.sh` script and wait to shutdown the computer.

Please make sure that the commands on all those scripts have the correct paths. The PATH environment is not defined when they run so the full path must be used. Check the paths on your system with `whereis <command>`.

6. Add the line `/home/pi<or other username>/eInkCalendar/run_calendar_witty.sh &` to `~/wittypi/afterStartup.sh`. Note the use of the amperstand in the end of the line to not block the startup process.

7. The script `~/wittypi/runScript.sh` has a bug described [here](https://www.uugear.com/forums/technial-support-discussion/locked-witty-pi-after-rescheduling-and-shutdown-on-slower-systems/), that can crash the system when shutting down on some slower systems. The fiz is described on the post. Also a fixed script is in the [Witty Pi folder](/hardware/Witty%20Pi%204%20L3V7/).

7. Create or change the `~/wittypi/schedule.wpi` and run `~/wittypi/runScript.sh`. This will create the schedule of startup and shutdown for screen refreshing. Use the file in schedule.wpi in the [Witty Pi folder](/hardware/Witty%20Pi%204%20L3V7/) or copy this:

```sh
BEGIN 2024-09-01 07:00:00
# Will not end (or at least in the following 40 years)
END 2064-09-01 07:15:00
#Will stay on 20 minutes (the displayRun.py has a timeout of 10 minutes for a network connection retry)
ON M20
#Will startup in about 6 hours (H6) in production.
OFF H5 M40
# For testing, allowing less time between boots, you can use the following line (after commenting the previous)
#OFF M15
```

<p align="right">(<a href="#top">back to top</a>)</p>

Expand All @@ -159,7 +268,7 @@ The STLs of the frame can be found in [hardware](https://github.com/13Bytes/eInk
It's designed for 3D-printing.
The two parts can be screwed together in three of the four corners.

The raspi is held in place by threaded heat set inserts.
The raspi is held in place by threaded heat set inserts (M2.5).


<img src="https://user-images.githubusercontent.com/12069002/150642718-5a24c717-1a19-4883-b932-1f1588f124fa.png" height=400>
Expand All @@ -170,6 +279,13 @@ The raspi is held in place by threaded heat set inserts.

## Questions

### The battery was dead and now the screen doesn't refresh, what can I do?
The clock is out of sync. Run the `wittyPi.sh`script, Synchronize with network time`, and `Write RTC time to system`.

### It doens't boot?
Witty Pi sometimes can crash on shutdown, especially after a RTC reset. You must try to disconnect it from its power sources: the USB cable and the battery. Then try to restart the pi.


Stuck somewhere? \
You can <a href="#contact">contact</a> me, or create a [issue](https://github.com/13Bytes/eInkCalendar/issues).

Expand All @@ -180,9 +296,12 @@ You can <a href="#contact">contact</a> me, or create a [issue](https://github.co

<!-- CONTACT -->
## Contact

Original Idea and Design:
Louis - [@Louis_D_](https://twitter.com/Louis_D_) - coding@13bytes.de

Original Idea and Design:
João - @joao - coding@colaco.me

<p align="right">(<a href="#top">back to top</a>)</p>


Expand Down
Loading