Is it possible to use arduino to control Cisco C40 Codec?

Hi Guys,

I work installing a lot of Cisco codecs and was trying to make my job a little easier by automating a setup process using Arduino. I was thinking of creating a program that sends some simple setup commands to the codec from an Arduino(with LCD for some visual feedback).

Is it possible to control a Cisco C40 Codec using an Arduino?

The Cisco C40 has a R-232 control port in the rear (illustrated in link above). Is it possible to connect it to an Arduino and send commands?

---------------------
ARDUINO		CODEC
---------------------
TX		TX
RX		RX
GND		GND
---------------------

I found this API Documentation but all those commands look like the SSH commands I’ve used to send commands to the codec from my PC via PuTTy.

Example Commands Listed in API

xConfiguration Audio Output Line 1 Equalizer Mode: Off
xConfiguration Audio Output HDMI 1 mode: On
xstatus call protocol

If I were to connect the Aruidno and Codec via R-232/DB9 and set proper buad rate, data bits, stop bits, etc… how would I then send those commands listed in the API documentation? How could I read/receive any feedback from the codec?

There are 167 pages in that PDF. What pages should I look at ?

If the Cisco device uses standard 12v RS232 signal levels you will need to convert them to TTL levels for the Arduino. The Max232 chip is commonly used for that.

If you can control the Cisco device from a terminal program such as puTTY then you should probably be able to do it from an Arduino. However if it requires SSH I don't know how you would do that, or whether it is possible.

...R

Robin2:
There are 167 pages in that PDF. What pages should I look at ?

If the Cisco device uses standard 12v RS232 signal levels you will need to convert them to TTL levels for the Arduino. The Max232 chip is commonly used for that.

If you can control the Cisco device from a terminal program such as puTTY then you should probably be able to do it from an Arduino. However if it requires SSH I don’t know how you would do that, or whether it is possible.

…R

Woops, sorry about that, I was hoping that the info on page 9 would help. I don’t quite know what I’m looking for either to be honest. I haven’t ever tried to do anything like this before and am not too knowledgable on this subject.

The heart of the API is the API-Engine. This is where all information is stored and processed. The API-engine can be accessed by an easy- to-use Command Line Interface called XACLI using RS-232, Telnet or SSH, or by the XML API Service (TXAS) over HTTP/HTTPS.

The api documentation is mainly talking about the commands that can be used in their “Command Line Interface (XACLI)” which I have used before using my PC/SSH on PuTTy.

Aside from SSH, it also says that you can use Telnet and RS-232 to use the Command Line Interface (XACLI). And I assume this XACLI is the only way to talk to the codec, I couldn’t find any other doc on the subject.

And I guess the best way to communicate from Arduino to Codec is RS-232? I’ve never used Telnet but according to wiki it’s not recommended to be used anymore. Created in 1968, plenty of security reasons not to use it, and was pretty much replaced by SSH in 1995.

I have used RS-232 few times on my computer(usb->rs232) to configure some stuff on other machines, and know how to terminate a cable.But didn’t know too much about it other than that. Wiki says its what was used in old personal computers for cumminicating with modems, printers, mice, data storage, uninterruptible power supplies, and other peripheral devices, but was replaced by the USB and others. It says its still used with industrial machines, networking equipment and scientific instruments.

So I figured that RS-232 would be the best way to communicate here. My original thought was that I could just hook up the Tx, Rx, and GND

on the arduino to the Tx, Rx, GND on the codec using a RS-232. And you are saying that it will work but I need to use MAX232 chip(thanks for that info btw, lead to some good research questions) which converts the Tx, Rx, CTS, and RTS signals? Lowers voltage from 12v RS232 to 5v TTL

So something like this below is what i need to buy and attach to an arduino?

5PCS Mini RS232 To TTL MAX3232 Converter Adaptor Module Serial Port Board
RS232 To TTL Converter/Adapter Board Module MAX232 Transfer Chip with Cable

