Introduction: Getting Started With GearBest Starter Kit for Arduino

If you are new to the "Arduino World" this tutorial will help you to make your first steps with electronics and Arduino boards.

We will use the "GearBest Starter Kit for Arduino" for this! Why? Because is a low cost kit - only 22$* - that includes all basic stuff that we will need plus Arduino Mega 2560 (compatible) development board!

It comes from www.gearbest.com on a nice box, you can buy it from here.

Let's get started!

*Price can be changed from seller

**I am not the seller

Step 1: What Is in the Box?

In the box you will find*:

  • MEGA R3 2560 development board + USB cable
  • Breadboard (Type: SYB - 120)
  • 30x Colorful cables (male to male)
  • LEDs: 5x Red, 5x Blue, 5x Yellow)
  • Resistors: 8x 220Ω, 4x 1KΩ, 5x 10KΩ
  • Potentiometer 50KΩ
  • 2x Photoresistrors
  • Buzzers: 1x Active & 1x Passive
  • 4x Buttons
  • One digit 7 Segment Display 5611AH
  • 2x Vibration Sensor (Shake Switch)
  • Flame sensor

*Parts can be change, read seller description

Step 2: Blink an LED - 1st Tutorial

LEDs (Light-emitting diode) can be found on many colors and sizes.

Our first tutorial shows the simplest thing you can do with an Arduino to see physical output: it blinks an LED!

In this tutorial you will also learn how to use pinMode(), digitalWrite() and delay() functions.

Common leds have two pins. The positive end of a led (larger pin) is called anode, and the negative end is called cathode.

The connections are pretty easy, see the image above with breadboard circuit schematic.

The schematic was made with the Arduino uno board, that will not be a problem, you can also use the digital pin 3 of the Arduino Mega board.


Here's the Blink code, embedded using Codebender!

Keep in mind that setup( ) routine runs only once after power on / re-program or press the reset button. In the program below, the first thing you do is to initialize pin 3 as an output pin with pinMode( ) function in setup( ) routine.

The loop( ) routine runs over and over again, forever. In the main loop, you turn on or off LED with digitalWrite( ) function and "pause" the program for three seconds with delay( ) function. (3 sec are 3000 ms)

Try downloading the codebender plugin and clicking on the Run on Arduinobutton to program your Arduino with the Blink sketch. And that's it, you've programmed your first Arduino with the basic Blink sketch! You can keep playing with that by clicking the "Edit" button and start making your own modifications to the code. For example you can add a second led or change the delay time!


Well done!

You have successfully completed our first Arduino "How to" tutorial and you learned how to use:

  • led
  • constants
  • pinMode(), digitalWrite() and delay() functions

Now you can proceed to the next tutorial!

Step 3: Fade an LED - 2nd Tutorial

In this tutorial you will learn how to fade an LED by using analogWrite() function. AnalogWrite uses pulse width modulation (PWM), turning a digital pin on and off very quickly, to create a fading effect.

The circuit is the same as our first tutorial, so you can proceed to the programming part.


Learn more about PWM here!


Here's the Fade code, embedded using codebender!
Keep in mind that setup( ) routine runs only once after power on / re-program or press the reset button. In the program below, the first thing you do is to initialize pin 3 as an output pin with pinMode( ) function in setup( ) routine.

The loop( ) routine runs over and over again, forever. The analogWrite() function that you will be using in the main loop of your code requires two arguments: One telling the function which pin to write to, and one indicating what PWM value to write.

In order to fade your LED off and on, gradually increase your PWM value from 0 (all the way off) to 255 (all the way on), and then back to 0 once again to complete the cycle. In the sketch below, the PWM value is set using a variable calledbrightness. Each time through the loop, it increases by the value of the variable fadeAmount.
Try changing the value of the delay by clicking 'Edit' button and see how it changes the program.


Well done!
You have successfully completed our second Arduino "How to" tutorial and you learned how to:

  • fade an led
  • use PWM pins
  • use analogWrite() function
  • put variables in your codeuse 'if' statement

Now you can proceed to the next tutorial!

Step 4: How to Use Potentiometer - 3rd Tutorial

