Joy-It Mega2560 R3 Starter Kit Service Manual

3
3
Mega2560 R3 Starter Kit
Ausgabe 19.05.2017 Copyright by Joy-IT 1
3
Index
2 Assignment
3 Soware installaon
3.1 Soware setup
4 EU-Declaraon of conformity
5 Project-examples
5.1 Project 1: Hello World
5.2 Project 2: ashing LED
5.3 Project 3: PWM Lightcontrol
5.4 Project 4: Trac lights
5.5 Project 5: LED chasing eect
5.6 Project 6: Buon controlled LED
5.7 Project 7: Responder experiment
5.8 Project 8: Acve buzzer
5.9 Project 9: Passive buzzer
5.10 Project 10: Reading analog values
5.11 Project 11: Light dependent resistor
5.12 Project 12: Flamesensor
5.13 Project 13: Tilt switch
5.14 Project 14: 1-Digit LED segment display
5.15 Project 15: 4-Digit LED segment display
5.16 Project 16: LM35 Temperature-sensor
5.17 Project 17: 74HC595
5.18 Project 18: RGB LED
5.19 Project 19: Infrarot remote control
5.20 Project 20: 8x8 LED Matrix
Mega2560 R3 Star-
Ausgabe 19.05.2017 Copyright by Joy-IT 2
Dear customer,
thank you for purchasing our product. Please nd our instrucons below.
1. General informaons & technical data
Our board is a high quality reproducon and fully compable with the Arduino Mega 2560. We would, however, like to emphasize that this is not an original Arduino.
The Mega board is the right microcontrollerboard for everyone who wants to quickly join the programmers world.
This set will lead you to a variety of projects.
Its ATMega2560-Microcontroller oers you enough performance for your ideas and projects. It has a size of 101.52 mm x 53.3 mm and includes 54 digital in– and outputs and 16 analog inputs.
Model ARD_Mega2560R3
Microcontroller ATmega2560 Input voltage 7-12V
Input current (max.) 6-20V
Digital IO 54 (14 mit PWM)
Analog IO 16
DC current IO 40mA
DC current 3.3V 50mA
Memory 256kB (8kB für Bootloader)
SRAM 8kB
EEPROM 4kB
Clock Speed 16 MHz
Dimensions 101.52mm x 53.3mm
Ausgabe 19.05.2017 Copyright by Joy-IT 3
2. Assignment
Ausgabe 19.05.2017 Copyright by Joy-IT 4
3. Soware installaon
To start programming your JOY-IT ARD_Mega2560R3, you need to install the development environment, and, of course, the drivers, on your computer.
The Arduino IDE is best for using with the Mega2560. It is licensed as open source soware under the GPLv2 terms and ist concept and design is aiming for beginners.
This IDE is completely compable to our Mega2560R3 board and oers you every driver you need for a quick start.
You can download the soware here.
3.1 Soware setup
Aer installing the soware, you need to choose the right microcontroller-board in the environment. Therefore you need to be aware of two steps:
1. Choose „Arduino/Genuino Mega or Mega 2560“ at [Tools->Board].
Ausgabe 19.05.2017 Copyright by Joy-IT 5
2. Choose the right port (marked with Arduino/Genuino Mega or Mega 2560) at [Tools -> Port].
Ausgabe 19.05.2017 Copyright by Joy-IT 6
4 EU-Declaraon of conformity
Manufacturer JOY-iT Europe GmbH Pascalstr. 8 47506 Neukirchen-Vluyn
Arcle descripon: ard_mega2560R3 /ARD-Set01
Descripon: Microcontroller-Board / Set
Purpose: experimental setup / prototyping
The manufacturer, the JOY-IT Europe GmbH, Pascalstr. 8, D-47506 Neukirchen-Vluyn, declares that the product „ard_Mega2560IP“ is, during operaon according to regulaons, in compliance with the fundamental requirements of the following guidelines:
2014/ 30/EU (EMV) & 2011/65/EU (Rohs)
The following standards has been applied for assessment:
EN 61326-1: 2013 electrical equipment for measure-, control– and laboratorydevices - EMV requirement part 1 ge­neral requirements
Date Name Signature Posion
03.03.2017 Yue Yang Director
Ausgabe 19.05.2017 Copyright by Joy-IT 7
5 Project examples
5.1 Project 1: „Hello World“
We start with an easy one. You just need the board and an USB cable to start with the „Hello World!“ project. This is an communicaon test for your Mega2560 and your computer and a basic project for your rst steps in the Arduino world.
Aer compleng the drivers installaon, let‘s open the Arduino soware and write some code, which displays „Hello World“ underneath your code. Of course you can create some code, which is going to repeat the message automacally. We can instruct the LED on PIN 13 to blink at rst and to output „Hello World“ aerwars.
Hardware Amount
Mega2560 board 1 USB cable 1 LED 1
Ausgabe 19.05.2017 Copyright by Joy-IT 8
int val; // defines variable “Val” int ledpin=13; // defines digital interface 13 void setup()
{
Serial.begin(9600); // sets baudrate to 9600 to comply
// with software configurationre
pinMode(ledpin,OUTPUT); // sets digital PIN 13 to output. // This configuration is requi //red when using I/O ports.}
void loop() {
val=Serial.read(); // reads symbols and assigns to „Val“
if(val=='R') // checks input for the letter „R“
{ // if so, turn on LED at PIN 13 digitalWrite(ledpin,HIGH);
delay(500); digitalWrite(ledpin,LOW); // turns off LED
delay(500);
Serial.println("Hello World!"); // shows “Hello World” }
}
Ausgabe 19.05.2017 Copyright by Joy-IT 9
Open the serial monitor and insert a „R“. The LED is going to light up once and you will see „Hello World“ in the serial monitor.
Ausgabe 19.05.2017 Copyright by Joy-IT 10
5.2 Project 2: ashing LED
The ashing LED project is quite easy. We already discovered the LED in the previous project. This me we will connect the LED to a digital port. Diesmal werden wir eine LED mit einem der digitalen Pins verbinden. This is what we need:
Hardware Amount
Mega2560 board 1 USB cable 1 Red M5 LED 1
220Ω resistor 1
Breadboard 1 Breadboard cable 2
Just connect the components as seen in the circuit diagram below. We are going to use digital pin 10. Connect the LED to a 220 Ohm resistor to avoid damage by higher currents.
Ausgabe 19.05.2017 Copyright by Joy-IT 11
int ledPin = 10; // Defines digital PIN 10.
void setup()
{
pinMode(ledPin, OUTPUT); // Defines PIN with connected LED as // output }
void loop() {
digitalWrite(ledPin, HIGH); // turns on LED delay(1000); // waits a second digitalWrite(ledPin, LOW); // turns off LED delay(1000); // waits a second
}
Nach dem Runterladen dieses Programms, wirst du im Experiment die an Pin 10 verbundene LED sich, mit einem Intervall von ca. einer Sekunde, Ein- und Ausschalten sehen.
Ausgabe 19.05.2017 Copyright by Joy-IT 12
5.3 Project 3: PWM Lightcontrol
PWM, short for Pulse Width Modulaon, is a technique, used to translate analog signals into digital signals. A computer is not able to output an analog voltage. Er kann nur Digitalspannung ausgeben mit Werten wie 0V oder
5V.
Therefore, a high-resoluon counter is used, to code an analog signal level, by modulang the occupancy rate of PWM. The voltage and current is led by repeated pulse sequences to the component.
Every analog value can be decoded by PWM, if the bandwith is appropiated. The value of the outputvoltage is calculated with the duraon of the on and o condions. Voltage = (ON duraon / pulse duraon) * maximum voltage
PWM has many uses: control of lighntensity, control of motor speed etc.
Ausgabe 19.05.2017 Copyright by Joy-IT 13
The three basic parameters of PWM:
1. Die amplitude of the pulse width (minimum/maximum)
2. Pulsefrequency
3. Voltage level
The Mega2560 has 6 interfaces, supporng PWM: digital PIN 3, 5, 6, 9, 10 and 11.
Hardware Amount
In a previous project, we used a digital signal to control a LED.
Mega2560 Plane 1 USB Kabel 1 Rote M5 LED 1 Variabler Widerstand 1
Now we are going to use a potenometer to adjust the brightness of the LED.
220Ω Widerstand 1 Breadboard 1 Breadboard Überbrückungskabel 6
Ausgabe 19.05.2017 Copyright by Joy-IT 14
While creang this program, we will make use of the analog wring funcon. In this experiment, we are going to read the analog value of the potenmeter and assign this value to the PWM port, to noce a change of LED brightness. The last part will be to show the analog value on the screen.
Ausgabe 19.05.2017 Copyright by Joy-IT 15
int potpin=0; // inialises analog PIN 0 int ledpin=11; // inialises digital PIN 11 (PWM output)
int val=0; // saves the value of the sensor void setup()
{ pinMode(ledpin,OUTPUT); // sets digital PIN 11 to output Serial.begin(9600); // sets baudrate to 9600
}
void loop() {
val=analogRead(potpin); // reads analog value and assigns it to „Val“ Serial.println(val); // shows „Val“ value analogWrite(ledpin,val/4); // turns on LED and assigns brightness //(maximum PWM output is 255) delay(10); // waits 0,01 seconds }
Aer transferring the code, we can noce the value changing by moving the potenometer. We can also noce the brightness of the LED changing.
Ausgabe 19.05.2017 Copyright by Joy-IT 16
5.4. Projekt 4: Trac lights
We already discovered the ashing LED project. Now it is me to do a more complicated experiment: Trac lights During this experiment we will used three LEDs with dierecnt colors.
Hardware Amount
Mega2560 board 1 USB cable 1 Red M5 LED 1 Yellow M5 LED 1 Green M5 LED 1 220Ω resistor 3 Breadboard 1 Breadboard cable 4
Ausgabe 19.05.2017 Copyright by Joy-IT 17
Because this is a simulaon of trac lights, the lighng duraon should be as long as real trac lights. Therefore we are going to use the Arduinos delayfuncon, to control the delay.
Ausgabe 19.05.2017 Copyright by Joy-IT 18
int redled =10; // initialises digital PIN 8 int yellowled =7; // initialises digital PIN 7 int greenled =4; // initialises digital PIN 4
void setup()
{
pinMode(redled, OUTPUT); // sets red LED PIN to output pinMode(yellowled, OUTPUT); // sets yellow LED PIN to output pinMode(greenled, OUTPUT); // sets green LED PIN to output }
void loop() { digitalWrite(greenled, HIGH); // turns on green LED delay(5000); // waits 5 seconds digitalWrite(greenled, LOW); // turns off green LED for(int i=0;i<3;i++) // flashes 3x
{
delay(5000); // waits 5 seconds digitalWrite(yellowled, HIGH); // turns on yellow LED delay(5000); // waits 5 seconds digitalWrite(yellowled, LOW); // turns off yellow LED
}
delay(5000); // waits 5 seconds digitalWrite(redled, HIGH); // turns on red LED delay(5000); // waits 5 seconds digitalWrite(redled, LOW); // turns off red LED
}
You can watch the trac lights, aer the transfer is complete. The green light is going to light up for ve seconds. The yellow light then ashes three mes. The green light will then light up for another ve seconds. Then the yellow light wll ash three mes again. In the end the red light will light up for three seconds and completes the cycle.
Ausgabe 19.05.2017 Copyright by Joy-IT 19
Loading...
+ 44 hidden pages