Your shopping cart is empty!
I2C Raspberry Pi Arduino - Controlling Servo Motor
- Idris Zainal Abidin
- 17 Oct 2018
- 456
INTRODUCTION
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.
VIDEO
This video will show you how to control a servo motor through I2C communication between Raspberry Pi and Arduino.
HARDWARE PREPARATION
Item used in the video.
- Raspberry Pi Zero WH (with Header)
- Maker UNO
- Servo Motor
- Maker pHAT
- Breadboard 8.5x5.5cm (400 Holes)
- Jumper Wire
SAMPLE CODE
This is the sample code for Arduino and Raspberry Pi used in the video.
Thank You
References
- Controlling an Arduino from a Pi3 using I2C
- i2c python documentation
- Raspberry Pi SPI and I2C Tutorial
- Master Writer/Slave Receiver
Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.