12v signal from a projector 433mhz signals

Hello
I'm working on a sketch I found on Github for a Motorized Screen with 433Mhz transmitter with an Arduino Nano.
When I start projector that should give 12v signal from a projector and raise or lower a Motorized Screen with RF-link 433MHz transmitter

but when I try to upload it to the Arduino Nano, I get an error message

E:\ProjectorScreen433mhz\ProjectorScreen433mhz.ino: In function 'void setup()':
E:\ProjectorScreen433mhz\ProjectorScreen433mhz.ino:35:18: error: 'protocol' was not declared in this scope
RF.setProtocol(protocol); //Hset RF protocal
^~~~~~~~
E:\ProjectorScreen433mhz\ProjectorScreen433mhz.ino:35:18: note: suggested alternative: 'protocal'
RF.setProtocol(protocol); //Hset RF protocal
^~~~~~~~
protocal

exit status 1

Compilation error: 'protocol' was not declared in this scope

/*
  Small program to catch a 12v signal from a projector
  and raise or lower a HomeGear Motorized Screen. 
  Values used were read from the HomeGear remote.
  Modify code to read the 433mhz signals and change
  accordingly for your screen commands.
  Arduino Nano was used.
  
  Special thanks to sui77 for the RC Switch library
  https://github.com/sui77/rc-switch/
  
  This Repo
  https://github.com/ndoty/
*/

#include <RCSwitch.h>

RCSwitch RF = RCSwitch();

// Configurable
const long lowerMhz = 2981764; //HomeGear Remote sent this command to lower so let's use it in the code
const long raiseMhz = 2981761; //HomeGear Remote sent this command to raise so let's use it in the code
const byte bitLength = 24; //HomeGear Remote used a 24 bit length so let's use it in the code
const long pulseRate = 384; //HomeGear pulse rate was 384ms so let's use it in the code
const byte protocal = 1; //HomeGear protocol is 1 so let's use it in the code

// Don't Modify unless you know what you are doing
const byte ledPin = 13; //Using Pin D13 to turn on and off LED
const byte mhzPin = 10; //Using Pin D10 to send 433mhz signals to screen
const byte interruptPin = 2; //Nano only works on pin D2 or D3 let's use D2
byte state = 2; // Set to 2 intitialy so both raise or lower will work on boot

void setup() {
  RF.enableTransmit(mhzPin); //Set RF transmit pin (D10)
  RF.setProtocol(protocol); //Hset RF protocal

  pinMode(ledPin, OUTPUT); //Set pin mode to power for LED
  pinMode(interruptPin, INPUT); //Set pin mode to input for interrupt pin

  attachInterrupt(digitalPinToInterrupt(interruptPin), move, CHANGE); //Wait for signal change from projector

  delay(500); //Give some time

  move(); //Set state right away to make sure it operates properly
}

void loop() {
}

void move() {
  delay(500); //Give pin time to stablalize

  int status = digitalRead(interruptPin);

  delay(500); //We Read it now wait a second before we act

  switch (status) {
    case LOW: //No Signal
      raiseScreen(); //Raise
      break;
    case HIGH: //12v Trigger Signal
      lowerScreen(); //Lower
      break;
  }
}

void raiseScreen() {
  if (state != 0 ) { //Only run this once if we are already up. Nano runs functions multiple times for some reason
    digitalWrite(ledPin, HIGH); //Visual LED for signal
    RF.send(raiseMhz, bitLength); //Send Command
    delay(1);
    RF.send(raiseMhz, bitLength); //Send again
    delay(1);
    RF.send(raiseMhz, bitLength); //Send again
    digitalWrite(ledPin, LOW); //Turn off Visual LED for Signal
  }
  state = 0; //Set flag for up
}

void lowerScreen() {
  if (state != 1) {  //Only run this once if we are already down. Nano runs functions multiple times for some reason
    digitalWrite(ledPin, HIGH); //Visual LED for signal
    RF.send(lowerMhz, bitLength); //Send Command
    delay(pulseRate);
    RF.send(lowerMhz, bitLength); //Send again
    delay(pulseRate);
    RF.send(lowerMhz, bitLength); //Send again
    digitalWrite(ledPin, LOW); //Turn off Visual LED for Signal
  }
  state = 1; //set flag for down
}

Hope for help
/Peter

Just as the messages indicate you have misspelled "protocol" as "protocal".

1 Like

Thanks for your help, now it works to upload, a bit embarrassing this from me

2 Likes

You will recover! I once worked an ex-Boeing programmer who said all their programmers had to explain in narrative what their current program was doing and answer questions about the program. That was their way of finding logic errors and omissions. The forum here, is sort of the same thing.

1 Like

Anyone that can help me

I have used the recive demo advance sketch to read remote control 433 MHz and get this using serial monitor but it doesn't work when I put Decimal: and Binary: in the sketch, what am I doing wrong

Lower projector screen

Decimal: 8383636 (24Bit) Binary: 011111111110110010010100 Tri-State: not applicable PulseLength: 188 microseconds Protocol: 1
Raw data: 5920,152,600,516,244,516,240,516,244,512,252,500,260,492,252,496,240,500,236,504,240,500,244,96,628,488,244,488,252,88,6 28,120,608,520,232,124,624,124,636,516,256,124,656,540,264,128,688,136,696,

Raise projector screen

Decimal: 8383634 (24Bit) Binary: 011111111110110010010010 Tri-State: not applicable PulseLength: 189 microseconds Protocol: 1
Raw data: 5920,112,640,512,248,504,252,504,256,500,252,512,252,504,252,504,256,504,244,512,252,500,260,96,660,492,268,488,264,100, 652,108,648,504,260,100,652,104,664,488,264,92,648,100,648,480,268,80,660,

// Configurable
const long lowerMhz = 8383636; //HomeGear Remote sent this command to lower so let's use it in the code
const long raiseMhz = 8383634; //HomeGear Remote sent this command to raise so let's use it in the code
const byte bitLength = 24; //HomeGear Remote used a 24 bit length so let's use it in the code
const long pulseRate = 384; //HomeGear pulse rate was 384ms so let's use it in the code
const byte protocol = 1; //HomeGear protocol is 1 so let's use it in the code

The results are THREE bytes long, 24 bits. So, you can only send three bytes with the Arduino. How many are you sending? Break the binary into three 8-bit segments and send bytes with those values.

thanks for your help
Now I don't really understand what you mean! what I have done is that I have entered the remote's code for the up and down of the projector screen with decimal 8383636 and 8383634 in the sketch, but it does not seem to work

I've got it almost working, if I plug in the USB cable and then the screen goes down and then I pull out the USB and then turn on power only without USB on D2 and then the screen goes up, I can't quite get the whole thing to work , should work when the projector gives a 12v trigger to D2 on the arduino then the screen should be lowered and when the screen is down and the projector is off then the screen should be raised , I can't get it to work

Anyone that can help me

Those are the equivalent decimal values, not the 24 bits that are actually sent. You are mixing different number bases because of very poor documentation that also mixed up number bases because whoever wrote the documentation was clueless and afraid to ask for clarification.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.