[SOLVED] Distance Sensor not working


#1

I have motors for wheels and distance sensor connected to the GoPiGo3 board. The motors are working fine but the code which involves distance sensor throws an error as shown below:
Distance Sensor init: [Errno 2] Opening I2C device: No such file or directory
Traceback (most recent call last):
File “E-Bot.py”, line 49, in
my_distance_sensor=gpg.init_distance_sensor() # Distance Sensor goes on A1
File “build/bdist.linux-armv7l/egg/easygopigo3.py”, line 881, in init_distance_sensor
File “build/bdist.linux-armv7l/egg/di_sensors/easy_distance_sensor.py”, line 37, in init
File “build/bdist.linux-armv7l/egg/di_sensors/distance_sensor.py”, line 28, in init
File “build/bdist.linux-armv7l/egg/di_sensors/VL53L0X.py”, line 116, in init
File “build/bdist.linux-armv7l/egg/di_sensors/dexter_i2c.py”, line 52, in init
File “build/bdist.linux-armv7l/egg/periphery/i2c.py”, line 58, in init
File “build/bdist.linux-armv7l/egg/periphery/i2c.py”, line 74, in _open
periphery.i2c.I2CError: [Errno 2] Opening I2C device: No such file or directory

Read_Info.py
Manufacturer : Dexter Industries
Board : GoPiGo3
Serial Number : 0F427793514E4C47324B2020FF050F19
Hardware version: 3.x.x
Firmware version: 1.0.0
Battery voltage : 4.163
5v voltage : 4.797


#2

I got the error solved. I2C was not enabled.


#3

It looks like the I2C bus has not been enabled.

Try updating DI_Sensors with this: curl -kL dexterindustries.com/update_sensors | bash

Probably unrelated to the issue above, but it looks like your power supply is inadequate. Whether running on USB power (as the case here) or battery power, the 5v voltage should be a little higher than 4.797. It should be at least 4.85v, but ideally 4.95v - 5.1v. I doubt it’s low enough to cause problems, but it’s probably pretty close.


#4

Thanks for the response


#5

This topic was automatically closed after 3 days. New replies are no longer allowed.