Skip to content

System Integration

Introduction

system integration - slcontrols.com

System integration is basically the process of linking together different computing systems and software applications to act as a whole. This involves making sure that various IT systems, hardware, and software work together to provide a unified set of operations and data.


Key Components of System Integration

Hardware Integration Connecting different physical devices and systems so they can communicate and operate with each other.

Software Integration Linking different software applications and services to make sure that they can share data and processes.

Data Integration Combining data from different sources and providing users with a unified view of this data.

Application Integration Making sure different applications, usually from different sources, can interact and function together.


Assignment

Design and document the system integration for your final project [x]

This week, we have to design and document all of the work that we’ve done towards integrating the system of our final project.

I’ve decided to divide my work into 2 main parts, the hardware, and the software. Hope it isn’t too difficult navigating through this week !!!


Enclosure Design

I wanted my project enclosure to look like something from the 2000’s, so I went online for some references and this render of a gameboy really caught my eye.

Description of the image

image source: Sabrina Garcia

So, building on the design I fabricated last week(which you can access here), I did a quick sketch of what I wanted the body to look like, as well as how I planned on piecing everything together.

Now that I had a clear goal in mind, I started my design process.


3D Design

I’ll be using Fusion360 for my 3D design, which you can learn more about here.

16x02 i2c LCD

After measuring the LCD that I would be using, I created a sketch of the different parts (it’s not that good but as long as the measurements work, it should be good 😭)

alt text

Then, I extruded them as so: Outer rectangle: 1mm Centre rectangle: 7.6mm Inner rectangle: 7mm

That’s it for the LCD! Here’s a render of the design:


Power Bank

Next, I decided to create the power bank that’ll be powering my project.

I created a sketch using the “slot” tool, and then extruded it sideways by 50.85mm

alt text

alt text

Then, I used the filet tool and fileted the edges by 10mm, and we’re done !!!

alt text

Here’s the render for my power bank:


RC522 Card Reader

The card reader design isn’t that complicated, but here’s what I did:

I measured out my RFID card reader and then created a rectangle matching those dimensions, which I extruded by 2mm.

alt text

Then, I inserted a picture of the RFID card reader module that I’m using via the Decal tool under the INSERT section in the menu.

alt text

alt text


The Physical Enclosure

alt text

final project enclosure by thinleywozer on Sketchfab


Here’s how I thought about system integration in my design:

alt text planned out which materials to use for each aspect of the design, as well as holders for each of my components.

alt text made the enclosure more user friendly, and thought about my power source and how to make the enclosure sustainable.

alt text user friendliness, including an intuitive design, and easy-to-use design.


PCB Production

The Schematic Layout

Not much has changed from the output devices week, however, I did include the pins to connect to the main input device that I have in mind: The PN532 NFC RFID Module.

alt text

I made sure to utilize tags, and no-connection flags.

alt text

The PCB Editor

I selected my “edge” material and then used the circle tool (at 0.6mm). For this week, my power lines were 0.6mm and my signal lines were 0.4mm.

alt text

I didn’t include my microcontroller footprint in the final export because I’ll be connecting it to the 1x07 connection sockets.

Final Result

This is how the board came out !!!

alt text


Connections

To connect my components, I’ll be using standard pitch jumper wires.

Zero Skateboards Skull Tee

Final System

After integrating all of my components, here’s how it looks:

alt text

alt text


Programming

I was running out of time !!! So I had to compromise and decide to run a simpler code that only scanned the card ID, and the time of scanning. After consulting ChatGPT for code inspiration and any debugging, as well as editing the code by myself, this is the final code that I uploaded to my development board.

#include <Arduino.h>
#include <WiFi.h>
#include <WebServer.h>
#include "time.h"
#include <ESP_Google_Sheet_Client.h>
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal_I2C.h> // Include the LCD library

// For SD/SD_MMC mounting helper
#include <GS_SDHelper.h>

#define WIFI_SSID "iDruk3"
#define WIFI_PASSWORD "your_password"

#define RST_PIN         3
#define SS_PIN          4

// Google Project ID
#define PROJECT_ID "iot-datalogging-425404"

// Service Account's client email
#define CLIENT_EMAIL "iot-datalogging@iot-datalogging-425404.iam.gserviceaccount.com"

