Serial Current Loop

wjfisherjr, if, when connected to the computer, the scoreboard receive data LED flashes when the computer sends data, and then when you then connect the scoreboard to the Arduino and send data, the same LED does not flash, then that to me suggests one of two things.
First, the wiring from Arduino to scoreboard is not correct or secondly, the software in terms of sending to the serial port is not correct.

Can you detail how you have the wiring from the Arduino to the scoreboard via the various converters you are using. Please detail this accurately.

Can you post your Arduino code here, making sure you use the code tags, the icon looks like </>

What I am asking is if the terminal program works I need to duplicate that signal on the arduino and it should work. The program I am using is Termite. I would guess it is ASCII but I am not sure.

What is Termite one might ask. It is a terminal program. What is that used for ? Well traditionally it is used to allow a human to type characters on the keyboard to be sent through to another device to be displayed, typically another computer at a different location, also with a keyboard for bi-directional exchange of keyboard characters. Termite like programs can do many other things as well. So these keyboard characters, how do they get encoded for transmission ? Traditionally ASCII has been common. There are other encoding systems as well.

Keep in mind the actual data being transferred is just a bunch of ones and zeros, which can be written on paper as ones and zeros or as hexadecimal or if the ones and zeros amount to an eight bit word, as an ASCII character, they all represent the same thing for a given data that sits between the start and stop bits in an asynchronous serial transmission.

The other thing to watch with ASCII is how the extended characters are being displayed on the system you have as opposed to how I might have. The characters up to character 127 are standard defined ASCII, with the upper 128 characters dependent on the the system, such as operating system.

So, when you print out those characters that you say make the scoreboard display meaningful information, then you need to know, not what ASCII character that is, but more what ASCII code that is, say in decimal or hexadecimal. To clarify, what position in the ASCII table that character is, for the reasons I mentioned above.

You are not sounding dumb, just that clarity and detail can be important to gain understanding.
You will get it working, I know, but we can help better if you answer all questions and provide clear detail, such as code and your hardware setup.


Paul - VK7KPA

The connection from the arduino uno to the scoreboard is as follows:

I am using the following adapter to connect to the Arduino pin 1 & 2 for TX and RX to output RS232 Click Here for Info. Then that connect to a gender changer and then to a B&B Electronics RS232 to Current Loop Converter this then connects to the scoreboard driver boards. Below is the code I am using to test different outputs.

//Hockey Version 3.03
int start = 2;
int score1 = 3;
int reset = 4;
int ledRun = 12;

void setup() 
{
Serial.begin(2400);
pinMode(ledRun, OUTPUT); //Game Running
pinMode(start, INPUT); //Start Game
pinMode(score1, INPUT); //Score +1
pinMode(reset, INPUT); //Reset Game
digitalWrite(ledRun, HIGH); //Turn on LED
}

void loop() 
{

if (digitalRead(score1) == LOW) //When target is hit tell scoreboard
{
  Serial.println("df00e000e400e810ee70f170f500f806fe7f817f850088008e409000946d98669e00a000a400a800ae00b000b43fb83fbe70c170c53fc83fce45d000d406d800");

}

if (digitalRead(start) == LOW) //When start is hit tell scoreboard to start timing
{ 
  Serial.println("àäÐ Ô");
}

  if (digitalRead(reset) == LOW) //Reset score and timer
{ 
  Serial.write("");
}
}

That is it.

Thanks

wjfisherjr, why Arduino pin 1 and Arduino pin 2, when the UART is on Arduino pins 0 and 1 ?
Also, read the customer reviews on that TTL to RS-232 converter, as many of them find the Tx and Rx pins are labeled incorrectly. Review number 2 clearly explains the details.

Also, you do not detail how you are supplying power to the TTL to RS-232 and also to the Rs-232 to 20mA converters ?

The last thing is that you need to check and confirm the actual RS-232 data transmit line is connected to pin 3 on the RS-232 to 20mA converter. and conversely, that the RS-232 data receive line is connected to pin 2 of the RS-232 to 20mA converter.

The product info for the current converter is good as it has a schematic, but I have little faith in how the DB9 pin out of the TTL to RS-232 converter.

