Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

smartsockets

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 353
  • Category: Other
  • Founded: May 10, 2006
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Using IV-17 smartsocket with usb>ttl adapter   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages Sort by Date  
#962 From: "julietmikebravo" <johanboonstra@...>
Date: Thu Dec 13, 2012 7:06 pm
Subject: Using IV-17 smartsocket with usb>ttl adapter
julietmikebravo
Send Email Send Email
 
Hi,

I got a IV-17 smartsocket kit from the listowner and successfully built it. I
was under the impression that you can easily send commands and data to it using
any serial port.
Unfortunately (for me) , the smartsockets require ASCII, binary and decimal
information to work properly.

I want to use the IV-17 tubes to display information from my Linux server.
Currently only the V and CDT commands work, I can't figure out how to send
binary and/or decimal code to the smartsocket.

Anyone here know how to send proper commands from a Linux server to the
smartsocket?




#963 From: "fixitsan2" <fixitsan@...>
Date: Sat Dec 15, 2012 9:20 am
Subject: Re: Using IV-17 smartsocket with usb>ttl adapter
fixitsan2
Send Email Send Email
 


--- In smartsockets@yahoogroups.com, "julietmikebravo" <johanboonstra@...>
wrote:
>
> Hi,
>
> Unfortunately (for me) , the smartsockets require ASCII, binary and decimal
information to work properly.>
> Anyone here know how to send proper commands from a Linux server to the
smartsocket?
>


Hi

I think the terms ascii, decimal and binary, in this context might be a source
of confusion.

You can send all the values correctly through the use of hex.

As you've found, a simple header can be sent easily in ascii (CDT, etc) using
just the keys of the keyboard. That's because the keyboard keys are all assigned
a number in the (usually basic) range of 0-255. There are not 255 keys on a
keyboard so some values are missing. You probably know this.

So if you want to send the number 17 as an 8-bit value (range = 0 to 255) and
you want to send it using only the keys on the keybopard, what do you do ?

