Jump to main content

How to Use an Arduino

Learning to use an Arduino is a great way to learn electronics and programming skills. Science Buddies has many cool science projects you can do with an Arduino. Before you can move on to more advanced projects, you need to learn the basics. This How to Use an Arduino series is the perfect place to get started. This simple tutorial will introduce you to how to setup an Arduino, how to program an Arduino, and how to connect electrical components to an Arduino. Follow along with our videos below and you will be building your own robots in no time.

Educators, our associated Introduction to Arduino lesson plan has additional classroom resources including student handouts.

Purchasing an Arduino

Just getting started with Arduino? The Science Buddies Electronics Kit for Arduino, available from our partner Home Science Tools, contains all the parts like buttons, LEDs, resistors, and switches that you will need to do the basic tutorials on this page.

1)

Setting Up Your Arduino

This video shows you how to set up your Arduino for the first time, install the programming environment (called the Arduino Integrated Development Environment, or IDE), and run a built-in example program to blink an onboard LED. Make sure you follow the instructions on the Arduino software page to install the correct IDE for your operating system. Follow these getting started instructions if you want to use the web-based editor instead of installing it locally. If you have a Chromebook, see the Arduino Chrome App page.

2)

Blink an External LED

This video shows you how to build a circuit on a breadboard, connect an external LED to your Arduino, and write your own Arduino program to make the LED blink on and off using the digitalWrite command.

3)

Troubleshooting

Sometimes your circuit does not work as you expect. This can be frustrating for beginners because it is not always obvious what is wrong. Before you continue, you should develop some troubleshooting or "debugging" skills to help you fix broken circuits.

4)

Tinkercad Circuits

Tinkercad Circuits is a free circuit simulator that lets you prototype a circuit and run Arduino code in a web browser. It is a great way to start learning if you do not want to spend money on a physical Arduino yet, or if you want to test out code before trying it on a real Arduino. This video shows you how to create a basic circuit and run a simulation. Note that many of our tutorials use Tinkercad Circuits to demonstrate circuits or code, but you can always follow along with a physical Arduino.

5)

Use a Button

In this video, you'll learn how to use a button as an input to your Arduino with the digitalRead command. You'll use the button to control an LED instead of automatically blinking the LED on and off. This starts your exploration into Arduino features that you can use in more advanced projects.

6)

LED Fading

In this video you'll learn how to control an LED's brightness using the analogWrite command. Once you understand this command, you can also use it for more advanced Arduino programming tasks, like controlling the speed of a motor.

7)

Use a Potentiometer

While a button only provides a digital input (on/off), a potentiometer provides an analog, or continuously variable input. In this video you'll learn how to use the Arduino's analogRead command. Combined with the analogWrite command from the previous video, you can make your own "dimmer switch" to control the brightness of an LED.

8)

PING Ultrasonic Distance Sensor

An ultrasonic distance sensor, also called a sonar sensor, emits bursts of ultrasonic sound and measures how long they take to bounce back to the sensor. This is the same principle used by animals like bats for echolocation. This video will show you how to use the PING sensor from Parallax, a popular ultrasonic sensor for Arduino projects.

9)

HC-SR04 Ultrasonic Distance Sensor

The HC-SR04 is another popular ultrasonic sensor for Arduino projects. It is much cheaper than the PING, but its performance is not always as reliable. This video shows you how to modify PING sensor code to work with the HC-SR04.

10)

Positional Servo Motor

You can use your Arduino to control the rotational angle of a positional servo motor. Unlike continuous rotation servo motors, positional servo motors have a limited rotation range, usually about 180 degrees. They are useful for building things that do not need to go through a full rotation, such as the joint of a robotic arm.

11)

Continuous Rotation Servo Motor

Continuous rotation servo motors look identical to positional servo motors, but their operation is slightly different. These servo motors can rotate continuously in either direction, but you cannot control their exact angle. Instead, you can use the Arduino to control their speed.

12)

Microphone

Learn to use a microphone with your Arduino's analog input to make projects that react to sound.

13)

Analog Joystick

Did you know that you can connect a joystick, just like the type used in video game controllers, to your Arduino and use it to control things? A two-axis analog joystick like the one in this video just contains two potentiometers, one for each axis. So if you have already watched our potentiometer video above, then you are already well on your way to using a joystick!

14)

Soil Moisture Sensor

Resistive soil moisture sensors work by measuring the resistance between two probes inserted into the soil. The sensor converts this resistance to a voltage that you can read with one of the Arduino's analog inputs. These sensors are useful for automatic plant-watering projects, but they require calibration since the definition of "wet" and "dry" soil will vary depending on the application. This video walks you through setting up and calibrating the sensor.

15)

DC Pump

Learn how to control a pump with an Arduino for all your DIY plant-watering and hydroponics projects! While you can power a very small pump directly from your Arduino, larger pumps will require external power, so the video also covers how to do this.

16)

DC Motor

Brushed DC motors are the bread and butter of many Arduino projects with moving parts. Since even very small motors typically require more current than the Arduino can provide, this video shows how to use a circuit part called a transistor to control power from an external source (like a battery pack). You will also learn how to control the motor's speed.

