sarful
Published © Apache-2.0

Servo motor control using Raspberry Pi and BLYNK APP

In this tutorial, we will learn how to interface Servo motor with the Raspberry pi module and operate it with the Blynk app. and This proje

BeginnerFull instructions provided1 hour72
Servo motor control using Raspberry Pi and BLYNK APP

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1

Software apps and online services

Blynk
Blynk

Story

Read more

Schematics

Servo motor control using Raspberry Pi and BLYNK APP

Servo motor control using Raspberry Pi and BLYNK APP

Code

Code snippet #1

Plain text
import RPi.GPIO as GPIO
import blynklib
import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(11, GPIO.OUT)

p=GPIO.PWM(11,50)
p.start(7.5)

auth_token = 'vbKmyZo2zYFHe1GqoYbgDZk0n5RfsxYI'

# Initialize Blynk

blynk = blynklib.Blynk(auth_token)

@blynk.handle_event('write V0')
def write_handler_pin_handler(pin, value):
    Doorlock = (format(value[0]))
    if Doorlock =="0":
        p.ChangeDutyCycle(12.5)
        print("Door Locked")
    elif Doorlock =="1":
        p.ChangeDutyCycle(7.5)
        print("Door Unlocked")
try:
    while True:
        blynk.run()

except KeyboardInterrupt:
    print("Quit")

# Reset GPIO settings
GPIO.cleanup()

Credits

sarful

sarful

51 projects • 22 followers
I am Sarful , I am a Mechatronics Engineer & also a teacher I am Interested in the evolution of technology in the automation industry .

Comments

Add projectSign up / Login