EnviroPlus Assistance

Excellent! Thanks mate

This looks awesome! I would really like to try this with my Enviro+. Can you share this project?
Thank you!

Greetings

The program for Enviroplus belongs to nophead,enclosed is the link to his github page https://github.com/nophead/EnviroPlusWeb
Have been having loads of fun experimenting with the Enviroplus
Tom

Hello there:
I installed the enviroplus web and receive the following error:
pi@raspberry1:~/EnviroPlusWeb $ sudo python3 app.py
Traceback (most recent call last):
File “app.py”, line 77, in
smallfont = ImageFont.truetype(path + “/Asap/Asap-Bold.ttf”, 10)
File “/usr/lib/python3/dist-packages/PIL/ImageFont.py”, line 280, in truetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File “/usr/lib/python3/dist-packages/PIL/ImageFont.py”, line 145, in init
layout_engine=layout_engine)
OSError: cannot open resource

When I look at the source code, the following folder does not exist:
enviroplus-python/examples/fonts

note: I am using the instructions from the latest issue of magpi

It seems Pimoroni have removed the font.

Try

from PIL import ImageFont
from fonts.ttf import RobotoMedium as UserFont

and change the smallfont line to:

smallfont = ImageFont.truetype(UserFont, 10)

That was recommended to me by another user but I haven’t tried it yet.

I did find a temp solution.
I created the fonts/Asap folders and downloaded the font from

I can get my PC to show the dashboard but the LCD is just static.

The LCD should start displaying after 5 minutes.

While nophead’s work looks awesome i’m less interested in the effects my lentil dahl is having on my household environment and much more interested in the outside environment and pollution in my area.

What the best way to do this? remotely run wires from an internal pi to the outside or put the whole lot outside pi and hat? either way i imagine volt drop might become an issue? sure somebody must have done it before?

I have one in Tenerife inside a utility cupboard / shed with a louvred door under a pergola. So it is pretty much outdoors but well protected and there is power.

In the UK I have it in my garage. It still sees car pollution for there.

To avoid problems with voltage drop you could use 12V and have a buck converter at the RPi end to make 5V.

Cool thanks for the feedback ( loved your CD changer back in the day), so something like a ATX power supply in the garage , 12v cabling out to the pi and step down ,somehow into the go?

Yes I have used Drok branded buck converters to run an RPi3 from 12V in a 3D printer. You don’t need anything as hefty as an ATX because the current goes down with a buck converter. If the RPI takes 2A at 5V it will take less than an amp at 12V.

If you do use an ATX be sure to add a fuse between the 12V output and your cable.

I have the basic program working and thanx for your work.
I am more interested in plotting the results from the PMS5003, rather than temp, pressure, etc. To do this, is it the index.html file that I would modify?

Yes I think if you remove elements from the items array it will plot less on the graph.

Helpful comment here nophead but…I can’t get a Windows 10 laptop that logs into the Raspi to show the diagram of data being collected.

Putting your data in my app.py now works displaying the words that are shown in the Magpi 92 article on p. 68 on lowest LHS. These are the words:

sudo python3 app.py is what is run and the output is:

  • Serving Flash app “app” (lazy loading)
  • Environment: production
    WARNING: Do not use the development server in a production environment
    Use a production WSGI server instead
  • Debug mode: off

Exactly as expected and the app stays open all the time and the tiny Enviro+ screen on the Enviro+ shows all the readings that are constantly changing. Also nothing else can be done on the Raspi as it is still in that application. So it is working.

But when I then contact to that Raspi from my Windows 10 laptop the Enviro+ diagram is not displayed as it says it should be.

I am surprised at what the Magpi 92 p.68 section 06 states. Just connecting from a laptop to the Raspi running Envirio+ automatically displays that diagram, I obviously want that to work as the diagrams that can be easily be adjusted are magnificent.

Any ideas?
Geoff

I had no idea my software was featured in Magpi, I have never read it!

What do you see when you point a web browser to the ip address of the RPI?

An idiot, that’s me, had thought I had to remotely log in to the RasPi from a Windows laptop!

Your comment made me realise I simply must point a web browser to the IP address.

I did this in Google on the Windows 10 laptop:

192.a.b.c (using my nos for a, b and c, of course)

Then it immediately opened up Enviro+
and after 5 mins all the data is there on the diagram!!!

I really appreciate your statement and I feel a real fool despite having conducted IT since 1968.

Excellent to see your comments and your really quick replies.

