Ks0258 keyestudio 16-channel Servo Motor Drive Shield: Difference between revisions
Keyestudio (talk | contribs) |
Keyestudio (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
[[image:KS0259.png|thumb|800px|right|keyestudio 16-channel Servo Motor Drive Shield]] | |||
<br> | |||
==Introduction== | ==Introduction== | ||
When we are doing robot experiments, it needs to use multiple PWM ports to drive the servo motor, however, the | When we are doing robot experiments, it needs to use multiple PWM ports to drive the servo motor, however, the commonly-used Arduino UNO R3 only has 6 PWM ports, really not enough. This allows you to use this expansion board, which is directly stacked on the Arduino UNO R3 board. It can drive up to 16 servos and use I2C input, occupying A4 and A5 pins of UNO. <br> | ||
The shield also comes with PCB double-sided holes, which can be used to solder with components to build up prototyping circuits. | |||
<br>[[File:图片1- ks0258.png|700px|frameless|thumb]]<br> | |||
== | <br> | ||
* | ==Specifications== | ||
* | *I2C input, controlling 16-channel PWM output | ||
* | *Servo power independent input V+, up to 6V. | ||
* | *Logic signal and logic power independent output 3-5V | ||
* | *Frequency: 40-1000Hz | ||
* | *Channels: 16-channel | ||
*Resolution: 12-bit | |||
== | <br> | ||
==Details== | |||
*'''Dimensions:''' 69mm x 54mm x 24mm | |||
*'''Weight:''' 20g | |||
<br>[[File:图片2- ks0258.png|700px|frameless|thumb]]<br> | |||
<br> | |||
== Interface Explanation == | |||
<br>[[File:Ks0258 pinout.jpg|700px|frameless|thumb]]<br> | |||
== Simple Hookup== | |||
Simply stack the shield onto [http://wiki.keyestudio.com/index.php/Ks0001_keyestudio_UNO_R3_BOARD UNO R3 board ]. <br> | |||
<br>[[File:KS0258-2.png|700px|frameless|thumb]]<br> | |||
== Sample Code == | == Sample Code == | ||
*Copy and paste the code below to [http://wiki.keyestudio.com/index.php/How_to_Download_Arduino_IDE Arduino IDE ]. <br> | |||
*Or [https://drive.google.com/open?id=1YDzJsMsh73CfSdYTp9wnSdedQanG6fzj click here ]to download the code. <br> | |||
*[https://drive.google.com/open?id=1uSpbRoHXHS3WPgWmKU0ex4NOjDMh0Z5j Click here] to download the libraries ''Adafruit_PWMServoDriver.h'' | |||
<pre> | <pre> | ||
/*************************************************** | /*************************************************** | ||
This is an example for our | This is an example for our keyestudio 16-channel PWM & Servo driver | ||
PWM test - this will drive 16 PWMs in a 'wave' | PWM test - this will drive 16 PWMs in a 'wave' | ||
These displays use I2C to communicate, 2 pins are required to | These displays use I2C to communicate, 2 pins are required to | ||
interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4 | interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4 | ||
keyestudio invests time and resources providing this open source code, | |||
please support | please support keyestudio and open-source hardware by purchasing | ||
products from | products from keyestudio ! | ||
****************************************************/ | ****************************************************/ | ||
Line 78: | Line 90: | ||
} | } | ||
</pre> | </pre> | ||
'''Note:''' Before compile the code above, do remember to add the libraries inside the libraries folder of Arduino IDE. | |||
<br>[[File:KS0259 - libraries.png|600px|frameless|thumb]]<br> | |||
<br> | |||
== Test Result == | == Test Result == | ||
Done uploading the above code to UNO R3. Then connect 16 servo motors shown below, finally you should see 16 servos rotate successively. | |||
<br>[[File:KS0258-3.png|600px|frameless|thumb]]<br> | |||
<br> | |||
==Resources == | ==Resources == | ||
'''Download the PDF file here: '''<br> | |||
https://drive.google.com/open?id=1BWn5NOc75E-EQfdVnPd8ITZzzChUecSY | |||
'''Download the code here:''' <br> | |||
https://drive.google.com/open?id=1YDzJsMsh73CfSdYTp9wnSdedQanG6fzj | |||
''' | '''Download all the libraries here: '''<br> | ||
https://drive.google.com/open?id= | https://drive.google.com/open?id=1uSpbRoHXHS3WPgWmKU0ex4NOjDMh0Z5j | ||
<br> | |||
==Get One Now == | ==Get One Now == | ||
'''Official Website''' | '''Official Website:''' | ||
[[Category: | [[Category: Shield]] |
Revision as of 10:53, 30 August 2018
Introduction
When we are doing robot experiments, it needs to use multiple PWM ports to drive the servo motor, however, the commonly-used Arduino UNO R3 only has 6 PWM ports, really not enough. This allows you to use this expansion board, which is directly stacked on the Arduino UNO R3 board. It can drive up to 16 servos and use I2C input, occupying A4 and A5 pins of UNO.
The shield also comes with PCB double-sided holes, which can be used to solder with components to build up prototyping circuits.
Specifications
- I2C input, controlling 16-channel PWM output
- Servo power independent input V+, up to 6V.
- Logic signal and logic power independent output 3-5V
- Frequency: 40-1000Hz
- Channels: 16-channel
- Resolution: 12-bit
Details
- Dimensions: 69mm x 54mm x 24mm
- Weight: 20g
Interface Explanation
Simple Hookup
Simply stack the shield onto UNO R3 board .
Sample Code
- Copy and paste the code below to Arduino IDE .
- Or click here to download the code.
- Click here to download the libraries Adafruit_PWMServoDriver.h
/*************************************************** This is an example for our keyestudio 16-channel PWM & Servo driver PWM test - this will drive 16 PWMs in a 'wave' These displays use I2C to communicate, 2 pins are required to interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4 keyestudio invests time and resources providing this open source code, please support keyestudio and open-source hardware by purchasing products from keyestudio ! ****************************************************/ #include <Wire.h> #include <Adafruit_PWMServoDriver.h> // called this way, it uses the default address 0x40 Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); // you can also call it with a different address you want //Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41); void setup() { Serial.begin(9600); Serial.println("16 channel PWM test!"); // if you want to really speed stuff up, you can go into 'fast 400khz I2C' mode // some i2c devices dont like this so much so if you're sharing the bus, watch // out for this! pwm.begin(); pwm.setPWMFreq(1600); // This is the maximum PWM frequency // save I2C bitrate uint8_t twbrbackup = TWBR; // must be changed after calling Wire.begin() (inside pwm.begin()) TWBR = 12; // upgrade to 400KHz! } void loop() { // Drive each PWM in a 'wave' for (uint16_t i=0; i<4096; i += 8) { for (uint8_t pwmnum=0; pwmnum < 16; pwmnum++) { pwm.setPWM(pwmnum, 0, (i + (4096/16)*pwmnum) % 4096 ); } } }
Note: Before compile the code above, do remember to add the libraries inside the libraries folder of Arduino IDE.
Test Result
Done uploading the above code to UNO R3. Then connect 16 servo motors shown below, finally you should see 16 servos rotate successively.
Resources
Download the PDF file here:
https://drive.google.com/open?id=1BWn5NOc75E-EQfdVnPd8ITZzzChUecSY
Download the code here:
https://drive.google.com/open?id=1YDzJsMsh73CfSdYTp9wnSdedQanG6fzj
Download all the libraries here:
https://drive.google.com/open?id=1uSpbRoHXHS3WPgWmKU0ex4NOjDMh0Z5j
Get One Now
Official Website: