Changing the baud rate between ATmega and BT modem

Hi guys,

I wish to connect my Arduino BT to an external unit that requires RS-232 and I have a question regarding redefining the baud rate between the ATmega and the BT modem.

While it is not normally an issue connecting RS-232 equipment to the Arduino - you can solder together/buy a TTL <-> RS-232 interface and use SoftwareSerial for the communications - this external unit needs to be connected at a baud rate of 19200. And the SoftwareSerial library only guarantees stable operations at up to 9600 baud, which means that I can’t use SoftwareSerial for this specific project.

So I am thinking, what about connecting the external unit to the Arduino BT’s TX and RX pins? I know that the two units will share the same line, with all the funny things that may happen when you suddenly have both a BT modem and another unit listening in on the same data… I’ll have to worry about that when I get things connected :slight_smile:

Anyway, using this approach would require me to lower the baud rate between the BT modem and the ATmega from 115200 to 19200. Will this pose any problems? I can see from the document that one should be able to define a custom baud rate, but I am not so keen on risking rendering my Arduino BT unusable by attempting to do so.

I look forward to hearing from you.

You can't have two drivers (e.g. the BT TX and the other device's TX) driving the same input (e.g. the arduino's RX). At best, you get garbage; at worst, you damage something.


You can't have two drivers (e.g. the BT TX and the other device's TX) driving the same input (e.g. the arduino's RX). At best, you get garbage; at worst, you damage something.


Thanks for answering.

For now I fortunately don't need the other device's TX to transmit data to the Arduino's RX, so that won't be a problem for now - but later on... :-)

I'm aware that putting two TX's on the Arduino's RX is simply just begging for trouble, but couldn't an 74-something XOR solve the problem? Eg. that the TX from the device feeds into the XOR along with the RX from the Arduino. Thus, if data is currently being transmitted back and forth between the BT modem and the Arduino on the RX pin, the other device won't be able to "write" data to the pin - because of the XOR. The XOR would have to drive a transistor, so that it doesn't put logical 0 on the RX when it's idling.

Hmm... There might be some issues with feedback there. It's a bit messy (and only off the top of my head, I admit. I won't venture into that right now. :o

You may be able to stick a gate and/or some transistors in there (I can't think of a gate that will work off the top of my head, but that doesn't mean it can't be done), but if you're going to that much trouble you may as well go ahead and multiplex the I/O. Of course, your mux/demux circuit would have to be between the arduino and the BT module (and your other device), so it may not be all that feasible.

There are a few ways to get real hardware UARTs for extra serial ports, but I haven't gotten a chance to work through the (non-trivial) details yet.


It sounds like a good idea with the multiplexer, but as you write, it may not be that feasible.

The best would probably be additional UARTs, as you mention.

For my project a solution could perhaps be to pre-program another ATmega microcontroller (with its own UART) to handle the communications with the external device. The device I need to attach is not providing a lot of data that the Arduino needs to process. Rather it’s more of a controller. But it requires 19200 baud, nonetheless.

That ATmega could then be connected to some of the I/O pins of the Arduino and the two microcontrollers could communicate with each other, perhaps using the SoftwareSerial protocol (provided that the additional ATmega is also loaded with the Arduino bootloader). Perhaps I2C would be even simpler, as the the data bandwidth needed between the two ATmegas is fairly limited.

All that could be made on a prototype shield, I guess. And then you have the goodness of being able to develop your app for the other ATmega through an Arduino board.

…Or one could purchase a Wiring board and get an ATmega128 with two UARTS - but then you’d need a Bluetooth dongle ::slight_smile:

I think I’ll go for the extra ATmega168 and the I2C protocol, actually.