Photon + 433Mhz RF Transmitter + RCSwitch Lib

I have a working version of a RPi with 433 Mhz transmitter and the RCSwitch library that I’m using for some simple home automation tricks. I’d like to port it to the Photon to save on space, power, etc. However, I’m having trouble getting it working. Here’s my setup:

The Photon is being powered over USB by a computer, as well. And the firmware code is here:

#include "RCSwitch/RCSwitch.h"

#define OFFICE_Light_1_Toggle 87489

RCSwitch switchObj = RCSwitch();

void smartHomeHandler(const char *event, const char *data)
{
  Serial.print(event);
  Serial.print(", data: ");
  if (data)
    Serial.println(data);
  else
    Serial.println("NULL");
}

void setup() {
    
    pinMode(D3, OUTPUT); 
  
    Serial.begin(9600);
    
    switchObj.enableTransmit(D3);
    
    Particle.subscribe("smart-home", smartHomeHandler);
}

void loop() {
    
    switchObj.send(OFFICE_Light_1_Toggle, 24);
    
    delay(2000);
    
}

When I upload the firmware, I get no response from the light that uses the above code number - it should be blinking on/off every two seconds. However, I can still use the RPi setup as well as sending the code manually to toggle the light. I’ve checked the RF transmitter works, and it has no issues. I also tried on different D# GPIO ports on the Photon to no avail. Any ideas about what I’m doing wrong? Thanks for anyone’s help!

Steve

I've read this somewhere

So could it be that the 3.3V for the data pin might be too little?

Might be worth dropping a line to these guys, I'm sure that's the same module they did beta testing with a while back

But, I don't have the 3.3V pin in use. I'm using the VIN pin which according to the datasheet page:

VIN will output a voltage of approximately 4.8VDC

Yea, I’ve seen that project before and a thread where they beta tested the RF transmitter via the same schematic I’m using. However, they don’t publish the firmware code - you actually had to have them flash their compiled firmware to your Photon if you wanted to beta test - and that’s really where I’m in need of some assistance, I think.

I found the answer via this thread: RC-Switch Library

And added this line to the setup() function:

switchObj.setPulseLength(180);

Thanks you guys for your ideas too!

4 Likes