350Mhz RF Remote. I know there is 315mhz and 433mhz.

Differential driving is really good to know. I would have tested on the bench, hooked it up in a semi-permanent installation to test and said WTF?

I think I found a better way to wire my project.

This relay says it can learn 315mhz codes.
http://www.ebay.com/itm/315-DC-12V-Single-Channel-Learning-Code-Wireless-Remote-Control-Relay-/261157962603?pt=LH_DefaultDomain_0&hash=item3cce3a436b

I could then put these in/near my small home (I'm betting they will be in range) and wire to my gates/gerage door and control them with one 315mhz transmitter on the Arduino. It would just depend on which code it broadcasts, right? Just want to conform I'm on the right track before I start buying stuff.

Its either that or I play with the remote relays that are on different channels, but I think different code would be better/more reliable. Wouldn't I need a bunch of different channel transmitters if I had different channel remote relays?

The "transmitter" should just be thought of as a wire. What you put into it, comes out of the receiver. That's all. The channels, house codes, and all the rest of that comes from the encoder on these remotes. But, since you are using the arduino, YOU are the encoder and have complete control over all of that. So, no... you would use only one 315Mhz module for all 315Mhz remotes, one 350MHz module for all 350Mhz remotes, etc... Your code handles the channels, housecodes, etc...

The rfswitch library I link you to handles all of that. You send whatever you want over the RF module.

There is nothing locking the actual radio module to specific channels, etc... all of that is done in the encoder. Check out the datasheets for a PT2262 attached. Nearly all of these remotes use this or some clone of this.

PT2262.pdf (454 KB)

Ohh. Thank you. That means that rotating codes could be a possibility if I learned how to use that IC to it's potential?

Can I play with the transmitters with just a computer for the moment, or do I need the Arduino right now too? I've got multiple computers with serial ports. What I cant seem to find is the equivalent of the library or an app that can tell the transmitter what to do. Windows, Linux. I dont care.

Incredible! Possibilities are limited only by ones imagination and programming abilities.

I was under the impression that channel was a slight change in frequency? I read the RC-Switch manual and missed that part.

I am not aware of any software on the computer that allows you to play with these modules. If you are handy with visual basic, you could progran something, I'm sure. But easier to just create a sketch, include that RF-Switch library, connect the data line to one of your pins on the arduino, and play with the examples included in that library. I just noticed that it is missing a nice example for setting commands from the serial port. I could write an example up for you, but I am probably not going to have time to do it this weekend. It would be useful to me in future project as well, so I will do it as soon as I have the time. In the meantime, I suggest just playing around with it.

You won't be using that encoder IC, but the datasheet helps explain how the protocol works. The RC-Switch library is meant to emulate that IC.

OK. I found a 350mhz Serial RF transmitter in a remote I had for the lights. I De-soldered it from the button board and it's free to use. It has three pins. VCC, GND, SIGnal. I've got an Arduino Uno, loaded the IDE, and can blink some LEDs.

Where do I go from here?

I imagine what I need to do is hook the button side of the remote to the Arduino and capture a couple codes so I know what to transmit with the transmitter. THEN hook the transmitter up and try transmitting.

How do I do that? Where do I go? I need some direction. :slight_smile: Thanks!

Take the line on the remote that was original connected to the signal pin on the module. Connect that line into your arduino and use the RCSwitch library example to read the codes when you push a button. You can remove it when done.

After you have all the codes, you connect the signal pin on your module to the Arduino, power it, send those codes you figured out using the RCswitch library.

There are examples in there that you can use to get the codes and to play with sending them.

Ohh Thank you.

I loaded the library and opened the receive simple example to play with. When I uploaded the program the L LED remains solid. I get no response from anything.

If I revert back to the blinking LED program the L LED will blink indicating all is well along with my LED that I plugged in.

I'm not sure how to troubleshoot this.

I know SPOOOON feed the new idiot :slight_smile:

The LED doesn't always blink. Do you have the module wired up already? If so, the library is meant to output to the serial port. So, you have to open the Serial Monitor in Arduino.

Yeah I know I have to have serial monitor open. I though a little program together that would write hello world 100 times then stop, and it worked. So I know that serial monitor is working.

At this point I think I'd like to somehow test that pin 2 can read anything with RCSwitch receive running.

ok, so you are using the RCswitch library with no modifications and have the data pin of the module connected to pin 2 on the Arduino?

You could connect an LED to this as well that will flicker when data is being received by the module. To check this with the Arduino, try a little sketch like this:

void setup(){
  Serial.begin(9600);
  attachInterrupt(0,test,FALLING);
}

void loop(){

}

void test(){

Serial.println("Pin went low!);

}

oh, and make sure that you have the ground on the transmitter connected to the ground on the arduino. Otherwise, a high or low may not be valid voltage levels.

I am using the example code with no modifications. I did play around with pins other than pin 0 (pin 2) just for fun.

If I run this code (which I found online)

/*
  DigitalReadSerial
 Reads a digital input on pin 2, prints the result to the serial monitor 
 
 This example code is in the public domain.
 */

// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // make the pushbutton's pin an input:
  pinMode(pushButton, INPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  int buttonState = digitalRead(pushButton);
  // print out the state of the button:
  Serial.println(buttonState);
  delay(1);        // delay in between reads for stability
}

I see just
0
0
0
0
0
0
many times.

then when I hook up the remote and press a button I do see it change, like
1
0
1
1
1
0

then it will go either
0
0
0
0
0

or

1
1
1
1
1
1
on and on and on

So I know it's reading something.

Even if I load SoftwareSerials TwoPortRecieve example and run it I see:

Data from port one:

Data from port one:

Data from port one:

Data from port two:

over and over again. Maybe something is wrong with the Arduino? Or my setup?

I'm running the board off of arduino power. I've tried both the regular ground near the power and the other ground on the digital side.

using the example ReceiveDemo_Simple, you aren't even getting "Unknown Encoding?"

That's correct.

When I ran your code I got

Pin went low! <when I touch to grond
Pin went low! <when I touch to gournd
Pi

stop. Then I'd have to close and reopen the serial viewer.

I suspect that's because it is generally not a good idea to do a serial print in the middle of an interrupt. So, the pin is working and the interrupt is working. Try my code with the remote connected. It is similar to the code you already tried, but uses an interrupt instead. It may freeze up, but if you get some stuff flowing, at least you know the remote is able to trigger an interrupt.

When I say stop. I mean the screen printout stops. I issue no command.

Could this be a FloatingPin Problem that I've read about?

I knew what you meant. It freezes completely. Only a reset brings things back to life.

I have had this happen when I didn't connect grounds together and I have had it happen when I have put serial commands inside of interrupts (though it doesn't always freeze up.) What is the floatingpin thing you have read about?

The Dout voltage from the transmitter could be too high or too low. It should be held high when not transmitting. Do you have a multimeter to check it?

I could check it.

I also have some interesting progress.

I found some code. Got inspired and did this.

int forwardPin = 12;

void setup()
{
  Serial.begin(9600);
   pinMode(forwardPin, INPUT);
   digitalWrite(forwardPin, HIGH); // Turn on the pullup resistor.
}

void loop()
{
  int forwardState = digitalRead(forwardPin);
  if (forwardState == HIGH)
  {
    Serial.print("1");
  }
  else
  {
    Serial.print("0");
  }
}

When I run this I get a nice stream of 1s. No random variations. When I connect pin 12 to the signal pin, they change to 0s. Then when I press the button for light on, I get this.
000000011010000000001101101000000001101000000000001101000000001100110100000000110100000000000110100000000110110110000000011010000000000011010000000011011010000000001101000000

However, if I go run that in the binary RCSDemo. Nothing happens.

/*
  Example for different sending methods
  
  http://code.google.com/p/rc-switch/
  
  Need help? http://forum.ardumote.com
*/

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

  Serial.begin(9600);
  
  // Transmitter is connected to Arduino Pin #10  
  mySwitch.enableTransmit(10);

  // Optional set pulse length.
  // mySwitch.setPulseLength(320);
  
  // Optional set protocol (default is 1, will work for most outlets)
  // mySwitch.setProtocol(2);
  
  // Optional set number of transmission repetitions.
  // mySwitch.setRepeatTransmit(15);
  
}

void loop() {

 

  /* Same switch as above, but using binary code */
  mySwitch.send("000000011010000000001101101000000001101000000000001101000000001100110100000000110100000000000110100000000110110110000000011010000000000011010000000011011010000000001101000000");
  delay(1000); 

 
  delay(20000);
}

I'm done for tonight. Thanks for your help.

Instead of printing the code to the screen with serial.print. Is there away to print the code to a pin?

I think I'd like to hook the button board up to the transmitter though the arduino and play from there. I dont know. Picking at straws I suppose.