- WS-MG90S micro servo
- 2 x ITR8307
- Custom PCB
- Flat cables
- 2 leads wide
- 3 x 3 leads wide
- 4 leads wide
- pin header 1x4
- 3D printed parts
- baseBox
- baseBushing
- encDisc
- encDiscTurningMount
-
Order PCB using gerber, BOM and CPL files:
PcbDesignes/combined/manufacture/gerber.zip
PcbDesignes/combined/manufacture/jlcpcbPcbaBOM.csv
PcbDesignes/combined/manufacture/jlcpcbPcbaCPL.csv
-
Burn bootloader to PCB. The following instructions are for burning the bootloader using a Raspberry Pi.
(For burning the bootloader with a
stlinkv2
on windows, see stlinkv2 on windows. Also see bootloader programmer for pogo-pin connector for PCB programmer)Power PCB via USB from pi and connect:
Prog1:D (swdio) -> GPIO 25 Prog1:C (swclk) -> GPIO 11 Prog1:Reset -> 3.3v (GPIO nr are for a Raspberry Pi 3 B)
-
Install OpenOCD on the pi with this guide: https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/compiling-openocd
or using apt-get:
sudo apt-get install openocd
-
Download bootloader: https://github.com/adafruit/uf2-samdx1/releases/download/v3.13.0/bootloader-itsybitsy_m0-v3.13.0.bin
or latest from: https://github.com/adafruit/uf2-samdx1/releases
-
Put *.bin file in new folder on pi together with the file burnBootloaderWithOpenOCD.txt and rename the script file to
openocd.cfg
-
run:
cd \\|Insert name of folder on pi with the script sudo openocd
-
-
Print objects in PrusaSlicer project file
CadFiles/MicroServoMG90S/prusaSlicer.3mf
Print in black PLA:
baseBox.stl
baseBushings.stl
Print in white PLA:
encDisc.stl
encDiscTurningMount.stl
Modify the servo according to the Build Video
Build steps in video:
-
Disassemble the servo
-
The
encDisc
part has to be completely smooth and free from defects. Getting the required resolution out of a normal FDM 3D printer is basically impossible. So to get a smoothencDisc
part we first need to file it down while spinning it: -
Mount the smooth
encDisc
and gear on the motor axis -
Solder on a 3 lead wide flat cable to each of the two ITR8307 sensors. Make sure that the orientation of the sensors are mirrored
-
Mount the sensors in
baseBox
so that the LED segment (pin 1) of the sensors are oriented towards each other -
Solder the ITR8307 sensors and potentiometer to the PCB
-
Put
baseBushing
on the center axis of the gear box -
Insert motor into
baseBox
, solder motor connections to PCB and screw everything together -
Done
-
Power servo (5 volt) via pin header and connect to computer via micro USB
-
Run
python3 ./ArduinoSketch/configurationWizard.py
-
Create a new configuration file by clicking
Create new
, selectdefaultMG90S.h
as template, and choose communication node nr -
Transfer the initial configuration to the servo by clicking
Transfer to target
-
Select
Optical Encoder
to calibrate encoderCalibration example:
- Move servo to 100 deg and Lock position by clicking
Lock
- Set
Motor pwm value
to 320 - Set
Start motor pwm value
to 450 - Choose position resolution
Fine (~4 min)
orUltra (~8 min)
- Click
Start calibration
- Move servo to 100 deg and Lock position by clicking
-
Identify system parameters with
Pwm and system identification
Calibration example:
- Move servo to 100 deg and Lock position by clicking
Lock
- Set
Motor settle time
to 0.1 s - Set
Min motor pwm value
to 320 - Set
Max motor pwm value
to 1023 - Set
System model cycle time
to 0.6 ms - Click
Start calibration
- Move servo to 100 deg and Lock position by clicking
-
Calibrate motor position dependent disturbances with
Motor cogging torque
(optional)Calibration example:
- Click
Set advanced parameters
- Set
Control speed
to 32 - Set
Inertia margin
to 2.0 - Click
OK
- Set position resolution to
Standard (~3 min)
- Move servo to 100 deg
- Click
Start calibration
- Click
-
Calibrate nonlinearities in output potentiometer with
Output encoder calibration
(optional)Calibration example:
- Click
Set advanced parameters
- Set
Control speed
to 28 - Set
Inertia margin
to 1.8 - Click
OK
- Set position resolution to
Fine (~4 min)
- Move servo to 100 deg
- Click
Start calibration
- Click
-
To test the final configuration select
Test control loop