Arduino Robot Car with Speed Sensors - Using Arduino Interrupts
DroneBot Workshop
Let's build a robot car that uses those slotted "optical speed sensors"! We'll also learn about Arduino Interrupts.
Get full instructions and Arduino sketches at https://dbot.ws/rbtcar More articles and tutorials: https://dronebotworkshop.com Join the conversation on the forum: https://forum.dronebotworkshop.com Subscribe to the newsletter and stay in touch: https://dbot.ws/dbnews
In this video, I will show you how to assemble a very popular 2WD robot car chassis kit and how to use the speed sensor disks or “encoder wheels” that are included with the kit. You’ll learn how to couple the encoder wheels with a couple of inexpensive optical sensors that are based upon an optocoupler and an LM393 dual comparator chip, allowing you to measure speed and distance traveled.
These inexpensive kits can form the basis of a simple or sophisticated robot, you are only limited by your imagination (and budget and technical abilities LOL). I’ll show you an example of a robot I’m constructing that illustrates just how much you can expand upon the basic robot car chassis, and I’ll offer some suggestions for planning out your own unique robotic creation.
There are a couple of different styles of these kits, I will show you two of them. The main difference between them is in how the motors are mounted to the chassis - one uses an acrylic mount while the other uses a mount made of aluminum. Either type is perfectly fine to use for these experiments.
In addition to the robot car chassis kit and a pair of LM393-based optical sensors, you’ll need an Arduino Uno and an L298N H-Bridge motor driver, as well as a few batteries to power everything up. I’ll show you how to hook it all up and how to determine the optimum placement for these components on your robot car chassis.
I’ll then explain how the optical sensor works and how you can use its readings to determine not only speed but distance as well.
Then comes the code! If you are relatively new to Arduino programming then you might not have used “interrupts” before, so it’s time to learn something new. The Arduino Uno allows for two hardware interrupts and both will be used in this design.
Here is an outline of what’s covered in the video:
00:00 - Introduction 02:20 - Extra parts you’ll need 03:00 - Parts included with Robot Car Kit 04:54 - Planning your Robot Car design 08:24 - Building the Robot Car 10:13 - Speed Encoder & Opto Interrupter operation 11:18 - Speed Encoder & Opto Interrupter demonstration 12:46 - LM393-based Speed Sensor 13:21 - How a Comparator works 14:18 - Explaining Arduino Interrupts 18:04 - Arduino Speed Sensor demo setup 19:14 - Arduino Speed Sensor demo sketch 26:19 - Arduino Speed Sensor in action 27:27 - Calculating Speed and Distance 28:57 - Robot Car wir ... https://www.youtube.com/watch?v=oQQpAACa3ac
348525868 Bytes