Arduino with RS232 connection

Hello - I am trying to learn about the Arduino and do a project here. While I am going to be attempting smaller things along the way, my goal is to complete the main project after I'm better acquainted with the Arduino. I am just getting started and have a lot to learn. However, looking into the feasibility of the project, I am trying to figure a couple of things out:

  1. If I wanted to attach a 9 pin serial port to the Arduino Uno, what would I need for that? I've done some searching online and in books and can't seem to find something being done like this. I've done some reading on the Arduino and everything I've seen is dealing with prototypes using breadboards. What I would need to construct would be something more solid and permanent. Of course, I would have preferred to use USB but the device already has had some modifications done to it a long time ago prior to USB so it has 9 pin serial connection. If you know of any tips/links, that would be great too.

  2. Is it possible/relatively easy to convert a serial port connection to a USB port? The serial port connection is using 3 wires (not sure right now what they are for) and I'm wondering if that is possible to replace the serial port connection with a USB connector. I would prefer not to have to use an adapter (serial to USB).

I appreciate any help/links that you could give me. It would be most helpful.

pulper

https://www.google.com/search?q=arduino+rs232+to+ttl+serial+adapter&biw=1215&bih=699&tbm=isch&imgil=ROFGwCRepqGB3M%253A%253Bhttps%253A%252F%252Fencrypted-tbn2.gstatic.com%252Fimages%253Fq%253Dtbn%253AANd9GcS0HTQjvXEFlmXWKDCoMxEr2ADMJRhvgm7_VPOlAEfcevGQ5p07%253B600%253B600%253BpoxtCF6QJPyw6M%253Bhttp%25253A%25252F%25252Fwww.dx.com%25252Fp%25252Frs232-serial-port-to-ttl-converter-communication-module-for-arduino-148963&source=iu&usg=__DKLJRo9HjEGciUU8hjxpMFEVD8Q%3D&sa=X&ei=HFl5U4qANo6AoQS1j4GoCQ&ved=0CIwBEPUBMAU#facrc=_&imgrc=ROFGwCRepqGB3M%253A%3BpoxtCF6QJPyw6M%3Bhttp%253A%252F%252Fimg.dxcdn.com%252Fproductimages%252Fsku_148963_1.jpg%3Bhttp%253A%252F%252Fwww.dx.com%252Fp%252Frs232-serial-port-to-ttl-converter-communication-module-for-arduino-148963%3B600%3B600

https://www.google.com/search?q=arduino+rs232+to+ttl+serial+adapter&biw=1215&bih=699&tbm=isch&imgil=3Q4oNeo7vjegNM%253A%253Bhttps%253A%252F%252Fencrypted-tbn0.gstatic.com%252Fimages%253Fq%253Dtbn%253AANd9GcSsdCKMuwvN2lOGnwFZymne4GEgf04m5AgQiVqRRzJyBUTEFzohzA%253B960%253B720%253BiZpzBBfC7jACbM%253Bhttp%25253A%25252F%25252Fdaverobertson63.wordpress.com%25252F2013%25252F06%25252F02%25252Fserial-port-mini-rs232-to-ttl-converter-adaptor-module-board-max3232-with-arduino%25252F&source=iu&usg=__06AFyssv340SXVL-42TdQ4YOow0%3D&sa=X&ei=HFl5U4qANo6AoQS1j4GoCQ&ved=0CI4BEPUBMAY#facrc=_&imgdii=_&imgrc=3Q4oNeo7vjegNM%253A%3BiZpzBBfC7jACbM%3Bhttp%253A%252F%252Fdaverobertson63.files.wordpress.com%252F2013%252F06%252Farduino_rs232.png%3Bhttp%253A%252F%252Fdaverobertson63.wordpress.com%252F2013%252F06%252F02%252Fserial-port-mini-rs232-to-ttl-converter-adaptor-module-board-max3232-with-arduino%252F%3B960%3B720

http://www.dx.com/p/rs232-serial-port-to-ttl-converter-communication-module-for-arduino-148963#.U3lZdfldWa8

rs232 to USB ==> RADIOSHACK USB TO RS232 CABLE (too expensive)
see below:

http://www.bhphotovideo.com/bnh/controller/home?O=&sku=817124&gclid=CJrv2tLmtr4CFY17fgodmqoAAQ&Q=&is=REG&A=details