Potentiometers are variable resistors and they function to alter their resistance via a knob or dial. You have probably used one before by adjusting the volume on your stereo or using a light dimmer.

Potentiometers have a range of resistance. They can be attuned from zero ohms to whatever maximum resistance that is specific to it. For example, a potentiometer of 10 kΩ can be adjusted from 0 Ω to its maximum of 10 kΩ. In this tutorial you will learn how to use a potentiometer with the Arduino board to fade an LED. You will also learn how to use analogRead() and map() functions.

The connections are pretty easy, see the image above with breadboard circuit schematic.
The schematic was made with the Arduino uno board, that will not be a problem, you can also use the digital pin 9 and Analog pin A0 of the Arduino Mega board.


Here's the 'Fade an LED with potentiometer' code, embedded using codebender!


By turning the shaft of the potentiometer, we change the amount of resistence on either side of the wiper which is connected to the center pin of the potentiometer. This changes the relative "closeness" of that pin to 5 volts and ground, giving us a different analog input. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and we read 0. When the shaft is turned all the way in the other direction, there are 5 volts going to the pin and we read 1023. In between, analogRead() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.

Ηow it works:

  • Read analog value from potentiometer middle pin
    -> value=analogRead(potPin)
  • Map analog values 0-1024 to pwm values 0-255
    -> value = map(value, 0, 1023, 0, 255);
  • Send pwm value to led
    -> analogWrite(ledPin, value);

Tip: You can make the same example by connecting potentiometer middle pin to a digital PWM pin and avoid to use map() function. Try it dy clicking 'Edit' button.


Well done!

You have successfully completed our third Arduino "How to" tutorial and you learned so far how to use:

  • LEDs
  • potentiometers
  • pinMode(), delay(), map(), digitalWrite(), analogWrite() and analogRead() functions
  • variables and constants
  • if statement

Congratulations you have become an Arduino developer!

Now you can proceed to the next tutorial!

Step 5: How to Use a Push Button - 4th Tutorial

Push buttons or switches connect two points in a circuit when you press them. This tutorial turns on one led when the button pressed once, and off when pressed twice.

In this tutorial you will also learn how to use 'flag' variable to control an event.

The connections are pretty easy, see the image above with breadboard circuit schematic.
The schematic was made with the Arduino uno board, that will not be a problem, you can also use the same pins with the Arduino Mega board.


Here's the 'Button' code, embedded using codebender!
Keep in mind that setup( ) routine runs only once after power on / re-program or press the reset button. In the program below, the first thing you do is to initialize pin 9 as an output pin with pinMode( ) function in setup( ) routine. The loop( ) routine runs over and over again, forever.

In the main loop, you read the state of button (pressed=high, unpressed=low) and you store it in buttonState variable. When button pressed once, the led turns on, and when pressed twice, the led turns off.

Read comments below

Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino with this sketch. And that's it, you've programmed your Arduino board! You can keep playing with that by clicking the "Edit" button and start making your own modifications to the code. For example you can add a second led or make it blink when button pressed.


Well done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use:

  • buttons
  • flag variable to control an event

Proceed to the next tutorial

Step 6: How to Use a Photoresistor - 5th Tutorial

A photoresistor or photocell is a light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity. A photoresistor can be applied in light-sensitive detector circuits, and light- and dark-activated switching circuits. It's also called light-dependent resistor (LDR).

In this tutorial you will learn how to use a photoresistor with an Arduino board.

The connections are pretty easy, see the image above with breadboard circuit schematic.
The schematic was made with the Arduino uno board, that will not be a problem, you can also use the same pins with the Arduino Mega board.


Here's the 'led & photoresistor' code, embedded using codebender!
How it works:

  • Read analog value from photoresistor/photocell
    -> value=analogRead(pResistor)
  • Check if value is bigger than e.g. 25
  • Send command to turn on/off the led

Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino with this sketch. And that's it, you've programmed your Arduino board!

You can keep playing with that by clicking the "Edit" button and start making your own modifications to the code. For example, try to change "25" value and see how it changes the program.


