Difference between revisions of "Servo"
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[File:SPI_Servo.jpg|thumb|300px|alt=The SPI_Servo PCB|The |
[[File:SPI_Servo.jpg|thumb|300px|alt=The SPI_Servo PCB|The Servo PCB (SPI version photographed)]] |
||
This is the documentation page for the SPI_servo |
This is the documentation page for the SPI_servo and I2C_SERVO boards. That can you can buy in the [http://www.bitwizard.nl/shop/expansion-boards/servo BitWizard shop]. |
||
== Overview == |
== Overview == |
||
This module enables you to easily control upto 7 servomotors over an SPI interface, while needing minimal resources from your CPU. |
This module enables you to easily control upto 7 servomotors over an SPI or I2C interface, while needing minimal resources from your CPU. |
||
The PCB is equipped with two SPI connectors, so daisychaining multiple SPI modules is |
The PCB is equipped with two SPI or I2C connectors, so daisychaining multiple SPI or I2C modules is possible.<br> |
||
This allows you to control |
This allows you to control a chain of boards with only 4 data lines (MOSI, MISO, SS and SCK) for SPI or two lines (SDA, SCL) for I2C. This is not only pin-saving, but is is also possible do daisy-chain multiple modules (we will be releasing even more boards with other functions in the very near future)!<br> |
||
The board can be used with all microcontrollers, such as the Atmel AVR, Arduino/Freeduino boards, Microchip PIC, etcetera. |
The board can be used with all microcontrollers, such as the Atmel AVR, Arduino/Freeduino boards, Microchip PIC, Raspbery PI etcetera. <br> |
||
<br> |
|||
For small servos, the power supplied by the SPI or I2C connector is enough. However current surges of up to a whole ampere are easily achieved even when two or three smaller servos need to move simultaneously. For larger servos however, the voltage drop may be to high. We suggest conneting an auxillary 5V power source to the PCB, and move the jumper. |
|||
== External resources == |
== External resources == |
||
Line 25: | Line 27: | ||
== Pinout == |
== Pinout == |
||
For the SPI connector see: [[SPI_connector_pinout]]. |
|||
for the I2C connector see: [[I2C_connector_pinout]] |
|||
The pinout is standard for servo-motors; |
The pinout is standard for servo-motors; |
||
{| border=1 |
|||
⚫ | |||
! pin !! function !! remark |
|||
⚫ | |||
|- |
|||
Pin 3 is data |
|||
| 1 || GND || Power Ground |
|||
|- |
|||
⚫ | |||
|- |
|||
| 3 || Servo || PWM data. |
|||
|- |
|||
|} |
|||
⚫ | |||
Besides the seven servo outputs, there is an eighth header: |
|||
{| border=1 |
|||
! pin !! function !! remark |
|||
|- |
|||
| 1 || GND || Power Ground |
|||
|- |
|||
| 2 || VCC || 5V |
|||
|- |
|||
| 3 || - || No pin |
|||
|- |
|||
|} |
|||
This can be used to provide power to the servos. For example, mosts ESCs have a BEC on board. These would fit on this connector, leaving the PWM signal pin unconnected. |
|||
Recent versions of the board allow you to disconnect the servo-power from the SPI (or I2C) bus power. Allowing you to keep the "clean" 5V for the raspberry pi and the "dirty" 5V for the servos separate. |
|||
{| border=1 |
|||
! pin !! function !! remark |
|||
|- |
|||
| 1 || GND || Power Ground |
|||
|- |
|||
| 2 || 5Vservo || 5V for the servos |
|||
|- |
|||
| 3 || 5V bus || 5V from the SPI or I2C bus. |
|||
|- |
|||
|} |
|||
The idea here is that you can connect your powersupply ground and 5V on 1-2, or a jumper on the 2-3 position to power the servos from the bus. |
|||
Keep in mind that even a small 9g servo will draw at least 500mA when you tell it to "suddenly" change position. So if your powersupply isn't powerful enough, 7 servos going to a new position may crash your BitWizard Servo board, or even your raspberry pi. |
|||
=== LEDs === |
=== LEDs === |
||
One LED is the normal power-LED. It is powered from the serial-bus-5V. |
|||
The other led, next to the servo connectors, shows you the status of the 5V that powers the servos. If for example, you forget to connect the jumper (2-3) for bus-powered servos, the led will show you that. |
|||
== Jumper settings == |
== Jumper settings == |
||
Solder jumper (on bottom layer): ICSP-Enable. CAUTION! Pin 1 and 2 are connected by a narrow PCB track. Cut this if you want to change this jumper setting. |
Solder jumper (on bottom layer): ICSP-Enable. CAUTION! Pin 1 and 2 are connected by a narrow PCB track. Cut this if you want to change this jumper setting.<br> |
||
1-2: Default: Both SPI connectors connected in parallel. |
1-2: Default: Both SPI connectors connected in parallel.<br> |
||
2-3: ICSP enabled; programming the MCU over the 6-pin connector marked SPI3 (near the edge of the board |
2-3: ICSP enabled; programming the MCU over the 6-pin connector. This connector may be marked SPI1 or SPI3 (near the edge of the board, furthest from the CPU.)<br> |
||
== |
== Protocol == |
||
For the intro to the SPI and I2C protocols read: [[SPI versus I2C protocols]] |
|||
To control the servos, you need to send things over the SPI bus to the PCB. The [[spi_servo 1.0_protocol|protocol is explained here]]. |
|||
The board specific protocol can be found here: [[Servo_1.0_protocol]] |
|||
You should also read the [[General_SPI_protocol]] notes. |
|||
For arduino, a sample PDE is available, called ardemo_lcd.pde, also at BitWizard software download directory . |
|||
This is a demo to send things using SPI to the lcd board. The SPI routines there are applicable for SERVO boards as well. |
|||
== The software == |
== The software == |
||
Line 52: | Line 106: | ||
== Future hardware enhancements == |
== Future hardware enhancements == |
||
⚫ | |||
* Add possibility to disconnect servo-power from VCC |
|||
== Future software enhancements == |
== Future software enhancements == |
||
Line 60: | Line 111: | ||
== Changelog == |
== Changelog == |
||
=== 1.2 === |
|||
⚫ | |||
=== 1.0 === |
=== 1.0 === |
Latest revision as of 12:57, 2 November 2015
This is the documentation page for the SPI_servo and I2C_SERVO boards. That can you can buy in the BitWizard shop.
Overview
This module enables you to easily control upto 7 servomotors over an SPI or I2C interface, while needing minimal resources from your CPU.
The PCB is equipped with two SPI or I2C connectors, so daisychaining multiple SPI or I2C modules is possible.
This allows you to control a chain of boards with only 4 data lines (MOSI, MISO, SS and SCK) for SPI or two lines (SDA, SCL) for I2C. This is not only pin-saving, but is is also possible do daisy-chain multiple modules (we will be releasing even more boards with other functions in the very near future)!
The board can be used with all microcontrollers, such as the Atmel AVR, Arduino/Freeduino boards, Microchip PIC, Raspbery PI etcetera.
For small servos, the power supplied by the SPI or I2C connector is enough. However current surges of up to a whole ampere are easily achieved even when two or three smaller servos need to move simultaneously. For larger servos however, the voltage drop may be to high. We suggest conneting an auxillary 5V power source to the PCB, and move the jumper.
External resources
Datasheets
The CPU: http://www.atmel.com/dyn/resources/prod_documents/doc8006.pdf
Additional software
Related projects
Pinout
For the SPI connector see: SPI_connector_pinout.
for the I2C connector see: I2C_connector_pinout
The pinout is standard for servo-motors;
pin | function | remark |
---|---|---|
1 | GND | Power Ground |
2 | VCC | 5V |
3 | Servo | PWM data. |
Pin one is located closest to the side of the board.
Besides the seven servo outputs, there is an eighth header:
pin | function | remark |
---|---|---|
1 | GND | Power Ground |
2 | VCC | 5V |
3 | - | No pin |
This can be used to provide power to the servos. For example, mosts ESCs have a BEC on board. These would fit on this connector, leaving the PWM signal pin unconnected.
Recent versions of the board allow you to disconnect the servo-power from the SPI (or I2C) bus power. Allowing you to keep the "clean" 5V for the raspberry pi and the "dirty" 5V for the servos separate.
pin | function | remark |
---|---|---|
1 | GND | Power Ground |
2 | 5Vservo | 5V for the servos |
3 | 5V bus | 5V from the SPI or I2C bus. |
The idea here is that you can connect your powersupply ground and 5V on 1-2, or a jumper on the 2-3 position to power the servos from the bus.
Keep in mind that even a small 9g servo will draw at least 500mA when you tell it to "suddenly" change position. So if your powersupply isn't powerful enough, 7 servos going to a new position may crash your BitWizard Servo board, or even your raspberry pi.
LEDs
One LED is the normal power-LED. It is powered from the serial-bus-5V.
The other led, next to the servo connectors, shows you the status of the 5V that powers the servos. If for example, you forget to connect the jumper (2-3) for bus-powered servos, the led will show you that.
Jumper settings
Solder jumper (on bottom layer): ICSP-Enable. CAUTION! Pin 1 and 2 are connected by a narrow PCB track. Cut this if you want to change this jumper setting.
1-2: Default: Both SPI connectors connected in parallel.
2-3: ICSP enabled; programming the MCU over the 6-pin connector. This connector may be marked SPI1 or SPI3 (near the edge of the board, furthest from the CPU.)
Protocol
For the intro to the SPI and I2C protocols read: SPI versus I2C protocols
The board specific protocol can be found here: Servo_1.0_protocol
You should also read the General_SPI_protocol notes.
For arduino, a sample PDE is available, called ardemo_lcd.pde, also at BitWizard software download directory .
This is a demo to send things using SPI to the lcd board. The SPI routines there are applicable for SERVO boards as well.
The software
Default operation
Future hardware enhancements
Future software enhancements
Changelog
1.2
- Added jumper/power connector for (external) servo power.
1.0
- Initial public release