receiving serial data

Hi,
Seems like the Arduino has nice support for sending serial data, but not for receiving it.

Here is what I am trying to do, i want control a 'network' of several Arduinos connected in serial (meaning not in parallel), controlled by a computer. I will address each device like 001, 002, 003 ... I need to control 3 pwm ports on each Arduino, so my thought is to send a 32 bit word. 1st byte for the address (0-255) and the next 3 bytes for the 3 pwm ports also 0 -255.

After checking out the documentation and the todbot tutorial Arduino-serial: C code to talk to Arduino – todbot blog
it seems like ascii values are sent and reading them with the Arduino means a bunch of string manipulation. There must be a better way.

Any advice?
Chuck

How are you wiring it up?

Seems like the Arduino has nice support for sending serial data, but not for receiving it.

Can you elaborate on what led you to that conclusion?

Here is what I am trying to do, i want control a 'network' of several Arduinos connected in serial

Meaning using something like RS232, SPI or something custom?

Any advice?

Maybe, but we need more detail on how you are trying to achieve this...

--Phil.

The one serial connection on the Arduino board will not allow a configuration like the one you are describing.

The standard rs232 port is really not meant to be used for anything but two devices communicating with each other, there is no way to address multiple devices built in.

One workaround could be to use the softe serial (see the playground). Then use the standard serial connection on the first Arduino board to communicate with the PC, the softserial to communicate with the standard serial on the next Arduino board and so on.

But this setup will not allow you to adress each board directly. Each board would have to read the serial data, check if he was the intended reciever, or otherwise send the data to the next board, and so on. This might add som undesired overhead / latency, depending on how "real time" your devices need to be controlled.

If the devices you are going to control are located not to far apart, a better solutuion might be to find a way to multiplex the PWM outputs, so you would only need one Arduino board to control your devices. There's an IC that will allow you to do that.

Or you could try to look into RS442 this forum topic http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1195139560 might be of interest.

MikMo

You could implement a serial 'ring' network. Computer connected to RX if first arduino ("A1"), TX of A1 connected to RX of A2, TX of A2 connected to RX of A3, ... TX of An connected to RX of computer. Then an interrupt task on each arduino detects the address in a message and either receives that message or just forwards the bytes on to the next arduino. You'd think something like this would have been standardized by now, but it hasn't (not that I know of, anyway.) Perhaps the patent issues surrounding token ring networks make it unattractive.

Any ascii you see in tutorials is to make the communications easier to understand. Neither the PC side nor arduino has any requirement that serial bytes be ascii.

You'd think something like this would have been standardized by now, but it hasn't (not that I know of, anyway.) Perhaps the patent issues surrounding token ring networks make it unattractive

Or maybe the fact that a single malfunctioning device will take down the entire network?

It's certainly not a bad idea, very nice in terms of simplicity, but it isn't exactly robust.

I suspect no one has done it because RS485 has pretty much done the same thing (bus instead of ring, though).

-j

a single malfunctioning device will take down the entire network?

Bah. True of most networking technologies. A simple NC relay/switch permits a host to opt-out of the ring.

RS485 has pretty much done the same thing

Yes, that's more likely, and rs485 is a potential solution to the original poster's problem. Unfortunately, rs485 converters and/or ports and/or drivers seem to be particularly expensive, while the ring network can work with traditional (cheap, common) rs232 drivers or even just ttl levels. (it will require a common ground on all the nodes, so it may have problems if the nodes are physically far apart...)

Check out the ISL83071E - It's an RS422/RS485 transceiver from Intersil. They're $1.68 each and there are samples available. There are also several variants with different speeds, duplex modes, etc. available. Check out the data sheet for more info:

http://www.intersil.com/data/fn/fn6115.pdf

Just get a handful of these, wire them up to the TTL interface and you're all set (from a signal prospective that is).

You'll still have to implement some sort of media access/collision control/avoidance in software.

I used the 5v version of that part in my SX-Net project (see the January '08 issue of Nuts & Volts magazine)

-- http://www.intersil.com/data/fn/fn6046.pdf

In that project each node receives a package header from thre stream and will only pick up the rest of the packet if the header matches the target node.