Well done!
You have successfully completed one more Arduino "How to" tutorial and you learned how to use a photoresistor!

Keep going!

Step 7: How to Use a Buzzer - 6th Tutorial

In this tutorial you will learn how to use a buzzer or piezo speaker with Arduino. Buzzers can be found in alarm devices, computers, timers and confirmation of user input such as a mouse click or keystroke.

You will also learn how to use tone() and noTone() function.

The connections are pretty easy, see the image above with breadboard circuit schematic. The use of the resistor is optional.
The schematic was made with the Arduino uno board, that will not be a problem, you can also use the same pins with the Arduino Mega board.


Here's the "Tone" code, embedded using codebender!


How it works? It's simple, tone(buzzer, 1000) sends a 1KHz sound signal to pin 9, delay(1000) pause the program for one second and noTone(buzzer) stops the signal sound. The loop() routine will make this run again and again making a short beeping sound.

(you can also use tone(pin, frequency, duration) function)

Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino with this sketch. And that's it, you've programmed your Arduino board!
You can keep playing with that by clicking the "Edit" button and start making your own modifications to the code. For example, try to change sound signal "1000" (1KHz) to "500" (500Hz) or delay time and see how it changes the program.


Well done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use:

  • buzzer / piezo speaker
  • tone(), noTone() functions

Step 8: One Digit 7 Segment Display - 7th Tutorial

A Seven Segment Display, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays.

Seven segment displays are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information. In this tutorial you will learn how to use one 7 Segment Display with Arduino uno.

You will be able to print a number from 1 to 9 at the 7 segment display from the serial monitor!

The connections are easy, see the image above with breadboard circuit schematic.
The schematic was made with the Arduino uno board, that will not be a problem, you can also use the same pins with the Arduino Mega board.

Pinout of 7 segment display:

  • 1 - "E" - Arduino pin 6
  • 2 - "D" - Arduino pin 7
  • 3 - "CC" - Arduino pin 4
  • 4 - "C" - Arduino pin 8
  • 5 - "DP" -
  • 6 - "B" - Arduino pin 9
  • 7 - "A" - Arduino pin 10
  • 8 - "CC" - Arduino pin 4
  • 9 - "F" - Arduino pin 11
  • 10 - "G" - Arduino pin 12

(if you want you can connect resistors to each pin - except "CC")


Here's the code, embedded using codebender!

  • numOfDigits = 1 If we have two seven segment displays we will change this to "2".
  • digitPins [numOfDigits] = {4} If we have two seven segment displays, we have to add the second display CC pin to e.g. arduino pin 3, so we will change it to "{4, 3}".
  • disp.setDutyCycle(50) Control brightness of display - "50" is 50% of led brightness.
  • disp.writeDigit(number) Print a number from 0 to 9

Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino with this sketch. And that's it, you've programmed your Arduino board!

Press the "connect" button to start the serial communication with your board. You can send numbers from 1 to 9.

You can keep playing with that by clicking the "Edit" button and start making your own modifications to the code.
For example, try to change disp.writeDigit(number) "number" with letter "F" (or 'b', 'd', 'A','E'). You can find more info about "SevenSeg.h" library and more available functions here.


Well done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use one Seven Segment Display with Arduino uno.

Step 9: Vibration Sensor (Shake Switch) - 8th Tutorial

In this tutorial we will use one vibration sensor or shake switch to make a beep sound from a buzzer while we shake our breadboard.

The connections are pretty easy, connect one pin of vibration sensor to arduino analog pin A0 and the other to 5V pin. Now connect the buzzer, one pin to Arduino pin 8 and the other to GND.


Here's the code, embedded using codebender!

Well done!
You have successfully completed one more Arduino "How to" tutorial and you learned how to use a shake switch with Arduino

Step 10: Congratulations!

Well done! Before this big starter tutorial you were just a beginner, but now you have becοme an Arduino developer!

Visit the www.ardumotive.com for more tutorials and cool arduino projects!

Make sure to buy this strater kit from www.gearbest.com !

I hope you liked this, let me know in the comments.


There will be more of them, so make sure to click Follow button!