[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-720827-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-720827-en":130,"doc-similar-720827":160},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","servopwmguide-sg90-9g-micro-servo-linux-pwm-guide-for-sg90-9g-micro-servo","ServoPWMGuide-SG90 9g Micro Servo - Linux PWM Guide for SG90 9g Micro Servo","","Servo & PWM Guide explains pulse-width modulation fundamentals (period and duty) and how PWM can be smoothed into an analog-like voltage using capacitors. It then walks through loading Linux PWM hardware via device tree overlays by editing /boot/uEnv.txt, installing bb-cape-overlays, and enabling BB-PWM0/1/2 overlays. It includes wiring notes for an SG90 9g micro servo and shows how to drive the servo from a Linux terminal using PWM interfaces. Command conventions for host and target boards are specified.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/servopwmguide-sg90-9g-micro-servo-linux-pwm-guide-for-sg90-9g-micro-servo/720827/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/servopwmguide-sg90-9g-micro-servo-linux-pwm-guide-for-sg90-9g-micro-servo/720827.png","ImageObject",300,407,{"name":42,"@type":43},"Logic","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-28","2026-11-18",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",5,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What are the two key parameters in PWM, and what do they control?","Question",{"text":63,"@type":64},"PWM is defined by the period (time between cycles) and duty cycle (percentage of the cycle the signal is high/low). Together they determine the waveform shape.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How do you enable PWM overlays on Linux using uEnv.txt?",{"text":68,"@type":64},"Install bb-cape-overlays, back up /boot/uEnv.txt, then edit /boot/uEnv.txt to add the relevant uboot_overlay_addr entries for BB-PWM0, BB-PWM1, and BB-PWM2 in the Additional custom capes section.",{"name":70,"@type":61,"acceptedAnswer":71},"How should PWM channel limitations be handled when channels share the same PWM hardware timer?",{"text":72,"@type":64},"For PWM channels sharing a PWM hardware timer (e.g., red and blue LEDs), the period cannot be changed independently. The guide directs users to review the relevant section for details.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},720827,1795039924,{"code":4,"msg":82,"data":83},"success",[84,88,92,96,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Exam",70,"exam",{"id":55,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":55,"slug":129},19,"General","general",{"code":4,"msg":82,"data":131},{"doc_id":79,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":110,"language":139,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":12,"update_tm":80,"read_time":117,"preview_page_count":33,"preview_urls":143},1099513958762,"https://ap-avatar.wpscdn.com/avatar/1000023916a998db790?x-image-process=image/resize,m_fixed,w_180,h_180&k=1784791008015729253","Servo & PWM Guide: SG90 9g Micro Servo  \nFor Linux Kernel 4.9.78-ti-r94 BeagleBone Firmware Image  \nby Catherine Riopel, Noel Riopel, Daniel Gomes Maia Filho-with additions and adaptations from Dr. Brian Fraser’s PWM Guide.  \nCreated: April 12, 2022  \nThis document guides the user through:  \n1. Loading PWM support.  \n2. Wiring and schematic of a SG90 9g Micro Servo.  \n3. Driving a SG90 9g Micro Servo via PWM from a Linux terminal.  \nTable of Contents  \n1. PW M Basics.....................................................................................................................................2  \n2. Load PWM Device Tree – Edit uEnv.txt...........................................................................................3  \n3. Servo Basics………………………………………………………………………………………………………………………….......4  \n4. Wiring the Servo………………………………………………………………………………………………………......……….….5  \n5. Linux PWM: Servo...........................................................................................................................6  \nFormatting:  \n1. Host (desktop) commands starting with (host)$ are Linux console commands:  \n(host)$ echo \"Hello world\"  \n2. Target (board) commands start with (bbg)$ :  \n(bbg)$ echo \"On embedded board\"  \n3. Almost all commands are case sensitive.  \n1. PWM Basics  \nPulse-width modulation (PWM) is a way of generating a digital wave form (think of a clock signal) . You can specify two main components of the digital wave form:  \n1. Period: How much time is there between the start of one cycle and the next. This is the time between rising edges of the wave form.  \n2. Duty: This is the percentage of the cycle which the signal is high (or low, depending on its configuration) .  \nTogether, these two parameters allow you to generate waves such as those shown in Figure 1.  \nIn some situations, an analog voltage is needed. A PWM wave can be used to create such a voltage by applying extra hardware (capacitors) to smooth out, or average out, the wave form. For example, when the signal is between 0 and 3.3V, a 50% duty cycle would average out to 1.65V (half of 3.3V) .  \nZen cape aside:  \nWe will not be utilizing the Buzzer nor the LEDs for this guide, but for reference, with the universal cape enabled, the PWM channels used by the Zen cape are listed below. Note that not all PWM channels are used by the Zen cape: some are unused on the BBG, and others are used by the HDMI hardware.  \n\n| Zen Cape Use | PWM Channel | BBG\u003Cbr>Pin | Linux Path | Notes |\n| --- | --- | --- | --- | --- |\n| Buzzer | PWM-0A | P9-22 | /sys/class/pwm/pwmchip0/pwm0/ |  |\n| Red LED | PWM-1B | P9-16 | /sys/class/pwm/pwmchip2/pwm1/ | Shares PWM hardware timer with Blue LED (PWM-1A) |\n| Green LED | PWM-2A | P8-19 | /sys/class/pwm/pwmchip4/pwm0/ |  |\n| Blue LED | PWM-1A | P9-14 | /sys/class/pwm/pwmchip2/pwm0/ | Shares PWM hardware timer with Red LED (PWM-1B) |\n\nNote that for PWM channels which share PWM hardware timers (red and blue), you cannot change the period of these channels independently. See Section 4 for more.  \n2024 Note from Dr. Brian  \nChanging uEnv.txt unnecessary; consult PWM guide.  \n2. Load PWM Device Tree – Edit uEnv.txt  \nLinux can learn about the PWM hardware in two ways, the universal cape, and the overlays in the device tree found in /boot/uEnv .txt. For this servo & PWM guide we will be utilizing device tree overlays. To load PWM overlays via uEnv.txt, do the following  \n1. Update the cape overlays:  \n\\# sudo apt-get update  \n\\# sudo apt-get install bb-cape-overlays  \no You must have an internet connection for this to succeed.  \n2. Ensure you have an up-to-date version (as of April 12, 2022):  \n\\# apt-cache show bb-cape-overlays Package: bb-cape-overlays  \nVersion: 4.14.20210821 .0-0~buster+20210821  \nArchitecture: armhf  \n....  \n3. Copy the current uEnv.txt file. This is necessary for recovering from anything going wrong!  \n\\# sudo cp /boot/uEnv.txt /boot/uEnv-BeforePwm.txt  \n4. Edit the uEnv.txt file to enable the PWM overlays  \n\\# sudo","cbCaimXulJoiEbL4","https://ap.wps.com/l/cbCaimXulJoiEbL4","pdf",925692,"English","# PWM Basics\n# Load PWM Device Tree - Edit uEnv.txt\n# Servo Basics\n# Wiring the Servo\n# Linux PWM: Servo","[{\"question\":\"What are the two key parameters in PWM, and what do they control?\",\"answer\":\"PWM is defined by the period (time between cycles) and duty cycle (percentage of the cycle the signal is high/low). Together they determine the waveform shape.\"},{\"question\":\"How do you enable PWM overlays on Linux using uEnv.txt?\",\"answer\":\"Install bb-cape-overlays, back up /boot/uEnv.txt, then edit /boot/uEnv.txt to add the relevant uboot_overlay_addr entries for BB-PWM0, BB-PWM1, and BB-PWM2 in the Additional custom capes section.\"},{\"question\":\"How should PWM channel limitations be handled when channels share the same PWM hardware timer?\",\"answer\":\"For PWM channels sharing a PWM hardware timer (e.g., red and blue LEDs), the period cannot be changed independently. The guide directs users to review the relevant section for details.\"}]","ServoPWMGuide-SG90 9g Micro Servo - Linux PWM Guide for SG90 9g Micro Servo | PDF",[144,148,152,156],{"page_no":22,"url":145,"width":146,"height":147},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/5fe5af995e1381b9e116598861fbbed0.webp",983,1272,{"page_no":26,"url":149,"width":150,"height":151},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/fbfc7b6c1bff9713e72a84c421833f65.webp",982,1270,{"page_no":30,"url":153,"width":154,"height":155},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/a3e9075e1e3766b97213720f9074ad60.webp",981,1269,{"page_no":33,"url":157,"width":158,"height":159},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/22f987ed36ad17ae37b6a015a6e41ca8.webp",980,1268,{"list":161,"token":11},[162,169,174,180,186,192,198,205,212,218],{"doc_id":163,"doc_title":164,"file_type":137,"home_preview_img_url":165,"slug":166,"view_count":167,"category_name":29,"create_tm":168},672234,"SG90 9 g Micro Servo - Datasheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988891256/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=NVUL9XegVQ%2FYxVE%2FoFpRYazKj2k%3D","sg90-9-g-micro-servo-datasheet",12,1793587370,{"doc_id":170,"doc_title":171,"file_type":137,"home_preview_img_url":172,"slug":173,"view_count":55,"category_name":29,"create_tm":168},672235,"SG90 TowerPro Micro Servo Motor - User Guide - Basic Technical Specifications & Arduino Control","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229989118525/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=q53hCK%2Bg1dzh55XJ66VuiV8kYs4%3D","sg90-towerpro-micro-servo-motor-user-guide-basic-technical-specifications-arduino-control",{"doc_id":175,"doc_title":176,"file_type":137,"home_preview_img_url":177,"slug":178,"view_count":33,"category_name":29,"create_tm":179},672236,"SG90 Servo Motor - Technical Datasheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229989118569/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=2MOBNdbW9YGJzeAMIJVcbyr759M%3D","sg90-servo-motor-technical-datasheet",1793587375,{"doc_id":181,"doc_title":182,"file_type":137,"home_preview_img_url":183,"slug":184,"view_count":101,"category_name":29,"create_tm":185},720825,"SG90 Servo - Overview, Wiring, and Performance Specifications","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230024408722/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=NXRF1%2FlyEm3IkWy7regwJNHuir4%3D","sg90-servo-overview-wiring-and-performance-specifications",1795039882,{"doc_id":187,"doc_title":188,"file_type":137,"home_preview_img_url":189,"slug":190,"view_count":55,"category_name":29,"create_tm":191},672240,"MG90S - Tower Pro Metal Gear Servo Specifications","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229989118683/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=KUnMSZh4oFn7TECVMpVwXIYciro%3D","mg90s-tower-pro-metal-gear-servo-specifications",1793587384,{"doc_id":193,"doc_title":194,"file_type":137,"home_preview_img_url":195,"slug":196,"view_count":110,"category_name":29,"create_tm":197},559220,"Electric Fence PWM Regulator - Technical Circuit Schematic","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229947577577/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=jVAAt6kRf4rT2uz1tVEgdS88rZI%3D","electric-fence-pwm-regulator-technical-circuit-schematic",1791800381,{"doc_id":199,"doc_title":200,"file_type":137,"home_preview_img_url":201,"slug":202,"view_count":203,"category_name":29,"create_tm":204},562201,"TL494 - PWM Power-Control Circuitry Overview - Dead Time and Output Control","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229947671863/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=HM9P%2FqnkJdJClzJZSbAE8nlwtpw%3D","tl494-pwm-power-control-circuitry-overview-dead-time-and-output-control",15,1791807997,{"doc_id":206,"doc_title":207,"file_type":137,"home_preview_img_url":208,"slug":209,"view_count":210,"category_name":29,"create_tm":211},559226,"PWM Regulator Circuit Schematic - Electrical Engineering Design","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229947577639/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=cJfLQ8gCRY4iJM1gV8VBOpnYD5s%3D","pwm-regulator-circuit-schematic-electrical-engineering-design",13,1791800386,{"doc_id":213,"doc_title":214,"file_type":137,"home_preview_img_url":215,"slug":216,"view_count":115,"category_name":29,"create_tm":217},689647,"TL493 - TL495 Pulse-Width Modulation Control Circuits - Data Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001780923/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=i9xOuOBgf1IjblBrqLIi2rQDGro%3D","tl493-tl495-pulse-width-modulation-control-circuits-data-sheet",1794118417,{"doc_id":219,"doc_title":220,"file_type":137,"home_preview_img_url":221,"slug":222,"view_count":223,"category_name":29,"create_tm":224},689643,"TL494 - Pulse-Width-Modulation Control Circuits - Datasheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001780872/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796184719&Signature=IUvHDnZur2GglIimf4yHugbOamQ%3D","tl494-pulse-width-modulation-control-circuits-datasheet",11,1794118384]