pimoroni / inky Goto Github PK
View Code? Open in Web Editor NEWCombined library for V2/V3 Inky pHAT and Inky wHAT.
Home Page: https://shop.pimoroni.com/?q=inky
License: MIT License
Combined library for V2/V3 Inky pHAT and Inky wHAT.
Home Page: https://shop.pimoroni.com/?q=inky
License: MIT License
Hello!
I am looking to use an Inky as well as another device on SPI. Looking through your code, you use SPI bus 0, which for the Pi, only allows for SPI modes 1 and 3 (i.e. CPOL, CPHA = 0,1 or 1,1).
Is your device able to operate on bus 1, which only allows for SPI modes 0 and 2 (i.e. CPOL, CPHA = 0,0 or 1,0)?
Cheers!
I'm trying to get started with my Inky Impression display, and have flashed the Raspbian Minimal latest image using the Raspberry Pi flasher, then ran curl https://get.pimoroni.com/inky | bash
per the instructions on the store page, choosing to install the examples and documentation.
Upon doing so, rebooting, and manually enabling I2C as the script didn't actually enable it somehow, rebooting again and trying to run any of the example scripts other than the buttons and identify scripts fails.
When using Python2 and running from inky.auto import auto; disp=auto()
I do correctly get an inky_uc8159 object, but when I then call disp.setup()
(or indeed any other method that writes to the SPI bus) I get a TypeError: Non-Int/Long value in arguments
exception.
When using Python3 and attempting to run from inky.auto import auto
I get a UnicodeDecodeError
.
This happens reproducibly with the latest Raspbian Minimal and the setup script, using both the Impression and my existing Inky wHAT (for which this library worked the last time I used it around a year ago), on multiple Pi 3 boards.
Here is how it fails if you try to run "cycle" example for 7color (Inky Impression):
~/git/inky/examples/7color $ python3 cycle.py
Color: Black
Traceback (most recent call last):
File "cycle.py", line 16, in <module>
inky.set_border(color)
File "/home/tango/.local/lib/python3.7/site-packages/inky/inky_uc8159.py", line 369, in set_border
raise NotImplementedError
NotImplementedError
Is there any reason why the SPI speed is set so slow? The display controller supports up to 20MHz.
In inky_uc8159.py the color definition for Orange in the saturated palette is [77, 106, 73] (see line 44 of inky_uc8159.py).
These values are more greenish than orange.
I think there is a mistake in this RGB value.
I'm trying to install the python library for my brank new Inky pHat, but I get the following error with both the following commands:
curl https://get.pimoroni.com/inky | bash
sudo pip install inky
pi@raspberrypi:~ $ sudo pip install inky
Downloading/unpacking inky
Downloading inky-0.0.5-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib/python2.7/dist-packages (from inky)
Downloading/unpacking smbus2 (from inky)
Downloading smbus2-0.3.0.tar.gz
Running setup.py (path:/tmp/pip-build-Zm5bh7/smbus2/setup.py) egg_info for package smbus2
error in smbus2 setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
Complete output from command python setup.py egg_info:
error in smbus2 setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-Zm5bh7/smbus2
Storing debug log for failure in /root/.pip/pip.log
Any ideas? My Pi version:
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie
Hello! I'm encountering an issue when trying to display images on my Black/White Inky Phat.
I generate the image using PIL. I save it locally it looks good (see attached pic)
The way I save it is:
img.convert('P').save("test.png")
(If I don't convert it I get ValueError: cannot reshape array of size 66144 into shape (104,212)
When I load it with:
Image.open("test.png").convert('P')
The screen flashed and then stays white.
If I do the last step, but with pointing the path to the Inky Example image it works correctly.
How to I save correctly the image so that it works when I load it back?
On a windows desktop, it was possible to use install inky and use inky.mock to simulate an inky display.
Since spidev is a requirement for installing in more recent versions, and spidev is not available on windows, this is not possible anymore.
Is there an option to keep spidev optional or separate the mocking functionality/library from the actual implementation which needs spidev?
Can the examples be tweaked to allow '--color' and '--colour' as many engineers cannot type colour any more as they're immersed in US English ;)
I tried setting the border to red in one of the examples and found that it didn't work, only black and white work - is that expected?
Important EOL Notice: As of Thursday, Jan. 3, 2019, the weather.yahooapis.com and query.yahooapis.com for Yahoo Weather API will be retired.
To continue using our free Yahoo Weather APIs, use https://weather-ydn-yql.media.yahoo.com/forecastrss. Contact [email protected] for credentials to onboard to this free Yahoo Weather API service.
From yahoo
So it's me again, so I tried a clean reinstall with the script: curl -sSL https://get.pimoroni.com/inky | bash
the first few things get installed without any problem but then at some point i get this:
Checking for additional software...
python-geocoder is required
Installing python-geocoder...
E: Unable to locate package python-geocoder
Apt failed to install python-geocoder!
Falling back on pypi...
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting geocoder
Downloading https://files.pythonhosted.org/packages/4f/6b/13166c909ad2f2d76b929a4227c952630ebaf0d729f6317eb09cbceccbab/geocoder-1.38.1-py2.py3-none-any.whl (98kB)
100% |████████████████████████████████| 102kB 425kB/s
Collecting click (from geocoder)
Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
100% |████████████████████████████████| 92kB 552kB/s
Collecting ratelim (from geocoder)
Downloading https://files.pythonhosted.org/packages/f2/98/7e6d147fd16a10a5f821db6e25f192265d6ecca3d82957a4fdd592cad49c/ratelim-0.1.6-py2.py3-none-any.whl
Collecting requests (from geocoder)
Downloading https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl (61kB)
100% |████████████████████████████████| 71kB 550kB/s
Requirement already satisfied: six in /usr/lib/python2.7/dist-packages (from geocoder) (1.12.0)
Collecting future (from geocoder)
Downloading https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz (829kB)
100% |████████████████████████████████| 829kB 91kB/s
Collecting decorator (from ratelim->geocoder)
Downloading https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl
Collecting idna<3,>=2.5 (from requests->geocoder)
Downloading https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl (58kB)
100% |████████████████████████████████| 61kB 536kB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->geocoder)
Downloading https://files.pythonhosted.org/packages/9f/f0/a391d1463ebb1b233795cabfc0ef38d3db4442339de68f847026199e69d7/urllib3-1.25.10-py2.py3-none-any.whl (127kB)
100% |████████████████████████████████| 133kB 489kB/s
Collecting certifi>=2017.4.17 (from requests->geocoder)
Downloading https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl (156kB)
100% |████████████████████████████████| 163kB 410kB/s
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/lib/python2.7/dist-packages (from requests->geocoder) (3.0.4)
Building wheels for collected packages: future
Running setup.py bdist_wheel for future ... done
Stored in directory: /root/.cache/pip/wheels/8b/99/a0/81daf51dcd359a9377b110a8a886b3895921802d2fc1b2397e
Successfully built future
Installing collected packages: click, decorator, ratelim, idna, urllib3, certifi, requests, future, geocoder
Successfully installed certifi-2020.6.20 click-7.1.2 decorator-4.4.2 future-0.18.2 geocoder-1.38.1 idna-2.10 ratelim-0.1.6 requests-2.24.0 urllib3-1.25.10
python3-geocoder is required
Installing python3-geocoder...
and not only with the python3-geocoder
also with: python-beautifulsoup4, with python3-beautifulsoup4, with python-fonts, with python3-fonts, python-font_hanken_grotesk, python3-font_hanken_grotesk, and every other font too and also the python-wikiquotes and python3-wikiquotes
does anyone know why?
Looks like Yahoo have finally removed their weather api:
Traceback (most recent call last):
File "weather-phat.py", line 106, in
weather = get_weather(location_string)
File "weather-phat.py", line 71, in get_weather
res = requests.get(uri)
File "/usr/local/lib/python3.5/dist-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/adapters.py", line 513, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='query.yahooapis.com', port=443): Max retries exceeded with url: /v1/public/yql?env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&format=json&q=select%20%2A%20from%20weather.forecast%20where%20woeid%20in%20%28select%20woeid%20from%20geo.places%281%29%20where%20text%3D%22Sheffield%2C%20GB%22%29 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75320570>: Failed to establish a new connection: [Errno -5] No address associated with hostname',))
From developer.yahoo.com/weather:-
Important EOL Notice: As of Thursday, Jan. 3, 2019, the weather.yahooapis.com and query.yahooapis.com for Yahoo Weather API will be retired.
Is there another service that can be used instead?
I just got my Inky, and it took a bit of investigating to get it figured out. The documentation provided here is missing some important details, would be great if you could add them. Note, I was using Buster, I'm not sure of these errors aren't valid for previous versions.
Inky requires Python 3, it does not work on 2.
You need to install a whole bunch of external dependencies with
curl https://get.pimoroni.com/inky | bash
this is listed on https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-inky-phat, it would be nice to have them here too.
3. The code examples in the readme of this repo and on the above Pimoroni don't work - I get lots of errors of type
OSError: [Errno 2] No such file or directory: '/dev/i2c-1'
Hi,
I'm not able to run the quotes-what.py demo on my Raspbery Pi.
Running a fresh install raspbian latest, python 3, pip 3.
Issue is with installing wikiquotes
, doesn't seem libxslt/libxml2 is installed by default and I can't find a suitable package that works without it.
Output from Pi:
Running setup.py install for lxml ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-r071llkk/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-wex8tsge-record/install-record.txt --single-version-externally-managed --compile:
Building lxml version 4.3.2.
Building without Cython.
ERROR: b'/bin/sh: 1: xslt-config: not found\n'
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.5
creating build/lib.linux-armv7l-3.5/lxml
copying src/lxml/sax.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/builder.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/__init__.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/cssselect.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml
creating build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.linux-armv7l-3.5/lxml/includes
creating build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/__init__.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-armv7l-3.5/lxml/html
creating build/lib.linux-armv7l-3.5/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.linux-armv7l-3.5/lxml/isoschematron
copying src/lxml/etree.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/etree_api.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/lxml.etree.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/__init__.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-armv7l-3.5/lxml/includes
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-armv7l-3.5
creating build/temp.linux-armv7l-3.5/src
creating build/temp.linux-armv7l-3.5/src/lxml
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-6waWnr/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/usr/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
In file included from src/lxml/etree.c:687:0:
src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory
#include "libxml/xmlversion.h"
^
compilation terminated.
Compile failed: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitjm8no0xj.c -o tmp/xmlXPathInitjm8no0xj.o
/tmp/xmlXPathInitjm8no0xj.c:1:26: fatal error: libxml/xpath.h: No such file or directory
#include "libxml/xpath.h"
^
compilation terminated.
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
I just got a red inkyphat, and its red color seems very, very dark. After testing all of the available versions using sudo pip3 install inky==<versionnumber>
, I found that it looks really good with 0.0.4, but gets really dark with 0.0.5. See photos below.
Version info from the eeprom:
>>> inky.eeprom.read_eeprom()
Display: 212x104
Color: red
PCB Variant: 1.2
Display Variant: 1
Time: b'2020-08-05 11:15:15.7'
My test is based off of the simple hello world example:
#!/usr/bin/python3
from inky import InkyPHAT
from PIL import Image, ImageFont, ImageDraw
from font_fredoka_one import FredokaOne
inky_display = InkyPHAT("red")
inky_display.set_border(inky_display.WHITE)
img = Image.new("P", (inky_display.WIDTH, inky_display.HEIGHT))
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(FredokaOne, 28)
climacons = ImageFont.truetype("Climacons-Font/Climacons.ttf", 32)
climacons = ImageFont.truetype("Climacons-Font/webfont/climacons-webfont.ttf", 104)
draw.text((0, 0), "InkyPHAT", inky_display.BLACK, font)
draw.text((0, 40), "Version 0.0.5", inky_display.RED, font)
inky_display.set_image(img)
inky_display.show()
I've been reviewing this code to see how to control the display that I have (Inky pHAT Black/White/Red v2) and noticed what I think are some inconsistencies. Granted that some of my information is based upon my assumption that the display is using an SSD1675 controller, which could be wrong but all the other commands match.
Is gate driving voltage being set correctly? It seems that the two bytes should be ORed together instead of being sent as separate bytes.
Line 164 in b19641e
I think this command is missing the three data bytes. I note that they are present in the old library.
Line 170 in b19641e
I bough an inky phat, the product page showed a screen with two electrodes. After reading this blog post I knew it was the right one to purchase.
Though, when it arrived the screen only had only one electrode. Disappointed, I desperately searched for an hypothetical v3 I hadn't heard about in order to avoid returning my inky.
Eventually I found what I was looking for: "We now populate an EEPROM on each Inky display in order to store information about the type and resolution of each display, but our current approach to reading and acting upon that EEPROM is suboptimal, too." (issue#53)
Also, it works with the new library (this one) and refreshes pretty quickly around 10s instead of 15s as advertised (not complaining here).
Here are pics to show you what I'm talking about:
https://imgur.com/a/jsb53Yo
It's going to go through some intensive use so I'd like to avoid the v1. I'm a bit confused, could you confirm why one electrode and an EEPROM? v1 screen but v3 PCB?
Thanks in advance.
pi@raspberrypi:~/inky/examples/phat $ ./weather-phat.py -c yellow
Traceback (most recent call last):
File "./weather-phat.py", line 9, in <module>
from font_fredoka_one import FredokaOne
ImportError: No module named font_fredoka_one
Font error also occurs on name-badge.py
Is there a pip install missing?
Is there a definitive list of the pins required to use the Inky pHAT?
The inky module lists the following pins,
RESET_PIN = 27
BUSY_PIN = 17
DC_PIN = 22
MOSI_PIN = 10
SCLK_PIN = 11
CS0_PIN = 0
while pinout.xyz indicates the CS pin should be BCM8. The MOSI_PIN
and SCLK_PIN
variables also appear to be unused.
When I connected only the pins from the Python module (along with 3.3V and 5V power). Writing to the display hangs in _busy_wait
. When I connect the pins from the pinout.xyz page, there is no hang but the display is not changed.
Making a mistake in connecting the jumpers notwithstanding, are there more pins that need to be connected? Is there something I have missed?
curl https://get.pimoroni.com/inky | bash
doesn't currently install the smbus2 dependency needed to run the name-badge.py example. Can we get this included?
The error that the example generates suggests running sudo pip install smbus2
(even when using Python 3) but I needed to run sudo pip3 install smbus2
to grab the right version.
While reading the source for inspiration for an elixir port I'm contributing to, I found that there seems to be an unnecessary conversion of the pixels in the accent colour (currently, red or yellow) to bits, even though the screen might be black.
My question: Is it necessary to convert and transmit bits for red/yellow on black screens due to a quirk in the chip(s)/the implementation or can it be skipped?
The code in question: https://github.com/pimoroni/inky/blob/master/library/inky/inky.py#L278-L288
(sorry about the word-soup-y title 😬)
Though #2 appears to have resolved this some time ago, a fresh install on Raspbian Buster resulted in font errors when running the name-badge.py example script.
Install missing fonts via pip.
I did everything like in the "getting started" guide and when I use the examples I get expected outputs like " Hello... my name is:" and the description what is does. However on the device itself nothing happens, I only see the image that it arrived with. I have no Idea where to start looking for the problem
I have a Raspberry Pi Zero with a clean fresh install of the Raspbian image from April, so still with Stretch. I did nothing but update the locale to en-us and set the timezone. Then I install inky as described in the readme.md and it is successful. I try to create a script with only
from inky import InkyPHAT
inkyphat = InkyPHAT('red')
inkyphat.set_border(inky.RED)
inkyphat.show()
but when I try to run it I get the following error:
Traceback (most recent call last):
File "inky.py", line 1, in
from inky import InkyPHAT
File "/home/pi/inky/inky.py", line 1, in
from inky import InkyPHAT
ImportError: cannot import name InkyPHAT
I tried the same with the new Buster image, same issue. I updated both to the latest packages and kernel, same error.
I'd appreciate any hint on what stupid little thing I'm not seeing.
Is it possible to update only part of the screen?
The inky interface only seems to allow entire screen refresh. Would it be possible to update only part of the screen - even if this meant not using deep sleep this might make small updates a lot faster.
Had to edit lines 131 and 135
from (131)
img = Image.open("resources/backdrop.png")
to
img = Image.open("/home/pi/Pimoroni/inky/examples/phat/resources/backdrop.png")
and
from (135)
for icon in glob.glob("resources/icon-*.png"):
to
for icon in glob.glob("/home/pi/Pimoroni/inky/examples/phat/resources/icon-*.png"):
in order to run a crontab schedule of
*/10 * * * * python ~/Pimoroni/inky/examples/phat/weather-phat.py --colour "red"
as suggested in the getting started page on Pimoroni web
the PIL library is required by examples
also missing libraries required by examples: font_fredoka_one, font_hanken_grotesk, font_intuitive
All input images are interpreted as having a white-black-red palette. Unfortunately lots of software does not let you choose the palette order.
I worked around it like this, but it would be nicer to honor the palette instead. (Of course red should be yellow if you have the yellow version...)
img = Image.open("temp.png")
cR = [255, 0, 0]
cB = [0, 0, 0]
cW = [255, 255, 255]
palette_old = img.getpalette()
p_conv = {0: palette_old[0:3],
1: palette_old[3:6],
2: palette_old[6:9]}
# p_target = {0: cW,
# 1: cB,
# 2: cR}
new_pixdata = []
old_pixdata = img.getdata()
for pix in old_pixdata:
if pix not in p_conv:
print('Pixel out of range: {}'.format(pix))
new_pixdata.append(0)
elif p_conv[pix] == cW:
new_pixdata.append(0)
elif p_conv[pix] == cB:
new_pixdata.append(1)
elif p_conv[pix] == cR:
new_pixdata.append(2)
img.putdata(new_pixdata)
img.putpalette(cW + cB + cR) # Goal palette
I'm attempting to use Inky on my new WaveShare 2.13inch e-Paper HAT (B) but nothing shows up, just blank still.
I've installed everything and tried every example, but nadda. Is there a way for this to work? I want to leverage Inky for a pi-hole stats screen and from what I've read, this is very polished system and easy to use...
Using auto mode I get:
Traceback (most recent call last):
File "logo.py", line 44, in <module>
inky_display = auto()
File "/home/pi/.local/lib/python3.7/site-packages/inky/auto.py", line 10, in auto
raise RuntimeError("No EEPROM detected! You must manually initialise your Inky board.")
RuntimeError: No EEPROM detected! You must manually initialise your Inky board.
when I run it with the args is says it runs, but no display...
pi@raspberrypi:~/Pimoroni/inky/examples$ python3 logo.py --type "phat" --colour "red"
Inky pHAT/wHAT: Logo
Displays the Inky pHAT/wHAT logo.
pi@raspberrypi:~/Pimoroni/inky/examples$
Sorry, the title of the issue isn't very helpful, but I'm not sure what the error actually is.
I got through all the issues with Pil, and wikiquotes to get to the point of testing it using the quotes-what.py
example, but I haven't found a solution to this error:
$ python3 quotes-what.py --colour red
Inky wHAT: Quotes
Display quotes on Inky wHAT.
"Science and everyday life cannot
and should not be separated."
- Rosalind Franklin
Traceback (most recent call last):
File "quotes-what.py", line 165, in <module>
inky_display.show()
File "/usr/local/lib/python3.5/dist-packages/inky/inky.py", line 288, in show
self._update(buf_a, buf_b)
File "/usr/local/lib/python3.5/dist-packages/inky/inky.py", line 209, in _update
self.setup()
File "/usr/local/lib/python3.5/dist-packages/inky/inky.py", line 184, in setup
self._spi.open(0, self.cs_pin)
FileNotFoundError: [Errno 2] No such file or directory
For context, I'm on a raspberry pi zero w with the latest Raspbian Stretch Lite (Version: April 2019).
I'd appreciate any troubleshooting recommendations.
pip3 seems to install an old version of the Inky-Impression code (set_border still raises an exception).
I have just received an Inky Impression but it doesn't seem to be recognised at all. I have updated all software.
Hello, I recently purchased the red Inky pHat red (similar to use issue #58) however upon downloading the packages I am faced with a similar issue. There is one electrode on the front of module
I've attempted to print read_eeprom() but it returns None.
I honestly have no idea which display has been sent to me and I've contacted the supplier to try and shed some light on the issue.
The following fonts are required by the examples, and should probably be installed alongside the library:
The latter two need to be added to the Python fonts library
Installed via the one line curl/bash script.
Fully updated Jessie install (yes, I know i should upgrade, but it's the pi zero I had to hand that I've been using with the inkey pHat & the script does say it's supported...)
Running any of the examples/7color
code gives the following error:
$ ./clear.py
Traceback (most recent call last):
File "./clear.py", line 14, in <module>
inky.show()
File "/usr/local/lib/python3.4/dist-packages/inky/inky_uc8159.py", line 365, in show
self._update(buf.astype('uint8').tolist(), busy_wait=busy_wait)
File "/usr/local/lib/python3.4/dist-packages/inky/inky_uc8159.py", line 320, in _update
self.setup()
File "/usr/local/lib/python3.4/dist-packages/inky/inky_uc8159.py", line 217, in setup
self._spi_bus.no_cs = True
AttributeError: 'SpiDev' object has no attribute 'no_cs'
I've tried running with python 3.4.2 and 2.4.7
It looks like the required version of python3-spidev is installed:
aptitude show python3-spidev
Package: python3-spidev
State: installed
Automatically installed: no
Version: 2.0~git20150907
Priority: optional
Section: python
Maintainer: Stephen Caudle <[email protected]>
Architecture: armhf
Uncompressed Size: 56.3 k
Depends: python3 (< 3.5), python3 (>= 3.4~), libc6 (>= 2.4)
Description: Python bindings for Linux SPI access through spidev (Python 3)
Python module for interfacing with SPI devices from user space via the spidev
linux kernel driver.
Homepage: https://github.com/doceme/py-spidev
$ grep spidev inky.sh
SPIDEV3="python3-spidev_2.0~git20150907_armhf.deb"
...
Looks like no_cs
was added in 2016 so after the 20150907 build available on Jessie.
Happy for this not to be fixed for Jessie if it's not simple, the right answer might be to say that Jessie is not supported.
When trying to merge a port of my inky-cryptochart project to this newer inky library from the older inky-phat library, I noticed that both my Inky pHAT and my Waveshare E-Ink display HAT stopped working.
As stated in your project description, this library does not support the older red v1 revision. Is there a specific reason for it? Will I hit a wall if I try to port the driver to this library? I don't think these Inky pHATs are open hardware, but can you share the changes between the different revisions? Do they use a different display or driver chip?
Also, I noticed a feature/ssd1608
branch. Is this for a future revision?
smbus
wasn't installed automatically by the install script, it should include
sudo apt install python3-smbus
and sudo apt install python2-smbus
.
So I have installed everything on a clean Buster-Installation, i could clean the screen but as soon as i want to use the calendar-phat.py i get the following output:
_Inky pHAT: Calendar
Draws a calendar for the current month to your Inky pHAT.
This example uses a sprite sheet of numbers and month names which are
composited over the background in a couple of different ways.
Traceback (most recent call last):
File "calendar-phat.py", line 6, in
import calendar
File "/home/pi/Pimoroni/inky/examples/phat/calendar.py", line 85, in
text = Image.open(os.path.join(PATH, "resources/calendar.png"))
NameError: name 'Image' is not defined_
Does anyone knows why? This happened with every Installation i had. The other things also didn't worked. It actually bothers me a bit because I have no idea why it is happening
Edit: I tried to remove the backdrop.png from the original code by removing the lines 98 to 100 but you could guess, that also didn't work out because still nothing really wants to work ._. maybe someone can help and tell me a) how/why the error is getting up there and b) how to remove the backdrop.png properly from the calendar
The published package says the license is MIT. Would be good to have this reinforced by adding a LICENSE file to the repo as well.
Two (yellow) Inky Phats, multiple Pi variants (Pi Zero W 1.1, Pi 3B+, Pi 4B)
Main thread here:
https://forums.pimoroni.com/t/inkyphat-not-working/14667/14
Mounting pics here: https://photos.app.goo.gl/RagyP2RHYzHoe6Mw6
If someone can give me some debug help - something like i2cdetect but for SPI, or a way of directly interrogating the board would be handy so I can see what might be wrong here.
Possibly buster specific challenge, not tried with older OS versions.
Feature Request
I'm interested in using this library with the GPIO expander mode from a PC (https://www.raspberrypi.org/magpi/pi-zero-gpio-expander/). That way I could plug in the pi 0 with an inky phat display, update the inky display, and unplug. No OS required.
How hard would this be to port and use in that fashion?
Is there a repository for einky?
I'd like to be able to install it on non-raspberry-pi machines to test out code before putting it on a board, but the pip install requires rpi-gpio which seems to be a native module whose compilation fails locally.
The set_border
colour is not working as expected for me. Below is a simple program in which I would expect the border color to turn white, but it doesn't.
#!/usr/bin/python
from PIL import Image
from inky import InkyPHAT
display = InkyPHAT("black")
def get_filled_image (color):
img = Image.new("P", (display.WIDTH, display.HEIGHT))
for x in range(display.WIDTH):
for y in range(display.HEIGHT):
img.putpixel((x, y), color)
return img
img = get_filled_image(display.WHITE)
display.set_border(display.WHITE)
display.set_image(img)
display.show()
At first I thought this was some sort of hardware limitation, but while hacking around with the lookup tables I managed to get a pretty nice update that entirely fills the screen with black or white. To solve this, I created a new lookup table that, instead of drawing the correct black or white pixels in phase 3, just draws pure black or pure white pixels. The result is that the border finally turns white.
I recently wanted to migrate my application from Inky-wHat to Inky-Impression and noticed that you swapped the color-codes for white and black. In a pure python-world, that is ok because you can use symbolic constants. But I have a json-file to configure fonts and colors and this really hurts.
Very strange since all versions up to the impression use 0 for white and 1 for black. Any reason for this incompatibility?
The show()
method could use a skip_busy_wait
for people who want to stick to simple single-threaded code but do something else while the display is updating.
See: https://forums.pimoroni.com/t/is-it-safe-to-run-inky-phat-screen-writes-in-a-separate-thread/9969
Hey there! Having fun tinkering with my inky pHAT! I've been adding new lookup tables to get a custom update sequence and wondered:
One step in the default B&W sequence is "clear the buffer" which makes the screen go entirely white. Is there a similar command or hex code that would clear with black instead of clearing with white?
Currently my custom sequence does this:
I'd like to remove step 1 from this sequence to speed things up. To do this, I need a way to clear the screen with white or black.
It actually already seems possible to clear to white using 0b10100000
in the LUT, which could potentially remove step 1 in the context of a white background. However, another issue #12 is preventing me from doing that, as for whatever reason the clear operation is resetting the border to black. In the case of black background, I am close to being able to remove step 1, but I need a flag that says "clear to black" instead of "clear to white," if such a thing exists.
Any ideas? 😄
Thanks!
Right now for single shot display updates (name-badge.py
and logo.py
) we have an exit trap in the code that abuses input()
to prevent the script from exiting, without blocking Tkinter's UI thread.
Tkinter should have some way to deal with this already, so we should find a way to block exit until the user clicks close in the output window.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.