http://www.bhphotovideo.com/bnh/controller/home?O=&sku=817124&gclid=CJrv2tLmtr4CFY17fgodmqoAAQ&Q=&is=REG&A=details

Is it possible/relatively easy to convert a serial port connection to a USB port?

Since you didn't specify TTL or RS232 no one knows what you mean by "Serial Port "
That could still be RS232 or TTL.
You need to be specific

Thanks so much for your reply and posts. That gives me some great ideas on which to base my research for this project. it is exactly what I needed to see in those pictures.

Sorry for probably a simple question, but If I did use the one from here:

would the Uno be able to communicate with an attached computer what is transmitted to the RS232 port from the device?

Regarding the serial port for direct conversion to USB, I'm referring to RS232. My preference would be to have this done without using an adapter. Difficult/easy?

Thanks again

  1. If I wanted to attach a 9 pin serial port to the Arduino Uno, what would I need for that?
    Just the cable... A level converter chip... Maybe a resistor or two!
    RS-232 vs. TTL Serial Communication - SparkFun Electronics

I've done some reading on the Arduino and everything I've seen is dealing with prototypes using breadboards. What I would need to construct would be something more solid and permanent.
You could use predrilled protoboard:
http://www.hackster.io/rayburne/sd-card-serial-logger

  1. Is it possible/relatively easy to convert a serial port connection to a USB port? The serial port connection is using 3 wires (not sure right now what they are for) and I'm wondering if that is possible to replace the serial port connection with a USB connector. I would prefer not to have to use an adapter (serial to USB).
    You may think about V-USB, but a Pro-Micro may be easier as V-USB is finicky
    V-USB: http://www.hackster.io/rayburne/arduino-to-excel-using-v-usb
    ProMicro: https://www.sparkfun.com/products/12640

Ray

http://www.obdev.at/products/vusb/index.html

@Mr. B.
Now you really got my attention. What all do I need to display analog voltages in Excel like that besides the USB_HID sketch and the resistors ?
What is that 8-pin DIP on the proto board ?

Hi, is there a reason you cannot use the existing serial/usb link that you program the arduino with?
You could use Processing, program in the PC to communicate with the arduino.

Just a thought.

Tom..... :slight_smile:

pulper:
2. Is it possible/relatively easy to convert a serial port connection to a USB port? The serial port connection is using 3 wires (not sure right now what they are for) and I'm wondering if that is possible to replace the serial port connection with a USB connector.

Yes it's possible, but how to do it depends whether you're talking about providing a USB host port or a slave port. It's not clear from your description how these two (or perhaps more?) devices connect to each other and what the Arduino is intended to provide here.

pulper:
I would prefer not to have to use an adapter (serial to USB).

Anything you use to carry serial data between a serial port and a USB port is by definition a serial to USB adapter, and if this is what you need then simply buying a standard one of these off the shelf is likely to get you a solution which is smaller, cheaper and more reliable than a DIY one. This is especially true if you need to interface with RS232 and the DIY solution is proposed to bodge the signal levels with resistors.

Why is the title of this Thread about "Analog input and output" when the subject matter is entirely about digital input and output using serial ports or USB?

If you use a sensible title you are more likely to attract the attention of people who have relevant expertise.

...R

Hi, trying to work out what is needed in para 1.

  1. If I wanted to attach a 9 pin serial port to the Arduino Uno, what would I need for that? I've done some searching online and in books and can't seem to find something being done like this. I've done some reading on the Arduino and everything I've seen is dealing with prototypes using breadboards. What I would need to construct would be something more solid and permanent. Of course, I would have preferred to use USB but the device already has had some modifications done to it a long time ago prior to USB so it has 9 pin serial connection. If you know of any tips/links, that would be great too.

To clarify..
Do you have a "device" that has a RS232 9pin connector on it?
Do you want to connect this "device" to an arduino and need a RS232 port input on the arduino?
What is this device?
What is the RS232 speed?

Tom....... :slight_smile:

Sorry for the confusion. Unfortunately this is sometimes what happens when the person posting isn't familiar with the terminology.