17)

H-Bridge

How do you control a motor's speed and change its direction? With an integrated circuit called an H-bridge! This video shows you how to use the L293D, a popular H-bridge that allows bidirectional control of two motors. Perfect for wheeled robots and autonomous cars.

18)

Radio Control

Add remote control to your projects with an RC transmitter and receiver! This video shows how to connect an RC receiver to your Arduino and read its output signals using the pulseIn command. This lets you take a hobby RC remote and use it to control your Arduino project! Use it to cut the cord and add wireless control to a project like our Arduino ROV.

19)

Powering Your Arduino Project

There are many different ways to power an Arduino project. You will probably start off using a USB cable plugged into your computer, but you can also power an Arduino through the barrel jack or the Vin pin. What type of power source you use will depend on the power requirements for your project and whether it is stationary or mobile. This video provides an overview of some different options.

20)

Buzzers

Buzzers let you add sound as an output to your Arduino projects. There are two different common types of buzzers: active and passive. Active buzzers require a DC power supply and produce a constant tone, while passive buzzers can produce variable-frequency tones using the Arduino tone() command. This video shows you how to use both types.

21)

LCD Screen

This video shows how to use a 1602 liquid crystal display (LCD) with your Arduino. "1602" indicates that this screen has 16 columns and 2 rows of characters, but other sizes are available. This screen uses parallel communication with the Arduino, meaning it requires more wires than an I2C interface, but they are a common and easy way to add text display to your Arduino projects!

22)

Flex Sensor

Flex sensors are a type of variable resistor. Their resistance changes when they bend. You can use them to do things like measure the amount of flex in the finger of a glove. This video shows you how to use one to control LEDs with an Arduino analog input.

23)

Force Sensor

This type of force sensor is called a force sensitive resistor (FSR). Their resistance changes when pressure is applied to the pad. They are not very accurate, so they are not well-suited for precise applications like building a scale where you need an exact measurement of weight. However, they work great for approximate force measurements, or when you want something that gives a continuous analog response when pressure is applied, instead a digital on/off response like a button.

24)

Slide Switch

This type of slide switch, also called a single-pole double-throw (SPDT) switch, is used commonly with Arduino projects. Unlike a pushbutton, which is spring-loaded and will pop back to its original position when you release it, this switch will hold its position when you let go. You can use them as a type of digital input or as a standalone power switch.

25)

Vibration Motor

Vibration motors, also called eccentric rotating mass (ERM) motors, are used in devices like cell phones and video game controllers to make them vibrate. They are typically much smaller than larger motors that you would use to drive motors or propellers, as shown earlier in our tutorial series. They are a great way to add vibration (for example, for haptic feedback) to your Arduino projects. They are available in different sizes and shapes, including cylindrical motors with an external rotating mass, and "coin" or "pancake" motors with no external moving parts.

26)

PIR Sensor

Passive infrared (PIR) sensors are used in home security systems and motion-activated lights. They are activated by moving infrared light sources such as body heat. They are a great way to add motion detection to your projects if you want to detect people or animals, but they won't work on room-temperature inanimate objects. Check out this video to learn how to use one.

27)

Photoresistor

Photoresistors, also called photocells or light dependent resistors (LDRs), are a simple way to add light sensing to your Arduino projects. They aren't very accurate, so are not great for precise measurements of light levels, but they work for measuring coarse changes or when an object is covered by something. Watch this video to learn how to use them in your projects.

28)

RGB LEDs

RGB LEDs contain red, green, and blue LEDs in a single package, allowing you to independently control their brightness and mix colors. Learn how to use them and add some awesome lighting effects to your next Arduino project! Check out the earlier videos in this series on LED fading and using potentiometers for some helpful background information for this video.

29)

Analog RGB LED Strip

Why use just one LED when you can buy them by the foot? RGB LED strips let you easily add customizable LED lighting to a larger project or entire room. This video shows you how to use analog RGB LED strips, which are controlled using analogWrite the same way you would control an individual RGB LED. You cannot control the LEDs in these strips individually, you can only set them to the same color all at once. Individually addressable digital LED strips are a topic for another video!

30)

Reed Switch

A reed switch acts as a simple digital magnet sensor. It is a switch with two thin, flexible metal contacts inside that are normally not touching. In the presence of an external magnetic field, the contacts bend and touch each other, closing the circuit. They can work independently of the magnetic pole and orientation, so you can use them to add a variety of non-contact magnetic sensing to your projects.

31)

Hall Effect Sensor

Hall effect sensors, like reed switches (see previous video), can be used to detect the presence of a nearby magnet. Unlike reed switches, however, you can use them to measure the strength or polarity of a magnetic field. Two general types are available: digital and analog. This video will show you how to use both to add non-contact magnetic sensing to your Arduino project.


Cool Arduino Projects

There are many interesting Arduino science projects you can do! This video shows a few. You can see a larger list of options in our library of science projects.

Top
Free science fair projects.