This post will list some of the common Raspberry Pi errors that I have encountered while building my Internet of Things (IOT) projects. This will include issues that arose while interfacing with sensors and the solutions I have figured out.
OSError: [Errno 121] Remote I/O error
I kept encountering the following error while working with an I2C LCD display together with other sensors like a Keypad and Servo Motor. Whenever I run my python code this error keeps on popping up for some unknown reason.
File "/home/pi/rpi_keypad_db_security_system/drivers/i2c_dev.py", line 104, in __init__ self.lcd_write(0x03) File "/home/pi/rpi_keypad_db_security_system/drivers/i2c_dev.py", line 127, in lcd_write self.lcd_write_four_bits(mode | (cmd & 0xF0)) File "/home/pi/rpi_keypad_db_security_system/drivers/i2c_dev.py", line 122, in lcd_write_four_bits self.lcd.write_cmd(data | LCD_BACKLIGHT) File "/home/pi/rpi_keypad_db_security_system/drivers/i2c_dev.py", line 74, in write_cmd self.bus.write_byte(self.addr, cmd) OSError: [Errno 121] Remote I/O error
I powered the LCD to the 5V pin of my Raspberry Pi GPIO. It turns out that not enough current is supplied by my raspberry pi charger. Powering this sensor or display with a separate power source will solve the issue. Just make sure that you connect the ground between your raspberry pi and your external source.
This could also be a case of bad connections or wiring between the GPIO pins and the I2C LCD getting cut. Replace the wires and validate.
Servo motor is not moving a full 180 degree
My servo is not moving the full zero to 180 degrees even if I have set the duty cycle according to the datasheet specification.
Please see the following link.
Servo motor is jittery
The servo motor appears to be jittery and is moving a lot or not staying in position.
I found the following solutions to work in my case. I am not sure if this will work out in your case.
In my code, if your servo motor does not need to move then setting the duty cycle to zero will keep the servo motor from jittering.
pwm = GPIO.PWM(servo_pin,50) pwm.ChangeDutyCycle(0)
Another solution is to power your servo motor from a different power source and not the raspberry pi. Just make sure to connect the ground of your external source with that of the raspberry pi.
These two solutions appear to have fixed my issues. Try it out yourselves and let me know if this does work.
I will keep updating this post to list down some of the common errors that I have encountered while working with my raspberry pi.
Stay Tuned! Happy Exploring!