On a Linux or Mac OSX computer

You can control your projector from a computer running Linux or Mac OSX.  It can turn your projector on & off, change video sources, and do just about anything that your remote can do.  The projector is connected to your compute via a serial cable and commands are given through shell commands.  This can be done on a schedule, too, thanks to the Cron scheduler built into Linux / Mac OSX.

 

To control your projector with Linux and/or Mac OSX, you will need these things

1. Projector with an RS232 serial port.  This port can have a DB9 serial port (most common) or a round DIN serial port.  A DB serial port has five pins in one row, and four pins in the second row.  Projectors with only USB ports are not able to be used for control.

2. "Straight through" serial cable, DB9 to DB9.  Typically this is a female to female cable.

3. Null modem adapter like this.  This may be needed for some projectors.  If your projector does not respond to commands, add this to the "straight through" serial cable above.

4. USB to serial adapter cable, such as this.  This cable adapts the USB port on the Linux/Mac computer to communicate to the DB9 serial port on the projector.

 

Finding hex control codes for your projector

Your projector listens for commands entering its serial port.  This allows you to turn the projector on, off, change video sources, etc., simply by sending commands to this port.  These commands are in the "hex" language, such as 00, AB, F1, B12, etc.

Different brands and models of projectors use different hex codes for these commands.  Your projector's manual should have an area that list these codes.  If you do not have the manual, search Google for "hex codes xxx projector" where "xxx" is the brand and model of your projector.  You can also find manuals for projectors by googling "xxx projector Clary Business Machines".  

Here is an example of hex control codes for a Boxlight Seattle WX25NU projector.  For example, hex command "43 30 30 0D" will turn on the projector and "43 30 31 0D" will turn it off.

This document should also indicate your projector's serial port communication settings (baud rate, data length, parity, stop bit, and flow control).  This information is important for your Linux/Mac computer to properly communicate with the projector's serial port, so write it down.

 

Connect your projector to your Linux/Mac computer

1. Connect the USB serial adapter cable to the computer's USB port.

2. Connect the DB9 serial cable to the USB serial adapter cable.

3. Connect the other end of the DB9 serial cable to your projector.  

4. Make sure the projector has its power cable connected.  It does not need to be turned on yet, but it does need to be in "standby" mode.  Some projectors indicate standby with a flashing power light.

 

Finding the name of your USB serial adapter 

When you connect the USB serial adapter to your computer, Linux/Mac will assign a name to it.  This could be "ttys0", but could vary depending on the make/model of your adapter.  To find the correct name of your adapter, do the following:

1. Open a shell / command prompt.

2. Enter this command: ls /dev/serial/by-id

3. The result should display the name of your adapter, such as "usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0". 

Note: If nothing is shown, then your adapter may need Linux/OSX drivers installed or perhaps your adapter is not compatible with Linux/OSX.

4. Enter this command: ls /dev/serial/by-path  

5. The result should show technical information about your adapter, such as "platform-3f980000.usb-usb-0:1.4:1.0-port0".  Note the phrase "usb-0:1.4" in this example.  This is helpful for the next step.

6. Enter this command: dmesg | grep tty

7. The result should list the active serial ports on your computer, such as "usb 1-1.4: pl2303 converter now attached to ttyUSB0".  

8. Remember the "usb-0:1.4" phrase from Step 5?  It somewhat matches the "usb 1-1.4" phrase from Step 7.  This is your USB serial adapter.  Therefore, "ttyUSB0" is the name of your adapter.

9. You're done!

 

Controlling the projector

Now it's time to see if everything works!

1. Open a shell / command prompt.

2. Enter this command: sudo chmod 666 /dev/ttyUSB0  (replace "ttyUSB0" with your adapter's actual name if necessary)

3. The above command sets permission for you to send commands to the serial adapter.

4. Find your projector's hex codes for "ON", "OFF", and "VIDEO".  Each hex code precedes with "\x", so hex codes "43 30 30 0D" to turn on a Boxlight projector would be entered as "\x43\x30\x30\x0D".  

5. For example, enter this command to turn on a Boxlight projector: echo -en '\x43\x30\x30\x0D' > /dev/ttyUSB0 

6. If all works well, your projector will turn on (wait a minute for the lamp to warm up).

 

If the projector is not responding...

1. Make sure the projector is connected to power.

2. Make sure the projector is in "standby" mode (not completely off).

3. The serial cable may need a "null modem adapter" added to it.  This adapter reverses pins 2 & 3 for the receive & transmission lines; some projectors need this.  Add the null modem adapter to the serial cable, then play the playlist again.

 

Control the projector on a schedule

Your computer can turn on/off your projector on a schedule, such as several times a day, daily, weekly, etc.  This is accomplished through Cron feature.  

1. Create a script that turns on your projector:

a. Enter this command: sudo nano /usr/local/bin/projector-on.sh

b. In the editor that appears, enter:

#!/bin/bash

sudo chmod 666 /dev/ttyUSB0

echo -en '\x43\x30\x30\x0D' > /dev/ttyUSB0

c. Save the script by pressing [Ctrl-O], then [Ctrl-X].

d. Make the script executable by entering this command: chmod u+x projector-on.sh

2. To test the script, enter "projector-on.sh" at the shell prompt.  Your projector should turn on.

3. Configure Cron so that it runs this script daily/weekly/etc.  These webpages have helpful instructions for using Cron:

https://opensource.com/article/17/11/how-use-cron-linux

https://www.howtogeek.com/101288/how-to-schedule-tasks-on-linux-an-introduction-to-crontab-files

https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses

4. That's it!

Last modified on Wednesday, 01 May 2019 02:37

Go to top
JSN Boot template designed by JoomlaShine.com