[SOLVED] Help needed - trying to build a projector serial remote control

Hi guys!

I'm trying to build a serial remote control for my Acer H5360BD projector. My board is a Freeduino Serial v2.0 found here.

I've got it all set up with the programming. I've go one button to turn the projector on and off and one to mute the picture. When the buttons are pressed, a command is sent through the serial port. Everything works fine, but nothing happens with the projector.

The ON command is * 0 IR 001\r
The OFF command is * 0 IR 002\r
The MUTE command is * 0 IR 030\r

I've tried sending the commands like this:

Serial.println("* 0 IR 001");
Serial.println("* 0 IR 001\r");
Serial.print("* 0 IR 001");
Serial.print("* 0 IR 001\r");
Serial.write("* 0 IR 001");
Serial.write("* 0 IR 001\r");

But the projector doesn't do anything. What am I doing wrong?

Hope you guys can help.

/Carl

Post a link to the document that describes the commands.

Post your complete Arduino program.

...R

Your link points to a kit. Did you personally assemble the kit? Does the result work properly?

Paul

Robin2:
Post a link to the document that describes the commands.

Post your complete Arduino program.

...R

You'll find the codes here. But a more user friendly list is found here (different model, same codes).

My Arduino sketch is as follows:

#include <Bounce2.h>

#define POWER_BUTTON 8
#define POWER_LED 9

#define PICTURE_BUTTON 6
#define PICTURE_LED 7

int POWER_ledState = LOW;
int PICTURE_ledState = LOW;

// Instantiate a Bounce object :
Bounce POWER_debouncer = Bounce();
Bounce PICTURE_debouncer = Bounce();

boolean projectorState = false;

void setup() {
  Serial.begin(9600);

  // Setup the button with an internal pull-up
  pinMode(POWER_BUTTON, INPUT_PULLUP);
  pinMode(PICTURE_BUTTON, INPUT_PULLUP);

  // After setting up the button, setup the Bounce instance
  POWER_debouncer.attach(POWER_BUTTON);
  POWER_debouncer.interval(5);

  PICTURE_debouncer.attach(PICTURE_BUTTON);
  PICTURE_debouncer.interval(5);

  // Setup the LED :
  pinMode(POWER_LED, OUTPUT);
  digitalWrite(POWER_LED, POWER_ledState);

  pinMode(PICTURE_LED, OUTPUT);
  digitalWrite(PICTURE_LED, PICTURE_ledState);
}

void loop() {
  int onBlink = 0;          //integer to hold value of blinks during 'turning on' state
  projectorState = false;   //default projector state is off

  // Update the Bounce instance
  POWER_debouncer.update();
  PICTURE_debouncer.update();

  // Toggle POWER LED and serial output
  if (POWER_debouncer.fell()) {
    POWER_ledState = !POWER_ledState;
    PICTURE_ledState = POWER_ledState;

    digitalWrite(POWER_LED, POWER_ledState);
    digitalWrite(PICTURE_LED, PICTURE_ledState);

    projectorState = true;

    if (POWER_ledState == 1) {
      Serial.println("* 0 IR 001\r"); // Turn projector on
      while (projectorState == true)  {                 //while projectorState is true, blink for 45 seconds while projector is turning on
        POWER_ledState = false;                         //switch POWER_ledState to off
        digitalWrite(POWER_LED, POWER_ledState);        //write POWER_ledState state to POWER_LED, turning off the ON LED
        delay (500);                                    //delay a half second
        POWER_ledState = true;                          //switch POWER_ledState to on
        digitalWrite(POWER_LED, POWER_ledState);        //write POWER_ledState state to POWER_LED, turning on the ON LED
        delay (500);                                    //delay a half second
        onBlink++;                                      //add 1 to onBlink integer (starting at 0)
        if (onBlink == 45)  {                           //if onBlink equals 45
          POWER_ledState = true;                        //switch POWER_ledState to on
          digitalWrite(POWER_LED, POWER_ledState);      //write POWER_ledState state to POWER_LED, turning on the ON LED
          onBlink = 0;                                  //reset onBlink counter to 0
          projectorState = false;                       //turn off projectorState to end blink program
        }
      }
    }
    else {
      Serial.println("* 0 IR 002\r"); // Turn projector off
    }
  }
  // Toggle PICTURE LED and serial output
  if (PICTURE_debouncer.fell() && POWER_ledState == 1) {
    PICTURE_ledState = !PICTURE_ledState;
    digitalWrite(PICTURE_LED, PICTURE_ledState);  // Toggle picture hide/mute LED
    Serial.println("* 0 IR 030\r");               // Send hide/mute command
  }
}

Probably not the most clean code (or most eccifient, but it works). Is this what you're asking for?

Paul_KD7HB:
Your link points to a kit. Did you personally assemble the kit? Does the result work properly?

Paul

