3 button rf remote

Pencil

Joined Dec 8, 2009
272
what do you mean by (operations need to be altered from the program)?
I take it you are not programming the PIC?

Are you buying a "kit" and substituting the MOSFETS for the relays?
(I thought you might be building from "scratch", that would be a good project).

Still no worry it can be done with an additional component or
find a suitable P-channel MOSFET.

Maybe you should buy the kit and verify a few things before committing
to the output driver configuration.
 

Thread Starter

seesoe

Joined Dec 7, 2008
99
yeah ill be programming all the pic's, the page i got the schematics from provides the files for the transmitter and receiver.

can you recommend a different mosfet? perhaps a cheaper one too, its $1.71 from digikey, i need 18 of them....

Rich (BB code):
//---------------------------------
// Receiver for RF remote control project
// (c) www.CoolCircuit.com
//---------------------------------
#include<pic.h>
#include"delay.h"

__CONFIG(XT&MCLRDIS&WDTDIS);

#define Header    0x20
#define RX  GP3
#define out1 GP0
#define out2 GP1
#define out3 GP2

unsigned char RXREG[3];
unsigned char toggle=0x00;
unsigned char old_toggle=0x00;
#define Channel RXREG[1]

bit get_data(unsigned char *buff);


bit rx_bit;

void main()
{ 
    
    DelayBigUs(580);
    GPIO=0x00;
    TRIS=0B00001000;
    OPTION=0x03;    
    
    while(1)
    {    
        while(get_data(RXREG));
        if (RXREG[2]==(RXREG[0] ^ RXREG[1]))
        {
            if (RXREG[0]==Header)
            {
                toggle = RXREG[1] & 0x80;
                if (toggle!=old_toggle)
                {
                    old_toggle=toggle;
                    RXREG[1]=RXREG[1] & 0x03;
                    if (RXREG[1]==0x01) out1=!out1;
                    if (RXREG[1]==0x02) out2=!out2;
                    if (RXREG[1]==0x03) out3=!out3;
                }
            }
        }
        //DelayMs(50);
    }
}    


bit get_data(unsigned char *buff)
{
    unsigned char i,j,T0,count;    
    
    i=35;        
    count=0;    
    OPTION=0x00;    // pre scaler = 2 for counting long time

    while(--i)    // wait preamble
    {            
         NOP();
         NOP();
         NOP();
         while(RX);         
         TMR0=0;
         NOP();
         NOP();
         NOP();
         while(!RX);
         T0=TMR0;
         if (T0==0xFF) return 1;      // error
         if ((T0>=198) && (T0<=218))      // 396-432 uS it OK.   
         {
            count++;
            if ((count>=1)|| (i==0)) break;
         }         
    }
    
    if (i==0) return 1; // error                
        
    OPTION=0x03;    // prescaler = 16
    //OPTION=0x04;    // prescaler = 32
    T0=0;
    while (!((T0>=94) && (T0<=114)))         // 1504 - 1824 uS it OK. syn bit for 4Te or 1664 uS
    //while (!((T0>=158) && (T0<=180)))         // 5056 - 5760 uS it OK. syn bit for 4Te or 5416=5mS+ (4*416uS) uS
    {
        NOP();
        NOP();
         NOP();
        while(RX);    // wait syn
        TMR0=0;
        NOP();
        NOP();
        NOP();
         NOP();
        while(!RX);
        T0=TMR0;    
    }    
        
    while(RX);             //wait start bit go low
    DelayBigUs(580);     // delay 624 uS before sampling (1.5Te)
    
    for (j=0;j<3;j++)
    {
      i=8;
      buff[j]=0;
      while(i--)
      {
        buff[j]=buff[j]<<1;
        rx_bit=RX;    // sampling
        buff[j]=buff[j] | rx_bit;            
        
        if (rx_bit==0) 
           while(!RX);    
        else
           while(RX);
        DelayBigUs(580);     // delay 7500 uS before sampling        
        
      }
    }
    
    if (rx_bit==0) 
        if (!RX) return 1; // error (no stop bit found)
    else
        if (!RX) return 1; // error (no stop bit found)
        
    return 0;
}
 

Pencil

Joined Dec 8, 2009
272
Since you are programming the PIC just make outputs
GP0, GP1, GP2 HIGH (1) to turn on the solenoids.

Post your code in the Microcontroller section for help changing code.
(If you need help)

can you recommend a different mosfet? perhaps a cheaper one too, its $1.71 from digikey, i need 18 of them....
I would try changing the code first. P-channel MOSFETS are not as popular
to use as N-channel, the recommendations you have are sound.

I just had a thought. If the program just toggles the outputs each time the same signal is received,
the output driver configuration will work as has been discussed.
 
Last edited:

Thread Starter

seesoe

Joined Dec 7, 2008
99
ok thank you, ill post the code there, i think they said on their site that the system will trigger each button on and off and remember it, im gonna change it to only turn the button request on and the other 2 off.

i just thought about it now, but i will have 6 pairs of these in the same spot, will i have the issue of them all working on the same frequency? or do i change the way each pair works with different id's in the code?
 

Thread Starter

seesoe

Joined Dec 7, 2008
99
would you suggest building one receiver unit that accepts commands from multiple transmitters, instead of building 6 separate receiver transmitter combo's?

i was thinking i could using something like the PIC18F4525, it would need to be capable for these i/o
18 for the valves
1 for the rf receiver
2 for the crystal (would i still need that for the 18f4525?)
3 temp sensors (maybe LM35)
3 status leds (if programmed temp is met)
6 extra pins for possible future valve expansion
 

Thread Starter

seesoe

Joined Dec 7, 2008
99
hello, i did my best to make the attached circuit, i believe everything is correct (as far as my knowledge).... can someone please check it and see if you have any questions comments concerns before i build it?

thank you for all the help so far!
seesoe
 

Attachments

Top