KS0507 Keyestudio Smart RV Kit: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
Line 321: Line 321:
The LED flashes faster through the lesson 1.2 test.<br>
The LED flashes faster through the lesson 1.2 test.<br>


=== <br>Project 2: Adjust LED Brightness<br> ===
=== <br>Project 2: Adjust LED Brightness<br> ===(1)Description:
(1)Description:
In previous lesson, we control LED on and off and make it blink.
In previous lesson, we control LED on and off and make it blink.
In this project, we will control LED brightness through PWM to simulate breathing effect. Similarly, you can change the step length and delay time in the code so as to demonstrate different breathing effect.<br>
In this project, we will control LED brightness through PWM to simulate breathing effect. Similarly, you can change the step length and delay time in the code so as to demonstrate different breathing effect.<br>
PWM is a means of controlling the analog output via digital means. Digital control is used to generate square waves with different duty cycles (a signal that constantly switches between high and low levels) to control the analog output.In general, the input voltage of port are 0V and 5V. What if the 3V is required? Or what if switch among 1V, 3V and 3.5V? We can’t change resistor constantly. For this situation, we need to control by PWM. <br>
PWM is a means of controlling the analog output via digital means. Digital control is used to generate square waves with different duty cycles (a signal that constantly switches between high and low levels) to control the analog output.In general, the input voltage of port are 0V and 5V. What if the 3V is required? Or what if switch among 1V, 3V and 3.5V? We can’t change resistor constantly. For this situation, we need to control by PWM. <br>

Revision as of 12:25, 10 March 2021


thumb

About keyestudio

Keyestudio is a best-selling brand owned by KEYES Corporation. Our product lines range from controller boards, shields and sensor modules to smart car and complete starter kits for Arduino, Raspberry Pi and BBC micro:bit, which can help customers at any level learn electronics and programming knowledge. Likewise, all of our products comply with international quality standards and are greatly appreciated in a variety of different markets throughout the world.
You can obtain the details and the latest information through visiting the following web sites:http://www.keyestudio.com


References and After-sales Service

1.Download Profile:https://fs.keyestudio.com/KS0507
2.Feel free to contact us please, if there is missing part or you encounter some troubles. Welcome to send email to us:service@keyestudio.com. We will update projects and products continuously from your sincere advice.


Warning

1.This product contains tiny parts(screws, copper pillars), keep it out of reach of children under 7 years old please.
2.This product contains conductive parts (control board and electronic module). Please operate according to the requirements of tutorial. Improper operation may cause parts to overheat damage. Do not touch and immediately disconnect the circuit power.

Copyright

The keyestudio trademark and logo are the copyright of KEYES DIY ROBOT co.,LTD. All products under Keyestudio brand can’t be copied, sold and resold without authorization by anyone or company. If you’re interested in our items, please contact to our sales representatives: fennie@keyestudio.com


Description:

When it comes to programming, many think it difficult. However, KEYES group issues a smart RV kit to cope with this problem.
This is low cost, easy-to-build and open source programming kit-----smart RV.
It integrates smart home and robot car. In addition, it helps you absorb the knowledge of programming like electronics, control logic and computing and science.
In compliance with the tutorial, you can create your own robot by boards, slot connection and wiring. In the assembly process, the detailed projects will guide you to learn the working principle of sensors and modules.
What’s more, it a has temperature humidity sensor and an LCD display except LED, line tracking sensor, ultrasonic sensor, Bluetooth module and motor driving modules.
Should you are interested in STEM and code programming, you can customize your RV by altering code and adding extra modules. That sounds entertaining, right? Let’s get started1

Features

  • Multi-purpose function:obstacle avoidance, line tracking, Bluetooth control, ultrasonic follow, smart sensation and so on.
  • Easy to build:Slot connection and without soldering circuit
  • Novel style:Adopt strong wood board, acrylic board, RGB and lcd1602 modules.
  • High extension:configure motor driving chip, preserve IIC, UART and SPI port and expand other sensor and module.
  • Basic programming learning:use C language and code

