Go Down

Topic: arduino as serial client? (Read 222 times) previous topic - next topic

RyanW

Oct 28, 2013, 07:10 pm Last Edit: Oct 28, 2013, 07:26 pm by RyanW Reason: 1
Hi, I've been out of the Arduino world for a couple of years now and I am very rusty. I'm hoping someone can point me in the right direction to help me get started on a new project. I think once I get a good footing, I'll be able to start picking things up again.

Here is what I'm trying to accomplish. At work, we use a certain device that I often have to connect to and ask what IP address it currently has. I do this using PuTTY to establish a serial connection over a null modem cable, I then issue the command "get ip" in the PuTTY window, and the device returns its current IP address. I would like to create a setup using some form of Arduino that I can leave connected to the DB9 connection on the device. I'll eventually figure out how I can hit a button connected to the Arduino, have it establish a connection and issue the "get ip" command, then store the returned data and display it on an attached LCD. I can figure out the button and LCD stuff down the road, but I have no idea how to handle the serial command stuff.

Can someone advise which Arduino board might be best suited for this task, how One would properly make the connection between the Ardiuno and the DB9 connector on the other device, and documentation for the kind of serial communication I'm looking to use?

This is my first time using this sort of serial communication and i'm a little lost. Most of the serial info I have come across has to do with using the USB port between a computer with an OS running the Arduino software for troubleshooting reasons. Thank you in advance to anyone who has bothered to read this far, and hopefully for lending a hand. =)

macegr

The Arduino is currently using serial over USB, but what you want is RS232 (which is more of a communication voltage standard as applied to serial comms). The TTL-serial data from your Arduino needs to be converted to RS232 levels, which is something like +/- 9 to 12 volts. Usually, people use a MAX232 chip (or compatible, they're cheaper) which is designed for this exact purpose. It would require soldering up a PCB with some capacitors etc. But there are premade shields for this, Sparkfun has one: https://www.sparkfun.com/products/11958

However, you'd need to remove that shield in order to program the Arduino through USB. There may be other shields out there that allow you to switch the RS232 connection on and off, or let you tie to other pins and use SoftwareSerial instead of the hardware ports.

Once you have the electrical side of things figured out, the rest is easy...just use some the Arduino serial examples. A "Serial.println("get ip");" might be your start.
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

RyanW

macegr, that's exactly the sort of thing I was looking for! Thank you so much. =)

I'll order one of those shields to get started with, since it's nice and simple and ready to go. I'll try to update this thread once I get somewhere, although it may be a while since it's sort of a side project when time allows.

Thanks again!

PeterH

#3
Oct 29, 2013, 01:38 am Last Edit: Oct 29, 2013, 02:09 am by PeterH Reason: 1
What will you use the address for, and how does the device get its address? Using a serial connection to ask it feels like a bodge and it seems to me that it ought to be possible to solve this problem just from the network side.

As an aside, I remember reading that early UNOs used a D-sub 9-pin RS232 connector instead of USB so if you can get hold of one of those it would save you from building a TTL-RS232 converter into your solution. Of course you'd need a USB-to-RS232 adapter to program it so it's swings and roundabouts ...
I only provide help via the forum - please do not contact me for private consultancy.

RyanW

PeterH,
You are certainly correct that normally it would be much easier to handle this on the network end of things. The company I work for often installs control equipment and AV equipment on corporate networks that we do not have control of and we do not have enough access to for checking this sort of thing easily. While it may seem sort of a bodge, as you put it, it is often easier (and MUCH faster) than tracking down someone in IT at whichever company we're at and have them track down a MAC address on the network to tell us the IP it has.

Ideally, in the end, I'd love to make a relatively inexpensive boxed arduino (or other)  contraption that could be mounted with our equipment in a rack to provide a nice push-button-to-get-IP-address-of-control-device sort of setup.

Go Up