SlideShare a Scribd company logo
1 of 14
Download to read offline
マイコン講習
ー第3回ー
K.Miyauchi
2021.10.05
目次
・RCサーボモータ
・RCサーボモータの回転角制御
(c) K.Miyauchi 2
本講習で使用するもの
パソコン:Windows, Mac
開発環境:Arduino IDE
マイコン:Arduino Leonardo
その他,回路周りの物品
(c) K.Miyauchi 3
回路図
(c) K.Miyauchi 4
RCサーボモータ
RCサーボモータとは,
PWM信号を与えることによって,
信号のON幅に対応した角度に回転するモータ.
簡単な動作のものであったり,
趣味で使う程度であれば便利なモータではあるが,
回転速度を変化させることができないことや,
角度の精度をいじれないため,
複雑な制御をする場合には,
サーボモータは自作する方がよい.
※サーボモータ・・・ある目標値を与えたら,
その目標値に追従するモータのこと.
(c) K.Miyauchi 5
RCサーボモータ
(c) K.Miyauchi 6
制御端子
3ピンある
モータ本体
RCサーボモータ
(c) K.Miyauchi 7
内臓コントローラ
DCモータ
ポテンショメータ付き出力軸
減速ギア
RCサーボモータ
RCサーボモータを使うときには,以下のパラメータを確認しましょう.
・電源電圧(5V以外にも12Vのものなどもあるので注意)
・PWM信号電圧レベル(3.3Vなのか5Vなのか)
・PWM信号周期(16~20 msのものが多い)
・動作角度範囲(180° or 270°のものが多い)
・動作PWM信号ON幅範囲(0.5 − 2.5 msのものが多い)
(c) K.Miyauchi 8
RCサーボモータの回転角制御
RCサーボモータの回転角は、
前回にも説明したようにPWM信号で設定することができます。
𝜃 = 𝜃𝑀𝐴𝑋 ×
𝑇𝑂𝑁 − 𝑇𝑀𝐼𝑁
𝑇𝑀𝐴𝑋 − 𝑇𝑀𝐼𝑁
ただし、
𝜃:回転角
𝜃𝑀𝐴𝑋:最大回転角
𝑇𝑀𝐴𝑋:最大回転角時のPWM信号のON時間
𝑇𝑀𝐼𝑁:最小回転角時(基本的に0度)のPWM信号のON時間
𝑇𝑂𝑁:PWM信号のON時間
である。
(c) K.Miyauchi 9
RCサーボモータの回転角制御
右の回路を実装して,サーボモータの回転角を制御してみましょう.
dutyの値を変えて,90度や180度になるようにしてみましょう.
(c) K.Miyauchi 10
RCサーボモータの回転角制御
右の回路を実装して,Arduino拡張機能を使用して
サーボモータの回転角を制御してみましょう.
(c) K.Miyauchi 11
RCサーボモータの回転角制御
<拡張機能>
「Servo型」
RCサーボモータの制御をするためのクラス
制御角が0度から180度,
周期20msのサーボモータを制御することができる.
・attach(pinNum, dutyMin, dutyMax)
RCサーボモータの制御をするGPIOピンを設定するためのメソッド
pinName : ピン番号
dutyMin : 0度時のパルス幅[µs](省略可能)
dutyMax : 180度時のパルス幅[µs] (省略可能)
(c) K.Miyauchi 12
RCサーボモータの回転角制御
・write(angle)
サーボモータの制御角を指定した角度にするメソッド
angle : 角度[°]
(c) K.Miyauchi 13
演習
・部屋が暗いときに扉をロックするような仕組みを作りたい.部屋が
明るいときにサーボの回転角を90度とすることで開放,暗いときに
サーボの回転角を0度とすることでロックすることとした.センサ等を
使用して,実装せよ.
・シリアル通信でサーボモータの角度を制御できるようにしたい.
サーボモータの制御コードを0から1800の数値とし,コードの1/10の
角度に制御せよ.
例) 900 ⇒ 90度; 15⇒1.5度
(c) K.Miyauchi 14

More Related Content

Similar to 第3回電子制御講習

Iaetsd autonomous pick and place rover for long distance
Iaetsd autonomous  pick and place rover for long distanceIaetsd autonomous  pick and place rover for long distance
Iaetsd autonomous pick and place rover for long distance
Iaetsd Iaetsd
 
Design and Mechanism ofControlling a Robotic ArmIntroduction.docx
Design and Mechanism ofControlling a Robotic ArmIntroduction.docxDesign and Mechanism ofControlling a Robotic ArmIntroduction.docx
Design and Mechanism ofControlling a Robotic ArmIntroduction.docx
carolinef5
 