// Service Account's private key
const char PRIVATE_KEY[] PROGMEM = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCQn+Y/VbGkVzwd\nx2hfj2ap/a+ibb694wPk76JrrFBzlVrPmd+Qw5eS+A4gLWLhlSMZHXvBQ51zM9tV\nSPJda9VuY+hlcMri01kXl2/PlvrEWr0Noe3fggtl+vLRwqWLM6i256xPSFAksqiy\nOY8bS/YEUdlp9ckwT/ki75c6CbjRcu4q2eVebHqXIrzz8v5as8I2lclS9CHSSwy+\nKvC/1tESCUJ+4/KMKaVrpguZpEv3//G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24DKOuLUmUTp1BK0Ol+Ia5hDdWj98TIYQ1H1chtvfXp8RT9mooQFM5OYP\nIPVk6ZFIgyIwuRutriOe6hqNJ6P7BgcCN7vIfpyyIQKBgQCnnibJdApkBm+kdvtr\ndGplNeNwOex9OCVNXAXAHTceIr5zWJP7TrVYxsjxBL/9y4tqF6rWvk885ivSgHwu\n0XH0OLhNc5dwfQmR/SfADlaT9k6flIoZ47PsDIvHYWvO5xiorWxbJ0dD4DIqJzrc\nd2QwA0O7R4kfKkeBBjmzhJ6ltQ==\n-----END PRIVATE KEY-----\n";

// The ID of the spreadsheet where you'll publish the data
const char spreadsheetId[] = "1K3Etm9YSZgw3v0-Y7d2HXux5V98chGTO6Q86B_7BXmk";

// Timer variables
unsigned long lastTime = 0;  
unsigned long timerDelay = 30000;

// Token Callback function
void tokenStatusCallback(TokenInfo info);

// WebServer instance
WebServer server(80);

// Variable to hold data received via web server
String uidStr;

// NTP server to request epoch time
const char* ntpServer = "pool.ntp.org";

// Variable to save current epoch time
unsigned long epochTime;

// RFID instance
MFRC522 mfrc522(SS_PIN, RST_PIN);

// LCD instance
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Function that gets current epoch time
unsigned long getTime() {
  time_t now;
  struct tm timeinfo;
  if (!getLocalTime(&timeinfo)) {
    return(0);
  }
  time(&now);
  return now;
}

void setup() {
  Serial.begin(115200);
  Serial.println();

  // Configure time
  configTime(0, 0, ntpServer);

  // Connect to Wi-Fi network
  WiFi.setAutoReconnect(true);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

  // Initialize RFID
  SPI.begin();
  mfrc522.PCD_Init();
  delay(4);
  mfrc522.PCD_DumpVersionToSerial();

  // Initialize LCD
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Ready");

  // Begin the access token generation for Google API authentication
  GSheet.begin(CLIENT_EMAIL, PROJECT_ID, PRIVATE_KEY);

  server.begin();
  Serial.println("HTTP server started");
}

void loop() {
  // Check for new RFID card
  if (mfrc522.PICC_IsNewCardPresent()) {
    if (mfrc522.PICC_ReadCardSerial()) {
      uidStr = "";
      for (byte i = 0; i < mfrc522.uid.size; i++) {
        uidStr += String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
        uidStr += String(mfrc522.uid.uidByte[i], HEX);
      }

      // Display "success" and the UID on the LCD
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("Success");
      lcd.setCursor(0,1);
      lcd.print(uidStr);

      FirebaseJson response;
      Serial.println("\nAppend spreadsheet values...");

      FirebaseJson valueRange;

      // Get timestamp
      epochTime = getTime();

      valueRange.add("majorDimension", "COLUMNS");
      valueRange.set("values/[0]/[0]", epochTime);
      valueRange.set("values/[1]/[0]", uidStr);

      // Append values to the spreadsheet
      bool success = GSheet.values.append(&response, spreadsheetId, "Sheet1!A1", &valueRange);
      if (success) {
        response.toString(Serial, true);
        valueRange.clear();
      } else {
        Serial.println(GSheet.errorReason());
      }
      Serial.println();
      Serial.println(ESP.getFreeHeap());

      // Wait for 3 seconds then display "ready" again
      delay(3000);
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("Ready");

      mfrc522.PICC_HaltA();
    }
  }

  // Handle web server
  server.handleClient();
}

void tokenStatusCallback(TokenInfo info){
  if (info.status == token_status_error){
    GSheet.printf("Token info: type = %s, status = %s\n", GSheet.getTokenType(info).c_str(), GSheet.getTokenStatus(info).c_str());
    GSheet.printf("Token error: %s\n", GSheet.getTokenError(info).c_str());
  }
  else{
    GSheet.printf("Token info: type = %s, status = %s\n", GSheet.getTokenType(info).c_str(), GSheet.getTokenStatus(info).c_str());
  }
}

In order to learn how to link your project to Google Sheets, please follow this tutorial.



Last update: June 29, 2024