You can see from the ascii table of values
http://en.wikipedia.org/wiki/Ascii_table
....that 17 is character 'DC1', and you don't have a key on the keyboard to
easily represent that value. Unlike '0', ascii character 48, hex value 30 (0x30
or 30h or even #30 sometimes) yoiu can just press the zero key to send hex 30
(decimal 48)

However, 17 is also hex 11, or 11h , or if you like 0x11 and any computer can
transmit that value if yoiu direct it to send the value as hex.

I found this snippet of JAVA code by someone who is sending hex values ot a com
port http://stackoverflow.com/questions/8777042/java-hexadecimal

If you only have a single 4 tube IV-17 smartsocket, then it is easy to remember
that when you want to address a particular tube, using it's decimal position, EG
the third tube from the left, number 3 tube, then in your sending string insert
0x03 for the number 3

I hope some of this makes sense. I think through the use of lookup tables, or by
storing instructions in various data constructs and arrays you only need to call
them up to have the correct order and type of data to send for each instruction.

If you can send data quickly enough then yoiu can probably get away with sending
data in chunks. There is a timeout timer in the Smartsocket which detects when
the incoming data stream has ended and as long as yoiu send another byte of data
before that timer expires you will reset the timer.

So for example, to put a message "HI" on the second and third tubes, you can do
the following

(in pseudo code)

CALL 'Send header for static message, MS'

CALL 'Send position of the tube to put the message at' in hex, 0x02

CALL 'Send the message' - "HI" in ascii; 0x48, 0x49 in hex; 72,73 in dec


As long as the delay between each call is smaller than the time it takes to
transmit one byte of data by the com port, and you have the next byte in the
send buffer ready to go, the Smartsocket will see these three individual sends
as one continuous datastream and process it as if you had sent "MS"<2>"HI"


I think C allows yoiu to send mixed radix messages very easily, but I tend to
stick with ideas and concepts based on sending a long message as smaller parts,
sometimes for no other reason than it makes for shorter code. Instead of using
HSEROUT ["MS"] at the start of every message, I place the command
'HSEROUT["MS"]' in a subroutine and use CALL Send_MS to send the start of a
direct display message. Then I might send the tube number in decimal, then I
send the message body usually in ascii. Sent quickly enough the Smartsocket,
which just reads data byte by byte, assumes it was all sent as a continuous
message.

Of course, all of this assumes that you have variable data, such as different
words which you need to display, perhaps captured from an RSS message reader.

However if you know exactly what the message is going to be and you're going to
repeat the display sequence over and over, then you can simply write the
complete message into a single data construct. In that case "MS"<2>"HI" could
be stored, if you like in hex, as

0x4D, 0x53, 0x02, 0x48, 0x49

If yoiu move those chars to the serial port the smartsocket will see the
appropriate message.

Chris










#964 From: "julietmikebravo" <johanboonstra@...>
Date: Sat Dec 15, 2012 10:38 am
Subject: Re: Using IV-17 smartsocket with usb>ttl adapter
julietmikebravo
Send Email Send Email
 

Thanks for the support.

I more or less understand the way the SS is controlled now, but I think the
problem is with my computer.

I use the Linux command "echo" to send the data to a USB serial port. That goes
like this:

echo -ne "V" > /dev/ttyUSB1

This works, version number pops up. If I want I can clear the screen with the MC
command.

However, when sending more complex stuff it fails. With echo you can send ASCII,
hex, octal, whatever. Hex is send by defining the byte with the \ escape
character and the hex number, like:

echo -ne "\x4D\x53\x02\x48\x49" > /dev/ttyUSB1

This should send MD<2>HI. Still, no response.

I think I am going to hook up my Arduino to it and try to send commands from
there, I can't trust Linux, echo and a CP2102 USB-TTL adapter to do this
properly it seems.




#965 From: "fixitsan2" <fixitsan@...>
Date: Sat Dec 15, 2012 6:55 pm
Subject: Re: Using IV-17 smartsocket with usb>ttl adapter
fixitsan2
Send Email Send Email
 


--- In smartsockets@yahoogroups.com, "julietmikebravo" <johanboonstra@...>
wrote:
>
>
> Thanks for the support.
>
> I more or less understand the way the SS is controlled now, but I think the
problem is with my computer.
>
> I use the Linux command "echo" to send the data to a USB serial port. That
goes like this:
>
> echo -ne "V" > /dev/ttyUSB1
>
> This works, version number pops up. If I want I can clear the screen with the
MC command.
>
> However, when sending more complex stuff it fails. With echo you can send
ASCII, hex, octal, whatever. Hex is send by defining the byte with the \ escape
character and the hex number, like:
>
> echo -ne "\x4D\x53\x02\x48\x49" > /dev/ttyUSB1
>
> This should send MD<2>HI. Still, no response.
>
> I think I am going to hook up my Arduino to it and try to send commands from
there, I can't trust Linux, echo and a CP2102 USB-TTL adapter to do this
properly it seems.
>


Is this any good ?
http://stackoverflow.com/questions/602912/how-do-you-echo-a-4-digit-unicode-char\
acter-in-bash


It looks like you're doing it correctlye (no doubt :) )....but there is mention
of setting the language of your shell correctly.

I've never had to get so involved with Linux unfortunately




#966 From: "julietmikebravo" <johanboonstra@...>
Date: Sun Dec 16, 2012 8:08 pm
Subject: Re: Using IV-17 smartsocket with usb>ttl adapter
julietmikebravo
Send Email Send Email
 


--- In smartsockets@yahoogroups.com, "fixitsan2" <fixitsan@...> wrote:
>
>
>
> >
> > I think I am going to hook up my Arduino to it and try to send commands from
there, I can't trust Linux, echo and a CP2102 USB-TTL adapter to do this
properly it seems.
>
> I've never had to get so involved with Linux unfortunately
>

Got the MD and MC commands working, using an Arduino to send the commands like
this:

Serial.write("MS"); //send command in ASCII
Serial.write(100); //send parameters in direct binary values
Serial.write(4); //
Serial.write(1); //
Serial.write("IV-17 Smartsocket driven by Arduino, test OK "); //send ASCII
to display
delay(20000); // wait for 20 sec before re-running commands

This results in the message scrolling nicely across the tubes :)

Still, I think an Arduino between the PC and the SS is unneccesary, a proper
serial port should be able to drive the SS directly. Going to spend some more
time figuring out why the serial adapter/PC is not sending the right data...





#967 From: John Rehwinkel <jrehwin@...>
Date: Sun Dec 16, 2012 9:34 pm
Subject: Re: Re: Using IV-17 smartsocket with usb>ttl adapter
jrehwin
Send Email Send Email
 
> I think I am going to hook up my Arduino to it and try to send commands from
there, I can't trust Linux, echo and a CP2102 USB-TTL adapter to do this
properly it seems.

Linux and the CP2102 aren't your problem. Echo is your problem. It's designed
to send human-readable ASCII text to terminals from shell scripts. While it can
be coerced into sending (some) arbitrary bytes, it's not happy or coöperative
about it. Normally, if I want to send arbitrary bytes, I'll just assemble them
in a file and
send them out the serial port with the "cat" command. Alternatively, some
systems have a "convert" sort of command that will take pairs of hex digits and
send
the corresponding bytes. And, since you're willing to program an Arduino, you
can similarly write a program for Linux to send whatever you want. If you want
to get more fancy than sending canned text, that's really the way to go. The
choice of language is up to you, the Arduino IDE supports a variant of C++. So
you
could use C or C++ without having to learn a lot of new things.