Yes I personally assembled the kit and I find it working properly. Haven't stumbled on anythng odd or not working.

Interesting problem. I found the users manual which shows a 9 pin RS232 connector, but never mentions it afterward. There seems to be no menu option to enable it. Do you have a link to an on-line copy of a manual that defines what you are trying to accomplish?

Paul

Paul_KD7HB:
Interesting problem. I found the users manual which shows a 9 pin RS232 connector, but never mentions it afterward. There seems to be no menu option to enable it. Do you have a link to an on-line copy of a manual that defines what you are trying to accomplish?

Paul

No I'm sorry. I haven't got any more info than that. I had a friend of mine make me a little piece of software for my pc to control the projector, some years ago. And it's been woking perfectly since. But now I would like to control the projector with buttons instead, and thought of the Arduino project for fun and education. The codes he's used are:

  • 0 IR 001&#xD; // On command
  • 0 IR 002&#xD; // Off command
  • 0 IR 030&#xD; // Hide command

The commands are in a XML config file, but I don't know if they are converted to HEX or something before they are sent to the projector. Unfortunately I can't get a hold of him to get an explaination.

carlrh:
No I'm sorry. I haven't got any more info than that. I had a friend of mine make me a little piece of software for my pc to control the projector, some years ago. And it's been woking perfectly since. But now I would like to control the projector with buttons instead, and thought of the Arduino project for fun and education. The codes he's used are:

  • 0 IR 001&#xD; // On command
  • 0 IR 002&#xD; // Off command
  • 0 IR 030&#xD; // Hide command

The commands are in a XML config file, but I don't know if they are converted to HEX or something before they are sent to the projector. Unfortunately I can't get a hold of him to get an explaination.

I love these problems. Really!

Here is what I found thanks to Google:

No Code (character) Function feature

1 OKOKOKOKOK\r Power On

2 * 0 IR 001\r Power On

3 * 0 IR 002\r Power Off

4 * 0 IR 004\r Keystone

5 * 0 IR 006\r Mute

6 * 0 IR 007\r Freeze

7 * 0 IR 008\r Menu

8 * 0 IR 009\r Up

9 * 0 IR 010\r Down

10 * 0 IR 011\r Right

11 * 0 IR 012\r Left

12 * 0 IR 013\r Enter

13 * 0 IR 014\r Re-Sync

14 * 0 IR 015\r Source Analog RGB for D-sub

15 * 0 IR 016\r Source Digital RGB

16 * 0 IR 017\r Source PbPr for D-sub

17 * 0 IR 018\r Source S-Video

18 * 0 IR 019\r Source Composite Video

19 * 0 IR 020\r Source Component Video

20 * 0 IR 021\r Aspect ratio 16:9

21 * 0 IR 022\r Aspect ratio 4:3

22 * 0 IR 023\r Volume +

23 * 0 IR 024\r Volume –

24 * 0 IR 025\r Brightness

25 * 0 IR 026\r Contrast

26 * 0 IR 027\r Color Temperature

27 * 0 IR 028\r Source Analog RGB for DVI Port

28 * 0 IR 029\r Source Analog YPbPr for DVI Port

29 * 0 IR 030\r Hide

30 * 0 IR 031\r Source

31 * 0 IR 032\r Video: Color saturation adjustment

32 * 0 IR 033\r Video: Hue adjustment

33 * 0 IR 034\r Video: Sharpness adjustment

34 * 0 IR 035\r Query Model name

35 * 0 IR 036\r Query Native display resolution

36 * 0 IR 037\r Query company name

37 * 0 IR 040\r Aspect ratioL.Box

38 * 0 IR 041\r Aspect ratio 1:1

39 * 0 IR 042\r Keystone Up

40 * 0 IR 043\r Keystone Down

41 * 0 IR 044\r Keystone Left

42 * 0 IR 045\r Keystone Right

43 * 0 IR 046\r Zoom

44 * 0 IR 047\r e-Key

45 * 0 IR 048\r Color RGB

46 * 0 IR 049\r Language

47 * 0 IR 050\r Source HDMI

apparently the connection params are: 9600,8,none,1

