Last week we took a look at how you can wirelessly connect together two unrealted microcontrollers; an Arduino UNO and a PIC. The week before that we showed you how to build Motor Control via Distance Sensing. This week, let’s combine the two project together to make a wireless IR proximity sensor that can control a motor’s speed through a pair of XBee wireless modules.
In this article, we will show you how to build a system where the input and output have seperate microcontrollers and are linked together using XBee modules. The input system will use an infrared distance sensor to measure how far away an object is from the sensor and the output will drive a standard DC motor using a power transistor.
Purpose & Overview Of This Project
The purpose of this project is to create a transmitter system that takes input from a sensor and passes it to a receiver system that produces some correlated output. The input will come from an IR distance sensor and output will go to a motor control circuit, driving a +3v motor. When the IR distance sensor, senses an object is a certain distance away from it, that will be passed to the motor controller, telling the motor to drive at a certain speed. The closer an object is to the sensor, the faster the motor will move.
We will need a fair amount of parts in order to build this system. The transmitter will be an Arduino UNO, with a sharp IR sensor, 16×2 LCD and XBee wireless module connected to it. The receive will be a PIC 18LF4520 with an LED Bar, TIP42, +3v motor and XBee wireless module connected to it. When everything is connected together, moving your hand back and forth infront of the sensor should vary the speed of the motor!
Sharp IR Sensor
 XBee Modules
40 MHz Crystal
16×2 LCD Display
1x 10uF Capacitors
2x 100Ω Resistor
+9v Battery Connector
Parts List Details
There are a lot of important parts in this project, so make sure you’re more familiar with them by reading the details below.
The PIC 18LF4520 will be part of the receiver system and depending upon the command it receives, it will drive the motor at a ceratin speed and light up a specific amount of LEDs (0 to 8).
The role the Arduino UNO will play is that of the transmitter. Depending upon the voltage input from the IR sharp sensor, different commands will be sent to the receiver module through the XBee wireless interface. The 16×2 LCD will also echo the current command being sent.
Sharp IR Distance Sensor
This sensor is the center-piece of this article. It outputs a specific analog voltage depending upon how far away an object is from the sensor.
XBee Wireless Modules
A pair of XBee wireless modules will be used for adding a simple wireless interace component to the system we’re building. Wireless means the sensor can be place wherever you need and the receiver as well without any need to connect the two systems together!
TIP42 Power BJT
To provide enough current to the motor we need to use a power transistor. A PWM signal from the PIC will tell the power transistor when to turn the motor on and when to turn the motor off. The PWM’s duty cycle will determine the speed the motor turns.
The Sharp IR Distance Sensor
There are four parts to the theory of this project that we need to cover before looking at the schematic. The first part is how the IR distance sensor works, the second part of the theory section will be looking at how the motor is controlled, the third part will look at how the XBee wireless modules work and the final part will look at serial communication theory and ASCII.
For more detail: Wireless Sensor Motor Control using PIC18LF4520
Current Project / Post can also be found using:
- 18lf4520 circuit diagram