Mid-Senior Engineers: Reinvent your career with Robotics, earning $100k-$200k+ in the next 90 days. Learn More

9 Sensors for Arduino You Must Learn

Liz Miller Learn Robotics

About the Author, Liz Miller, Founder/CEO @ Learn Robotics

Liz graduated with a degree in Robotics Engineering from Worcester Polytechnic Institute and researched drones at UPenn's GRASP Lab. Liz is a former Raytheon Engineer, where she managed major $MM automation projects worldwide. Today, she's the driving force behind Learn Robotics, offering the Robotics Career Blueprint for Engineering Professionals and beginner courses through the Online Robotics Class. Liz is a third-generation entrepreneur who is all about the application of innovation in robotics, automation, and AI. Follow Liz on LinkedIn and Facebook.

Disclosure: Some of the links below are affiliate links. This means that, at zero cost to you, Learn Robotics will earn an affiliate commission if you click through the link and finalize a purchase. Learn Robotics is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a way for websites to earn advertising revenues by advertising and linking to Amazon.com.

Join our Private Discord Server, MakeRobots! Sign Up

Are you building an electronic prototype using Arduino? Maybe you need to measure a specific condition and you’re looking for the right sensor to use. Regardless of the project, you can use this growing list of popular Arduino sensors to retrofit your next project.

The goal of this article is to outline some of the most popular sensors and then expand on this list over time. If your favorite sensor isn’t on this list, be sure to add it to the comments below. I will revise this list to create a comprehensive reference guide.

Tip: Bookmark this page (Windows: CTRL-D or Mac: CMD-D) to save it for future reference.

Popular Arduino Sensors List

Here’s a growing list of popular sensors for Arduino. A lot of these sensors can also be used with Raspberry Pi. So, if you plan on building electronics prototypes, I highly recommend having these sensors in your collection.

What it’s used forWhere to Buy
Ultrasonic SensorCalculate distances between objectsBuy on Amazon
IR SensorDetect contrast and distances of objectsBuy on Amazon
IR ReceiverRead data from IR remotesBuy on Amazon
PhotoresistorDetermine brightnessBuy on Amazon
TemperatureMeasure the ambient temperatureBuy on Amazon
Numeric KeypadProvide numerical input dataBuy on Amazon
PotentiometerSend rotational position data to ArduinoBuy on Amazon
JoystickProvide (x,y) coordinate input dataBuy on Amazon
RFID ReaderRead data from RFID tagsBuy on Amazon

If you’re going to be working with Arduino and sensors for multiple projects, I recommend purchasing an Arduino sensor kit.

What’s the difference between Analog and Digital Sensors?

Analog sensors allow us to take readings over a range of values rather than just an ON/OFF condition. The digital pins on the Arduino provide a 1-bit signal (HIGH/LOW). The Arduino has a built-in 10-bit Analog-to-Digital Converter (ADC).

analog vs digital signals Arduino

Analog signals allow us to precisely measure Temperatures, Distances, across a range and then respond accordingly. Whereas digital signals only tell us if a signal is active or not.

1. Ultrasonic Sensor with Arduino

Ultrasonic Sensors are popular for measuring distances and object avoidance. The HC-SR04 and PING sensors are two common models. For less than $2 per sensor, you can calculate distances of 0.78 in-196 in (2cm-500cm). The HC-SR04 has four pins (Ground, Power, Trig, and Echo).

Rather than connecting the signal pins (Echo and Trig) into the analog pins on the Arduino, you’ll use two digital PWM pins. Here’s a wiring diagram that you can use to connect this sensor to the Arduino.

HC-SR04 ultrasonic sensor pin diagram

If you’re using the PING sensor, you can wire it to the Arduino using the diagram, below.

PING ultrasonic sensor pin diagram

Then, refer to this article to program your Ultrasonic Sensor.

Buy on Amazon

 

2. IR Sensor with Arduino

Another popular sensor is the IR sensor. This sensor can be used to detect objects or contrast. It’s a popular choice for line following or line avoidance in robotics.

