Using a USB to RS-232 to control a Proyector

Hello!
I’m trying to make a proyector turn on and off only when the openFrameworks application I’m programming tells it to. Is this possible? I’ve been reading a bit about this and I know oF has a directory called OF_serialTest but I don’t know where to start.

First of all, Serial or RS-232, are they the same?
Also the manual that came with the proyector says it is possible and shows me code like this.
Name Op. Type CRC Header Command Response
Power ON BE, EF, 10, 05, 00, C6, FF, 11, 11, 01, 00, 01, 00 06

I will continue to research now, thanks y’all!

hi

i have done this with a benq projector.
i connected this guy http://www.sparkfun.com/products/449 to an arduino and the arduino to my computer.
the computer communicated to the arudino through the regular of_serial.
the ardunio communicated to the RS232 Shifter of the software serial lirbray on pin 2/3.

stephan.

Thanks stephanschulz!
So the OF_serialTest uses the Arduino as a Serial Port in order to control anything that works with RS-232?

How about if one would like to use just a usb to serial converter? Does oF have an addon for such functionality?
What kind of software serial library do you mean? :slight_smile:
I read that there are some crossover serial cables too. How would I know that I need them?
I’m trying out the serialExample that comes with oF but I don’t really know where to start sending the codes.

I will try using the arduino example too! =D

Thanks :stuck_out_tongue:

you can use the same of_serial commands to talk to/via a standard usb to serial adapter. i used to use the keyspan adapter. but i found that such an adapter costs just as much as an arduino.

if i remember right i try using the usb to serial adapter with the rs232 but had too many problems with drivers and such.

good luck.

i’ve also done this with a computer with an rs232 port directly using ofSerial and also with an ethernet to rs232 converter using ofxTCPSender and it works without problem

Thank you both very much!
I will try this out on the hardware when I get a access to it. =D

:stuck_out_tongue:
With another program it worked!

Now I will have to learn to integrate it with an openF application!
Many thanks! =D

Hello again!
I got to control the proyector with an external program and now I would like to learn how to integrate sending serial messages to the proyect using an existing openF project.

I starting by trying to send a string using this part of the serialExample that comes with openF v0.062 and CodeBlocks:

  
// (1) write the letter "a" to serial:  
serial.writeByte('a');  

But it didn’t work. I know I have to send a HEX string such as this to turn on the projector:
BEEF100500C6FF111101000100

…but I don’t know how. Any thought?
Thank you! =D

if it’s an hex string probably it’s just the hex representation of the chars, so you can just do:

  
serial.writeByte(0xBE);  

each char is 2 hex positions: FF = 255

It works!!! =D
Thank you so much!

I am curious about this so I have to ask… I had to write 13 lines of code for the 26 characters like this:

  
serial.writeByte(0xBE);  
serial.writeByte(0xEF);  
serial.writeByte(0x10);  

… but I read about serial.writeBytes(), tried it like the ofserial.cpp files says but it didn’t work and I have no idea how to tell it to send those pairs together. Can it be done in some way? or is the solution I already have the best one?

I’ve never really gotten into this until now so thanks! =D

you can convert the hexadecimal values to decimal and that correspond to an ascii value from 0 to 255 so for example BE is 190 which is ´ EF = ï

but that would be really weird and probably you will have problems with some characters, a better option is to put the hex values in a char array like:

  
char init_str[] = {0xBE,0xEF...};  
writeBytes(init_str,13);  

Whoa thanks!
Will try it out.=D
–Edit!

Everything worked just fine and I got every projector command working just as I wanted.
I thank you both very much for your patience. =)
Now I will try to save the world one hex at a time.:stuck_out_tongue: