Basic Motion Sensors: Ultrasonic and IR
2023-11-27 | By Antonio Velasco
When working on some fun electronics or robotics projects, you might find yourself needing a sensor that detects a physical object, its proximity to it, or just tracking it. Among all the types of sensors available for such a task, Ultrasonic and Infrared, or IR, sensors are typically the most popular, and it's important to distinguish between the two to understand what would work best for your project.
Ultrasonic Sensors - Like a Bat!
As the header of this section suggests, ultrasonic sensors work similarly to a bat–using echolocation. Echolocation is when something emits a sound and waits for the sound waves to bounce off an object and come back to detect something. The ultrasonic sensor will emit a super high-frequency wave and measure how long it takes for the waves to bounce off an object and come back to it, returning a value that dictates how far said object is.
You can use these sensors for multiple things, especially since the sound waves travel relatively far and return accurate values. Most commonly people use it for proximity or distance measurements to see how far an item may be. You’ll see them all the time in robotics projects for competitions–something that I’m going to touch on in a future project! They can also be used in the industry for detectors like a computer that detects the fuel level based on how high the water level is.
IR Sensors - Like Your Eyes!
IR sensors rely on receiving light–just not the visible light that we see. They take advantage of infrared light that we can’t necessarily see and take measurements based on that. The sensor will emit an IR light, and when enough light is reflected, it will return whether an object is there. You can adjust the sensitivity based on how much light is reflected back since some colors (like white) reflect more light than others (black).
Like ultrasonic sensors, there are many applications for IR sensors. They’re also used in robotics, mainly for line-following robots. I used IR sensors for a line-following robot that I made in my freshman engineering class! They can be applied in similar ways to ultrasonic sensors but are mostly used in remote controls these days. You’ll notice the signature IR bulb at the end of most television remotes.
Ultrasonic vs IR
When it comes to comparing the two, there are multiple components to consider. The first is the detection range, where ultrasonic sensors take the cake. IR sensors are more limited since their light waves can’t travel too far and return without being absorbed elsewhere. This also comes into play when considering accuracy, as since the IR waves are easily influenced by other objects, it makes them less accurate and more prone to interference. Especially in sunlight, IR sensors tend to fall behind.
IR sensors, however, have their strong suits. For one, they’re cheaper and easy to find since they’re simply easier to make. Ultrasonic sensors can get expensive, and with that are also a little big. You’ll notice an ultrasonic sensor on a rover just by looking at it. IR sensors tend to be more compact and less noticeable.
To summarize, when it comes to needing a super accurate measurement or finding something far, maybe an ultrasonic sensor would be best for you. When you’re looking at things closer (say like a line on the ground) or have budget/size constraints, an IR sensor fits your needs. When it comes down to it, you just need to assess your project and its needs to pick a sensor that best fits you. Both are amazing inventions that are easy to use and extremely useful.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum