Bonjour tout le monde,
Je n'arrive pas à faire fonctionner mon servo (MG995) avec l'arduino. Branché sur une voiture téléguidé il fonctionne donc le problème ne viens pas de lui. Je fais mais test avec le programme test de arduino. Lorsque je control à l'oscilloscope, les signaux de la voiture et de l'arduino semble tout deux correct et semblable. Ca peut venir de quoi ? Merci à vous
(si vous voulez je peux vous partager les photos vidéos de mes tests mes ca ne me parait pas intéressant)
Sinon sur une carte de control de moteurs j'ai vu qu'il y avait possibilité de branché un servo mais je ne trouve aucune explication sur comment faire.
Hello everyone,
I can't get my servo (MG995) to work with the arduino. Connected to a remote-controlled car it works, so the problem doesn't come from him. I do my tests with the arduino test program (swerve). When I check with the oscilloscope, signals from the car and the arduino seems correct and similars. What could it be from? Thank you
(if you want pictures or videos ask me but I don't think it's interesting)
Otherwise on a motor control card I saw that there was the possibility of connecting a servo but I can't find any explanation on how to do it.
Without knowing how the servo is connected to the Arduino, which Arduino that you are using or how the servo is powered there is no way to help you.
Please post a schematic. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.
Post photos showing the wiring and components.
Post the test code that you are using. Read the forum guidelines to see how to properly post code and some good information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = 0; pos <= 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=0; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
The stall current of an MG995 is 1.5Amp@5volt.
Stall current is drawn every time the servo starts moving.
The Arduino power pin can't supply that kind of current.
Use a separate 5volt supply capable of at least that current for the servo.
Leo..