Specification:

  • Working voltage: 5v
  • Input voltage: 7-12V
  • Maximum output current: 3A
  • Maximum power dissipation: 15W
  • Motor speed: 200 rpm (4.5V)
  • Motor driving form: TB6612 chip drive
  • Ultrasonic sensing angle: <15 degrees
  • Ultrasonic detection distance: 2cm-400cm
  • Bluetooth remote control distance: 50 meters (measured)
  • Bluetooth APP control: support Android and iOS system


Kit

Remember to check if the components received are in line with the following product list when you getting this kit.


thumb

thumb

thumb

thumb

thumb

thumb

thumb

thumb

thumb


Getting Started with Arduino

Installing Arduino IDE

When we get control board, we need to download Arduino IDE and driver firstly. You could download Arduino IDE from the official website:
https://www.arduino.cc/, click the SOFTWARE on the browse bar, click“DOWNLOADS” to enter download page, as shown below:


thumb

You can download either Windows win7 and newer or Windows ZIP file.
The first one doesn’t require

There are two versions of IDE for WINDOWS system, you can choose from the Installer (.exe) and the Zip packages. We suggest you use the first one that installs directly everything you need to use the Arduino Software (IDE), including the drivers.
With the Zip package you need to install the drivers manually. The Zip file is also useful if you want to create a portable installation.


thumb

thumb

You just need to click JUST DOWNLOAD.

Keyestudio MEGA 2560 Smart Development Board

We need to know keyestudio MEGA 2560 development board, as a core of this smart car.


thumb

The processor core of MEGA 2560 board is ATMEGA2560-16AU, with the cp2102 chip.
It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, 1 ICSP header, and a reset button.
It can be interfaced computer with external power with a USB cable.


thumb

thumb

Install Driver on Windows System

Let’s install the driver of keyestudio MEGA 2560 smart development board. The USB-TTL chip on this board adopts CP2102 serial chip. The driver program of this chip is included in Arduino 1.8 version and above, which is convenient. Plugged in USB port, the computer can recognize the hardware and automatically install the driver of CP2102.

If install unsuccessfully, or you intend to install manually, open the device manager of computer. Right click Computer----- Properties----- Device Manager.


thumb

There is a yellow exclamation mark on the page, which implies installing unsuccessfully. Then we double click the hardware and update the driver.


thumb

Click “OK” to enter the following page, click“browse my computer for updated driver software”, find out the installed or downloaded ARDUINO software. As shown below:


thumb

There is a DRIVERS folder in Arduino software installed package. Just open driver folder and you can see the driver of CP210X series chips.


We click “Browse”, then find out the driver folder, or you could enter “driver” to search in rectangular box, then click“next”, the driver will be installed successfully. (I place Arduino software folder on the desktop, you can follow my way)


thumb

thumb

Open device manager, we will find the yellow exclamation mark disappear. The driver of CP2102 is installed successfully.


thumb

Install Driver on MAC System

The USB to serial chip of control board is CP2102. We install driver on MAC as follows: https://wiki.keyestudio.com/How_to_Install_the_Driver_of_CP2102_on_MAC_System


Arduino IDE Setting

Click0486-12.png icon,open Arduino IDE.


0507--25.png


To avoid the errors when uploading the program to the board, you need to select the correct Arduino board that matches the board connected to your computer. Then come back to the Arduino software, you should click Tools→Board, select the board. (as shown below)


0507--26.png


Then select the correct COM port (you can see the corresponding COM port after the driver is successfully installed)


0507-22.png

0507--28.png

Before uploading the program to the board, let’s demonstrate the function of each symbol in the Arduino IDE toolbar.


0507--29.png


  • A- Used to verify whether there is any compiling mistakes or not.
  • B- Used to upload the sketch to your Arduino board.
  • C- Used to create shortcut window of a new sketch.
  • D- Used to directly open an example sketch.
  • E- Used to save the sketch.
  • F- Used to send the serial data received from board to the serial monitor.


Note: the setting method on Mac system is same as on Windows system except different COM port, as shown below:


0497=图片8.png

