Servus from Munich/Germany

Moderators: rtenklooster, Voyager, BertB, Stuntteam

Post Reply
Message
Author
Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Servus from Munich/Germany

#1 Post by Uewel » 18 Jun 2018, 22:51

Hi all,

I'm dealing with ESP easy since 3 weeks or so. My brother gave me the crucial tip to look to this awesome project. Currently I have some ESP-WROOM-32 boards connected to a BME280 and do some testing with collecting temperature, humidity and air pressure in my flat. Only for fun and learning more about IoT. Until yesterday I have used the prebuild R20100 ESP32 image for my testing.

But I am a software developer. I would like to build my own image because I wanted to do some debugging in the Wifi-active-LED code parts, because the LED feature doesn't work with my boards. But there was an small issue in the ESP32 build which was posted in the Platformio forum. I'm very happy that I could help TD-er to get this working (again).

Maybe in future I can give support with software development.


Cheers,
Uwe

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Servus from Munich/Germany

#2 Post by TD-er » 18 Jun 2018, 23:58

And again a big thanks on your help today.

The I2C on ESP32 is currently as stable as a drunk guy on rollerblades.
But there is some patch out there I would like to try.
And then a lot more I2C plugins can be used on ESP32 also.

Welcome here :)

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#3 Post by Uewel » 19 Jun 2018, 12:00

@TD-er: Thank you!

I'm currently trying to get familiar with the SW structure and build environment. In the meantime I was able to get the latest build from yesterday working on my ESP32 board. The flash prodedure seems to be very fragile. Sometimes the board starts correctly after flashing and sometimes not. Sometimes the CRC checksum is ok and sometimes not. It seems to be much more stable if I erase the entire flash before re-flashing. Strange.

And in comparision to the "old" prebuild R20100 ESP32 image a lot of devices are not included (e.g. BME280). Is the unstable I2C the reason for this?

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#4 Post by Uewel » 19 Jun 2018, 12:05

Further modification in configuration are not saved.
E.g. I do the very first config of the AP over 192.168.4.1. After this the board connects to my access point and is accessible over my home wifi network. After reboot of the board all is gone and I must configure it again over 192.168.4.1.

But maybe I am doing something wrong ....

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#5 Post by Uewel » 20 Jun 2018, 14:01

I'm learning every day more and more about ESPeasy's sw structure.
So, my ESP32 board now works with a BME280 without obvious problems and shows it's wifi connection state via a blue LED. ;)

Now I need to setup git. Currently I'm doing modifications without source control. Maybe I can share some of my modifications in the future.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Servus from Munich/Germany

#6 Post by TD-er » 20 Jun 2018, 22:04

What did you do to get BME280 working?
On my setup the I2C stuff was really unstable.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#7 Post by Uewel » 21 Jun 2018, 08:02

For getting BME280 working with latest ESPeasy code I have (maybe naive) done the following 3 quick and dirty modifications:
- platformio.ini: remove ESPeasySoftwareSerial and EspESPeasySoftwareSerial from lib_ignore
- define_plugin_set.h: add a '#define USES_P028' in the PLUGIN_SET_GENERIC_ESP32 section
- ESPeasySoftwareSerial.cpp:ESPeasySoftwareSerial::rxRead(): Use register GPIO_STATUS_W1TC_REG for clearing interrupt on ESP32.

The last step was done to eliminate an compiler error, since ESP8266 uses here GPIO_STATUS_W1TC_ADDRESS (which is not available in ESP32).

As said before, it was only a quick and dirty test. I haven't checked it with the logic analyzer. But I get plausible values of temperature, humidity and air pressure periodically displayed in the devices section.

What kind of instability have you observed? Was it in context with a BME280-sensors? Or an other device?

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#8 Post by Uewel » 21 Jun 2018, 10:56

@ TD-er: Currently I'm sending my BME280 values testwise to ThingSpeak. Everything works fine. Every 60s a plausible value of all 3 measurements. I cannot see any problem until now. :shock:

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Servus from Munich/Germany

#9 Post by TD-er » 21 Jun 2018, 22:08

OK, so there is still hope ;) (or something has been fixed in the core lib)
I only got the OLED Framed plugin to work somewhat stable.
Based on your post, I flashed my ESP32 yesterday and connected the OLED Framed with 5 sec screen change interval and it is still running fine. :)

N.B. no controller is active yet, so almost no other interrupts occur.

I will try to add some more to see what happens.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Servus from Munich/Germany

#10 Post by TD-er » 21 Jun 2018, 23:16

Hmm, the BME280 I connected to the ESP32 is found with I2C scan, but as soon as I try to access it, the I2C bus seems frozen.
I2C scan does not find anything anymore and the OLED display stops.

When I remove the BME280 plugin and restart, all seem to work again.

Why did you enable the software serial? It is not needed for the BME280.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#11 Post by Uewel » 22 Jun 2018, 06:44

I assume your OLED display utilizes I2C? Maybe there is still a problem if more than one I2C devices are connected and used at the same time. I still have only one I2C device, the BME280, and this works fine.
I have ordered some BH1750 lightsensors. Hope they come today. The BH1750 driver was also on the lib_ignore list because of compiler errors. But there were only some casting issues. When I receive the light sensors I will take them into service together with the BME280 and continue my tests. If this works I could share my BH1750 modification.

I have enabled the software serial because I wanted to minimize the libraries from lib_ignore. Still uninformed for what it is for. ;) Probably this is not the reason why my BME280 seem to work.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#12 Post by Uewel » 22 Jun 2018, 06:47