Rotary encoder training material
Rotary encoder training materialRotary encoder training material
Rotary encoder training material
Sáng Bùi Quang
 
Gsm robot with cctv camera
Gsm robot with cctv cameraGsm robot with cctv camera
Gsm robot with cctv camera
ashutoshsahu2908
 

Similar to 第3回電子制御講習 (20)

MOBILE CONTROLLED ROBOTIC ARM USING ARDUINO AND HC-06
MOBILE CONTROLLED ROBOTIC ARM USING ARDUINO AND HC-06MOBILE CONTROLLED ROBOTIC ARM USING ARDUINO AND HC-06
MOBILE CONTROLLED ROBOTIC ARM USING ARDUINO AND HC-06
 
Obstacle observing
Obstacle observingObstacle observing
Obstacle observing
 
Iaetsd autonomous pick and place rover for long distance
Iaetsd autonomous  pick and place rover for long distanceIaetsd autonomous  pick and place rover for long distance
Iaetsd autonomous pick and place rover for long distance
 
manufacturing and desighn of cnc milling machine
manufacturing and desighn of cnc milling machinemanufacturing and desighn of cnc milling machine
manufacturing and desighn of cnc milling machine
 
(11 16) rajiv g
(11 16) rajiv g(11 16) rajiv g
(11 16) rajiv g
 
Electronica mechatronic systems
Electronica mechatronic systemsElectronica mechatronic systems
Electronica mechatronic systems
 
Advanced robotics
Advanced roboticsAdvanced robotics
Advanced robotics
 
Mini CNC Plotter and Laser Engraver
Mini CNC Plotter and Laser EngraverMini CNC Plotter and Laser Engraver
Mini CNC Plotter and Laser Engraver
 
Microchip motor
Microchip motorMicrochip motor
Microchip motor
 
Design and Mechanism ofControlling a Robotic ArmIntroduction.docx
Design and Mechanism ofControlling a Robotic ArmIntroduction.docxDesign and Mechanism ofControlling a Robotic ArmIntroduction.docx
Design and Mechanism ofControlling a Robotic ArmIntroduction.docx
 
Rotary encoder training material
Rotary encoder training materialRotary encoder training material
Rotary encoder training material
 
How to make a Line Follower Robot
How to make a Line Follower RobotHow to make a Line Follower Robot
How to make a Line Follower Robot
 
Embedded system
Embedded systemEmbedded system
Embedded system
 
Arm
ArmArm
Arm
 
IRJET- Automatic Mini CNC Machine for PCB Drawing using Arduino
IRJET- Automatic Mini CNC Machine for PCB Drawing using ArduinoIRJET- Automatic Mini CNC Machine for PCB Drawing using Arduino
IRJET- Automatic Mini CNC Machine for PCB Drawing using Arduino
 
Design, Implementation and Control of a Humanoid Robot for Obstacle Avoidance...
Design, Implementation and Control of a Humanoid Robot for Obstacle Avoidance...Design, Implementation and Control of a Humanoid Robot for Obstacle Avoidance...
Design, Implementation and Control of a Humanoid Robot for Obstacle Avoidance...
 
F0554050
F0554050F0554050
F0554050
 
Design, Implementation and Control of a Humanoid Robot for Obstacle Avoidance...
Design, Implementation and Control of a Humanoid Robot for Obstacle Avoidance...Design, Implementation and Control of a Humanoid Robot for Obstacle Avoidance...
Design, Implementation and Control of a Humanoid Robot for Obstacle Avoidance...
 
OV7670 Camera interfacing-with-arduino-microcontroller
OV7670 Camera interfacing-with-arduino-microcontrollerOV7670 Camera interfacing-with-arduino-microcontroller
OV7670 Camera interfacing-with-arduino-microcontroller
 
Gsm robot with cctv camera
Gsm robot with cctv cameraGsm robot with cctv camera
Gsm robot with cctv camera
 

More from Koshiro Miyauchi

More from Koshiro Miyauchi (7)

第1回c#画像処理講習
第1回c#画像処理講習第1回c#画像処理講習
第1回c#画像処理講習
 
第2回c#画像処理講習
第2回c#画像処理講習第2回c#画像処理講習
第2回c#画像処理講習
 
第7回電子制御講習
第7回電子制御講習第7回電子制御講習
第7回電子制御講習
 
第5回電子制御講習
第5回電子制御講習第5回電子制御講習
第5回電子制御講習
 
第4回電子制御講習
第4回電子制御講習第4回電子制御講習
第4回電子制御講習
 
第2回電子制御講習
第2回電子制御講習第2回電子制御講習
第2回電子制御講習
 
第1回電子制御講習
第1回電子制御講習第1回電子制御講習
第1回電子制御講習
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 

第3回電子制御講習