Normally you will need to cross over the transmit and receive lines so that both devices can talk to each other.

Get that sorted and then you can move on to the code, which I think will need some work.


Paul - VK7KPA

Sorry I meant pins 0 and 1 on the arduino. I am powering the ttl to rs232 converter with the 3.3v and ground from arduino, I also tried it with the 5v output. I have swap the RX and Tx on this converter and still did not work and the Rs232 to current loop converter is powered by an external 12vdc power supply.

I will check the pins on the ttl converter on monday when I am back at work.

Thanks for your help

I checked the TTL to RS232 converter and found Pin 3 on the serial connector goes to pin13 on the MAX3232 which is RIN1 and pin 2 of the serial connector does not ring to anything which is wierd.

I ordered a new converter and here is info click here. When that come in I will try it and see what happens.

Thanks

So new unit works and I am now able to control the scoreboard with the Arduino. I know need some help with my code if possible.

Here is my code:

//Hockey Version 3.03
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // TX, RX

int timer; //scoreboard timer value
int points; //scoreboard points value
int start = 2; //start button input pin
int score1 = 3; //score +1 input pin
int reset = 4; // reset button input pin
int ledRun = 12; //Led showing program is running
int enable = 3; //enable set after start button pressed
int reset2 = 0; //reset after reset is pressed
byte messageTimer[] = {0x00, 0xD4};//Timer output to scoreboard
byte messagePoints[] = {0x00, 0xe0};//Points output to scoreboard

void setup() 
{
  mySerial.begin(2400);
  pinMode(ledRun, OUTPUT); //Game Running
  pinMode(start, INPUT); //Start Game
  pinMode(score1, INPUT); //Score +1
  pinMode(reset, INPUT); //Reset Game
  digitalWrite(ledRun, HIGH);
  delay(500);
  digitalWrite(ledRun, LOW);

    // initialize timer1 
  noInterrupts();           // disable all interrupts
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1  = 0;

  OCR1A = 31250;            // compare match register 16MHz/256/2Hz
  TCCR1B |= (1 << WGM12);   // CTC mode
  TCCR1B |= (1 << CS12);    // 256 prescaler 
  TIMSK1 |= (1 << OCIE1A);  // enable timer compare interrupt
  interrupts();             // enable all interrupts
  
}

ISR(TIMER1_COMPA_vect)          // timer compare interrupt service routine
{
      if (enable == 0  && timer != 0 && points != 4)
      {
         --timer; //timer -1
         messageTimer[0] = timer; //make timer array first digit = timer
         mySerial.write(messageTimer, sizeof(messageTimer)); //send timer info to scoreboard
      }
}

void loop() 
{
  
  if (digitalRead(reset) == LOW)
  {
    digitalWrite(ledRun, LOW); //turn off led
    points = 0x00; //points = 0
    timer = 0x20; //timer = 20
    messageTimer[0] = timer; //make timer array first digit = timer
    messagePoints[0] = points; //make points array first digit = points
    mySerial.write(messageTimer, sizeof(messageTimer)); //send timer info to scoreboard
    mySerial.write(messagePoints, sizeof(messagePoints)); //send points info to scoreboard
    enable = 1; //enable start
    reset2 = 1; //reset set to 1
    delay(1000);
  }
  
  if (digitalRead(start) == LOW && reset2 == 1) //start button pressed 
  { 
    digitalWrite(ledRun, HIGH); //turn on led
      
    while(reset2 == 1)
    {
      enable = 0;
      
      if (digitalRead(score1) == LOW)
      {
        ++points; //add 1 to points
        messagePoints[0] = points; //make points array first digit = points
        mySerial.write(messagePoints, sizeof(messagePoints)); //send points info to scoreboard
        delay(250);
      }
      
      if (points >= 5 || timer <= 0)
      {
        reset2 = 0;
      }
    }
  }
  
}

I am trying to use a timer interrupt to control the timer but the value is dec and I need it to be hex for the scoreboard to work and I think this is my problem. The timer should just countdown from 20 to 0.

Here is a video of what is happening:

I just wanted to say thanks to everyone for the help. My system is up and running.

Do you have any final details about your success? Hardware? Software? Schematics? Cool tricks? Thanks!