Arduino Sensor’s with interface code


What is a sensor ?





“A sensor is an object whose purpose is to detects the change in the environment  and then provide a corresponding output- input “


Why do we need a sensor?

A sensor is the type that provides data to system through it’s input. Supposing you adjust your air conditioner system so that the ambient temperature is 15 degrees, considering that it was previously disabled (and that the current room temperature is different from 15 degrees), now the system starts pumping air so that the room reaches the desired temperature, how do you know when the ambient temperature has been reached?

This is where the Arduino sensor comes in: there must be a sensor in the room to instruct the air conditioning system to stop pumping when the desired temperature is reached. That’s more or less like that.

We need the sensor to feed data to the system and tell the controller when to act

If you are building an Arduino propulsion car that will avoid obstacles while navigating, you could, for example, use a collision sensor to alert the controller when an obstacle is in front of the car, then the controller can alert the wheel to stop and move in a different direction.

The following are some of the sensors and interface code so you can use when working with an Arduino board .

                                     The most used Arduino Sensors

        Temperature + humidity sensor

DHT11 basic temperature-humidity sensor «

This is a humidity sensor/temperature. You can use this Arduino-compatible sensor to monitor ambient temperature or humidity. As a basic project, you can connect an LCD screen to Arduino and make it show the temperature/humidity of the your  room and office .


     (Download Code)

          Infrared emission sensor


KY一005 3pin Infrared Emission Sensor Module for arduino DIY Starter Kit KY005: Industrial & Scientific

This is an infrared emission sensor, also called an infrared emitting diode. It operates at a 38KHz modulating signal. This sensor can be used to send code to another Arduino or to control a TV.

(Download Code)

              Photo resistances

This is a light-sensitive resistance. The strength of the component will vary with the intensity of the light to which it is exposed. Explained in simple terms, we will say that this sensor is a resistance whose resistance decreases when the light hits it.

  (Download Code )


     Ultrasonic distance sensor

Ultrasonic US-015 Distance Sensor Module



Ultrasonic sensor is electronic device that measures the distance of object This sensor automatically sends a 40 to 70 kHz audio signal and detects if there is a pulse signal.  to measure how far away you are from an object  , that is, the distance from the sensor to the object in front of it. You can feel an object in the range: 2cm-500cm

(Download Code)


                  Vibration sensor

Robotics 801s Vibration / Shock Sensor Sensitivity Adjustable Analog Output at Rs 254.00/piece | Piezo Sensor, Piezoelectric Motion Sensors, वाइब्रेशन सेंसर, कंपन संवेदक - ROBOTICSDNA, Pune | ID: 22297019455



In simple terms, this is a switch that activates when it detects a hit. There is an LED that alternately gives a visual signal of sensor status, high or low, and high level designated by LED ignition.

(Download Code)




        Sound sensor

Sound Sensor Module at Rs 100/piece | Sound Sensors | ID: 16817002448




This is a sensor that will detect the surrounding sound and has an adjustable sensitivity. This is used for projects such as voice changers.


(Download Code)

                 Voltage detectors

Robodo VOLTSENS Voltage Detection Sensor Module - Arduino, ARM and other MCU: Industrial & Scientific



This sensor detects the voltage level of any continuous voltage supplier, up to 25 volts. Overvoltage/undervoltage hotspots can be adjusted.


(Download Code)


              Heart rate pulse sensor (pulse sensor)

Pulse Sensor - SEN-11574 - SparkFun Electronics



This sensor helps detect pulse heart rate. The operating voltage is 3V/5V; amplification factor: 330. This sensor can be used to track and trace your heartbeat.


   (Download Code)


        Magnetic sheet sensor for Arduino

KY 003 Arduino Hall Magnetic Sensor Module at Rs 41/piece | Hall Sensor | ID: 23131253248



This sensor helps detect the presence of magnetic fields. When a magnetic substance approaches, the switch detects the magnetic field and electrifies; therefore, the module emits a low level. When a magnet is not approaching, the module is deactivated and emits a high output signal.

         (Download Code)



               Optical fingerprint sensor

Buy R309 Optical Fingerprint Sensor Module – Arduino UNO, Raspberry Pi & Android Online in India at Lowest Prices | Price in India |



This sensor helps detect, record, or verify fingerprints. This can help you register new fingers directly. Up to 162 fingerprints can be stored in the built-in FLASH memory.



       (Download Code)

           Comparator speed sensor

Generic LM393 Chip Slot Motor Measuring Comparator Speed Sensor Module for MCU: Home & Kitchen



This sensor is mainly used in motor speed detection, pulse counting. As the name implies, it helps detect speed differences.



  (Download Code)


         Alcohol detector by gas sensor for Arduino




This sensor detects the presence of gas alcohol in the air. The detection range is 10 to 1000 ppm. Detection type: Alcohol, Ethanol



  (Download Code)


          Water Sensor / Rain Sensor

Interfacing Rain Sensor with Arduino Uno - Tutorial



This sensor is used for water detection and can be used in projects where: rain detection, water level, water leaks, deposit overflow detector. This sensor can easily convert the water size into an analog signal, and the analog output value can be used directly in the program function, to achieve a function of desire.


     (Download Code)

         Collision crack sensor


See the source image



This is a switch that can be used to detect the position of an object, when it collides and changes the sensor trigger that can be seen in the side image.



     (Download Code)

         Line tracking sensor




This sensor follows the line. It is mainly used for projects where you want your robot/car to navigate following a white line on the black background.

    (Download Code)


           Infrared motion detection

