Besides digital and analog interface through I2C, we can utilize it to control a PWM (pulse width modulation). Raspberry Pi runs Raspbian OS – which is not a real time operating system (RTOS). It is a bit difficult to produce fix PWM especially to control servo angle. Combination between Raspberry Pi and Arduino, can help to solve this problem. In this tutorial, we will show you how to communicate between Raspberry Pi and Arduino through I2C communication, thus controlling a servo motor.
This video will show you how to control a servo motor through I2C communication between Raspberry Pi and Arduino.
This is the sample code for Arduino and Raspberry Pi used in the video.