2 button RF keyfob has different ranges for A & B buttons?

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

2 button RF keyfob has different ranges for A & B buttons?

Post by strykeroz »

Hi guys

Bought a Keyfob 2-Button RF Remote Control - 315MHz and Simple RF L4 Receiver - 315MHz Latching Selector Type (PRODUCT IDs 1391 & 1098) and firstly, thanks for a great product. I've made a simple motion alarm, with Arduino pro mini, the receiver, a PiR sensor and a MOSFET to trigger a hacked bike horn as the alarm. What I've noticed is the B button on the fob has a consistently shorter range than the A. Inside the plastic enclosure I've put this in, I stretched the antenna out in a square fashion following the inside of the box. The A button can "arm" it from a metre away through a closed wardrobe door - in contrast the B button won't trigger unless the key fob is very near the box and never through the wooden door.

Is this difference in range expected/normal? If so, can anyone else share what they did to even things out?

Thanks,
Geoff

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by adafruit_support_bill »

That is rather strange. It is the same transmitter & receiver, just a different code.
For best reception, the receiving antenna should be straight & vertical - although that is not always practical.

Can you post a photo or diagram of the circuit? What happens if you swap the functions of the A and B pins so that B arms and A triggers?

User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by strykeroz »

adafruit_support_bill wrote:That is rather strange. It is the same transmitter & receiver, just a different code.
For best reception, the receiving antenna should be straight & vertical
Thanks for the tip. I'll drill a hole in the top and pull the antenna through and see if that improves things.

The circuit itself (due to the genius of the Adafruit receiver) is very simple.
- D3 (from memory) on the L4 receiver into A0 on the Arduino
- D13 has an LED and 330R current limiting resistor, which flashes at different rates for armed or passive
- D9 has the gate of the 2N7000 MOSFET (with 1M pulldown resistor) to bypass the bicycle horn's switch for making noise
- D2 has the PiR sensor input
- There's a TM1637 4 digit 7seg display (counts down from 30 secs when you arm it before the PiR is monitored) on D4 for clock and D5 for data.

B acts to disarm it, but all it's really doing is monitoring that one latched output using a modified version of your tutorial code with the value threshold of 50 as per that example. Watching the inputs on the serial monitor shows active is a solid 1023 and inactive is mostly 0 with some flickers up to 10 or so.

I'll try that antenna suggestion first though, thanks!
Geoff

User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by strykeroz »

Hi,

I stripped down my code to the bare minimum where essentially it loops around watching for a change in D3 (on A0) and I've made the antenna stand up out the top of the enclosure.

Fob key A can be received from the far end of our house (further probably, but it's raining) around 15m away. Fob key B can be received no further than 2 metres away, line-of-sight. The test code flashes the pulse LED and beeps the piezo alarm so I can tell when out of the room if it is responding.

Code: Select all

// constants
const byte BUTTON_THRESHOLD = 50;                                  // Analog threshold used to determine when FOB buttons are pressed
// 50 is typically good enough as high result is 1023 but low result is noisy 0-50 range
const unsigned long confirmBeep = 50;                              // duration of a confirmation beep

// status variables
boolean armed = false;                                             // true when monitoring sensor

// pin declarations    
const int alarmTrigger = 9;                                        // alarm siren output
const int FOBinput = A0;                                           // key fob input
const int pulseLED = 13;                                           // pulse LED on pro mini Arduino

// ---------------------------------------------------------------------------------
//
void setup(){
  // setup IO pins
  pinMode(alarmTrigger, OUTPUT);
  pinMode(pulseLED, OUTPUT);
}

// ---------------------------------------------------------------------------------
//
void loop(){
  // confirmation flash of pulse LED is different for armed or passive
  unsigned long offDuration = 1750;
  unsigned long cycleTime = 2000;
  if(armed) { 
    offDuration = 250; 
    cycleTime = 500; 
  }
  // confirmation flash D13 LED now
  digitalWrite(pulseLED, millis() % cycleTime > offDuration);

  // test to see if armed state needs to change
  boolean FOBpressed = (analogRead(FOBinput) > BUTTON_THRESHOLD);
  if(FOBpressed != armed) {                                      // state change
    armed = FOBpressed;                                          // record new state
    // confirmation beeps
    int beepCount = 3;
    if(armed) beepCount = 2;
    for(int i = 0; i<beepCount; i++) {                           // it's blocking, but that's okay here
      digitalWrite(alarmTrigger, HIGH);
      delay(confirmBeep);
      digitalWrite(alarmTrigger, LOW);
      delay(confirmBeep*2);
    }
  }
}
The receiver is the latching type, so there's no need (so I understand) to test both pins - testing D3 is fine as it will toggle off when a B key code is received. It's the same code block that deals with the toggled state so as far as I can see, the B code truly does have a shorter range. Or what am I not seeing?

Additional info: just loaded my whole code, and the range is just the same as the cut-down test above so the vertical antenna helps quite a bit - the different range for A & B codes remains a mystery though.

Thanks
Geoff

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by adafruit_support_bill »

Let me check with some of our RF experts and see if they have any clues to the cause.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: 2 button RF keyfob has different ranges for A & B button

Post by adafruit2 »

wow no idea, but we can get you a new one, just email support@adafruit - would be interesting to see if its the same between two of them :)