I would like to keep the project compact and use something more like the first link, unless anyone has reason not to?

The next question I have is, how would I send/receive data to/from the codec?

Would it be something like this?

#include <SoftwareSerial.h>

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

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop() {
  //write
  Codec.println("xConfiguration Audio Output Line 1 Equalizer Mode: Off");
  
  //read
  if ( Codec.available() ) {
    int inByte = Codec.read();
    Serial.write(inByte);
  }
}

Do I need to convert the string to HEX or something? Or just send as is?

Also will this method of communication require authentication? Such as a username and password? Or is it just directly sending data to machine. I wont need a username and password like I do on SSH?

Flawed: which I have used before using my PC/SSH on PuTTy.

I had a look at Page 9 and a few following pages but I would need to read a lot more - and I am too lazy. You do the reading :)

Can you post some examples of the stuff you send to the device using puTTY ?

I get the impression from what I read that it is not essential to use SSH. I suggest you explore all the possibilities with puTTY and the user manual. Ultimately you just need to get the Arduino to do what you do with puTTY.

...R

Robin2:
Can you post some examples of the stuff you send to the device using puTTY ?

Flawed:
Example Commands Listed in API

xConfiguration Audio Output Line 1 Equalizer Mode: Off

xConfiguration Audio Output HDMI 1 mode: On
xstatus call protocol

Robin2:
I get the impression from what I read that it is not essential to use SSH. I suggest you explore all the possibilities with puTTY and the user manual. Ultimately you just need to get the Arduino to do what you do with puTTY.

…R

Flawed:

The heart of the API is the API-Engine. This is where all information is stored and processed. The API-engine can be accessed by an easy- to-use Command Line Interface called XACLI using RS-232, Telnet or SSH, or by the XML API Service (TXAS) over HTTP/HTTPS.

If possible I would like to use RS-232. But am not sure how to get it to work. You said I should use a max232 chip to convert rs232 to ttl? How does that data get sent and received in the arduino code? I posted an example code of what I thought it might look like.

Flawed:

#include <SoftwareSerial.h>

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

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop() {
  //write
  Codec.println(“xConfiguration Audio Output Line 1 Equalizer Mode: Off”);
 
  //read
  if ( Codec.available() ) {
    int inByte = Codec.read();
    Serial.write(inByte);
  }
}

Does the string being sent to the codec need to be in a different format? Hex? Do I need to authenticate log in? I have never used this before and was hoping someone with more experience could point me in right direction while I wait for that max232 chip to come in.

I will draw diagram in paint of what I have in mind when I get home because I think there is still confusion here. Maybe this will help, sorry maybe I am very bad with getting my ideas across to people >.>

Flawed: If possible I would like to use RS-232. But am not sure how to get it to work. You said I should use a max232 chip to convert rs232 to ttl? How does that data get sent and received in the arduino code? I posted an example code of what I thought it might look like.

Does the string being sent to the codec need to be in a different format? Hex? Do I need to authenticate log in? I have never used this before and was hoping someone with more experience could point me in right direction while I wait for that max232 chip to come in.

I will draw diagram in paint of what I have in mind when I get home because I think there is still confusion here. Maybe this will help, sorry maybe I am very bad with getting my ideas across to people >.>

Flawed: If possible I would like to use RS-232 and not SSH or Telnet. But am not sure how to get it to work. You said I should use a max232 chip to convert rs232 to ttl? How does that data get sent and received in the arduino code? I posted an example code of what I thought it might look like.

Does the string being sent to the codec need to be in a different format? Hex? Do I need to authenticate log in? I have never used this before and was hoping someone with more experience could point me in right direction while I wait for that max232 chip to come in.

I will draw diagram in paint of what I have in mind when I get home because I think there is still confusion here. Maybe this will help, sorry maybe I am very bad with getting my ideas across to people >.>

