Here is my question described in more practical terms:
i have on a robot i’m building, the following components:
2 X L293D chips, which turn 4 motors and require 9 outputs (the 9th is the enable pin on all sides of both L293D, which i made common to all 4 motors).
6 X servos which require 6 outputs.
1 X relay which turns another type of motor, which requires 1 output.
1 X bluetooth dongle, which requires RX and TX.
This is all working well on an Arduino Mega - but now i need to put it all together in a much smaller box - so anything even close to the size of a Mega won’t do.
The question is: What would me the smallest Arduino board, which can handle the connections described above?
The Uno can support 20 digital I/O pins, 0-13 and A0-A5. A0-A5 can be used for either analog (ADC) input or digital.
The Micro can also support 20 digital I/O pins. It uses a different microcontroller, so it has more pins that can be used for analog input or digital (12 vs 6). It also has more SRAM and one additional PWM capable pin. It’s basically a Leonardo on a smaller board.
Can you please help me understand to which pinholes on the Micro should i connect the 6 servos, the 9 wires coming from the two L293D and finally the relay? The RX TX i can probably find by myself - but the rest, i’m not sure…
Your I/O is all digital. Aside from the bluetooth dongle, you can connect them to whichever pins make the wire routing most convenient, then you just need to change your code to match your wiring.
If you are connecting servos, you will be limited to using pins that support PWM. These are usually indicated on the board with a ~ symbol. On the Uno they are 3, 5, 6, 9, 10, 11.
shawt:
If you are connecting servos, you will be limited to using pins that support PWM.
This is a common misconception. It is not true. The servo library does use a hardware timer and will limit the use of PWM, but it is not limited to PWM capable pins. In fact, an Uno can drive 12 servos simultaneously.