0

BrightSign meets Arduino (TTL Serial Communication)



Hello Roku,

i ceceived my BrightSign HD410 and everything works fine, it starts a Projector via RS232 smoothly and plays content on the push of a button.

But now i want to control the Player via the 5V TTL serial port using a Atmel328 Microcontroller (Arduino) and cant get it working.

This ist the script on the Player:
1 serial = CreateObject("roSerialPort", 1, 9600) p = CreateObject("roMessagePort") serial.SetByteEventPort(p) serial.SetMode("8N1") gpio = CreateObject("roGpioControlPort") gpio.SetPort(p) i = CreateObject("roImagePlayer") i.DisplayFile("s0.jpg") wait_for_serial: msg = wait(0, p) if msg = &H00 then i.DisplayFile("s2.jpg") goto wait_for_serial endif if msg = &H01 then i.DisplayFile("s3.jpg") goto wait_for_serial endif if msg = &H02 then i.DisplayFile("s4.jpg") goto wait_for_serial endif if msg = &H03 then i.DisplayFile("s5.jpg") goto wait_for_serial endif i.DisplayFile("s1.jpg") goto wait_for_serial [/code] And this is the Code running on the Arduino Microcontroller: 1 void setup() { Serial.begin(9600); } void loop() { Serial.print(0x02, BYTE); delay(3000); } [/code]

The SetByteEventPort Event is thrown, but the content of the Byte is confused. They don't fit together. The SetLineEventPort does not work at all. Maybe the bytes that are sent are misinterpreted.

In this article they talked about the signals to be »inverted«
http://forums.roku.com/viewtopic.php?t=23094&highlight=both+serial+ports

In which way do they have to be inverted? What do the Stop-, Start and Databits actually look like, are they HIGH or LOW? Or do i have to use a special Baudrate?

It would be a great feature to get the Atmel working with the BrightSign player but at the moment you got me at a loss.

7 comments

  • 0
    Avatar
    RokuLyndon


    The brigtsign converts your hex bytes when received their ascii values.



    So, if the hex value you are sending is equivalent to 2, the you should check for this:



    if msg =chr(2) then





    ....
  • 0
    Avatar
    Martin Spengler


    Hello RokuLyndon and thank you for that fast reply!



    But the new code makes the »Err« LED blink red:


    serial = CreateObject("roSerialPort", 1, 4800)
    p = CreateObject("roMessagePort")
    serial.SetByteEventPort(p)

    i = CreateObject("roImagePlayer")
    i.DisplayFile("s0.jpg")

    wait_for_serial:
    msg = wait(0, p)
    if msg =chr(2) then
    i.DisplayFile("s2.jpg")
    goto wait_for_serial
    endif
    if msg =chr(1) then
    i.DisplayFile("s3.jpg")
    goto wait_for_serial
    endif
    i.DisplayFile("s1.jpg")
    goto wait_for_serial

  • 0
    Avatar
    Martin Spengler


    The signals have to be inverted. There is a library for Arduino which can do this.

    <!-- m --><a class="postlink" href="http://arduiniana.org/libraries/newsoftserial/">http://arduiniana.org/libraries/newsoftserial/</a><!-- m -->
    A Code snippet for Arduino
    #include <NewSoftSerial.h>
    NewSoftSerial mySerial(6, 7, true); // Inverted TTL
    mySerial.begin(4800);
    mySerial.println(analogRead(0));


    Bright Sign snippet:
    serialArdiuno = CreateObject("roSerialPort", 1, 4800)
    serialArdiuno.SetLineEventPort(p)
    msg = wait(0, p)

  • 0
    Avatar
    belle12


    I also want to drive a LCD via the serial port but have no levitra idea where the serial port hookup is at! Anybody can figure anything out?
  • 0
    Avatar
    RokuLyndon


    The rs232 port is on the front, next to the power and other leds. If you don't see it, then you don't have a unit with a serial port.
  • 0
    Avatar
    RotoJeremy

    Would this be easier now by using the "live text" feature on the new version of BrightAuthor? If so, how would I go about doing so?

  • 0
    Avatar
    Lyndon

    THe latest 2.2 beta lets you set variables using serial or udp commands, and you can display variables in a live text field. 

Please sign in to leave a comment.