I review the Elegoo Mega 2560 Kit “The Most Complete Starter Kit” for the review I reviewed the 34 lessons that Elegoo proposes in its learning tutorial included with the kit.
To support the review I use an Analog Discovery 2, 14-bit 100MS / s USB Oscilloscope, Logic Analyzer, and Variable Power Supply and a Multicom Pro MP730026 Digital Multimeter.
In the kit you have everything you need to carry out all the tutorials proposed in the learning guide.
It is a great kit to get started with microcontrollers. You will be able to experiment with digital and analog signals. Analog to digital converters. PWM signals. 1-wire communication protocols, I2C, SPI, UART. Driving LEDs, motors, relays, displays. Remote control with IR. Lighting, temperature, relative humidity, position sensors, inertial acceleration sensors and gyroscope. Reading sensor signals, switches, potentiometers, keyboards, rotary encoders, IR signals.
I have done a thorough review of all the tutorials. Most without problems, I have only found an error in the tutorial diagram that shows how to use the 4-digit 7-segment display in which there are two interchanged connections and in the tutorial that shows the relay connection that I have had problems connecting it. As it was not a breadboard-friendly relay and when bending the pin suggested by the tutorial it broke. As I have several Elegoo kits I finished the tutorial with the relay from another kit without plugging it on the breadboard. Also the example does not make sense, with the relay you cannot control the direction of rotation of the motor. It does not change the polarity, it just acts as a switch.
The kit has fully met my expectations. The instructions in the tutorials are sufficient to assemble all the circuits and the programs are compiled without errors and executed without any necessary modification. Virtually all components of the kit are used in the tutorials with little repetition. The lessons are short enough to take less than an hour, and Elegoo provides you with all the necessary source codes and libraries so you don't have to search the Internet. The price-quality ratio is excellent.
Finally I have made a small game with the components of the kit and the Elegoo touch screen Mega 2560 Touch Breakout Game
Arduino also offers a similar learning kit the ArduinoStarterKit with a book with 15 projects and 150 components. The price is almost double that of the Elegoo kit and includes fewer components. In any case, the Elegoo Kit uses the tools created by Arduino and surely you want to contribute so that Arduino can continue with its great work. There are many ways to donate and support the Arduino project from buying something from their store or simply donate some money.
Detailed ReviewThe learning tutorial divided into 34 lessons with which you will have an introduction to the components included in the kit. The lessons use all the components of the kit except the Prototype Expansion Shell for the Elegoo Mega 2560 board and some discrete components such as ceramic capacitors, electrolytic capacitors, diodes and transistors also included with the kit.
In the documentation they include the datasheets of all the components in case you want to delve more deeply into each of the components or write our own communication libraries with the sensors and actuators.
Each lesson is accompanied by the code used in the lesson and the necessary libraries ready to load as zip. In the first two lessons you learn how to install the Arduino programming environment, Arduino IDE and how to load the libraries that come with the tutorials.
Unboxing & PackagingThe kit comes very well packed in a protective bubble envelope
and a security seal as proof that the package has not been opened before
Inside the envelope is a very well built plastic box ready to last for many years. I have other Elegoo kits bought four years ago and they are still like the first day.
Inside the box we have the more than 200 kit components. Many of the components are well protected inside anti static bags and the smaller ones such as LEDs, diodes, transistors, chips, potentiometers and capacitors are in a small box with separators to keep them well classified and organized.
- 25 x LED (white, yellow, blue, red & green)
- 2 x RGB LED
- 10 xCeramic Capacitor(22pf & 104pf)
- 2 x Photoresistor (Photocell)
- 1 x Thermistor
- 5 x Diode Rectifier (1N4007)
- 4 x Electrolytic Capacitor (10UF 50V & 100UF 50V)
- 5 x NPN Transistor (PN2222
- 5 x NPN Transistor (S8050 )
- 1 x Tilt Ball Switch
- 5 x Switch Button (small)
- 1 x 1 digit 7-segment Display
- 1 x 4 digit 7-segment Display
- 1 x Sound Sensor Module
- 1 x LCD1602 Module (with pin header)
- 1 x IC L293D
- 1 x IC 74HC595
- 1 x Active Buzzer
- 1 x Passive Buzzer
- 1 x RTC Module
- 1 x DHT11 Temperature and Humidity Module
- 2 x Potentiometer 10K
- 1 x Rotary Encoder Module
- 1 x Joystick Module
- 1 x Keypad Module
- 1 x 5V Relay
- 1 x IR Receiver Module
- 1 x MEGA 2560 Controller Board
- 1 x 830 Tie-Points Breadboard
- 1 x Servo Motor (SG90)
- 1 x Stepper Motor
- 1 x ULN2003 Stepper Motor Driver Board
- 1 x Prototype Expansion Shell Module
- 1 x Power Supply Module: 9V IN, 5V/3.3V OUT
- 1 x HC-SR501 PIR Motion Sensor
- 1 x Ultrasonic Sensor
- 1 x GY-521 Module (with pin header)
- 1 x MAX7219 Module
- 1 x IR Remote Control
- 1 x 9V 1A Adapter Power Supply
- 1 x 65 Jumper Wire
- 1 x Water Lever Detection Sensor
- 1 x USB Cable
- 1 x 9V Battery with Snap-on Connector Clip
- 1 x RC522 RFID Module + 2 x Mifare Classic Cards
- 120 x Resistor (10R/100R/220R/330R/1K/2K/5K1/10K/100K/1M)
- 20 x Female-to-male Dupont Wire
The Mega 2560 is a microcontroller board based on the ATmega2560
https://www.microchip.com/en-us/product/ATmega2560
It has 54 digital input/output pins (of which 14 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, an ICSP header, and a reset button. The Mega is compatible with most shields designed for the Arduino Duemilanove or Diecimila.
Tutorial Index:
- Lesson 0 Installing IDE
- Lesson 1 Add Libraries and Open Serial Monitor
- Lesson 2 Blink
- Lesson 3 LED
- Lesson 4 RGB LED
- Lesson 5 Digital Inputs
- Lesson 6 Active buzzer
- Lesson 7 Passive Buzzer
- Lesson 8 Tilt Ball Switch
- Lesson 9 Servo
- Lesson 10 Ultrasonic Sensor Module
- Lesson 11 Membrane Switch Module
- Lesson 12 DHT11 Temperature and Humidity Sensor
- Lesson 13 Analog Joystick Module
- Lesson 14 IR Receiver Module
- Lesson 15 MAX7219 LED Dot Matrix Module
- Lesson 16 GY-521 Module
- Lesson 17 HC-SR501 PIR Sensor
- Lesson 18 Water Level Detection Sensor Module
- Lesson 19 Real Time Clock Module
- Lesson 20 Sound Sensor Module
- Lesson 21 RC522 RFID Module
- Lesson 22 LCD Display
- Lesson 23 Thermometer
- Lesson 24 Eight LED with 74HC595
- Lesson 25 The Serial Monitor
- Lesson 26 Photocell
- Lesson 27 74HC595 And Segment Display
- Lesson 28 Four Digital Seven Segment Display
- Lesson 29 DC Motors
- Lesson 30 Relay
- Lesson 31 Stepper Motor
- Lesson 32 Controlling Stepper Motor With Remote
- Lesson 33 Controlling Stepper Motor With Rotary Encoder
Lesson zero teaches us how to install the arduino IDE. Fortunately, Arduino has done a great job over the last few years and the process of installing the programming environment is very simple.
The Elegoo Mega 2560 R3 board is compatible with the Arduino Mega 2560 board so the Arduino installation tutorials can be followed.
The tutorial that comes on the CD or that can be downloaded from the official Elegoo website is somewhat confusing and the images refer to the Arduino / Genuino UNO board, not the Arduino Mega 2650.
You can download the Arduino IDE or use the Arduino Web Editor, and the Create Platform. The Arduino Web Editor allows you to write code and upload sketches to any official Arduino board from your web browser.
I downloaded and installed the Arduino IDE from the Arduino page.
https://www.arduino.cc/en/software
Once the version is downloaded and installed, you can connect the board to our PC using the USB cable included in the Kit.
Connecting the board with Windows 10
If the drivers have been installed correctly when connecting the board, you will see in the Device Manager a new COM port assigned to the Arduino Mega 2650 board.
Windows found the board without problems like an Arduino Mega 2560
Once the drivers are installed, you can open the Arduino IDE and load your first Sketch onto the board.
Within the Arduino IDE in the Tools / Port menu option we should be able to select the new COM port, COM7 in my case.
The Arduino IDE also recognizes the board without problems.
The type of board with which we are going to work must be indicated to the IDE in the Tools / Board menu option, we will select "Arduino Mega or Mega 2560"
Lesson 1 Add Libraries and Open Serial MonitorThe first lesson is an introduction to the Arduino IDE and how to install libraries and access the serial monitor.
Lesson 2 BlinkThis is the Arduino's Hello World.
Make the LED L on the board blink. It is an example that comes with the Arduino IDE. We check that it works without problems.
From the File / Examples / 0.1Basics / Blink option we open an example that makes the LED built-in on the board, LED_BUILTIN, blink. On the UNO, MEGA and ZERO it is attached to digital pin 13
We compile our first sketch and upload it to the board. We have not been five minutes since we have opened the box and we have already loaded our first sketch. Arduino has greatly improved its IDE and its drivers.
We started to build something. We learn what an LED is and how it connects to the Arduino but without controlling it from the program only using the regulated source on the board. We also have an introduction to resistors and their color code.
We are going to connect an LED and test various resistors in series to see the effect on the brightness of the LED.
Required components
- (1) x Elegoo Mega 2560 R3
- (1) x 5mm red LED
- (1) x 220 ohm resistor
- (1) x 1k ohm resistor
- (1) x 10k ohm resistor
- (2) x M-M wires (Male to Male jumper wires)
In lesson 4 the RGB diode introduces some color theory and PWM Pulse Width Modulation theory to control the power and in this case the brightness of each of the three LEDs that make up the RGB led.
In this lesson we already need the Arduino IDE to upload the sketch and connect the LED to one of the digital outputs of the board
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 Tie Points Breadboard
- (4) x M-M wires (Male to Male jumper wires)
- (1) x RGB LED with common cathode.
- (3) x 220 ohm resistors
On the CD or on the Elegoo website we can download the code for the tutorials.
The example fades the LEDs for the three colors red, blue and green continuously.
Example, fades out blue bring red full
redValue = 0;
greenValue = 0;
blueValue = 255;
for(int i = 0; i < 255; i += 1) // fades out blue bring red full when i=255
{
blueValue -= 1;
redValue += 1;
analogWrite(BLUE, blueValue);
analogWrite(RED, redValue);
delay(delayTime);
}
}
Pulse Width Modulation (PWM) is a technique for controlling power. We also use it here to control the brightness of each of the LEDs.
The diagram below shows the signal from the three PWM pins used to drive the three LEDs of the RGB LED on the MEGA 2560.
RED and BLUE at different brightness and GREEN off
In lesson 5 digital inputs are introduced using push switches using the internal PULL-UP resistors of the ATMega2560 ports
The circuit has two buttons. One turns on the LED and the other turns it off
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 Tie-points Breadboard
- (1) x 5mm red LED
- (1) x 220 ohm resistor
- (2) x push switches
- (7) x M-M wires (Male to Male jumper wires)
It is a very simple example that allows us to treat both the digital inputs and the digital outputs and introduces the necessary pullup resistors so that the digital input does not float.
Lesson 6 the active buzzerThis lesson teaches you how to generate sounds with the buzzer active. It is a very simple lesson in which we generate two notes of different frequencies using a square wave programmed from the Arduino.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x Active buzzer
- (2) x F-M wires (Female to Male DuPont wires)
//output an frequency
for(i=0;i<80;i++)
{
digitalWrite(buzzer,HIGH);
delay(1);//wait for 1ms
digitalWrite(buzzer,LOW);
delay(1);//wait for 1ms
}
//output another frequency
for(i=0;i<100;i++)
{
digitalWrite(buzzer,HIGH);
delay(2);//wait for 2ms
digitalWrite(buzzer,LOW);
delay(2);//wait for 2ms
}
}
With a logic analyzer we can see the two waves generated at the two frequencies
Frequency 492 Hz approx. 2 ms period
Frequency 248 Hz aprox. 4 ms period
Lesson 7 Passive Buzzer
In this lesson, we learn how to use a passive buzzer. The purpose of the experiment is to generate eight different sounds, each sound lasting 0.5 seconds: from Alto Do (523Hz), Re (587Hz), Mi (659Hz), Fa (698Hz), So (784Hz), La (880Hz), Si (988Hz) to Treble Do (1047Hz).
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x Passive buzzer
- (2) x F-M wires (Female to Male DuPont wires)
We learn how we can generate different sounds using PWM Pulse Width Modulation.
Using a logic analyzer we capture the signals generated by PWM.
- La (880Hz)
- Si (988Hz)
- Re(587Hz)
- Alto Do (523Hz)
In this lesson, we learn how to use a tilt ball switch in order to detect small angle of inclination. The example uses the internal led of the board. BUILTIN LED, 13.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x Tilt Ball switch
- (2) x F-M wires (Female to Male DuPont wires)
In this lesson we learn to drive a servo motor that can only rotate 180 degrees and that we control by sending electrical pulses from the Mega 2560 R3 board.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x Servo (SG90)
- (3) x M-M wires (Male to Male jumper wires)
The motor is powered by 5 V through pin 1 and the signal with the pulses is sent to it through pin 2. The length of the pulse indicates the position to which the servo has to move.
The code
Position "0" (1.5 ms pulse) is middle, "90" (~2ms pulse) is middle, is all the way to the right, "-90" (~1ms pulse) is all the way to the left.
In this lesson we learn how to use the HC-SR04 ultrasound sensor to measure distances.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x Ultrasonic sensor module
- (4) x F-M wires (Female to Male DuPont wires)
The ultrasonic sensor module HC-SR04 provides 2cm-400cm non-contact measurement function, the ranging accuracy can reach to 3mm. The modules includes ultrasonic transmitters, receiver and control circuit.
Test distance = (high level time × velocity of sound (340m/s) /2
The Timing diagram is shown below. You only need to supply a short 10us pulse to the trigger input to start the ranging, and then the module will send out an 8 cycle burst of ultrasound at 40 kHz and raise its echo. The Echo is a distance object that is pulse width and the range in proportion.
In this lesson we learn how to integrate a keyboard with an MEGA 2560 R3 board so that the MEGA 2560 R3 can read the keys being pressed by a user.
byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x Membrane switch module
- (8) x M-M wires (Male to Male jumper wires
byte rowPins[ROWS] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; //connect to the column pinouts of the keypad
Lesson 12 DHT11 Temperature and Humidity SensorIn this lesson we learn how to use a DHT11 temperature and humidity sensor.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x DHT11 Temperature and Humidity module
- (3) x F-M wires (Female to Male DuPont wires)
DHT11 digital temperature and humidity sensor is a composite Sensor which contains a calibrated digital signal output of the temperature and humidity.
/* Measure temperature and humidity. If the functions returns
true, then a measurement is available. */
if( measure_environment( &temperature, &humidity ) == true )
{
Serial.print( "T = " );
Serial.print( temperature, 1 );
Serial.print( " deg. C, H = " );
Serial.print( humidity, 1 );
Serial.println( "%" );
}
MCU to DHT11 communication. DHT11 uses Single-bus data format for communication and synchronization between MCU and DHT11 sensor. One communication process is about 4ms. Data consists of decimal and integral parts. A complete data transmission is 40 bit, and the sensor sends higher data bit first.
Relative Humidity % 8 bit integral RH data + 8 bit decimal RH data
Temperature 8bit integral T data + 8 bit decimal T data
In this tutorial you learn to use an analog joystick for horizontal and vertical control and a push switch.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x Joystick module
- (5) x F-M wires (Female to Male DuPont wires)
Serial.print("Switch: ");
Serial.print(digitalRead(SW_pin));
Serial.print("\n");
Serial.print("X-axis: ");
Serial.print(analogRead(X_pin));
Serial.print("\n");
Serial.print("Y-axis: ");
Serial.println(analogRead(Y_pin));
Serial.print("\n\n");
In this lesson we will be connecting the IR receiver to the MEGA2560, and then use a Library that was designed for this particular sensor.
In our sketch we will have all the IR Hexadecimal codes that are available on this remote, we will also detect if the code was recognized and also if we are holding down a key.
Using an IR Remote is a great way to have wireless control of your project.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x IR receiver module
- (1) x IR remote
- (3) x F-M wires (Female to Male DuPont wires)
With only three cables we connect the infrared receiver. The bookstore takes care of the rest.
Using the IR remote control included in the kit we can send orders to our Elegoo MEGA 2650 R3. In the lesson we learn to differentiate the different commands sent by the remote control.
if (irrecv.decode(&results)) // have we received an IR signal?
{
translateIR();
irrecv.resume(); // receive the next value
}
In this lesson we learn how to connect a MAX7219 and scroll the text across.
Since these modules use the MAX7219 LED driver chip, we will be able to turn on and off the 64 LEDs of each module, using only 3 pins on our MEGA 2560.
Component Required:
- (1) x Elegoo Mega2560 R3
- (1) x Max7219 module
- (5) x F-M wires (Female to Male DuPont wires)
This display allows us to show information or as a display for small games.
The MAX7219 IC is a serial input/output common-cathode display driver that interfaces microprocessors to a 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs. Here an 8×8 LED matrix, integrated with a MAX7219 IC setup, available as a pre-wired module is used.
You can control individual LEDs
lc.setLed(0,row,col,true);
A column
lc.setColumn(0,col,(byte)0);
Or a row
lc.setRow(0,row,(byte)0);
For displaying characters you can define in rows
byte a[5]={B01111110,B10001000,B10001000,B10001000,B01111110};
Then to display:
lc.setRow(0,0,a[0]);
lc.setRow(0,1,a[1]);
lc.setRow(0,2,a[2]);
lc.setRow(0,3,a[3]);
lc.setRow(0,4,a[4]);
https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
We capture the digital signals. We indicate by lowering CS that we are going to send data. We activate the clock to synchronize the data sent by the DIN serial data line and send the data.
In this lesson, we will learn how to use GY-521 module which is one of the best IMU (Inertia Measurement Unit) sensors, compatible with Arduino. IMU sensors like the GY-521 are used in self balancing robots, UAVs, smart phones, etc.
Component Required:
- (1)x Elegoo Mega 2560 R3
- (1)x GY-521 module
- (4)x F-M wires
The GY-521 comes with a MPU6050 IMU, an Inertial Measurement Unit. The MPU6050 is a popular six DoF accelerometer and gyroscope (gyro) with six axes of sensing and 16-bit measurements.
Uses I2C communication. I2C Logic Pins
SCL - I2C clock pin, connect to your microcontroller's I2C clock line. This pin is level shifted so you can use 3-5V logic, and there's a 10K pullup on this pin.
SDA -I2C data pin, connect to your microcontroller's I2C data line. This pin is level shifted so you can use 3-5V logic, and there's a 10K pullup on this pin.
Scanning I2C protocol
Uses two lines SCL, clock, and SDA Data
const int MPU_addr=0x68; // I2C address of the MPU-6050
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
In this lesson you will learn how to use a PIR movement detector with an MEGA 2560. The MEGA 2560 is the heart of this project. It 'listens' to the PIR sensor and when motion is detected, instructs the LED to light on or shut off.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x HC-SR501 PIR motion sensor
- (3) x F-M wires (Female to Male DuPont wires)
This module only needs a connection line through which the sensor will tell us if it has detected something or not. To configure we must adjust the module controls.
The HC-SR501 PIR motion sensor is built around the BISS0001 Micro Power PIR Motion Detector IC. This IC is specifically developed to process the signal from PIR motion sensors.
Pin or Control Function
- Time Delay Adjust: Sets how long the output remains high after detecting motion.... Anywhere from 5 seconds to 5 minutes.
- Sensitivity Adjust: Sets the detection range.... from 3 meters to 7 meters
- Trigger Selection Jumper: Set for single or repeatable triggers.
- Output Pin Low when no motion is detected.. High when motion is detected. High is 3.3V
- Power Pin: 5 to 20 VDC Supply input
- Ground pin: Ground input
The example turns on the internal led when movement has been detected.
pirValue = digitalRead(pirPin);
digitalWrite(ledPin, pirValue);
Lesson 18 Water Level Detection Sensor ModuleOverview
In this lesson, you will learn how to use a water level detection sensor module. This module can perceive the depth of water and the core component is an amplifying circuit which is made up of a transistor and several pectinate PCB routings. When put into the water, these routings will present a resistor that can change along with the change of the water’s depth. Then, the signal of water’s depth is converted into the electrical signal, and we can know the change of water’s depth through the ADC function of MEGA 2560 R3.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (3) x F-M wires (Female to Male DuPont wires)
- (1) x Water lever detection sensor module
int value = analogRead(adc_id); // get adc value
if(((HistoryValue>=value) && ((HistoryValue - value) > 10)) || ((HistoryValue<value) && ((value - HistoryValue) > 10)))
{
sprintf(printBuffer,"ADC%d level is %d\n",adc_id, value);
Serial.print(printBuffer);
HistoryValue = value;
}
Warning: The transistor gets very hot.
Lesson 19 Real Time Clock ModuleIn this lesson, you will learn how to use the RTC module, The DS1307 real-time clock is a low-power chip. Address and data are transferred serially through an I2C, which can be used unless being connected to UNO with only three data cables. DS1307 provides seconds, minutes, hours, day, date, month, and year information. Timekeeping operation continues while the part operates from the backup supply.
Component Required:
- (1) x Elegoo Uno R3
- (1) x DS1307 RTC module
- (4) x F-M wires (Female to Male DuPont wires)
In this lesson, you will learn how to use a sound sensor module. This module has two outputs: AO: analog output, real-time output voltage signal of microphone DO: when the intensity of the sound reaches a certain threshold, the output is a high or low level signal. The threshold sensitivity can be achieved by adjusting the
potentiometer. To make sure the microphone can detect your voice normally, please try to change its sensitivity by turning the blue precise potentiometer on the module. Given to its preciseness, it takes at least 10 circles for you to get some response. Component Required:
- (1) x Elegoo Uno R3
- (1) x Sound sensor module (4) x F-M wires (Female to Male DuPont wires)
analogValue = analogRead(sensorAnalogPin); // Read the value of the analog interface A0 assigned to digitalValue
digitalValue=digitalRead(sensorDigitalPin); // Read the value of the digital interface 7 assigned to digitalValue
Serial.println(analogValue); // Send the analog value to the serial transmit interface
if(digitalValue==HIGH) // When the Sound Sensor sends signla, via voltage present, light LED13 (L)
{
digitalWrite(Led13,HIGH);
}
else
{
digitalWrite(Led13,LOW);
}
delay(50); // Slight pause so that we don't overwhelm the serial interface
In this lesson, you will learn to how to apply the RC522 RFID Reader Module on MEGA2560 R3. This module uses the Serial Peripheral Interface (SPI) bus to communicate with controllers such as Arduino, Raspberry Pi, beagle board, etc.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x RC522 RFID module
- (7) x F-M wires (Female to Male DuPont wires)
The MFRC522 is a highly integrated reader/writer for contactless communication at
13.56 MHz. The MFRC522 reader supports ISO 14443A / MIFARE® mode.
The MFRC522’s internal transmitter part is able to drive a reader/writer antenna designed to communicate with ISO/IEC 14443A/MIFARE® cards and transponders without additional active circuitry. The receiver part provides a robust and efficient implementation of a demodulation and decoding circuitry for signals from ISO/IEC 14443A/MIFARE® compatible cards and transponders. The digital part handles the complete ISO/IEC 14443A framing and error detection (Parity & CRC).The MFRC522 supports MIFARE®Classic (e.g. MIFARE® Standard) products. The MFRC522 supports contactless communication using MIFARE® higher transfer speeds up to 848 kbit/s in both directions.
It is a 3.3V module fortunately the Elegoo MEGA2560 R3 can power our module at 3.3V
Connections RC522 RFID module to Elegoo Mega 2560 R3
- RST/Reset : RST - 5
- SPI SS : SDA(SS) - 53
- SPI MOSI : MOSI - 51
- SPI MISO : MISO - 50
- SPI SCK : SCK - 52
We can read and write MIFARE®Classic cards like those used in many access control and transport systems. As long as we have the keys.
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
// Dump debug info about the card; PICC_HaltA() is automatically called
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
In this lesson, you will learn how to wire up and use an alphanumeric LCD display. The display has an LED backlight and can display two rows with up to 16 characters on each row. You can see the rectangles for each character on the display and the pixels that make up each character. The display is just white on blue and is intended for showing text.
In this lesson, we will run the Arduino example program for the LCD library, but in the next lesson, we will get our display to show the temperature, using sensors.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x LCD1602 module
- (1) x Potentiometer (10k)
- (1) x 830 tie-points Breadboard
- (16) x M-M wires (Male to Male jumper wires)
The circuit:
- LCD RS pin to digital pin 7
- LCD Enable pin to digital pin 8
- LCD D4 pin to digital pin 9
- LCD D5 pin to digital pin 10
- LCD D6 pin to digital pin 11
- LCD D7 pin to digital pin 12
- LCD R/W pin to ground
- LCD VSS pin to ground
- LCD VCC pin to 5V
- 10K resistor:
- ends to +5V and ground
- wiper to LCD VO pin (pin 3)
Connections
- RS: A register select pin that controls where in the LCD’s memory you are writing data to. You can select either the data register, which holds what goes on the screen, or an instruction register, which is where the LCD’s controller looks for instructions on what to do next.
- R/W: A Read/Write pin that selects reading mode or writing mode
- E: An enabling pin that, when supplied with low-level energy, causes the LDC module to execute relevant instructions.
- D0-D7:Pins that read and write data
// BS E D4 D5 D6 D7
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis() / 1000);
In this lesson, you will use an LCD display to show the temperature.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x LCD1602 Module
- (1) x 10k ohm resistor
- (1) x Thermistor
- (1) x Potentiometer
- (1) x 830 tie-points Breadboard
- (18) x M-M wires (Male to Male jumper wires)
A thermistor is a thermal resistor - a resistor that changes its resistance with temperature.
int tempReading = analogRead(tempPin);
double tempK = log(10000.0 * ((1024.0 / tempReading - 1)));
tempK = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * tempK * tempK )) * tempK );
float tempC = tempK - 273.15; // Convert Kelvin to Celsius
// Display Temperature in C
lcd.setCursor(0, 0);
lcd.print("Temp C ");
lcd.setCursor(6, 0);
// Display Temperature in C
lcd.print(tempC);
In this lesson, you will learn how to use eight large red LEDs with an MEGA 2560 without needing to give up 8 output pins!
Although you could wire up eight LEDs each with a resistor to an MEGA 2560 pin you would rapidly start to run out of pins on your MEGA 2560. If you don't have a lot of stuff connected to your MEGA 2560. It's OK to do so - but often times we want buttons, sensors, servos, etc. and before you know it you've got no pins left. So, instead of doing that, you are going to use a chip called the 74HC595 Serial to Parallel Converter. This chip has eight outputs (perfect) and three inputs that you use to feed data into it a bit at a time.
This chip makes it a little slower to drive the LEDs (you can only change the LEDs about 500, 000 times a second instead of 8, 000, 000 a second) but it's still really fast, way faster than humans can detect, so it's worth it!
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 tie-points breadboard
- (8) x leds
- (8) x 220 ohm resistors
- (1) x 74hc595 IC
- (14) x M-M wires (Male to Male jumper wires)
int latchPin = 11;
int clockPin = 9;
int dataPin = 12;
leds = 0;
updateShiftRegister();
delay(500);
for (int i = 0; i < 8; i++)
{
bitSet(leds, i);
updateShiftRegister();
delay(500);
}
void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
digitalWrite(latchPin, HIGH);
}
In this lesson, you will build on Lesson 24, adding the facility to control the LEDs from your computer using the Arduino Serial Monitor. The serial monitor is the 'tether' between the computer and your MEGA 2560. It lets you send and receive text messages, handy for debugging and also controlling the MEGA 2560 from a keyboard! For example, you will be able to send commands from your computer to turn on LEDs.
In this lesson, you will use exactly the same parts and a similar breadboard layout as Lesson 24.
if (Serial.available())
{
char ch = Serial.read();
if (ch >= '0' && ch <= '7')
{
int led = ch - '0';
bitSet(leds, led);
updateShiftRegister();
Serial.print("Turned on LED ");
Serial.println(led);
}
if (ch == 'x')
{
leds = 0;
updateShiftRegister();
Serial.println("Cleared");
}
}
In this lesson, you will learn how to measure light intensity using an Analog Input. You will build on lesson 25 and use the level of light to control the number of LEDs to be lit.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 tie-points breadboard
- (8) x leds
- (8) x 220 ohm resistors
- (1) x 1k ohm resistor
- (1) x 74hc595 IC
- (1) x Photoresistor (Photocell)
- (16) x M-M wires (Male to Male jumper wires)
After learning Lesson 24、25 and Lesson 26, we will use the 74HC595 shift register to control the segment display. The segment display will show number from 9-0.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 tie-points breadboard
- (1) x 74HC595 IC
- (1) x 1 Digit 7-Segment Display
- (8) x 220 ohm resistors
- (26) x M-M wires (Male to Male jumper wires)
Connection DS, ST_CP and SH_CP pin:
DS (pin 14) connected to MEGA 2560 R3 board pin 2 (the figure below the yellow line) ST_CP (pin 12, latch pin) connected to MEGA 2560 R3 board pin 3 (FIG blue line below) SH_CP (pin 11, clock pin) connected to MEGA 2560 R3 board pin 4 (the figure below the white line)
74HC595 pin Seven shows remarkable control pin (stroke)
- Q0 → 7 (A)
- Q1 → 6 (B)
- Q2 → 4 (C)
- Q3 → 2 (D)
- Q4 → 1 (E)
- Q5 → 9 (F)
- Q6 → 10 (G)
- Q7 → 5 (DP)
int latchPin = 11; // (11) ST_CP [RCK] on 74HC595
int clockPin = 9; // (9) SH_CP [SCK] on 74HC595
int dataPin = 12; // (12) DS [S1] on 74HC595
void setup() {
// Set latchPin, clockPin, dataPin as output
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
In this lesson, you will learn how to use a 4-digit 7-segment display.
When using 1-digit 7-segment display please notice that if it is common anode, the common anode pin connects to the power source; if it is common cathode, the common cathode pin connects to the GND.
When using 4-digit 7-segment display, the common anode or common cathode pin is used to control which digit is displayed. Even though there is only one digit working, the principle of Persistence of Vision enables you to see all numbers displayed because each the scanning speed is so fast that you hardly notice the intervals.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 tie-points breadboard
- (1) x 74HC595 IC
- (1) x 4 Digit 7-Segment Display
- (4) x 220 ohm resistors
- (23) x M-M wires (Male to Male jumper wires)
The diagram has an error, the connections of segment C and of the decimal point are interchanged.
The example does not make the digit selection show the same data in all 4 digits and therefore it is not a valid example.
In this project I show you how you could select each of the digits separately using 4 digital outputs and 4 NPN2222 transistors to drive the 7 LEDs of each display.
In this lesson, you will learn how to control a small DC motor using an MEGA 2560 R3 and a transistor.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 tie-points breadboard
- (1) x L293D IC
- (1) x Fan blade and 3-6v motor
- (5) x M-M wires (Male to Male jumper wires)
- (1) x Power Supply Module
- (1) x 9V1A adapter
The power supply module
3.3V DC Output
5V DC Output
- M1 PWM - connect this to a PWM pin on the Arduino. They're labelled on the 2560, pin 5 is an example. Output any integer between 0 and 255, where 0 will be off, 128 is half speed and 255 is max speed.
- M1 direction 0/1 and M1 direction 1/0 - Connect these two to two digital Arduino pins. Output one pin as HIGH and the other pin as LOW, and the motor will spin in one direction.
Reverse the outputs to LOW and HIGH, and the motor will spin in the other direction.
Enable is a PWM output.
Serial.println("PWM full then slow");
//---PWM example, full speed then slow
analogWrite(ENABLE,255); //enable on
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(2000);
analogWrite(ENABLE,180); //half speed
delay(2000);
analogWrite(ENABLE,128); //half speed
delay(2000);
analogWrite(ENABLE,50); //half speed
delay(2000);
analogWrite(ENABLE,128); //half speed
delay(2000);
analogWrite(ENABLE,180); //half speed
delay(2000);
analogWrite(ENABLE,255); //half speed
delay(2000);
digitalWrite(ENABLE,LOW); //all done
delay(10000);
In this lesson, you will learn how to use a relay.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 tie-points breadboard
- (1) x Fan blade and 3-6v dc motor
- (1) x L293D IC
- (1) x 5v Relay
- (1) x Power Supply Module
- (1) x 9V1A Adapter
- (8) x M-M wires (Male to Male jumper wires)
The relay is not prepared for a breadboard and you can damage it when inserting it, but it will not make good contact. We have chosen to connect it with dupont cables.
#define ENABLE 5
#define DIRA 3
#define DIRB 4
Example does not make sense, with the relay you cannot control the direction of rotation of the motor. It does not change the polarity, it just acts as a switch.
//---back and forth example
Serial.println("One way, then reverse");
digitalWrite(ENABLE,HIGH); // enable on
for (i=0;i<5;i++)
{
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(800);
Serial.println("front");
digitalWrite(DIRA,LOW); //reverse
digitalWrite(DIRB,HIGH);
delay(800);
Serial.println("back");
}
In this lesson, you will learn a fun and easy way to drive a stepper motor.
The stepper we are using comes with its own driver board making it easy to connect to our MEGA 2560.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 tie-points breadboard
- (1) x ULN2003 stepper motor driver module
- (1) x Stepper motor
- (1) x 9V1A Adapter
- (1) x Power supply module
- (6) x F-M wires (Female to Male DuPont wires)
- (1) x M-M wire (Male to Male jumper wire)
const int stepsPerRevolution = 2048; // change this to fit the number of steps per revolution
const int rolePerMinute = 15; // Adjustable range of 28BYJ-48 stepper is 0~17 rpm
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
In this lesson, you will learn how to control stepper motors using a rotary encoder. We will use the inexpensive and popular stepper motor that comes with its own control board: the 28BYJ-48 stepper motor with the ULN2003 board.
The 28BYJ-48 motor is not very fast or very strong, but it’s great for beginners to start experimenting with controlling a stepper motor with an Arduino.
We will write some code to have the motor move in the direction that we turn the rotary encoder, and will also keep track of how many steps we have taken, so that we can have the motor move back to the starting position by pressing down on the rotary encoder switch.
Component Required:
- (1) x Elegoo Mega 2560 R3
- (1) x 830 tie-points breadboard
- (1) x Rotary Encoder Module
- (1) x ULN2003 stepper motor driver module
- (1) x Stepper motor
- (1) x Power supply module
- (1) x 9V1A Adapter
- (9) x F-M wires (Female to Male DuPont wires)
- (1) x M-M wire (Male to Male jumper wire
In order to get encoder transitions we use interrupts
// Interrupt routine runs if CLK goes from HIGH to LOW
void isr () {
delay(4); // delay for Debouncing
if (digitalRead(PinCLK))
rotationdirection= digitalRead(PinDT);
else
rotationdirection= !digitalRead(PinDT);
TurnDetected = true;
}
void setup () {
pinMode(PinCLK,INPUT);
pinMode(PinDT,INPUT);
pinMode(PinSW,INPUT);
digitalWrite(PinSW, HIGH); // Pull-Up resistor for switch
attachInterrupt (0,isr,FALLING); // interrupt 0 always connected to pin 2 on Arduino UNO
}
Comments