The IR sensor has three pins (Ground, Power, and Signal). Connect the signal pin to any analog pin on the Arduino. Here’s how to wire an IR Sensor to an Arduino Uno.

IR Sensor pin diagram

Buy on Amazon

 

You can also use this sensor digitally by connecting the signal pin to any digital pin on the Arduino. Once you have this sensor connected to the Arduino, you can learn how to program it using this guide.

3. IR Receiver with Arduino

Another type of IR sensor is an IR receiver. Rather than using IR light to detect an object or read a line, we’ll use an IR receiver to decode the signal from a TV remote.

This is helpful if you have a device you want to control or if you want to use a remote to drive a robot around. The IR Receiver has three pins (Ground, Power, and Signal). Connect the signal to any digital pin on the Arduino. Here’s a fritzing diagram for an IR receiver connected to the Arduino Uno.

IR receiver wiring diagram to Arduino

Once you have this wired up, install the IR Remote Library and you’re ready to start making. Check out my tutorial on how to control a robot using a TV remote to see a guided walk-through on how to use this sensor.

Buy on Amazon

 

4. Photoresistor with Arduino

The fourth analog sensor for Arduino is a photoresistor (also known as a light-dependent resistor or LDR). Photoresistors can detect brightness. If you want to build a robot that follows a light or a prototype that triggers an action based on light or dark conditions, you’ll want to use a photoresistor. wire photoresistor to Arduino diagram

Photoresistors have two pins (Ground and signal). Because a photoresistor is a special type of resistor, you’ll create a voltage divider against the signal. You’ll also use a 10KΩ resistor to pull the signal up or down. This will determine whether dark is a high or low reading.

Connect the resistor to Ground if you want low values to represent darkness and high values to represent brightness. Connect the resistor to power if you want to flip this metric and have light values represent low reading. Refer to this tutorial to program a photoresistor.

Buy on Amazon

 

5. Temperature Sensor (TMP36) with Arduino

The next sensor on our list is the TMP36 Temperature sensor. You can also get a sensor module like the BME280, which reads the temperature, humidity, and also atmospheric pressure.

This sensor is great for IoT projects or if you want to make a weather station. (Try this kit.) Here’s the wiring diagram to connect the TMP36 to the Arduino Uno.

TMP36 Arduino wiring diagram

Buy on Amazon

 

Here’s another diagram if you want to connect the BME280 to an Arduino Uno.

BME280 Arduino fritzing diagram

Once you have your sensor wired up, you can learn to program the BME280 in this tutorial.

6. Numeric Keypad with Arduino

A numeric keypad is another awesome sensor to use with Arduino to provide user input. While this isn’t an analog sensor, it does provide many combinations of numbers, passcodes, and inputs for the Arduino.

Buy on Amazon

 

Numeric keypads use eight digital inputs to map out the rows and columns for each button. You can purchase a 4x3 Keypad or a 4x4 Keypad. Here’s a diagram to wire a 4×3 numeric keypad to the Arduino Uno.

keypad wiring fritzing diagram Arduino

You can access the free example code for the numeric keypad, below. Enter your email to access the Numeric Keypad Example code.

Here’s your download!

/* 4x4 Matrix Keypad connected to Arduino
 * This code prints the key pressed on the 
 * keypad to the serial port
 *
 * For use without warranty
 * www.www.learnrobotics.org
 */

#include 

const byte numRows= 4; //number of rows on the keypad
const byte numCols= 4; //number of columns on the keypad

//keymap defines the key pressed according to the row and columns just as appears on the keypad
char keymap[numRows][numCols]= 
{
{'1', '2', '3', 'A'}, 
{'4', '5', '6', 'B'}, 
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};

//Code that shows the the keypad connections to the arduino terminals
byte rowPins[numRows] = {8,7,6,5}; //Rows 0 to 3
byte colPins[numCols]= {4,3,2,1}; //Columns 0 to 3

//initializes an instance of the Keypad class
Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);

void setup()
{
    Serial.begin(9600);
}

