Best comm method for 30 feet

Two mega. About 30 ft apart. Need to send simply var passing between the two. I’ve done ic2 before, and know the code, but not sure if best for the distance.

Any pointers welcome.

TTL serial. Three wires (TX, RX and GND). Low data rate.

If you are using a wired Serial connection have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

The technique in the 3rd example will be the most reliable.

You can send data in a compatible format with code like this

Serial.print('<'); // start marker
Serial.print(','); // comma separator
Serial.println('>'); // end marker

If you would prefer a wireless solution then a pair of nRF24L01+ modules would be cheap and effective. Have a look at this Simple nRF24L01+ Tutorial


Perfect. I’ll look into that. I’ll have buried 3 wire in between the two board of good wire gauge.

Thx guys.

buried 3wire in between the two board of good wire gauge.

If you have already done that, then using it is clearly the way to go but, if not, reading the last comment in reply #2 again is a really good idea, it might be a lot cheaper

Buried? In the ground outdoors?

Nearby lightning strikes can induce staggeringly large currents in the cable. Make sure there's a solid ground - like a copper stake - near the entry point into any building. Otherwise the current can travel into the building via the wire and set fire to things inside.

Even a not-very-close strike can destroy your Arduinos. For this kind of distance, I would always use MAX232 chips with some ESD (electrostatic discharge) protection. 15KV protection is really easy to do and protects you against all sorts of mishaps.

How are you powering the Arduinos at each end of this cable?