Hello Everyone following this tread,
I had semi-successful control over my Acer S1200 projector over RS232.
I tested most of the commands and they work properly except the POWER ON commands “OKOKOKOKOK\r” and “* 0 IR 001\r” seams they don`t work.
The commands doesn’t turn on the projector for same reason and if I I send twice they give me Overflow
Data sent: * 0 IR 001\r (Nothing happens after this.)
Data sent: * 0 IR 001\r (I send it one more time...)
Data received: RS232Overflow
Update:
When the projector is on and I send the POWER ON command:
Data sent: * 0 IR 001\r
Data received: *001
but every other command return
Data received: *000
----------SOME COMMANDS--------------------------
Data received: *000Lamp1
Data sent: * 0 Src ?\r
Data received: *000Src0
Data sent: * 0 IR 035\r
Data received: *000S1200
Data sent: * 0 IR 036\r
Data received: *000Res
Data sent: * 0 IR 037\r
Data received: *000NameAcer
The baud 9600, Data 8 bit, Parity none, Stop bit 1.

The above is a collection from several sites. Apparently you are not the first to want to control a projector.

Seems some projectors do return a response.

Paul

If I was trying to get a program to talk to the projector, I would start fresh and write a program to just send a command to turn OFF the projector. This seemed to consistently work for all the projectors. Be sure the projector is on, first. Set the comm parameters as shown.

Then enable the receive for the serial port and try to get a response from the projector and display it on the monitor.

By the way, I did not see any place in your program listing where you actually defined or sent anything to the Arduino board's serial port connected to the projector. An I missing something?

Paul

I note in the second link in Reply #3 that it says

Note: "\r" means the command "Enter".

Normally \r means the carriage return character. But I would expect "enter" to send two characters \r\n or \n\r and I wonder if it would be worth trying to send both characters. (Note that \n is the newline character)

It would be much easier if there was access to a proper user manual.

...R

@Paul - I don't understand what you mean by "I did not see any place in your program listing where you actually defined or sent anything to the Arduino board's serial port connected to the projector. An I missing something?". I'm sending the code

Serial.println("* 0 IR 001\r"); // Turn projector on

Isn't this correct?

And also "Then enable the receive for the serial port and try to get a response from the projector and display it on the monitor." If I'm sending a command with the arduino, how do I show a response on the monitor?

/Carl

Apparently I have two accounts on the Arduino forum... carlrh and carlroger is the same guy - me :slight_smile:

carlroger:
If I'm sending a command with the arduino, how do I show a response on the monitor?

I presume that you have pins 0 and 1 (Rx and Tx) (and GND) connected to your projector?

You can use SoftwareSerial to create another serial port on two other pins and use them to talk to the projector leaving the regular USB cable free for sending debug messages to the Serial monitor.

...R

Ok. Maybe this is where I'm going wrong. My board is a Freeduino Serial v2.0. It hasn't go an USB port but a DB9 port. I expected it to be as simple as connecting the projector directly to the boards DB9. Am I wrong?

Another question: if I use RX, TX, GND pins on a Arduino Uno and connect them to the projector, will the board transmit through these pins?

carlroger:
Another question: if I use RX, TX, GND pins on a Arduino Uno and connect them to the projector, will the board transmit through these pins?

Unlike your Freeduino, the Uno does not have RS-232 IO. It has TTL io, which needs to be converted to RS-232 signals. Look for MAX232 devices.

Paul

Or a module
http://www.nkcelectronics.com/rs232-to-ttl-converter-board-33v232335.html
or
http://www.nkcelectronics.com/RS232-to-TTL-converter-board-DTE-with-Male-DB9-33V-to-5V_p_369.html

I didn't read all of first page - USB to RS232 cable?
http://www.nkcelectronics.com/USB-to-Serial-Adapter-Cable_p_423.html

A buddy of mine has a serial shield for the uno, like this one: RS232 Shield V2 - DEV-13029 - SparkFun Electronics

Is there any special way to configure it or is it just plug and play?

carlroger:
Ok. Maybe this is where I'm going wrong. My board is a Freeduino Serial v2.0. It hasn't go an USB port but a DB9 port. I expected it to be as simple as connecting the projector directly to the boards DB9. Am I wrong?

Assuming your DB9 connector works with RS232 signal levels you are probably correct. But you need to make sure that the DB9 connector on the Freeduino has the pins wired the way the projector expects. This was always a PITA with serial cables. You used to be able to buy "modem" cables and "null-modem" cables and one of them had the wires swapped over - can't recall which, now.

But for debugging purposes you also need a second serial port (SoftwareSerial) so you can communicate with your PC as well as your projector. If you get a USB-TTL cable you could use that to connect SoftwareSerial to the PC without disturbing your DB9 connection to the projector.

How do you connect your Freeduino to your PC so you can upload a program?

...R

Robin2:
Assuming your DB9 connector works with RS232 signal levels you are probably correct. But you need to make sure that the DB9 connector on the Freeduino has the pins wired the way the projector expects. This was always a PITA with serial cables. You used to be able to buy "modem" cables and "null-modem" cables and one of them had the wires swapped over - can't recall which, now.

But for debugging purposes you also need a second serial port (SoftwareSerial) so you can communicate with your PC as well as your projector. If you get a USB-TTL cable you could use that to connect SoftwareSerial to the PC without disturbing your DB9 connection to the projector.

How do you connect your Freeduino to your PC so you can upload a program?

...R

Thanks for explaining! To upload a program to the Freeduino, I have to connect it to the serial port on my computer with a male/female straight through serial cable.

I've tried using both a straight through and crossed serial cable on the monitor.