Interface PIR Sensor to Arduino - Motion Sensor/Detector



This is a pyroelectric IR infrared sensor for people detection. I often like to test this sensor simply by using it as a Switch-ON/Switch -Off device for an LED, which allows you to easily adjust its sensitivity and time.


     (Download Code)


          Flame sensor

Arduino Compatible IR Infrared Flame Sensor Module, Working voltage: 3.3v - 5v, Detect range: 60 degrees



This sensor detects the presence of flame and is often also used to detect the presence of light. Detects a flame or light source of a wavelength in the range of 760nm-1100 nm. A light flame test can be activated within 0.8m. If the flame intensity is high, the detection distance will increase.


      (Download Code)

             CH4 methane gas sensors

Arduino Methane CH4 Gas Sensor Analog gas leak detector MQ4 GAS sensor For Arduino|Gas Analyzers| - AliExpress



This is a hydrogen propane methane gas sensor for Arduino, ideal for detecting gas leaks at home or at the factory. This sensor can be used to detect: Combustible gas such as LPG, butane, methane, alcohol, propane, hydrogen, smoke.



    (Download Code)


           2.4GHz wireless transceiver in antistatic foam

Techleads Nrf24L01 Ultra Low Power 2.4Ghz Rf Wireless Transceiver In Antistatic Foam Arduino Compatible: Industrial & Scientific




This is an important part of a wireless sensor network. It can help control objects wirelessly. This module can be used for projects such as: wireless voice transmission such as VoIP, home automation and wireless networks.

(Download Reciever Code)

(Download transmitter  Code)


             Color sensor

Color Sensors, Color Mark Sensor, Colour Sensor, Color Detection Sensor, Color Recognition Ssensor, Colour Detection Sensor in Sahakara Nagar, Bengaluru , Leuze Electronic Pvt Ltd | ID: 4429603530




This sensor detects static color and emits a square wave with a frequency directly proportional to the intensity of the incident light. The ideal detection distance is 10 mm. It can be used to classify objects by colors.


(Download Code)


      Adafruit Digital Light / Luminosity Sensor

439 Adafruit Adafruit TSL2561 Digital Luminosity/Lux/Light Sensor Breakout Arduino, Electronics and Robotics Electan, OnLine Store



This sensor allows accurate lux calculations and can be configured for different gain and timing ranges to detect light ranges up to 0.1 – 40,000 lux.


   (Download Code)


            Fast Vibration Sensor

Fast Vibration Sensor Switch (Easy to trigger) : ID 1766 : $0.95 : Adafruit Industries, Unique & fun DIY electronics and kits


This is a spring vibration sensor that is a high sensitivity trigger switch induced by non-directional vibration. Inside there is a very soft spring rolled around a long metal pin. When the switch is moved, the two pins will act as a closed switch. When everything is still, the switch is open.


 (Download Code)

          Adafruit’s short bending/double sensors

Short Flex Sensor : ID 1070 : $7.95 : Adafruit Industries, Unique & fun DIY electronics and kits



This sensor detects bending (only in one direction). It is more or less a resistance that changes its value depending on how much it flexes.


(Download Code)


          Barometric pressure and altitude sensors Adafruit

MPL115A2 - I2C Barometric Pressure/Temperature Sensor : ID 992 : $7.95 : Adafruit Industries, Unique & fun DIY electronics and kits


This sensor can be used for all types of weather detection. helps measure barometric pressure and temperature. This could also be used to build an altimeter.

(Download Code)


                 Water flow sensor

Buy Water Flow Sensor Online @ Best Price in India


This sensor can help you build a basic flow meter. It can help measure the flow of liquid/water. It has a reel and a small magnet attached to it, and there is a Hall-effect magnetic sensor on the other side of the plastic tube that can measure how many turns the reel has made through the plastic wall.


(Download Code)


   Barcode Reader/Scanner Module

Barcode Reader/Scanner Module - CCD Camera - USB Interface : ID 1203 : $69.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Barcode Reader This sensor can help you build your own barcode reader/scanner. Bring the benefits of barcode reading to your Arduino. It uses a compact and long-range CCD barcode scanning module with highly sensitive line image sensor and integrated self-sense function, which can be used in your project to decode almost any type of 1D (striped) barcode.

  (Download Code)

             Liquid Water Level Sensor / Float Switch

Water Level Sensor Float Switch - P43 buy online at Low Price in India -


This is a sensor that helps detect water level. Like the water sensor, it can be used to detect the water level in a container, but it has a float switch.


      (Download Code)

         Adafruit Laser Cutting Beam Sweep Sensors

IR Break Beam Sensor - 5mm LEDs : ID 2168 : $6.50 : Adafruit Industries, Unique & fun DIY electronics and kits


This is a laser break sensor. Detects an object that breaks a laser beam. But normally you have to install a laser at one end and a sensor at the other. The sensor must be large enough not to misalign with the beam.





NextPCB PCB Manufacturers Company


Thanks so much NextPCB for sponsor this project. Nextpcb offer For New Customer, Your First Order Will Be 10 PCBs for just $0 at Free.

NextPCB one of the world’s most professional PCB manufacturers based in China. With professional PCB manufacturing capabilities, for each file of our customer will be double-checked by more than 14 years PCB engineers. they handle the whole process of PCBs including the PCB assembly ,PCB manufacturing, testing and final shipment.

GET $100 Coupan For 1st Order :- Sign up on Nextpcb


About Author

Leave A Reply