This project contains a few small tasks, including "hand-made" PWM generated by digialWrite(), this project should be taken after PJ026: The Dimmable LED with Arduino, the student should already have basic idea of Analog Output and PWM. Goals:
Consolidate Analog Output and PWM concept
Understand how a PWM signal is made to satisfy the servo motor, create "hand-made" PWM signal to drive a servo motor
Use Servo library to driver servo motor
START A BIT > Projects Library > This page
[ ] Simple: 30-60 minutes
[x] Moderate: 1-2 hours
[ ] Challenging: more than 2 hours
The estimation bases on average situation without unexpected troubleshooting, assuming that the student meets prerequisites. It only indicates rough time needed to complete this project, but not about technical difficulty, not covering discussion and sharing time.
One should have prior knowledge
1x Arduino UNO board (R3 revision or WiFi Rev2) , with USB cable
A few jumping wires
FS90 uses PWM as communication signal to get user input of the requested angle, and requires continuous PWM signal input to hold the angle
But it has specific requirement of how much on/off-time and cycle time, refer to FS90 Datasheet/specifications
analogWrite() doesn't work
We can "hand-make" the required PWM to drive FS90
Purpose: First experience to make a PWM that can be accepted by FS90
Read the codes as reference, write your own code and fix the red-marks to make a working result
Test and analyze how it works
Change line 7 for different values, if we want to go to 30 degrees, what value should be for on_time_us?
Purpose: Based on Task 1, get user input to get required angle to go, consolidate PWM concept
Read the codes as reference, write your own code and fix the red-marks to make a working result
Test and analyze how it works, input from serial
500
900
1500
2100
2500
What will happen if we input < 500 or >2500?
If we want to get user input as degrees to go, but not the milliseconds that doesn't mean so much for user, how to improve the code? Tips:
on_time_us = map(input_angle, 0, 180, 500, 2500);
Purpose: Try to use the ready-made Servo library
Just try out 2 examples here, observe the working result, find out the difference between hand-made PWM and Servo library
How does Servo lib know our servo motor requires 500-2500 us to map 0-180 degrees?
Example 1: Swiping
Example 2: Go to requested angle
Purpose: Enhance basic knowledge understanding, reflect and summarize what we have learnt
What is analog output?
What is the required PWM signal to drive FS90 servo motor?
How to use Servo library, tell us with your understanding
Take 1-2 minutes to explore anything on the tools and the making flow, with curiosity, no matter how much prior knowledge you have, you should make
At least 1 interesting finding
At least 1 curious question
Used by LP2536.A: PWM Output, 25w36