Servo

From BitWizard Wiki
Revision as of 12:57, 2 November 2015 by Cartridge1987 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The SPI_Servo PCB
The Servo PCB (SPI version photographed)

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