void loop()
{
    char keypressed = myKeypad.getKey();
    if (keypressed != NO_KEY){
        Serial.print(keypressed);
    }
}

7. Potentiometer with Arduino

Another popular sensor for Arduino is a potentiometer. A potentiometer can be used for many different hobby projects with the Arduino Uno.

Buy on Amazon

 

Some examples include controlling the brightness of an LED or setting the speed of a motor controller. Rotate the knob and you’ll get a proportional reading from the built-in ADC on the Arduino. Potentiometers have three pins (Ground, Power, and Signal).

potentiometer arduino wiring diagram

First, Connect Ground to GND on the Arduino. Then attach the Power pin to 5V on the Arduino. Finally, connect the Signal pin to any available analog pin on the Arduino. Here’s a wiring diagram to connect a potentiometer to an Arduino Uno. You can learn more about potentiometers in this tutorial.

8. Joystick with Arduino

If you’re looking to control x-y positions or send coordinate data to the Arduino, then you’ll want to check out the joystick module. You can also pick up a Gamepad Shield to turn your Arduino Uno into a game controller.

Buy on Amazon

 

joystick arduino wiring

The joystick module has five wires: Ground, Power, two analog inputs (VRx and VRy) and one digital input (Selector Switch). Refer to the joystick wiring diagram, above.

Using the analogRead() method, you can read the horizontal (x) and vertical (y) positions of the joystick. Since we’re using a 10-bit ADC, the home position or origin ends up being in the center at (511,511). Then, you can map these positions to drive a robot or control an LED matrix. It’s an interesting sensor to use if you need access to (x,y) coordinates.

9. RFID Reader (RC522) with Arduino

The RFID RC522 Reader (and writer) is a popular choice for automating door locks and access systems. There are seven wires for the RFID-RC522 sensor: Ground, Power, and five digital signal wires. Check out the RC522 Wiring Diagram, below.

RFID Arduino diagram

Once you have the RFID reader wired up, you’ll want to download and import the RIFD-RC522 library. Open the Arduino IDE and go to Sketch > Include Library > Manage Libraries… Then search for RC522. You’re now ready to program the RFID reader.

Buy on Amazon Buy on Learn Robotics

 

Wrap Up & Additional Arduino Resources

In this article, we explored nine popular sensors for Arduino. Whether you want to build a robot or develop a Smart Home, you’ll want to learn how to use analog sensors. Next time you’re developing a prototype, consider these Arduino sensors for your application.

Which Arduino sensors have you used frequently? Comment below! I’ll be adding your favorite sensors to this list. The goal is to create a comprehensive list of popular sensors for Arduino that you can reference at any time.

Do you need help learning Arduino? Enroll in Arduino for Beginners. It’s the only Arduino course you’ll ever need.

Like this article? Help a fellow maker by sharing this guide!

Experienced Engineer (Mechanical, Electrical, Computer, Software): If I offered to help you upgrade your engineering career to robotics, earning $100k-$200k+ in the next 90 days, would you take me up on that offer? Click here for details.
Liz Miller Learn Robotics

🚀 Pre-Launch: Become a "MakeR" with MakeRobots!

Hey Reader, 👋

Liz Miller, Founder/CEO, here with some Exciting News!

Learn Robotics just acquired MakeRobots™, an Online Robotics Community, and are prepping its Official Learn Robotics Debut in Late 2023.

MakeRobots™ is your one-stop-shop for learning, gaining coding, electronics, and robotics skills, connecting, and building robots for one low monthly membership!

Join MakeRobots™ at our Special Pre-launch Rate!
🤖 Access our Private Community & Robotics Courses
💬 Network, Collaborate, Connect with Other Makers
🔓 Only $5.99/month – locked in for life
⏱️ Pre-launch deal is Limited to the first 1,000 subscribers

This is a perfect opportunity for you to get into the fastest growing robotics community on the internet, at our ground-level, pre-launch membership rates.

👇 Click the button below to Claim your Pre-launch Membership and become a MakeR in the MakeRobots Community, today!

Learn Robotics Botly Favicon

MORE LEARN ROBOTICS ARTICLES