The following are the components that we need:
Grove - OLED Display 0.96''
Grove - Branch Cable for Servo
Open your Wio Link App, sign in and connect to WiFi network, drag the “Generic PWM/Analog Output” to Digital0 port, and I can set PWM wave to control servo via “Generic PWM/Analog Output”. Then, drag the “OLED Display” to I2C port.Click “UPDATE”.
If you don’t know how to use Wio Link App, please visit “Hello world”tutorial.
I only have a 9V battery, but the micro servo only support 5V. So, I need to build a Voltage conversion circuit.
Here is power supply circuit:
The battery anode plug into “Input” port,and the canoed plug into “GND” port. Plug capacitors show in circuit. Now youcan convert the voltage from 9V to 5V.
There are three wires on the servo, the brown is GND, the red is Vcc and the orange is signal wire. Plug brown wire into GND, plug red wire into +5V output.
The orange wire connect to Digital0’s PWMsignal wire(the yellow one).Furthermore, the GND of Digital0 have to connect to the GND of servo.
The software part works with the “Temp & Humi IoT device” tutorial’s software part. I get and set data via specified URL.
Open the project file, copy the “Print a string in one line” API’s URL to SetScreenLine1(String h) andSetScreenLine2(String h) , and modify these parameters that show in following screenshot
Copy the “Output a PWM wave on specified IOwith specified frequency” API’s URL to GetFreq()andGetDuty().
Now, run the project , and the OLED screen
will show duty precent and frequency data.
Setthe duty precent and frequency of PWM wave let the motor rotate specifiedangle.