Editing SG90 Servo

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 2: Line 2:
 
'''In many computers the current is not enough to drive the servo!!!'''
 
'''In many computers the current is not enough to drive the servo!!!'''
  
'''If it does not work, keeps disconnecting, or rebooting the ESP the power is not sufficent and you need a capacitor ot an extra power supply.'''
+
'''If it does not work, keeps disconnecting, or rebooting the ESP the power is not sufficent and you need an extra power supply.'''
 
 
See the last section below ([[SG90 Servo#Power Issues]]) and the video for details how to do this.
 
  
 
= Schematic - Connecting the SG90 =
 
= Schematic - Connecting the SG90 =
Line 23: Line 21:
 
servoPin = Pin(5, Pin.OUT)
 
servoPin = Pin(5, Pin.OUT)
 
pwm =  PWM(servoPin, freq=50)
 
pwm =  PWM(servoPin, freq=50)
pwm.deinit() # workaround to reset PWM
+
pwm.deinit() // workaround to reset PWM
 
pwm = PWM(servoPin, freq=50)
 
pwm = PWM(servoPin, freq=50)
  
Line 56: Line 54:
 
   sleep(1)
 
   sleep(1)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
= Related Tutorial Videos =
 
== PWM Output: connecting a servo and and LED ==
 
 
<youtube>XovIHYo7s1A</youtube>
 
 
<!-- old video <youtube>_4bXk8JjQSk</youtube> -->
 
 
= Power Issues =
 
When connecting the servo to the ESP32 or ESP8266 it may not work at all, may restart at random times, or may move to a wrong angle. This is typically a power issue. The ESP-board is and the USB-output of the computer does not provide enough power.
 
There are two fixes: adding a big capacitor (e.g. electrolytic capacitor [[Elko]] 2000 uF) or adding an external power source (e.g. [[USB-Power]]). The external power source is the better solution.
 
 
Have a look at the video for details.
 
 
== Adding a Capacitor ==
 
 
[[File:PowerElko.JPG|400px]]
 
 
== Connecting an external Power Source == 
 
 
[[File:PowerUSB.JPG|400px]]
 
[[File:PowerUSB-module.JPG|270px]]
 
 
[[File:PowerUSB-setup.JPG|400px]]
 

Please note that all contributions to Sketching with Hardware at LMU Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see My wiki:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)