# KS0509 Keyestudio Mega 2560 Smart Development Board ## 1. Description ![](media/image-20260127175425772.png) The core processor of this MEGA 2560 Smart development board is TMEGA2560-16AU which is compatible with the Arduino MEGA 2650 development board. Integrated with 2 TB6612 motor driving chips, this processor can be served as the solution to drive the 4WD Smart car . In addition, the output power supply of this board can reach the maximum 5V 3A, in 3 channels (good heat dissipation).Through 2.54mm pins, most of the GPIO ports are extend out to facilitate external connection of sensors/ modules. ## 2. Specifications ![](media/image-20260127175455209.png) The core processor of this development board is ATMEGA2560-16AU, together with the chip CP 2102 equipped it can serve as a UART - to - USB converter. It boasts 54 digital I/O ports (12 designed for motors) of which 15 can be used an PWM output (4 for motors), 16 analog input ports, 4-channel serial communication ports (port 0 is for program burning), 16MHz quartz crystal, a USB interface , a power jack, a ICSP plug and a reset button. It supports all functions as a microcontroller. And connecting it to a computer with a USB cable, and powering it up through the external power (BAT power supply: DC 7-12V) are all needed to start using it. | Core Processor | ATMEGA2560-16AU | | -------------------------------------------------------- | ------------------------------------------------------------ | | Working Voltage | 5V | | Power Supply Output | VCC (Anode): 5V ; GND (Cathode):5V Output Current:3A | | BAT Power Supply | DC7-12V | | Digital IO Ports | 54个 (D0-D53) | | PWM IO Ports | 15 (D2-D13, D44-D46) | | Analog Input Ports | 16 (A0-A15) | | Serial Ports | RX1(D19)、TX1(D18)、RX2(D17)、TX2(D16)、RX3(D15)、TX3(D14) | | IIC | SDA(D20)、SCL(D21) | | TB6612 Motor Connectors(the one close to power button) | Connector C:Speed=D9,Direction=D28、D29Connector D:Speed:D10,Direction=D30、D31
Speed can be controlled through PMW signal.Direction can be adjusted through high or low level. | | TB6612 (the one near the USB Interface) | Connector A:Speed=D12,Direction=D34、D35Connector B:Speed:D11,Direction=D32、D33
Speed can be controlled through PMW signal.Direction can be adjusted through high or low level. | | Output Current for IO Ports | 20 mA | | Output Current for IO Ports | 50 mA | | Output Current for DC 3.3V | 256 KB (ATMEGA2560-16AU) of which 8 KB is used for bootloader | | SRAM | 8 KB (ATMEGA2560-16AU) | | EEPROM | 4 KB (ATMEGA2560-16AU) | | Clock Speed | 16 MHz | ## 3. Software Download Open the browser and search: https://www.arduino.cc/en/software, we will take WINDOWS system as an example to show you how to download and install. ![](media/1.gif) You just need to click JUSTDOWNLOAD,then click the downloaded file to install it. And when the ZIP file is downloaded,you can directly unzip and start it. ![](media/2.gif) ## 4. Installing driver ## 4.1 Windows System **Checking the driver** 1. Connect the motherboard to the computer. ![](media/image-20260128091534842.png) 2. Open Device Manager,Open the device manager, if the prompt **"Silicon Labs CP210x USB to UART Bridge (COMx)"** appears to prove that the driver has been installed, please skip the **"Driver installation"** part. ![](media/Animation.gif) **Manual driver installation** 1. Driver download - Windows System: [Windows System driver](./Windows.7z) 2. Connect the motherboard to the computer, open the device manager, if there is a yellow exclamation mark in front of the driver in the picture, it proves that the driver is not installed, please download the driver and install it manually. ![](media/Animation-1750921346712-3.gif) ## 4.2 MAC System **1 Checking the driver** Connect the development board to the computer, according to [Tools] ---> [Port] to select the development board port (Note: If you can not confirm which port is the development board, please connect the motherboard to take pictures to record all the ports, and then unplug the development board to re-take pictures to record all the ports, and then compare to find the disappeared ports, and then unplug the motherboard after the disappeared ports is the port of the board, and then select the port on the line)If you can not recognize the port, please replace the computer USB port or around the phone cable to re-recognize the port, if it still does not work refer to the following steps to install the driver. ![](media/image-20260128091644575.png) **2 Manual driver installation** 1. Driver download ​ Mac System: [Mac System driver](./Mac.7z) 2. double-click to decompress the downloaded driver zip package ![](media/image-20260128091729274.png) ![](media/image-20260128091704413.png) ![](media/image-20260128091713032.png) 3. After that keep **"Next ”** installing until the installation is complete ![](media/image-20260128091742338.png) ## 5. Set Arduino IDE Connecting the board to the computer,and select the development board and port. ![](media/image-20260128092658608.png) ![](media/image-20260128092705118.png) ![](media/image-20260128092712875.png) - A- Used to verify whether there is any compiling mistakes or not. - B- Used to upload the sketch to your Arduino boar. - C-Used to send the serial data received from board to the serial monitor. ## 6. Enjoy Your First Program We have learned how to download the Arduino IDE and the driver. Now let’s begin the first program “Hello World!” The test code is as follows: ```c void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } void loop() { // print out "Hello world!" Serial.println("Hello world!"); delay(1000);// delay 1 second } ``` When upload successfully, set baud rate to 9600 and the serial port monitor output “Hello World! “ as shown in the picture below: ![](media/image-20260128092957707.png) Congratulations! You have finished your first program! ## 7. Driving Motors The MEGA 2560 Smart development board, integrated with 2 TB6612 chips, can independently control 4-channel DC0-12V motors and the average driving current can reach 1.2A. The IO ports used for driving motors is as follows: ![](media/1.png) **Pinout:** ![](media/image-20260128093126440.png) **Principle** In final analysis, the direction of motor A(M4) is controlled by D35 and D34 and its speed is determined by D12; the direction of motor B(M3) is controlled by D33 and D33 and its speed is determined by D11; the direction of motor C(M1) is controlled by D29 and D28 and its speed is determined by D9; the direction of motor D(M2) is controlled by D31 and D30 and its speed is determined by D10; More details are shown in the below table: (Please notice that the range of PWM signal is from 0 to 255 and the larger the PMW, the bigger the speed of the motor ) ![](media/2.png) ![](media/3.png) Connection Diagram: (take TT motor as an example) ![](media/image-20260128093350449.png) **Test Code:** Download code: [Code](./Code.7z) ```c // Define the pin of Motor A const int A_D1 = 34; const int A_D2 = 35; const int A_S = 12; //Define the pin of Motor B const int B_D1 = 32; const int B_D2 = 33; const int B_S = 11; //Define the pin of Motor C const int C_D1 = 28; const int C_D2 = 29; const int C_S = 9; //Define the pin of Motor D const int D_D1 = 30; const int D_D2 = 31; const int D_S = 10; void setup() { //All motor interfaces are configured in output mode pinMode(A_D1, OUTPUT); pinMode(A_D2, OUTPUT); pinMode(B_D1, OUTPUT); pinMode(B_D2, OUTPUT); pinMode(C_D1, OUTPUT); pinMode(C_D2, OUTPUT); pinMode(D_D1, OUTPUT); pinMode(D_D2, OUTPUT); } void loop () { //Motor A rotate in clockwise direction digitalWrite(A_D1, HIGH); digitalWrite(A_D2, LOW); analogWrite(A_S, 100); //Motor B rotate in clockwise direction digitalWrite(B_D1, HIGH); digitalWrite(B_D2, LOW); analogWrite(B_S, 100); //Motor C rotate in clockwise direction digitalWrite(C_D1, LOW); digitalWrite(C_D2, HIGH); analogWrite(C_S, 100); //Motor D rotate in clockwise direction digitalWrite(D_D1, LOW); digitalWrite(D_D2, HIGH); analogWrite(D_S, 100); delay(2000); //Delay in 2s //Motor A rotate in anticlockwise direction digitalWrite(A_D1, LOW); digitalWrite(A_D2, HIGH); analogWrite(A_S, 100); //Motor B rotate in anticlockwise direction digitalWrite(B_D1, LOW); digitalWrite(B_D2, HIGH); analogWrite(B_S, 100); //Motor C rotate in anticlockwise direction digitalWrite(C_D1, HIGH); digitalWrite(C_D2, LOW); analogWrite(C_S, 100); //Motor D rotate in anticlockwise direction digitalWrite(D_D1, HIGH); digitalWrite(D_D2, LOW); analogWrite(D_S, 100); delay(2000); //Delay in 2s //All four motors stop analogWrite(A_S, 0); analogWrite(B_S, 0); analogWrite(C_S, 0); analogWrite(D_S, 0); delay(1000); //Delay in 2s } ``` **Test Results:** Uploading the test code and powering the board up, the motors rotate in clockwise direction at 2s and then in anticlockwise direction at 2s and repeat the sequence. **Code Explanation:** ``` digitalWrite(PIN,HIGH/LOW);//The corresponding pins output High or Low Levels ``` ``` analogWrite(PIN,0-255); //The corresponding pins output PWM signals ``` Notes: PIN stands for the digital ports or PWM ports of this MEGA 2560 Smart development board.