I posted this with the title dealing with analog prior to wording my entire post. Unfortunately, as i started typing I tried to keep my questions limited and didn't add items that dealt with analog to digital conversion. What I have however in this project is something that is analog communicating with an A/D converter using an RS232 port. I'll explain below in detail with the hopes that it makes sense.

My friend has a hand grip that is used to measure force. It is not digital and it has an analog readout. A long time ago, the innards of the hand grip were altered slightly so that the hand grip could communicate the force results to a computer. Three wires were connected to the hand grip internally, and these wires were attached to an RS232 cable. This RS232 cable attaches to an RS232 port on a small box that houses, among other things, an A/D converter. This box has an output RS232 port that you attach to an RS232 port on a computer, allowing the findings from the hand grip to be communicated to the computer and then analyzed.

A few things have happened since then and recently. RS232 ports on computers have become rarer and rarer, RS232 to USB converters are very hit and miss (at least with what we are using currently) with almost all of them being "miss", and most importantly, the box is failing and the company that built it is out of business. I have programming experience (have built some applications in Visual Foxpro) but no hardware experience (probably can tell by my posts). I am trying to see if this is something that I can help out with, as there is time but limited budget. I remember when I first started in Foxpro and didn't even know what a database was. I learned a lot over time and now have become pretty decent with it. I'm hoping that this will happen with hardware too (I'm starting out in pretty much the same place). I am a little slower these days but as I said time is not the issue right now.

I thought the Arduino (and possibly Rasberry PI) would work well in this situation, so I have purchased both and spent some time reading about them over the past week or so. However, I have only gotten so far with this and thought I could post on one of these forums and get some help. The links so far have proven to be really good, especially the RS232 board for the Arduino. However, I don't see how the virtual USB would help in this (this of course is probably due to my post not being clear previously).

What I would like to do is the following:

Connect the hand grip through the already attached RS232 cable to the Arduino Uno. Have the Uno convert the analog hand grip readings (as the hand grip is being used) to digital, and then communicate that directly to a computer attached to the Uno. Right now, this is done using a box that is failing and the box communicates to the computer using an RS232 port. I would prefer to have the Uno communicate using USB, something that is more recent and is on every computer. BTW, I saw a link above for an UNO with an SD card attached but I would prefer not to have the separate step of having the data stored on an SD card and then having to attach the card to a computer.

OR:

If possible (not necessary but would be nice) to rewire the innards of the hand grip to make it into a USB connection rather than a RS232 connection. Right now as mentioned above there are three wires going from the hand grip to an RS232 cable. I would like to change the wiring to make it a USB connection. Then use the hand grip as described in the previous option.

I hope the above sheds more light on what I'm looking at. I really appreciate the help so far and hopefully you guys/gals can help a bit more with the above.

Thanks.

I guess we can assume you don't have the schematic for the magic box ?
How is the RS232 speed set ? (do you use device manager to do that ?)
Do you have a Terminal capture file that shows the RS232 output of this box ?

Regarding the serial port for direct conversion to USB, I'm referring to RS232. My preference would be to have this done without using an adapter. Difficult/easy?

Since your not t HW person I just want to say that in the future , try to avoid using the term "serial" without also including something that identifies the "type" of serial (HW or SW protocol,ie: TTL (0 to 5V logic), I2C, SPI, RS485, etc...)

Can you draw a schematic of what you know with pin labels ?
If you use the RS232 to TTL serial converter I suggested in the previous post and Software Serial, you should be able to connect your RS232 to the DB-9 on the converter and read the serial data representing the analog values with the arduino.

You need to use Software Serial (ie: Rx=2,Tx=3) because you need 0 & 1 to send the data to your PC using the Serial Monitor.
You would use Serial.print statements to echo data received on Software Serial (2) [This is the TTL Tx out from the RS232 converter we talked about] .

thanks again for your help here. I appreciate it, along with the advice on terminology.

i don't have the schematics, etc for this right now but i can see if my friend has it. I do doubt that however. I believe that they set the RS232 speed using the software that the company provided to them but it defaults, if i'm correct, to 19200.

Regarding the converter you suggested, I looked at the hand grip and I'm going to need a converter with a DB9 male. i'm glad i checked this b/c I would have assumed that what I would need was a DB9 female. My searching online provided this, which unless you see anything wrong with it, I'll go ahead and purchase:

http://www.nkcelectronics.com/RS232-to-TTL-converter-board-DTE-with-Male-DB9-33V-to-5V_p_369.html

Thanks again.

That will work. Remember what I said about Software Serial. You CANNOT connect the output of this converter to the arduino Rx pin-0.

I posted this with the title dealing with analog prior to wording my entire post.

You can modify the title on that first post you know. Then modify it on your next and we will all b in sync with a new title.

you probably could have named it "black box"

raschemmel:
@Mr. B.
Now you really got my attention. What all do I need to display analog voltages in Excel like that besides the USB_HID sketch and the resistors ?
What is that 8-pin DIP on the proto board ?

That's it! Well, include the two 3.6V low-wattage zener diodes and voila, a HID keyboard device. These things can also be done with t85 (and other 8-pin chips). What is really cool, is that most of the Trinket and Digispark t85 libraries will also work on the Trinket clone, http://www.hackster.io/rayburne/chachka-trinket-attiny85-clone

For the 328 variety of chips, this is the library:
https://code.google.com/p/vusb-for-arduino/
This library and a bit of sketch work to create the keystrokes that go into the HID keyboard to drive Excel is it. Of course, the same can be done with the Leonardo or the ProMicro... but, where is the fun in that?

The Excel stuff is all formula-based parsing... that is, no VBA or macros. As Excel is smart about how it allocates calculation resources, only the cells that change are actually taking CPU resources for parsing. While I did not set up a graph showing the AD channels, it would be easy enough to do.

Ray

I can't seem to find anything on that page describing what the 8-pin chip is in the photos. My first thought is it must be an
ATtiny85 but then it occurred to me in might be an ADC. Do I even need to know ? I would be using a breadboarded ATmega328
or one on a protoboard. I have six of them with OPTIBOOT boot loader. I'm only using one right now but the USB-HID looks like a good application for one.

What I have however in this project is something that is analog communicating with an A/D converter using an RS232 port. I'll explain below in detail with the hopes that it makes sense.

My friend has a hand grip that is used to measure force. It is not digital and it has an analog readout. A long time ago, the innards of the hand grip were altered slightly so that the hand grip could communicate the force results to a computer. Three wires were connected to the hand grip internally, and these wires were attached to an RS232 cable. This RS232 cable attaches to an RS232 port on a small box that houses, among other things, an A/D converter. This box has an output RS232 port that you attach to an RS232 port on a computer, allowing the findings from the hand grip to be communicated to the computer and then analyzed.

I would recommend drawing a schematic of the hand grip. Since it is somewhat aged, it may be nothing more than a spring and a potentiometer.... hand grip force is exerted against a spring which moves the wiper of the potentiometer... just a guess. I am doubting that it is a load-cell, but ...

The A/D in the box must have some form of USART to create the TTL serial or RS232 serial signal. It is important to note which voltage levels are being used. The PC software... is it "receive only" and at what BAUD? If you open a PC communication terminal (teraterm, for example) can you "connect" to the serial port and make sense of the data? Knowing more about this link will be helpful.

Depending on the workable space within the handset, you may be able to put a Bluetooth serial transmitter in the grip along with a Pro Mini (assuming 10 bit analog.) Then use a DC cable to keep the device happy... even just the 5V from the USB. But to design anything, it is important to understand the entire circuitry. Is there, to your knowledge, any intelligence in the black-box? For example, you stated there is an A/D in the box; you need to determine if you can read the labeling and acquire the datasheet. If the PC software is just taking a "number" and manipulating it, then things are simple. If the box is taking a resistance and converting that to serial ASCII alphanumerics, things are more complex.

Ray

raschemmel:
I can't seem to find anything on that page describing what the 8-pin chip is in the photos. My first thought is it must be an
ATtiny85 but then it occurred to me in might be an ADC. Do I even need to know ? I would be using a breadboarded ATmega328
or one on a protoboard. I have six of them with OPTIBOOT boot loader. I'm only using one right now but the USB-HID looks like a good application for one.

It is a tiny85. I used the Adafruit V-USB bootloader. ONe can also use the Digispark bootloader but you lose Reset but gain an PWM. While these are t85 V-USB they cannot use the USBkeyboard.h ... that is for Arduino328P only.

Ray