Tuesday, April 9, 2013

Remote motor speed control using PIC microcontrollers and RF modules



1.things needed 
- 2 microcontrollers(better if both have ADC and PWM so we can have more fun).
- 2 RF modules
- MPLAB v8.xx (any version would work).
- Motor controller IC L298.

2.Procedure 
- connect 2 RF modules(receiver and transmitter) and 2 mcus on a protoboard 
- and make sure everything works fine with modules and our basic assembly code.
- have some fun with the RF modules and establishing a simple communication.
- Soldering 2 simple boards to control the speed of a motor Remotely.

3.Overview of things we are working with

  1. RF modules
     
Fig1: RF transmitter and Receiver 
These were the exact modules that I used in my project anything shape is not much impotent.They work fine for the purpose and gave me a good range(~70m) even without a long antenna( 6 cm antennas were  used).
all you need to know about your module is what are the DATA,VCC(+) and GND(ground) pins and what are the idle states of their output and input.
supply power to both modules.Be careful to use 2 separate sources because sharing the same ground cause various anomalies. Then connect a LED to the out put of the Receiver and ground and try shorting DATA pin of Transmitter to the GND and VCC. If you can see LED going off corresponding to the the your pulse then Module is active LOW means it gives output by pulling it low.Make sure to record the Transmitter input(+ or -) which triggers the Receiver output too.
Fig2: I/O state detection.

4. Microcontroller coding
    
   coding is simple all you need is some proficiency in ASM. Our coding has Definitions of I/O pins to modules,I/O states of modules , a user  I/O Handling loop and RF loops.
Codes that are written for PIC16F628 could be found here.