Raspberry Pi2 Based DC Motor Control Using ZigBee

In the previous tutorials we had seen the Zigbee communication and DC motor control in Raspberry Pi2. Now we have to interface these two modules for developing an intelligent embedded system. Our intention is to control the speed and rotation of the DC motor on the basis of commands received through a Zigbee module. A suitable paired Zigbee is connected to a PC for transmitting the commands, and there by running the DC motor through wireless communication system. 

Apart from the previous tutorial there is an additional process that is to control the speed of the DC motor by means of pulse width Modulation (PWM). The amount of power going to the motor is controlled by changing the duty cycle. As the Duty cycle changes the width of on time and off time will be changed and a suitable power control is retrieved by the motor. If the duty cycle is given as 10 %, and the total pulse width is 1ms, then 0.1ms is for on time and the rest 0.9ms is for off time. A graphical representation is shown below:

 

Modules Needed

  1. Raspberry Pi2
  2. Plastic Gear Motor
  3. L293D ic
  4. Power supply or Battery (5v)
  5. Bread Board
  6. Connecting Wires
  7. XBee 1mW Wire Antenna- Series 1 (2 No:)
  8. XBee Explorer Dongle  (2 No:)

So here we can change the duty cycle from 0 to 99. The connection diagram is shown below:

L293D Interfacing Diagram

Before doing the process check the zigbee communication with Raspberry Pi. Click here to see the zigbee interface with Raspberry Pi2.

After that make the connections as shown in the figure and power up the module. Write a Python script to test the process.

Open the Hyperterminal in the PC where the Zigbee is connected. The modes of operations of the DC motor is differentiated on the basis of the commands transmitted through the Zigbee. Check the Motor movements by entering the commands mentioned in the code.

Shop With Us

  • Click here to buy Raspberry Pi 2 from RhydoLabz.
  • Click here to buy Raspberry Pi 2 Starter Kit from RhydoLabz.
  • Click here to buy Raspberry Accessories from RhydoLabz.
  • Click here to buy XBee 1mW Wire Antenna-Series 1 from RhydoLabz
  • Click here to buy XBee Explorer Dongle from RhydoLabz.
  • Click here to buy plastic geared DC Motor

Resources

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">