User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by strykeroz »

Hi guys

Thanks for the replacement, and apologies for the break in comms as I've been out of town. Did a range test today and the new one behaves essentially the same as the first.

I'll make sure to order another latching type receiver when I next need some Adafruit gear to see if the issue is at the receiving end. I'll also grab the 4 key fob to see if that fixes this. It will be several weeks before I get back to this but will report here with what I find. If in the meantime you have a breakthrough your side please shout it out.

Cheers ! Geoff

User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by strykeroz »

Hi,

I have received my order with a single and 4 button keyfob so can now confirm the same range difference in A & B button on this project when using the 4-key fob, and also that the single button fob disarms the project at a similarly short range to the other keyfobs' B button.

If the range is supposed to be the same for A&B buttons the culprit is looking more and more like the receiver board. I will next test by swapping out the latching board and let you know if the new one changes anything.

Cheers!
Geoff

User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by strykeroz »

Hi again

Tested another L4 board in place of the original, at first with antenna coiled and then stretched out without change of behavior.

From what I'm seeing here, the A button is best used for any longer range remote work - I can't get the B button to be functional at any useful distance at all with the latching receiver at least. Unless there's any suggestions here to point out the error in what I'm doing, I'll rework my code to make this arm/disarm using A button and a T or M style receiver board.

Cheers!
Geoff

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by adafruit_support_bill »

No idea what is going on there. We haven't had any similar reports of that problem. I'll have to set up a bit of a range test here and see if I can reproduce it.

User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by strykeroz »

Thanks, that would be brilliant. I don't see how it's possible either.

User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by strykeroz »

adafruit_support_bill wrote:No idea what is going on there. We haven't had any similar reports of that problem. I'll have to set up a bit of a range test here and see if I can reproduce it.
Hi,

After quite a break I've come back to this project after a friend suggested RF interference from the Arduino might be the issue. I have an Arduino pro micro socketed in headers onto a protoboard, and the RF receiver is also socketed into a female header adjacent to it. The regulator on the Arduino knocks the 9V DC voltage down and then feeds the rest of the components. The wire antenna sticks out through a hole in the top of the enclosure.

Tonight I extended the RF receiver away from the Arduino using 20cm dupont leads, and difference between A & B range appears to be fixed. Overall the range of the keyfob appears to be better too. It's such a revelation I think I'm close to calling this one solved, though at this stage it doesn't look like I could house this project in one box. I'm going to try a wider enclosure and maybe some aluminium foil to try to shield the Arduino.

Have you encountered anything like this before?
Geoff

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by adafruit_support_bill »

That is interesting - and somewhat unexpected. As far as I know, the transmission frequency of all the buttons is the same - only the key-code is different. I would expect any RF interference to affect all keys the same. But it is hard to argue with experimental evidence to the contrary!

My attempts to reproduce the problem were not successful - probably because I did not have an Arduino in the mix.

Thanks for posting your results!

User avatar
strykeroz
 
Posts: 34
Joined: Wed Jan 11, 2012 2:59 am

Re: 2 button RF keyfob has different ranges for A & B button

Post by strykeroz »

adafruit_support_bill wrote:I would expect any RF interference to affect all keys the same. But it is hard to argue with experimental evidence to the contrary!!
I agree, unless it's not RF interference but some other issue. I see it but I'm not able to rationalise it myself just yet.

Will post again once I know more, Geoff

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”