I am building a 6dof robotic arm. I bought a servo driver board with Arduino uno to control the servo motors (mg996r). I connected all the wires, connected the power supply (2 18650 li-ion batteries) to the board, uploaded the code to the arduino, but none of the servos move. What can I do about this?
I haven't found a datasheet for the board yet. VM likely supplies the motors, but I was wondering whether something needed to be supplied to VS? I would guess that 5V and 3.3V are supplied from the UNO, so maybe not, but without any data for the board I am not sure.
BTW, I see that the servo is attached to pin 14 in the sketch. The diagram makes it appear that it is plugged in to 15, but perhaps more to the point is the fact that there is no digital pin 14 or 15 on the UNO. Pin 13 is as high as it goes and that's he built-in LED pin. The a bank of pins that the diagram shows the servo being connected to appears to be driven from the PCA9685 chip onboard the shield. You would therefore likely need to drive the servo via a library for that that chip:
You can install a PCA9685 library via Manage Libraries. Just search for 9685 and at least a couple of options will pop up. Once installed, you should fine examples under File -> Examples.
Thank you for all your suggestions.
I'll try the thing about rearranging the pins. I'd like to point out that the diagram I attached isn't exactly what I'm using. I found that off of a website that shows the general configuration of what I'm trying to do. I'm using 6 servo motors placed in pins 10-15, and 2 18650 lithium ion batteries powering it. The positive end is going into VM and the negative end is going into the ground.
Can't use the servo library and attach() for a PCA9685.
I think your best bet is to try the library and sketch for the Adafruit PCA9685 servo board.
Or any of the other PCA9685 servo libraries available through the library manager of the IDE.
Leo..
Well what is no use at all. Please produce a diagram that IS exactly what you are doing.
Also a link to that board you are using because it looks like a simple motor drive. You control the speed of them with PWM, but the type of PWM required to drive a servo is not the same sort of PWM that is used to drive / control a DC motor.
Yes there is.
It is the "proper" way to define the pins A0 and A1 when used as just a digital pin.
Thanks. I was unaware of that. I don't think I have up to this point ever seen pin numbers above 13 used on a UNO/Nano but have always seen them referred to as just A0-A5 (up to A7 on Nano). Noted for future reference.
With just the photo to go on, it is difficult to tell how things are laid out and interconnected on that board. It is quite likely that a number of UNO pins are being used to drive devices on the shield. Quite possibly SDA/SCL (A4/A5) and likely also MOSI/MISO/CLK/SS (pins 10 thru 13) would be obvious candidates (pins 10 & 11 are not marked as PWM pins in contrast to pins 9, 6, 5 & 3), which would remove them from availability as digital pins.
Without design details it is difficult to make a determination, however, I did find this which might hopefully be of some help:
It would appear that all the pins on that triple row marked 0 -15 are connected to the PCA9685 controller. It would also appear that power is required to be applied to VS to supply the servos. A supply separate from the 5V Arduino supply is being recommended.
Yes I am aware that A6 and A7 pins on a Nano do not have internal circuitry, including pull-up resistors, to make them usable as digital pins. They can only be used as analog inputs.
Hello everyone, thanks for the responses. @Wawa , I will try to use the PCA9685 library today and see if that works. @TomGeorge , I used a DMM to measure the voltage before and it read around 3.7V on each lithium ion battery but the multimeter became hot very quickly. @Grumpy_Mike , I'm sorry, I'm not very experienced in all of this and I don't really know how to produce a diagram, but I can explain it the best I can:
Servo Driver Board on top of an Arduino Uno connected by all the pins on the Arduino Uno board. Power source inputting into VM and GND. Servo motors in pins 10-15.
I might change some of this regarding the servo pins due to the suggestions above. @BitSeeker , the link you sent is the board I am using.
Again, thank you all for your suggestions, and I hope what I sent now helps.
The multi-meter became hot? That shouldn't happen, especially at these low voltage levels!
Make sure that the meter is set to DC Volts and probes are in the correct sockets. For measuring DC Volts there should not be a probe in the 10A/Current socket for example.....
Apologies if you already know your way around a DMM.
disregard this, I got a motor to work after I switched the location of my positive power supply wire from VM to VS. I'll do some more testing later to make sure it all fully works