This part has a page of its own, with a note on using it and a circuit to try: the part page.
The signal is the same as every hobby servo's: a pulse fifty times a second whose
width names the angle, so the Arduino Servo library drives it with the same
attach() and write() as the SG90. The servo article explains
the pulses.
Pins
| Pin | What it does |
|---|---|
GND |
Ground, the brown wire. |
VCC |
Supply, 4.8 V to 7.2 V, the red wire. |
PWM |
The signal, the orange wire. |
Properties
min_pulse, max_pulse and range map the pulse onto the angle, 544 to 2400 us for
0 to 180 degrees by default, the Arduino library's window.
While it runs
Nothing to drag. The horn turns to where the pulses put it.
What the model gets right
From the MG996R datasheet:
Speed. 0.17 s per 60 degrees at 4.8 V and 0.14 s at 6 V: about 353 and 429 degrees a second. The model takes the speed from the supply, in a straight line between those two figures.
Dead band. 5 us: a pulse within 5 us of the last one it obeyed does not move it.
The supply. Under 4 V it does not move.
What it does not model
Torque (9.4 kgf.cm at 4.8 V and 11 at 6 V on the datasheet) and current. A real MG996R under load pulls amps, and on a board's 5 V pin it browns the board out; the model has nothing on the horn and will not.
Common mistakes
Powering it from the board's 5 V pin. Give it its own 5 V or 6 V supply, with the grounds joined.
See it in action
Big servo steers an MG996R from a slide potentiometer, with the servo on its own 6 V battery pack and only the ground shared. Parking barrier builds one into the barrier's post and lifts the arm when an HC-SR04 sees a car. Open them at /templates.
The Automatic pet feeder opens a food gate with one at each meal time from a DS3231, on its own 6 V supply.
Related
- The MG996R part page, with its pinout
- PCA9685 16-channel servo driver