Go Down

Topic: Serial Current Loop  (Read 5754 times) previous topic - next topic

wjfisherjr

I am working on a project which uses an Arduino Uno to communicate with a scoreboard. The scoreboard protocol is a current loop so I am using a TTL to RS-232 converter which I can connect to a PC and see the Arduino's output. From the RS-232 converter through a RS-232 to Current Loop converter. The scoreboard needs to see a Hexadecimal output from the Arduino telling the scoreboard to display how many points and timer control. So I have a program that output this but scoreboard is not updating. My question is has anyone done this type of project with any success? Does anyone have any suggestion? Is there an Arduino board to convert TTL to Current Loop? Any help would be great. Thanks.

pylon

You might use a MIDI shield as MIDI also uses serial communication with current loop. At which current level does your scoreboard operate?

wjfisherjr

I dont know what current the scoreboard runs at, I can only assume its 20ma.

Paul_KD7HB

You can surely break the existing current loop and insert a milliamp meter. the marking current should be 20 ma. A remote possibility would be 60 ma, like a really old telletype machine.

Do you know the baud rate of the display and is the Arduino the same? Which device is supplying the current for the current loop? One device or the other must be the supplier.

Paul

wjfisherjr

I know the baud rate is 2400 8,n,1. I ordered a midi shield and will try that and see.

wjfisherjr

Ok, have a midi shield from linksprite. Any help on where to begin. I have the following sample code and I am trying to covert back to rs-232 using a current loop to rs-232 converter to see results on PC.

/*
 MIDI note player

 This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data.
 If this circuit is connected to a MIDI synth, it will play
 the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.


 The circuit:
 * digital in 1 connected to MIDI jack pin 5
 * MIDI jack pin 2 connected to ground
 * MIDI jack pin 4 connected to +5V through 220-ohm resistor
 Attach a MIDI cable to the jack, then to a MIDI synth, and play music.

 created 13 Jun 2006
 modified 13 Aug 2012
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/Midi

 */