Thanks nophead.

Geoff

Experiences I have used to get EnviroPlusWeb working properly at last.

Yet again, I completely, rebuilt EnviroPlus with PM5003 from scratch on a new 32GB microSDHC from SanDisk.

I installed Rasbian Buster (full) on 10 May 2020 from RasPi website.

I also immediately updated it with sudo apt update

I ensured that enabled were SSH and i2c.

I did all the steps (as before) that were written in MagPi 92 (Apr 2020), pp 66-69.

I then ran activities:

EnviroPlus Activities

enviroplus-python

cd examples

python all-in-one.py

Worked. Could run all applications in enviroplus-python/examples. Very Good.

EnviroPlusWeb activities

Then I installed EnviroPlusWeb

cd

git clone https://github.com/nophead/EnviroPlusWeb.git

Tried to run

cd EnviroPlusWeb

sudo python3 app.py

the last line gave this error about BM280 not able to access i2cdevice. “No module i2cdevice”

Here is a screen capture of what that said:

Table 1
image
Notice as well in Table 1, that after the failure, I typed in i2cdetect –y 1

It shows all of the i2c items: 23, 49 and 76.

I, then, looked at the files as follows:

Python 2 is using i2cdevice and the only place where it is located on the Raspbian from a search is:

Table 2
image
That is, i2cdevice is inside the python2.7 directory

/usr/local/lib/python2.7/dist-packages/i2cdevice-0.0.6-py2.7.egg/ i2cdevice

It is not inside the python3.7 directory.

This is why in Table 1 above, using python3 leads to it not being able to find i2cdevice.

Here is the structure of the /usr/local/lib/python3.7:

/usr/local/lib/python3.7/dist-packages/pimoroni_bme280-0.0.2-py3.7.egg/bme280/init.py

So I, fundamentally, changed to running EnviroPlusWeb using python2 instead of python3

i.e.

cd EnviroPlusWeb

sudo python2 app.py

Initially, it flagged as often discussed before in this discussion group that was solved on April 2 2020 by nophead in EnviroPlus Assistance:

(EnviroPlus Assistance section 44/56.)

Here is what he said:

“It seems Pimoroni have removed the font.

Try

from PIL import ImageFont

from fonts.ttf import RobotoMedium as UserFont

and change the smallfont line to:

smallfont = ImageFont.truetype(UserFont, 10)”

I inserted that and now it’s working perfectly with python2 instead of python3. Hurrah!

Even adding the standard crontab –e entry works properly after reboots.

I just added this line to crontab –e

@reboot sudo python2 /home/pi/EnviroPlusWeb/app.py &

(from Magpi 92 article Section 08 pp 68-69)

Every time, I link from my laptop using putty, to log into the Raspberry Pi that is running Enviro+ software, I can then issue a sudo reboot to the Raspberry Pi. After reboot the Enviro+ display is always visible at any time from a laptop that simply uses Internet Explorer to issue Raspberry Pi’s IP address (e.g. . 192.168.n.m )

Summary questions

1: Why is the i2cdevice not in the correct place for running python3?

2: Why has the file EnviroPlusWeb/app.py not yet been corrected to solve what that expert nophead found a month ago?

Could Pimoroni /Raspi staff update a solution to these issues? This would influence ongoing sales of Enviro+ kits I believe.

Overall, I totally support advice and comments from alphanumeric and nophead that have quickly advised solutions to me and others.

Geoff

  1. Libraries for Python 3 need to be installed with pip3. So pip3 i2cdevice would probably fix it.

  2. I haven’t got around to changing it because to test it would require me so stop my system and reinstall the latest Pimoroni library. It was probably a mistake to base my code on an examples library as Pimoroni keep changing things with no regard for backwards compatibility. As they are examples why would they?

What I really should do is make an installation procedure that is independent of the Pimoroni stuff and document it.

I doubt Pimoroni / Raspi staff are interested in my personal project. The Magpi article gives the impression it is an official solution but it is just my personal project that I announced to people in this forum.

Hello,

I’ve been playing with the Enviro+ board and the examples for a while. I recently discovered EnviroPlusWeb and have been playing with it. I am unfamiliar with Python and would like to change the units from Metric to Imperial for the temperature and pressure. Would anyone be willing to help me with this? Also, would it be possible on the graph to “hover over” a vertical line and have it pop up with the values of that time?

Thanks!

Hi Tor,

If you have everything running on the Pi, I would really like to now how you did this. Do you share your project on GIT?