Arduino - Interfacing Sensor and Motor
by Robotics club of CEG in Circuits > Arduino
52 Views, 0 Favorites, 0 Comments
Arduino - Interfacing Sensor and Motor

Hey guys ! In this instructable we will provide you with a step by step instruction on how to interface sensors and motors to arduino. In order that we build any embedded project, the most basic interface would be sensor and actuator. Having that in mind we thought it would be good to have an instructable. This would also be useful for those guys who wish to build basic autonomous robots like line following robot , obstacle avoiding robot, wall following robot etc
Hope, you enjoy it !! So, let's get started.
Components Required




To do this, we require
Arduino - Any arduino board will do. Here, i am using a Arduino clone
IR sensor(Tx and Rx)
Resistor - 330 ohm and 10Kohm (3 nos each)
Ultrasonic Sensor(HC-Sr04)
Bo motor - 2nos
L293D motor driver IC
Prototyping board
IC 7805
9V Battery and it's clip
Connecting wires
What Is Arduino ?
Hope, most of you will be familiar with what an arduino is, If in case you are new to electronics/arduino. Here is a short description about what an arduino is, Arduino is an open-source electronics platform based on easy-to-use hardware and software. It also has an easy to use Integrated development environment using which anyone with a basic C knowledge will be able to program the uC. Regarding the hardware, It uses uC manufactured by ATMEL. The one i am using in this instructable has an atmeg328p in it which has a 32KB of inbuilt flash memory. To know more about arduino check out arduino web page.
Sensors
A sensor is a device that detects events or changes in quantities and provides a corresponding output, generally as an electrical or optical signal. Here in this tutorial, we will learn about IR and Ultra sonic sensors.
IR sensors are pretty common and easy to interface. We might have seen IR sensor very often in our life
Simple example is the one present in our Television remotes. This IR emit Infrared radiations which are decoded by the receiver in the Television set. But here at this stage it is enough for us to check whether the obstacle is present or not using the sensor and need not worry about these decoding side.
Ultra sonic sensor on the other hand, works on the principle of SONAR. They emit Ultra sonic waves which travels with the speed of sound waves (340m/s) and gets reflected back when their is an obstacle in its way. The one i am using here has a range of 2cm to 5m. These are most commonly used in obstacle avoiding robots and projects involving distance measurement.
Motor Driver
Motors we use in real life run at various voltages and also consume lot of current which our uC cannot source. Hence we go for a driver circuit which is commonly called as motor driver and it acts as a interface between our uC and motors. Here we use L293D ic. It has 4 input channels and 2 enable pins to enable these input pins. It can handle upto 1A current and capable of driving 2 motors. If you have to drive high current motors, i would suggest you to go for L298 Driver IC. Having spoke enough about all the sensors and motors it's now time for experimenting with them.
Sensor Connections
Below is a schematic that tells you have to wire the sensors to arduino. But before that we need to do a little bit of soldering !! Regarding IR if you have got a module from your local store, you can directly wire it to arduino. If not, follow this circuit !!