void setup() {
  //  Set MIDI baud rate:
  Serial.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (int note = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);
    delay(100);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

wjfisherjr

Any one able to help with this project?

wjfisherjr

Ok, not having any luck with the Midi Shield. I basically want to be able to transmit the following on a 20ma current loop, if anyone has any experience or can add any helpful points would be great.

df 00 e0 00 e4 00 e8 10 ee 70 f1 70 f5 00 f8 06  ß.à.ä.è.îpñpõ.ø.
fe 7f 81 7f 85 00 88 00 8e 40 90 00 94 6d 98 66  þ….ˆ.Ž@."m˜f
9e 00 a0 00 a4 00 a8 00 ae 00 b0 00 b4 3f b8 3f  ž. .¤.¨.®.°.´?¸?
be 70 c1 70 c5 3f c8 3f ce 45 d0 00 d4 06 d8 00  ¾pÁpÅ?È?ÎEÐ.Ô.Ø.
Above is with the following on controller:
Time: 45:00 score Home: 00 Score Visitor: 00 Period: 1

d8 40 de 00 e0 00 e4 00 e8 10 ee 70 f1 70 f5 00  Ø@Þ.à.ä.è.îpñpõ.
f8 06 fe 7f 81 7f 85 00 88 00 8e 40 90 0f 94 3f  ø.þ….ˆ.Ž@."?
98 5b 9e 00 a0 00 a4 00 a8 00 ae 00 b0 00 b4 3f  ˜[ž. .¤.¨.®.°.´?
b8 3f be 70 c1 70 c5 3f c8 3f ce 20 d0 0f d4 06  ¸?¾pÁpÅ?È?Î Ð.Ô.
Above is with the following on the controller:
Time: 00:20 Score Home: 00 Score Visitor: 00 Period: 1

ce 20 d0 0f d4 06 d8 40 de 01 e0 00 e4 00 e8 10  Î Ð.Ô.Ø@Þ.à.ä.è.
ee 70 f1 70 f5 00 f8 06 fe 7f 81 7f 85 00 88 00  îpñpõ.ø.þ….ˆ.
8e 40 90 0f 94 3f 98 5b 9e 00 a0 00 a4 00 a8 00  Ž@."?˜[ž. .¤.¨.
ae 00 b0 00 b4 3f b8 3f be 70 c1 70 c5 3f c8 3f  ®.°.´?¸?¾pÁpÅ?È?
Above is with the following on the controller:
Time: 00:20 Score Home: 01 Score Visitor: 00 Period: 1

Paul_KD7HB

You have not answered the question about which device is powering the 20ma current loop! I am assuming the display powers the current loop. A normal 20ma current loop uses an on/off sequence for data. On is marking or zero bit. Off is a space or a 1 bit. This can easily be done with an opto-coupler that will handle 20ma. This would isolate the Arduino from the line. TTL would drive the LED in the opto-coupler.

Paul

wjfisherjr

Yes the display is powering the current loop. I am using an adapter for the Arduino to get to RS-232 the using an adapter to convert RS-232 to current loop, but this still does not work. Then someone suggest MIDI so I now have a MIDI Shield but can not get either to work. I would prefer to use the RS-232 to current loop adapter. I am just having a problem getting the output right and have no way to test if it is even working. I did try to go through the RS-232 to current loop adapter back through another current loop adapter back to RS-232 to a PC but not getting and output. Thanks for your help.

Paul_KD7HB

Change the baud rate to the lowest you can go. Use a VOM, or if nothing else a DVM, to see if there is a fluctuation in the RS-232 output. Try pin 3 and then pin 2 to pin 7. You should be able to see movement!

Paul

wjfisherjr

I am still working on this project with no luck. I did decide to connect controller to pc through current loop converter and see what the RAW data is and this is what I found.

[06]Ø@Þ[00]à[00]ä[00]è[10]îpñpõ[00]ø[06]þ…[00]ˆ[00]Ž@[0F]"?˜[ž[00] [00]¤[00]¨[00]®[00]°[00]´?¸?¾pÁpÅ?È?Î Ð[0F]Ô
[06]Ø@Þ[00]à[00]ä[00]è[10]îpñpõ[00]ø[06]þ…[00]ˆ[00]Ž@[0F]"?˜[ž[00] [00]¤[00]¨[00]®[00]°[00]´?¸?¾pÁpÅ?È?Î Ð[0F]Ô
[06]Ø@Þ[00]à[00]ä[00]è[10]îpñpõ[00]ø[06]þ…[00]ˆ[00]Ž@[0F]"?˜[ž[00] [00]¤[00]¨[00]®[00]°[00]´?¸?¾pÁpÅ?È?Î Ð[0F]Ô
[06]Ø@Þ[00]à[00]ä[00]è[10]îpñpõ[00]ø[06]þ…[00]ˆ[00]Ž@[0F]"?˜[ž[00] [00]¤[00]¨[00]®[00]°[00]´?¸?¾pÁpÅ?È?Î Ð[0F]Ô
[06]Ø@Þ[00]à[00]ä[00]è[10]îpñpõ[00]ø[06]þ…[00]ˆ[00]Ž@[0F]"?˜[ž[00] [00]¤[00]¨[00]®[00]°[00]´?¸?¾pÁpÅ?È?Î Ð[0F]Ô
[06]Ø@Þ[00]à[00]ä[00]è[10]îpñpõ[00]ø[06]þ…[00]ˆ[00]Ž@[0F]"?˜[ž[00] [00]¤[00]¨[00]®[00]°[00]´?¸?¾pÁpÅ?È?Î Ð[0F]Ô

From what I see is ASCII and decimal mixed together. Because I can connect controller output to PC I should be able to get Arduino output connected to scoreboard, I just don't think the data being sent from Arduino is correct. The Arduino is sending all HEX data.

If anyone can make any sense out of this it would be greatly appreciated. Thank You.

PaulS

Quote
The Arduino is sending all HEX data.
No. The Arduino is sending binary data. The value may be one that has a recognizable character associated with it, when you look at the value in an ASCII table, or it may not.
The art of getting good answers lies in asking good questions.

wjfisherjr

Ok, does anyone have any clue where i should even start with what the Arduino should be outputing to communicate with my scoreboard.

rockwallaby

#14
Feb 16, 2017, 12:26 pm Last Edit: Feb 16, 2017, 12:28 pm by rockwallaby
wjfisherjr, it appears you are not really reading what people are suggesting to you, as you seem to ignore what is being said.

Take for example, the last post of PaulS, where he suggests to you that the Arduino is sending data as binary, not as hexadecimal.

Did you go and look at the ASCII table yet, no, well here is a link for you, ASCII Table ?

I don't know the details of your device and you really haven't provided much to go on.

For example, if you wish to send a number 35 out the serial port for your scoreboard, you will likely need to do the following.
First, realise that the number 35 is made up of two characters, a 3 and a 5.
The number 3 in the ASCII table is 51 decimal, and the number 5 is, you guess it, 53 decimal.
So, if you send using serial.write the value 51 followed by another serial.write with value 53, you may be getting closer.

If in fact you need to send hex, then send the hex codes instead of decimal.

Many years ago, these sort of projects were common place, to work with different serial interfaces.

As Paul_KD7HB suggested to you, you do not need the RS-232 interface together with the RS-232 to current loop converter.
You simply need an opto-coupler set up correctly.
Why not do an online search for digital 20mA current loop circuit ?
It must be your lucky day, here, I did it for you, and this link will tell you much to learn about digital current loops.
As you will notice, there are even simple schematics based on opto-couplers, just as Paul_KD7HB suggested.

Forget the MIDI interface, it may not provide enough current, maybe as low as 5mA, which will not be enough for the scoreboard I think.
_____________
Paul - VK7KPA
Paul - VK7KPA

Go Up