Skip to content

Networking & Communication

This week our group experimented with networking & communication through communicating between two projects, and sending and receiving a message.

We communicated between the final project boards of students Drew Griggs and Teddy Warner.

Hardware

We started by hooking up our boards. Drew’s final project included the use of both software and hardware serial, so we used that board as a reciving board. We had it receive messages through the software serial port, and send them out to a monitor through the hardware serial ports.

Teddy’s board included many more pin headers for an LCD display, as well as a power regulator to drop power down from 12V, tx/rx pins, and other features. These extra features make it optimal if we wanted to hook up multiple different boards to it, so we used it as a master board.

We connected the programming pins to their respective locations, and programmed our boards. Drew’s board uses FTDI protocol, so we hooked up an FTDI chip to program it. Teddy’s board uses ISP protocol, so we connected an arduino uno programmed with “Arduino as ISP” to program it.

Software

Master Code:

int tx = 0;
void setup() 
{
 Serial.begin(9600);
}

void loop() {
 Serial.println(tx);
 tx++;
 delay(500);
}

Reciving Code:

#include <SoftwareSerial.h>
#define sensdx 3

SoftwareSerial port2(sensdx, 9);

String rx;

void setup() {
Serial.begin(9600);
while(!Serial)
{
  ;
}
 port2.begin(9600);
}

void loop() {
 port2.listen();
 rx = port2.parseInt();
 Serial.println(rx);
}

The reciving code was the most complicated, as it involved 2 serial ports. Most of the code is setup, including the SoftwareSerial library, setting up the pins, and starting the port. All the code does is listen to the software serial port, set a string to any incoming data, and print it to hardware serial.

The master code simply prints an incrementing integer every 1/2 second.

Testing

We uploaded our code using our different protocols and starting testing. We connected the tx pin of Teddy’s board to the software serial rx pin on Drew’s, opened the serial port, and found ourselves reading an incrementing integer

Our files for this group assignment can be found in this zip file


Last update: May 19, 2021