Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Solutions to Exercise 4: The I2C Bus and the SHT30 Temperature and Humidity SensorExercise 2: | ||||||||
Line: 30 to 30 | ||||||||
This looks good but ... When I take the SHT30 off the triple base, I still get the same result which is much less good! Looking into the mysht30.py code I see that by default pin 5 is used for SCL and pin 4 for SDA, which is not correct for our board! Now we have 2 options:
| ||||||||
Changed: | ||||||||
< < | Since We will use the driver only with the ESP32 WeMos D1 mini card, I decided for the first option. I also add the bus number (1) to make MicroPython use the ESP32 hardware interface to the I2C bus. SHT30 class initialization now looks like this: | |||||||
> > | Since We will use the driver only with the ESP32 WeMos D1 mini card, I decided for the first option. I also add the bus number (1) to make MicroPython use the ESP32 hardware interface to the I2C bus. SHT30 class initialization now looks like this: | |||||||
Line: 50 to 50 | ||||||||
Changed: | ||||||||
< < | This tells me that start() and stop() are not supported by the I2C driver on the ESP32. Looks like the I2C start and stop conditions have been integrated into the writeto() and readfrom() methods! Let's just remove those two calls: | |||||||
> > | This tells me that start() and stop() are not supported by the I2C driver on the ESP32. Looks like the I2C start and stop conditions have been integrated into the writeto() and readfrom() methods! Let's just remove those two calls: | |||||||
Line: 1 to 1 | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Added: | |||||||||||||||||||||||||||
> > |
Solutions to Exercise 4: The I2C Bus and the SHT30 Temperature and Humidity SensorExercise 2:This is an extremely relevant exercise because it shows typical work that must be done during an IoT project. Often code from other authors can be found on the Internet (e.g. github) but often you find problems with this. Maybe it is
A quick tryAfter having uploaded mysht30.py I simply copy the first example to a Python script and modify the import statement: and this is what I see when running it:Debugging the STH30 driverWell, this does not look good! So, let's have a look if the SHT30 is found on the I2Cbus. This is the code found in the sht30 README.md: and here is the result: This looks good but ... When I take the SHT30 off the triple base, I still get the same result which is much less good! Looking into the mysht30.py code I see that by default pin 5 is used for SCL and pin 4 for SDA, which is not correct for our board! Now we have 2 options:
Comments
|