Bukit Mertajam, Penang

I2C Raspberry Pi Arduino – Controlling Servo Motor


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.

Sample Code

This is the sample code for Arduino and Raspberry Pi used in the video.

Thank You


  1. Controlling an Arduino from a Pi3 using I2C
  2. i2c python documentation
  3. Raspberry Pi SPI and I2C Tutorial
  4. Master Writer/Slave Receiver

Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.

Comments (1)


schematic please 🙂

Leave a comment