Having issues while running app.py

#6 · closed · 10 comments

View on GitHub ↗

BrahmaFarmsLLC

error# Traceback (most recent call last): File "app.py", line 15, in <module> bus = smbus2.SMBus(bme_pin) File "/home/pi/EnvironmentMonitor/.venv/lib/python3.7/site-packages/smbus2/smbus2.py", line 279, in __init__ self.open(bus) File "/home/pi/EnvironmentMonitor/.venv/lib/python3.7/site-packages/smbus2/smbus2.py", line 308, in open self.fd = os.open(filepath, os.O_RDWR) FileNotFoundError: [Errno 2] No such file or directory: '/dev/i2c-1' Code snippet -- # Configuration parameters bme_pin = 1 bme_address = 0x76 moisture_pin = 2 led_pin = 16 # Create the sensors bus = smbus2.SMBus(bme_pin) calibration_params = bme280.load_calibration_params(bus, bme_address) moisture_sensor = GroveMoistureSensor(moisture_pin)

Comments

jimbobbennett

Are you running the latest version of Raspbian Buster? Are you use the same hardware?

BrahmaFarmsLLC

Yes, I am using the latest version of Raspbian Buster on Pi3 On Sat, Mar 28, 2020 at 5:07 PM Jim Bennett <[email protected]> wrote: > Are you running the latest version of Raspbian Buster? Are you use the > same hardware? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/jimbobbennett/AgroHack/issues/6#issuecomment-605519592>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AONG7SFPONJQ7PMK74Y3KFLRJZRHZANCNFSM4LVTBTTQ> > . >

BrahmaFarmsLLC

Updated the I2c as suggested below, still having same issue. https://github.com/jimbobbennett/AgroHack/blob/master/Steps/SetUpTheEnvironmentMonitor.md#turn-on-the-i2c-interface

jimbobbennett

I get the issue if I2C is turned off. Turning it on and the problem goes away. Are you definitely turning it on using raspi-config?

BrahmaFarmsLLC

you are correct, just turned it on seems to resolve one issue this worked -- bus = smbus2.SMBus(bme_pin) now having issues with the below module calibration_params = bme280.load_calibration_params(bus, bme_address) Traceback (most recent call last): File "app.py", line 16, in <module> calibration_params = bme280.load_calibration_params(bus, bme_address) File "/home/pi/EnvironmentMonitor/.venv/lib/python3.7/site-packages/bme280/__init__.py", line 153, in load_calibration_params compensation_params.dig_T1 = read.unsigned_short(0x88) File "/home/pi/EnvironmentMonitor/.venv/lib/python3.7/site-packages/bme280/reader.py", line 40, in unsigned_short return self._bus.read_word_data(self._address, register) & 0xffff File "/home/pi/EnvironmentMonitor/.venv/lib/python3.7/site-packages/smbus2/smbus2.py", line 453, in read_word_data ioctl(self.fd, I2C_SMBUS, msg) OSError: [Errno 121] Remote I/O error

jimbobbennett

Have you plugged the sensor into the correct socket?

BrahmaFarmsLLC

I hope so, just followed the instructions that you have given On Sat, Mar 28, 2020 at 5:53 PM Jim Bennett <[email protected]> wrote: > Have you plugged the sensor into the correct socket? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/jimbobbennett/AgroHack/issues/6#issuecomment-605524464>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AONG7SAHK2LWK3MRIMJPID3RJZWURANCNFSM4LVTBTTQ> > . >

jimbobbennett

Just to double check - it's a Grove BME280 Temperature/Pressure/Humidity sensor, plugged in to the bottom left I2C socket. Bottom left being the I2C sockets are on the bottom, so it's the first socket. Are the cables in firmly on both sides?

anurag01a

Traceback (most recent call last): File "SoilTemperatureSensor.py", line 1, in <module> from sensors.BaseSensor import BaseSensor ModuleNotFoundError: No module named 'sensors' How to resolve this? The code is [here](https://github.com/microsoft/farmbeatsforstudents/blob/main/farmbeats-datastreamer/sensors/SoilTemperatureSensor.py).

jimbobbennett

@Anurag-0-1-A - that code is in a different project. Wouldn't it be better to raise an issue there?