Flawed:
If possible I would like to use RS-232. But am not sure how to get it to work. You said I should use a max232 chip to convert rs232 to ttl?

Slow down please. Let’s learn to walk before worrying about running.

I asked you to post examples of what you do with puTTY and your reply was to quote from the manual. Are you saying that you type the line
xConfiguration Audio Output Line 1 Equalizer Mode: Off
into puTTY and then press return ?

Does the Cisco device respond with a message ? If so with what?

I would like to see a copy and paste from puTTY, not from the manual.

Please take account of the fact that you know a great deal about this Cisco thing and I know nothing apart from what you tell me.

…R

Robin2: Slow down please. Let's learn to walk before worrying about running.

I asked you to post examples of what you do with puTTY and your reply was to quote from the manual. Are you saying that you type the line xConfiguration Audio Output Line 1 Equalizer Mode: Off into puTTY and then press return ?

Does the Cisco device respond with a message ? If so with what?

I would like to see a copy and paste from puTTY, not from the manual.

Please take account of the fact that you know a great deal about this Cisco thing and I know nothing apart from what you tell me.

...R

You're right man. I find this stuff pretty exciting, anxious to dive in and start making something useful for people lol.

So yes that would be an example command of something you could type into putty/ssh. Here is an example command with feedback.

For example if I want to reset the camera pan tilt I would use the below command.

xcommand Camera PanTiltReset CameraId: 1

Command with feedback from Putty.

xcommand Camera PanTiltReset CameraId: 1

OK
*r PanTiltResetResult (status=OK):
** end

OK. If I understand you correctly you have been using PuTTY as an SSH connection.

Can you try and see if you can use PuTTY to control the Cisco thingy without using SSH ? Can you connect your PC to the device using a USB-Serial connector ? The advantage of doing that is that you can figure out if authentication is required.

If you can't try that and if your only means to experiment is with an Arduino I suggest you use the second example in Serial Input Basics to receive the responses from the Cisco device.

Your example

Codec.println("xConfiguration Audio Output Line 1 Equalizer Mode: Off");

seems fine

What Arduino are you using ?

...R

Robin2: OK. If I understand you correctly you have been using PuTTY as an SSH connection.

Can you try and see if you can use PuTTY to control the Cisco thingy without using SSH ? Can you connect your PC to the device using a USB-Serial connector ? The advantage of doing that is that you can figure out if authentication is required.

If you can't try that and if your only means to experiment is with an Arduino I suggest you use the second example in Serial Input Basics to receive the responses from the Cisco device.

Your example

Codec.println("xConfiguration Audio Output Line 1 Equalizer Mode: Off");

seems fine

What Arduino are you using ?

...R

I Just had the chance to test it out today. It does require username and password authentication, by default they don't have password set and username is always the same. But I don't think this will be much of an issue. I can just program it to log-in (send username, return, return).

And I have an Esplora, Uno, Duo, Mega, and just ordered a Yun yesterday.

A Yun has Ethernet and WiFi included and you can program the Linux side in Python and connect with SSH. Maybe that would be the best option ? (obvioulsy more expensive than an Uno)

You have not said if you can communicate via Serial with PuTTY - but I think that is what you mean by "I Just had the chance to test it out today". There should be no problem getting an Arduino to provide a username and password as long as you don't have a problem including that data in the Arduino program

...R

Good morning, I am interested in knowing solution to this if it was possible. I wanted to control Cisco or other routers with console connection remotely via Arduino and internet connect without the need to travel miles to the location.

The API-engine can be accessed by an easyto-use Command Line Interface called XACLI using RS-232, Telnet or SSH, or by the XML API Service (TXAS) over HTTP/HTTPS

Cisco C40 Codec's API Documentation

for TCP support ( preset up IP address, config firewall) could use SSH/HTTP/HTTPS. for full firewall transparent support, RS-232 + Yun/Yun shield reverse ssh is needed.