Start First Program

We’ve known how to download and install the driver of development board , next, we will burn a code to show“Hello World!”in the monitor.

Test Code


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
}


Open Arduino IDE, and set board as follows:


0507--31.png


Set COM port, as shown below:


0507--32.png

Click 0486-20.png to start compiling the program, and check errors.
Click 0486-23.png to upload the program, upload successfully.


0507--33.png

Upload the program successfully, open serial monitor and set baud rate to 9600. Monitor will print“Hello World!”each 1s.
Congratulation, you finish the first program.


0507--34.png


Projects

For detailed projects, nevigated the website https://fs.keyestudio.com/KS0507


The whole project begins with basic program. Starting from simple to complex, the lessons will guide you to assemble smart RV and absorb the knowledge of electronic and machinery step by step. I reckon that you might hardly sit still and itch to have a go, let’s get started.

Note: (G), marked on each sensor and module, is negative pole and connected to“G”,“-”or“GND”on the sensor shield or control board ; (V) is positive pole and interfaced with“V”,“VCC”,“+”or“5V”on the sensor shield or control board.

Project 1: LED Blink

(1)Description:


0507--1.png

For the starter and enthusiast, this is a fundamental program---LED Blink. LED, the abbreviation of light emitting diodes, consist of Ga, As, P, N chemical compound and so on. It is often applied to numbers and text display as an indicator in the circuit.

The LED can flash diverse color by altering the delay time in the test code. When in control, power on GND and VCC, the LED will be on if S end is high level; nevertheless, it will go off.

(2) Parameter:


0507--2.png 0507--3.png

  • Control interface: digital port
  • Working voltage: DC 3.3-5V
  • Pin spacing: 2.54mm
  • LED display color: red


(3) Component:


0507--4.png

(4)Connection Diagram:


0507--5.png

From the above diagram, pin -, + and S of LED module are respectively connected to pin G, 5V and D13 of expansion board. Then we compile the code as follows:


(5)Test Code:

  /*
  keyestudio smart RV
  lesson 1.1
  Blink
  http://www.keyestudio.com
*/
#define LED  13 //define the pin of LED as D13
void setup()
{
  pinMode(LED, OUTPUT);// initialize digital pin LED as an output.
}
void loop() // the loop function runs over and over again forever
{
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level
  delay(1000);    // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);    // wait for a second
}
//*******************************************************************


(6)Test Result:

Upload the program, LED blinks with the interval of 1s.

(7)Code Explanation:

pinMode(LED,OUTPUT) - This function can denote that the pin is INPUT or OUTPUT.
digitalWrite(LED,HIGH) - When pin is OUTPUT, we can set it to HIGH(output 5V) or LOW(output 0V).

(8)Extension Practice:
The LED flashes for 1s through the test result, therefore, pins and delay time affect flash frequency.

/*
  keyestudio smart RV
  lesson 1.2
  Blink
  http://www.keyestudio.com
*/
#define LED 13 //Define the pin of LED as D13
void setup()
{
  pinMode(LED, OUTPUT);// initialize digital pin LED as an output.
}
void loop() // the loop function runs over and over again forever
{
  digitalWrite(LED, HIGH);   // turn LED on (HIGH is the voltage level
  delay(100);    // wait for a second
  digitalWrite(LED, LOW);    // turn LED off by making the voltage LOW
  delay(100);    // wait for a second
}
//****************************************************************

The LED flashes faster through the lesson 1.2 test.

===
Project 2: Adjust LED Brightness
===(1)Description: In previous lesson, we control LED on and off and make it blink. In this project, we will control LED brightness through PWM to simulate breathing effect. Similarly, you can change the step length and delay time in the code so as to demonstrate different breathing effect.
PWM is a means of controlling the analog output via digital means. Digital control is used to generate square waves with different duty cycles (a signal that constantly switches between high and low levels) to control the analog output.In general, the input voltage of port are 0V and 5V. What if the 3V is required? Or what if switch among 1V, 3V and 3.5V? We can’t change resistor constantly. For this situation, we need to control by PWM.