How to address the Servo connectors A6 to A15 on the MegaPi ? The servo sample code requires slot and port numbers but how are A6 - A15 related to ports and slots ?
Servo Connection to MegaPi
Hi TONI,
The servo sample code in the makeblock library requires slot and port numbers are special for the servos sold by makeblock.
The servos sold by makeblock cannot be connected to A6~A15, it can only connected to the MegaPi through the MegaPi Shield for RJ25 in this link with the Me RJ25 adapter.
If you buy the servos from the other manufacturer, you can connect the servos to the A6~A15, and you can use the Arduino official example programs.
You can run the servos by custom wiring from 5v, ground and PWM pins. I am running 4 HS-645MG servos using a 1K resistor in the pwm. I bought mating connectors from Walmart.com to plug into the external connectors.
The board has plenty of power using a 1amp 12 volt power supply. The red female sockets have 5v and ground. The yellow pins across from the 5v and gnd sockets can do PWM.
I understand but what can I do when I want to use the Node.js Official Makeblock Firmware. Here the example code only refers to your RJ25 Servos…can you add a sample for standard servos using A5 to A15.
I would assume that I can use the command pwmWrite( pin, pwm ) to control servos via A5-A15 but I haven´t found any schematic which shows the relation between Axx and pin
Hi TONI,
You may double check the official Arduino’s example program for servo and use the myservo.attach(9) and myservo.write(pos).
For the schematic of the MegaPi, please see this link: http://learn.makeblock.com/en/megapi/
Besides, you can use the mBlcok software to program the MegaPi and the servo directly.
Axx pins on the Meag2560 cannot do PWM, so no motor control.
There is no way to plug servos directly into MagaPi. You can use pins 4,5,6,7,8,9,11,12. You must build custom cabling to run servos direct from MegaPi. I use a 1K resistor on the PWM line to protect the processor. Pin numbering on the MegaPi matches the processor pin numbering. Read about the processor for details on what each pin can do.
Hi TONI,
Bit late with an answer, but today I tried connecting servos with and without the RJ25 adapter.
What I found is that it worked exactly the same way:
Port7, Slot1 ~ A10
Port7, Slot2 ~ A11
Port8, Slot1 ~ A12
Port8, Slot2 ~ A13
The rest could be figured out in a similar manner I presume (but I haven’t tested all slots)
Hi Toni.
I have 6 Makeblock servos (http://store.makeblock.com/robot-servo-pack-blue) connected to MegaPi pins (A6 to A11) and are working without problem.
But using arduino IDE. It cannot be codded using mBlock.
There is an arduino equivalent:
Arduino 60 -> MegaPi pin A6
Arduino 61 -> MegaPi pin A7
Arduino 62 -> MegaPi pin A8
…
Here is my code to attach the servos.
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
…
…
servo1.attach(60); //60 to 69 same as A6 to A15
servo2.attach(61);
servo3.attach(62);
servo4.attach(63);
servo5.attach(64);
servo6.attach(65);
But you have to take care of:
-
Servos use 6V, so USB 5V is not enough, you have to use an external power supply, I use a 12V connected to the “High-power DC input interface”, It also will help you to manage DC Motors. (I have 6 connected).
-
Servo wire color are Black=for ground, Red=for Voltage, White=for Signal. And MegaPi servo pins colors are Black=for ground, Red=for Voltage, Yellow for signal.
Hope it helps.
Kike.