I forgot to mention that I have initially also enabled 'SerialSensors' by removing it from the lib_ignore libraries.
Here my current lib_ignore:
lib_ignore = ESP8266WiFi, ESP8266Ping, ESP8266WebServer, ESP8266HTTPUpdateServer, ESP8266mDNS, IRremoteESP8266, ESPEasy_ESP8266Ping

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Servus from Munich/Germany

#13 Post by TD-er » 22 Jun 2018, 19:07

Those software serial lib is for serial communications like the Senseair CO2 sensor and some dust sensors and a few more.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#14 Post by Uewel » 22 Jun 2018, 22:37

Ok. So, this has also nothing to do with I2C..

Today I got the BH1750 light sensors. And now I understand what you mean with that instabilities. :roll:
If I have both (BME280 and BH1750) on I2C bus everything is instable. Sometimes I get values from the lightsensor and sometimes not. Sometimes the web interfaces hangs sporadically.
But when I remove the BME280 electrically and from configuration, the BH1750 seems to run stable.

So, from my current point of view it's problematic to have more than one sensor on one bus. That can cause troubles.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#15 Post by Uewel » 23 Jun 2018, 09:04

@TD-er: Have you added pullup resistors to your I2C lines? I'm currently not. I need to repeat my tests with pullups.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Servus from Munich/Germany

#16 Post by TD-er » 23 Jun 2018, 19:40

Yep, there are pull-up resistors present.
There is already a patch present for the I2C problems, but the current implementation may break present libraries using I2c.
I am currently looking into creating a specific PlatformIO platform, so we can use that to make the builds possible for anyone.
Other approach may be to create a pre-compile script to patch the sources of the used PlatformIO platform.

The main problem to me is that currently it is hard to make sure the platform is built again with patched sources.
It is like the Puya patches all over again.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#17 Post by Uewel » 25 Jun 2018, 09:19

Ok, I undestand.
Let me know, if I could support you with testing. Until now I'm not very experienced with git collaboration (using github). In my company we had our local/private and not web-based git environment.

Then I have ordered yesterday a SSD1306 display. Maybe it's not wrong to have something to display.... Although I have some IL9341 color displays. But they probably need too much RAM for the framing.

Btw, now I have also pull-up resistors. It works a lot more better now. But sometimes it hangs and the module is not sending values to ThingSpeak. Or values are accidentally completely wrong.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#18 Post by Uewel » 29 Jun 2018, 18:51

Now I have a OLED display and have the same effects like you, TD-er. The display works fine alone. As well as the BME280. But together there is no chance. The display will not be updated anymore after the BME280 was tried to be accessed. With BME280 + BH1750 together the problems was not so heavy.
Could you please give me a hint with the I2C patch you have mentioned? Probably I could try it in parallel. Thank you in advance.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Servus from Munich/Germany

#19 Post by TD-er » 30 Jun 2018, 19:42

You could try this fork: https://github.com/stickbreaker/arduino-esp32
It looks like it is being merged with arduino-esp32, since this branch has already been merged with the dev branch of them.
But as I understood, it will break the current implementation of the Wire class, so they may need some work to get it right.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#20 Post by Uewel » 01 Jul 2018, 22:53

Thank you. I will have a look on it tomorrow.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#21 Post by Uewel » 04 Jul 2018, 22:39

@TD-er: So, I have done a quick test and it looks very promising.
To get fast results I have done the following quick&dirty test by replacing the following 5 files from the stickbreaker fork you have mentioned in the framework tree (in my case framework-arduinoespressif32@1.4.0) in my .platformio folder:
\cores\esp32\esp32-hal-i2c.c
\cores\esp32\esp32-hal-i2c.h
\cores\esp32\esp32-hal-log.h
\libraries\Wire\src\Wire.cpp
\libraries\Wire\src\Wire.h
For ESP32 no further adaptions were needed. Currently I have only a ESP32 build.

And now I can display the BME280 values in the SSD1306 display. And the values are updates correctly within the configured time. Seems to work very stable since 1h (with 20 second update time).
I will do some further tests now with an 3rd I2C device (BH1750) on the bus.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#22 Post by Uewel » 05 Jul 2018, 16:06

With the 3rd I2C device (BH1750) it still seems to be ok. I get reasonable values from the two sensors and they will be displayed on the OLED display.

Btw, I've observed strange behavior when deepsleep is enabled. Sometimes my ESP32 doesn't wake up properly respectively it doesn't connect to my wifi network. In this state it cannot be accessed anymore and I have erased and reprogrammed the flash. Therefore for the moment my both ESP32 boards + sensors are running without deepsleep.

An other strange effect is, that the web page for ThingSpeak controller configuration is very slow and hangs very often. But with deactived I2C devices there is not difference. So, this is probably caused by something else.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Servus from Munich/Germany

#23 Post by TD-er » 09 Jul 2018, 23:29

Good to hear the stickbreaker patch is working.
I have had not so much time to work on ESPeasy last few days.
One of the things taking a lot of time was changing my living room, to make a proper dev-corner for me to work on ESPeasy :)
So I hope to be able to start dev'ing again very soon.

Uewel
Normal user
Posts: 16
Joined: 18 Jun 2018, 22:28
Location: Germany

Re: Servus from Munich/Germany

#24 Post by Uewel » 14 Jul 2018, 19:33

I'm currently on holidays and have also not much time for developing. :) But my environment is still running stable (with 3 I2C devices). So, the patch seems to fix the problems (for me).

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests