Controlling a Kodak Slide Projector via RS232 (P-Com Protocoll)

Hello community,

I've been trying to set up a system to control Kodak Slide projectors via it's serial port with the arduino. Using the Software Serial protocol and a MAX232 chip, I get already a binary output - but the projector doesn't seem to understand me. I'm using the Kodak P-Com protocol, which needs 3 bytes of information - here's some more information on this: http://slideprojector.kodak.com/plugins/acrobat/ektaproP-com.pdf

I'm guessing the problem is with the configuration of the start and stop-bytes, since I already receive 3 bytes of information when re-checking via serial monitor. The needed setup for the projector is:

1 start bit
8 data bits
no parity
1 stop bit
9600 baud

This is the code I'm using right now:

#include <SoftwareSerial.h>

SoftwareSerial myserial(2, 3); // RX, TX
int zeros=0;
String printStrFirst;
String printStrSecond;
String printStrThird;

int firstbyte=251;
int secondbyte=30;
int thirdbyte=0;

void setup()
{
myserial.begin(9600);
}

void loop()
{
//myserial.print(0xAF, BIN);
//myserial.print(0x11, BIN);
//myserial.println(0x0, BIN);

// first byte
zeros = 8 - String(firstbyte,BIN).length();
for (int i=0; i<zeros; i++) {
printStrFirst = printStrFirst + "0";
}
printStrFirst = printStrFirst + String(firstbyte, BIN);
myserial.print(printStrFirst);
printStrFirst="";

// second byte
zeros = 8 - String(secondbyte,BIN).length();
for (int i=0; i<zeros; i++) {
printStrSecond = printStrSecond + "0";
}
printStrSecond = printStrSecond + String(secondbyte, BIN);
myserial.print(printStrSecond);
printStrSecond="";

// third byte
zeros = 8 - String(thirdbyte,BIN).length();
for (int i=0; i<zeros; i++) {
printStrThird = printStrThird + "0";
}
printStrThird = printStrThird + String(thirdbyte, BIN);
myserial.println(printStrThird);
printStrThird="";

delay(2000);
}

That projector does not expect a string of '0's and '1's. The commented out code, using SoftwareSerial::print() is closer to the correct way to send data, but it is still wrong.

You need to use SoftwareSerial::write(), and loose the ,BIN crap.

The values may be wrong. It's hard to tell, since the documentation defines the commands and data in binary, and you have them in decimal, and you have not described what you expect the projector to do.

you have not described what you expect the projector to do

I'd be more interested to hear why anyone wants to use a 35mm slide projector in the first place.....

I also tried the following one with no success:

#include <SoftwareSerial.h>

SoftwareSerial myserial(2, 3); // RX, TX

void setup()
{
myserial.begin(9600);
}

void loop()
{
// not working - should switch on standby
myserial.write(0xFB1E00);

// also not working - should slide forward
byte test[3]={'253','0','0'};
Serial.write(test, sizeof(test));
delay(2000);
}

Well, I controlled a Kodak Slide projector for my senior project in college about 30 years ago, and I didn't have any fancy RS-232 stuff. I had a special cable that let me dim the bulb with a triac dimmer and relays to advance the slides. I used a CDP1802 to control it and a cassette tape to record the commands.

Back to the problem at hand, are you sure you have the RX's and TX's going to the correct pins? Did you try reversing them? Is the Kodak DCE or DTE?

I also tried the following one with no success:

  myserial.write(0xFB1E00);

Why did you compress three myserial.print()s into ONE myserial.write()?

Try:

  myserial.write(0xFB);
  myserial.write(0x1E);
  myserial.write(0x00);
   // also not working - should slide forward
   byte test[3]={'253','0','0'};
   Serial.write(test, sizeof(test));

Well, of course not. '253' != 253 (or 0xFB for that matter).

'0' is not 0x00, or \0, either.

Try:

  myserial.write(0xFB);

myserial.write(0x1E);
  myserial.write(0x00);