If you like, I can write a C program equivalent to the Arduino one you posted to
get you started.

- Cheers,
John




#968 From: "julietmikebravo" <johanboonstra@...>
Date: Thu Dec 20, 2012 8:48 pm
Subject: Re: Using IV-17 smartsocket with usb>ttl adapter
julietmikebravo
Send Email Send Email
 


--to go. The choice of language is up to you, the Arduino IDE supports a
variant of C++. So you
> could use C or C++ without having to learn a lot of new things.
>
> If you like, I can write a C program equivalent to the Arduino one you posted
to get you started.
>
> - Cheers,
> John
>

If you can do that that would be very nice. Of course, I am looking into some C
programming in Linux also at the moment.

Regards,

Johan




#969 From: John Rehwinkel <jrehwin@...>
Date: Fri Dec 21, 2012 1:42 am
Subject: Re: Re: Using IV-17 smartsocket with usb>ttl adapter
jrehwin
Send Email Send Email
 
> --to go.  The choice of language is up to you, the Arduino IDE supports a
variant of C++. So you
>> could use C or C++ without having to learn a lot of new things.
>>
>> If you like, I can write a C program equivalent to the Arduino one you posted
to get you started.
>>
> If you can do that that would be very nice. Of course, I am looking into some
C programming in Linux also at the moment.

Happy to, I uploaded it to my server for you:

http://www.vitriol.com/ftp/smartsocket.c

I don't remember offhand how many bits per second the smartsockets want - the
program is written
to use 9600bps, 8 bits, no parity. There's a #define near the top that sets the
port speed, change it
as needed.

A couple of lines below it, a string is set to the name of the serial port
device - you'll likely have to change
this to whatever it is on your system. Many Unix systems offer two versions of
serial ports, some have names
like tty.s0, and others have names like cu.s0. The difference is the kind of
flow control required to operate. If
your system offers both kinds, try them both. Note that you can specify which
port to use at run time (see below).

Compile it with a command like this:

gcc smartsocket.c -o smartsocket

To run it, type:

./smartsocket

and it should attempt to connect to the port, configure it, and start sending
commands. To use a different
port than the one compiled in, add the port name to the command line:

./smartsocket /dev/tty.USA19Hfd1221P1.1

Like the Arduino original, it loops forever until interrupted.

Let me know if you have any questions!

Cheers,
John








#970 From: "julietmikebravo" <johanboonstra@...>
Date: Tue Jan 1, 2013 6:21 pm
Subject: Re: Using IV-17 smartsocket with usb>ttl adapter
julietmikebravo
Send Email Send Email
 


--- In smartsockets@yahoogroups.com, John Rehwinkel <jrehwin@...> wrote:
>
> > --to go. The choice of language is up to you, the Arduino IDE supports a
variant of C++. So you
> >> could use C or C++ without having to learn a lot of new things.
> >>
> >> If you like, I can write a C program equivalent to the Arduino one you
posted to get you started.
> >>
> > If you can do that that would be very nice. Of course, I am looking into
some C programming in Linux also at the moment.
>
> Happy to, I uploaded it to my server for you:
>
> http://www.vitriol.com/ftp/smartsocket.c

Compiled it, but no reaction of the Smartsocket, even when sending the V,
CSTxxxxxx or CDT1 command.

Until now, the only way I have been able to scroll messages was by connecting it
to an Arduino and relaying stuff. I think I will purchase one of those miniature
Arduino PCB's and write some kind of abstraction layer. Shouldn't be much code
as I don't use all the commands.

It seems that computers in general have a hard time sending mixed ASCII/binary
stuff, microprocessors seem to do this better.





#971 From: "fixitsan2" <fixitsan@...>
Date: Mon Jan 7, 2013 12:13 pm
Subject: Re: Using IV-17 smartsocket with usb>ttl adapter
fixitsan2
Send Email Send Email
 


--- In smartsockets@yahoogroups.com, "julietmikebravo" wrote:

> Compiled it, but no reaction of the Smartsocket, even when sending the V,
CSTxxxxxx or CDT1 command.

Strange that it won't send even a single 'V'. I was going to suggest there was a
timing issue. Is the port looking for some handshaking ? RTC/CTS etc ? Set
handshaking to 'none' maybe ?




 
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help