ttl to RS232 converter

Hi Everyone,

I recently bought one of these:

http://www.virtualvillage.co.uk/max232-rs232-serial-to-ttl-converter-board-pic-003602-008.html?utm_source=googlebase&utm_medium=shcomp

I am having trouble getting it to send any data. I have wired its TXD pin to the arduino TX pin, the RXD pin to the arduino RX pin, GND to GND to and its Vcc to 5v.

Has anyone else bought one of these and got it to work? They say they are out of stock now...

Is it ok to drive it from the arduino RX and TX pins or do I have to drive it from digital out pins as in the tutorial? http://www.arduino.cc/en/Tutorial/ArduinoSoftwareRS232

Some help would be very much appreciated.

Thanks, hal

If you jumper TXD and RXD together, does it correctly loop back?

Some devices mislabel TX and RX, so sometimes you have to connect TX on the device to RX on the Arduino, and vice versa.

Some devices mislabel TX and RX

No they don't! They label them according to whether the equipment is considered DTE or RTE http://en.wikipedia.org/wiki/Data_terminal_equipment

blush Yes, that's true, and it isn't always clear which is which, so it's worth trying the swap to see what happens.

Yes, that's true, and it isn't always clear which is which, so it's worth trying the swap to see what happens.

I think it's better to have an understanding and references to the datasheets and documentation of the devices to be wired together.

It's rather simple, an output pin must wire to a input pin and visa versa. Having two outputs wired together can cause damage so one shouldn't just make a random guess and try it out.

Lefty

Hi Guys,

Thanks for the advice.
So I’v set up my adapter and used the exact code from the Arduino example:
http://www.arduino.cc/en/Tutorial/ArduinoSoftwareRS232

something is happening now which is a massive improvement but it’s still not behaving as I would expect.

I have set it to the hyperterminal settings as described in the tutorial. However the ‘hi’ at the start comes out as something that looks like -|.± (but the + and - are above each other). When I paste it into this window it is as follows: ´.ñ

if I type o I get an upside down capital U, pasted here is the following: ï
this suggests its making the first bit a 1 instead of a 0?

In hyperterminal if I set force incoming data to 7bit ASCII then things are better but the letters are not in capital but the numbers do come out as if caps lock was pressed. The ‘hi’ at the start is still the same.

Also k occasionally comes as an o meaning that it is making the third bit a 1 instead of a 0. This happens on some other letters as well.

I would really appreciate some help I need to finish this by friday!
The end result is that I need to be able to send exact bytes to a serial device from the arduino in standard rs232 format.

Thanks again everyone.
Hal

You need to make sure that the baud rate is the same at both ends. Also set the terminal to 8 data no parity.

Those are the settings that I am using...

It does sound like a miss match of baud rates, could there be another reason? You haven't enabled the arduino's environment serial monitor have you? You do have the correct crystal frequency?

The other thing that causes that sort of problem is if the signal is not the right way up. But the TTL to RS232 should sort that. If you have a meter measure the voltage on the RS232 line with nothing being transmitted. It should be a negative voltage between 7 and 12V.

Hi Mike,

Ok so I have almost got the adapter working on a mega using tx1 and rx1 and just using the following:

byte val =B00110011;

Serial1.print(val);

This works fine as long as the highest bit is not 1. So upto 01111111 everything matches up but the pound symbol (£ or 10100011) comes out in Hyperterminal as u with a dash ontop, which in my ASCII table is 11111010.

Any idea why this is happening?

Thanks again, hal

It could be the ASCII tables hyper terminal is using ASCII is only universally decoded as a 7 bit value so it could be that.

Or it could be the number of data bits and parity it is expecting.
One parity option is mark parity, that is the parity bit is always the same and always high.

Hi,

Thanks for the help Mike, it seems to be working fine now.

I have the adapter working fine and I can control my other serial device that I need to control from the PC fine.

However if I try and control the serial device from the adapter nothing happens... Is it just a matter of swapping the tx and rx pins (ie 2 and 3)?

Thanks again, hal

Yes it sound like this should be the solution.

Just for reference for people who might dig up this thread in the future can you say what you were doing wrong in the first place.

Not sure there is much to learn here appart from I should use my brain a bit more. Here is a list anyway:

-I started off trying to talk to a RS232 serial device using the normal ttl output from the Arduino. This results in the inversion of most of the bits and some shifting.

-I then got a converter from virtual Village which I tried to implement using the standard Arduino example (http://www.arduino.cc/en/Tutorial/ArduinoSoftwareRS232 ).I couldn't get this to work properly, it seemed to be changing the third bit occasionaly and sometimes it would miss a bit. I don't understand this as I would assume that this example has been heavily tested by others and any problems would have been reported. I did not manage to solve this.

-I then used an arduino mega and using standard Serial.write() commands on one of its serial outputs with the adapter. Things seemed to work well with Hyperterminal.

-My last bug was that the adapter and the device were both setup to be controled by pc so were both listening on pin3 and talking on pin2.

-by crossing these wires things now seem to be working fine.

Thanks for all the tips Mike.

Hal