Tried that in the first place and then made some ugly experiments - also no successs with the second suggestion (for sliding forward).

KeithRB: I need a more steady solution for a installation that runs a couple of months. Using the DCE. RX and TX is connected correct. Also checked cables.

Tried that in the first place

Then, you should explain how you arrived at the values 0xFB, 0x1E, and 0x00.

values 0xFB, 0x1E, and 0x00

1st Byte: FB: 11111011: 11111 - Address of the projector (global for modell 5020). 011 - Programm mode (Set/Reset Mode)
2nd Byte: 1E: 00011110: 000111 - Command: Standby on/off. 1 - Set bit to ON. 0 - given bit.
3rd Byte: 00000000: not used.

see page 18 at the projector manual posted above.

I don't think it's the commands, they work fine if I send them directly via terminal...

Are you inverting the serial data from TTL to RS232 in hardware? From the documentation the projector expects RS232-level signals.

I think you can try inverting them with Softserial, but that assumes the projector is happy with 0-5v signals rather than true RS232.

g0rg:
I don't think it's the commands, they work fine if I send them directly via terminal...

Have you proved that your MAX232 output is generating what you expect wrt levels, polarity? How did you do the testing with terminal - have you confirmed that the settings for speed, start/stop bits, parity were the same as your Arduino is generating?

g0rg:
I don't think it's the commands, they work fine if I send them directly via terminal...

How are you sending a byte like 0xFB from a terminal program?

PeterH:
Have you proved that your MAX232 output is generating what you expect wrt levels, polarity? How did you do the testing with terminal - have you confirmed that the settings for speed, start/stop bits, parity were the same as your Arduino is generating?

Yes we proved that (it's actually we). I used the exact same setting succesfully on other occasions. The only difference was, that all other devices (dvd-players, digital-projectors) usually accept normal strings.

But this nifty device is a bit akward.

As been said, we are able to send the commands via a terminal directly to the projector without any problems. I use termite with the hexview plugin for that. It's easy, just type in 0xFD0000 (for example).

And i'm just trying to mimic that. Still don't see the problem with the following for example. If i connect the output of the arduino with an windows com-port i can see the result, and i seems to be correct.

#include <SoftwareSerial.h>
SoftwareSerial myserial(2, 3); // RX, TX
byte data[] = {0xFD,0x00,0x00};

void setup() {
  myserial.begin(9600);
}

void loop() {
  myserial.write(data,sizeof(data));
  delay(3000);
}

PeterH:
Have you proved that your MAX232 output is generating what you expect wrt levels, polarity? How did you do the testing with terminal - have you confirmed that the settings for speed, start/stop bits, parity were the same as your Arduino is generating?

Ah, that struck me for a moment, but than i realized that i always checked the output of the arduino on my comport (usb-serial) on my pc.
As with the settings i'm also pretty sure, that there are no mistakes. The only thing that cannot be set is the startbit. That could be the source of the problem.

I must say that i was easily able to remote control the projector from my pc with this great peace of software without any problem.

Start bits are unlikely to be your problem - I don't think I've ever come across a protocol with more than one start bit, but multiple or even fractional stop bits are known.
Or parity.

As far as i know RS232 is somewhat a NRZ Code, so couldn't be emulated with TTL Levels?!

AWOL:
Start bits are unlikely to be your problem - I don't think I've ever come across a protocol with more than one start bit, but multiple or even fractional stop bits are known.
Or parity.

Yes, that's why i didn't really concentrated on that. Just wanted to mention it.

luciusf:

[quote author=Professor Chaos link=topic=144284.msg1083763#msg1083763 date=1358882985]
Are you inverting the serial data from TTL to RS232 in hardware? From the documentation the projector expects RS232-level signals.
I think you can try inverting them with Softserial, but that assumes the projector is happy with 0-5v signals rather than true RS232.

As far as i know RS232 is somewhat a NRZ Code, so couldn't be emulated with TTL Levels?!
[/quote]

I missed the part in the original post where you specified that you were using a MAX232; never mind!