Go Down

Topic: 350Mhz RF Remote. I know there is 315mhz and 433mhz. (Read 8530 times) previous topic - next topic

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. :)  Thanks!

Retroplayer

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 :)

Retroplayer

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.

Retroplayer

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:

Code: [Select]

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

void loop(){

}

void test(){

Serial.println("Pin went low!);

}

Retroplayer

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) 
Code: [Select]
/*
  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.

Retroplayer

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.



Retroplayer

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? 

Retroplayer

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.

Code: [Select]
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.

Code: [Select]
/*
  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);
}

Go Up