Page 1
Welcome! Thank you for purchasing our AZ-Delivery MG90S Micro Servomotor. On the following pages, you will be introduced to how to use and set-up this handy device. Have fun!
Page 2
Areas of application These servos are used in model building projects to provide precise control movements. They are suitable for applications where precise motion controls are required. Required knowledge and skills Installation and commissioning should be carried out by people with basic knowledge of model making or manual skills. Knowledge of handling control electronics and mechanical components is required.
Table of Contents Introduction....................3 Specifications....................4 The pinout.....................5 How to set-up Arduino IDE................6 How to set-up the Raspberry Pi and Python..........10 Connecting the servo motor with Atmega328p..........11 Sketch example..................12 Connecting the module with Raspberry Pi..........14 Libraries and tools for Python..............15 Python script....................16 - 2 -...
Introduction The MG90S is a small and light micro servo-motor that has aluminum metal gears, a coreless motor, a double ball bearing and a high power output. Servo motors can be commanded to go to a specific position and so are the...
How to set-up Arduino IDE If the Arduino IDE is not installed, follow the link and download the installation file for the operating system of choice. The Arduino IDE version used for this eBook is 1.8.13. For Windows users, double click on the downloaded .exe file and follow the instructions in the installation window.
Page 9
For Linux users, download a file with the extension .tar.xz, which has to be extracted. When it is extracted, go to the extracted directory and open the terminal in that directory. Two .sh scripts have to be executed, the first called arduino-linux-setup.sh and the second called install.sh.
Page 10
Almost all operating systems come with a text editor preinstalled (for example, Windows comes with Notepad, Linux Ubuntu comes with Gedit, Linux Raspbian comes with Leafpad, etc.). All of these text editors are perfectly fine for the purpose of the eBook. Next thing is to check if your PC can detect an Atmega328p board.
Page 11
If the Arduino IDE is used on Windows, port names are as follows: For Linux users, for example port name is /dev/ttyUSBx, where x represents integer number between 0 and 9. - 9 -...
How to set-up the Raspberry Pi and Python For the Raspberry Pi, first the operating system has to be installed, then everything has to be set-up so that it can be used in the Headless mode. The Headless mode enables remote connection to the Raspberry Pi, without the need for a PC screen Monitor, mouse or keyboard.
Connecting the servo motor with Atmega328p Connect the servo motor with the Atmega328p as shown on the following image: Motor pin Mc pin Wire color Black wire Red wire Orange wire Potentiometer pin Mc pin Red wire P2 (Center pin) Blue wire Black wire - 11 -...
Page 14
Use a potentiometer on pin A0 to command a servo attached to pin 3 to move to a specific position. The Servo MIN_VALUE and MAX_VALUE in the sketch can be adjusted to avoid hitting the servo stops. - 12 -...
Page 16
Upload the sketch to the Atmega328p and run the Serial Monitor (Tools > Serial Monitor). The result should look like as on the following image: - 14 -...
Connecting the module with Raspberry Pi Connect the module with the Raspberry Pi as shown on the following image: Module pin Raspberry Pi pin Physical pin Wire color Red wire GPIO2 Orange wire Black wire - 15 -...
Libraries and tools for Python To use the module with the Raspberry Pi, the library RPi.GPIO has to be installed. If the library is already installed, running the installation command only updates the library to a newer version. To install the library, open the terminal and run the following commands, one by one: sudo apt-get update &&...
GPIO.setmode(GPIO.BCM) GPIO.setup(servo_pin,GPIO.OUT) GPIO.PWM(servo_pin,50) # 50 Hz (20 ms PWM period) pwm.start(7) # start PWM by rotating to 90 degrees print('MG90S Micro Servo-motor script') print('[Press Ctrl + C to end the script!]\n') try: while True: pwm.ChangeDutyCycle(2.0) print('Rotating to 0 degrees') time.sleep(2)
Page 20
Save the script by the name mg90s.py. To run the script open the terminal in the directory where the script is saved and run the following command: python3 mg90s.py The result should look like as on the following image: To stop the script press ‘CTRL + C’ on the keyboard.
Page 21
Internet. If you are looking for the high quality microelectronics and accessories, AZ-Delivery Vertriebs GmbH is the right company to get them from. You will be provided with numerous application examples, full installation guides, eBooks, libraries and assistance from our technical experts.
Need help?
Do you have a question about the MG90S and is the answer not in the manual?
Questions and answers