Networking And Communications


This period of time, I am also working on another project where part of it, involves the measurement of the temperature of a lake. So, for this week I thought to use the temperature sensor of the other project and embed it in this one. So, my goal was to measure temperature using one of the boards and then transfer the data to the other board in order for that to be able to print it out.

Measurement of Temperature

The temperature sensor used is the PT100 with 2 configuration wires. In order to achieve the communication between the sensor and the Arduino I used an RTD Sensor Amplifier, MAX31865. The connections required between the amplifier and the Arduino are depicted below:

PCB Boards

As mentioned before, the one board was for the measurement of the temperature. The PCB board used for this purpose is the one that was used in the week of the Output and Input Devices. For the production of it and more details please visit the weeks above-mentioned.

The board that would receive the data was developed this week. It was designed to control a GSM module and a temperature sensor but I used it just to receive the data. What is missing from this board are the SDA and SCL pins and as a result I could not use the I2C communication between the boards although I tried with different libraries to achieve that but the software SCL and SDA pins would not communicate with the hardware ones of the other board, so I switched to the serial communication instead.

So, the board that would receive the data is again a modified version of the satshakit.

Below are the added parts of it:

The production of it was done as all the other boards before with the same exact settings apart from the xyz coordinates of course. So, for the production of the board, please refer to previous weeks.

Software of the PCBs

The program was written in Arduino language. The software for the board that would measure the temperature is depicted below. In the serial communication there is no slave-master configuration as no more than two boards can be connected whereas in the I2C configuration it can be one master board which requests data and multiple slaves that send the data when requested. So, below is the code for one of the two boards. This board reads the data temperature and sends it via serial to the other board.

//PT100 Sensor Readings

//library needed between the serial communication between the boards
#include <SoftwareSerial.h>
//library needed for the RTD amplifier
#include <Adafruit_MAX31865.h>

//declaration of the pins used for the serial communication
SoftwareSerial mySerial(A4, A5);

/*declaration of the pins the amplifier uses and the 
reference resistance of the sensor*/
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);
#define RREF 430.0

void setup() {
  mySerial.begin(9600); //for the serial communication
  max.begin(MAX31865_2WIRE);  //begin a 2-wire configuration


void loop() {
  //read and print temperature values
  uint16_t rtd = max.readRTD();

  Serial.print("RTD value: "); Serial.println(rtd);
  float ratio = rtd;
  ratio /= 32768;
  Serial.print("Ratio = "); Serial.println(ratio,8);
  Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
  Serial.print("Temperature = "); Serial.println(max.temperature(100, RREF));

  //send temperature values
  mySerial.println(max.temperature(100, RREF));
  Serial.print("Data sent");
  // Check and print any faults
  uint8_t fault = max.readFault();
  if (fault) {
    Serial.print("Fault 0x"); Serial.println(fault, HEX);
    if (fault & MAX31865_FAULT_HIGHTHRESH) {
      Serial.println("RTD High Threshold"); 
    if (fault & MAX31865_FAULT_LOWTHRESH) {
      Serial.println("RTD Low Threshold"); 
    if (fault & MAX31865_FAULT_REFINLOW) {
      Serial.println("REFIN- > 0.85 x Bias"); 
    if (fault & MAX31865_FAULT_REFINHIGH) {
      Serial.println("REFIN- < 0.85 x Bias - FORCE- open"); 
    if (fault & MAX31865_FAULT_RTDINLOW) {
      Serial.println("RTDIN- < 0.85 x Bias - FORCE- open"); 
    if (fault & MAX31865_FAULT_OVUV) {
      Serial.println("Under/Over voltage"); 

The code of the other board which is receiving the temperature data and printing them out via the serial from the previous board can be seen below.

//Receiving temperature readings 

//library for the serial communication between the two boards
#include <SoftwareSerial.h>

//declaration of the pins used for the serial communication
SoftwareSerial mySerial(10, 12);

void setup() {
  mySerial.begin(9600);   //for the serial communication
  Serial.begin(115200);  // start serial for output

void loop() {

  if (mySerial.available() > 0) { // "slave" may send less than requested

For the boards to communicate I had to connect them somehow. As indicated in the codes, I connected the pins that were necessary for the communication (A4 and A5 with 10 and 12 respectively). Also, the ground was also shared. Apart from the connections between them, the boards should also be powered seperately. I personally used FTDI cables to power them as I was programming and debugging them at the same time. Below, you can see the pins I used for the connection of the two boards:

So, the result of the communication of the two boards looks like this:

In order to see the result of the communication of the two boards, I had to open the serial monitor of the board that receives the data. So, be careful of which port you are using. Also while I was using the FTDI cables to upload the codes in the two boards, I had to be careful of which ports belonged to which board.

Below you can see a short video of the two boards communicating with each other:


"Slave"_Serial.ino || "Master"_Serial.ino || SensorBoard.sch || SensorBoard.brd