Smart Laboratory Asset Management System

0 317 Medium

Streamlines equipment tracking, maintenance, and inventory. IoT integration enhances efficiency and productivity.

 

Smart Laboratory Asset Management System
HARDWARE LIST
1 DFRobot Hackster EEDU Kit - Getting started with IoT
1 DFRobot HUSKYLENS AI Camera

Software apps and online services

· Arduino IoT Cloud


Hand tools and fabrication machines

· Soldering iron (generic)
· Solder Wire, Lead Free
· Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)

 

About Sekolah Robot Indonesia

Sekolah Robot Indonesia (SRI) is an exciting after-school program in Indonesia that introduces students to the world of robotics. Through hands-on activities, SRI helps students learn about building and programming robots, developing problem-solving skills, and fostering creativity. The program offers a supportive learning environment and experienced mentors who guide students in their robotics journey. SRI also organizes workshops and events to keep students updated with the latest advancements in robotics. It's a great opportunity for young learners to explore their passion for robotics outside of regular school hours and develop valuable skills for the future. (www.sekolahrobot.co.id)

 

 

Laboratory Asset Management in Sekolah Robot Indonesia(SRI)

We have implemented inventory recording using the localhost web database, we have recorded some of the existing equipment at SRI.We have implemented inventory recording using the localhost web database, we have recorded some of the existing equipment at SRI. But This system enables laboratory managers and staff to effectively track, monitor, and maintain a wide range of assets, including instruments, apparatus, reagents, and consumables. It provides a centralized database where all asset information is stored, making it easy to access and update vital details such as location, status, calibration schedules, and maintenance history.

 

Fig 1.1.. Website Laboratory management system in SRI

                                               Fig 1.1.. Website Laboratory management system in SRI

 

Fig 1.2. Website Laboratory management system in SRI

                                               Fig 1.2. Website Laboratory management system in SRI


so, we want to develop an existing management laboratory with IOT or artificial intelligence, making it easier for us to find out the location of the equipment. To start developing, the steps are as follows:

 

 

Step 1-Prepare Hardware

In this project we use some hardware from DFRobot EEDU Kit for Arduino IoT Starter, even though I prefer to be get the DFRobot EEDU Kit for Arduino AI Starter, but hackster.io give me DFRobot EEDU Kit for Arduino IoT Starter (Big thanks Hackster.io).

 

For complete my project I buy HuskyLens. The following hardware components are needed in this project :

· FireBeetle 2 ESP32-E IoT Microcontroller

· Gravity: IO Shield for FireBeetle 2 (ESP32-E/M0)

· Fermion: DFPlayer Pro - A mini MP3 Player with On-board 128MB Storage (Breakout)

· Stereo Enclosed Speaker - 3W 8Ω 

·Gravity: Huskylens

 

Fig 2.2.. Hardware and Wiring Smart Lab Asset Management System

                                           Fig 2.2.. Hardware and Wiring Smart Lab Asset Management System

 

 

Step 2-Prepare Arduino Cloud

Make account Arduino cloud and click web editor

 

Fig 3. Dashboard Arduino Cloud

                                                                          Fig 3. Dashboard Arduino Cloud

 

Select Board FireBeetle-ESP32 and Port Com

 

Fig 4. editor Arduino Cloud

                                                                          Fig 4. editor Arduino Cloud

 

for dfplayer pro and huskylens we need add library in arduino cloud, so for another instruction to add library and board installation please refer to this documentation https://wiki.dfrobot.com/Hackster_EEDU_Kit_AI_IoT_Environmental_Sensing#target_4                                           

 

 

Step 3- coding for hardware

Coddingfor DFPlayer Pro

· save mp3 in dfplayer pro

 

Fig 5. Mp3 file DFPlayer

                                                                                       Fig 5. Mp3 file DFPlayer

 

· Add library in arduino cloud 

 

Fig 6. Add library DFRobot_DF1201S

                                                                                  Fig 6. Add library DFRobot_DF1201S

 

· codding test DFPlayer with arduino cloud

CODE
#include <DFRobot_DF1201S.h>

DFRobot_DF1201S DF1201S;
void setup(void) {
  Serial.begin(115200);
  Serial2.begin(115200);
  while (!DF1201S.begin(Serial2)) {
    Serial.println("Init failed, please check the wire connection!");
    delay(1000);
  }
  /*Set volume to 20*/
  DF1201S.setVol(/*VOL = */20);
  Serial.print("VOL:");
  /*Get volume*/
  Serial.println(DF1201S.getVol());
  /*Enter music mode*/
  DF1201S.switchFunction(DF1201S.MUSIC);
  /*Wait for the end of the prompt tone*/
  delay(2000);
  /*Set playback mode to "repeat all"*/
  DF1201S.setPlayMode(DF1201S.ALLCYCLE);
  Serial.print("PlayMode:");
  /*Get playback mode*/
  Serial.println(DF1201S.getPlayMode());
}

void loop() {
  Serial.println("Start playing");
  DF1201S.start();
  delay(3000);
  Serial.println("Pause");
  DF1201S.pause();
  delay(3000);
  Serial.println("Play the next song");
  DF1201S.next();
  delay(3000);
  Serial.println("Play the previous song");
  DF1201S.last();
  delay(3000);
  Serial.println("Start playing");
  DF1201S.fastForward(/*FF = */10);

  Serial.print("File number:");
  Serial.println(DF1201S.getCurFileNumber());
  Serial.print("The number of files available to play:");
  Serial.println(DF1201S.getTotalFile());
  Serial.print("The time length the current song has played:");
  Serial.println(DF1201S.getCurTime());
  Serial.print("The total length of the currently-playing song:");
  Serial.println(DF1201S.getTotalTime());
  Serial.print("The name of the currently-playing file:");
  Serial.println(DF1201S.getFileName());
  delay(3000);
  DF1201S.playFileNum(/*File Number = */1);
  while (1);
}

 

Codding for Huskylens

· in this prototype use 4 tag to detection tool in our laboratory pegboard save. so huskylens need to learn multiple tag recognition. please refer this documentation : https://wiki.dfrobot.com/HUSKYLENS_V1.0_SKU_SEN0305_SEN0336#target_20

 

Fig 7. Add Multiple tag

                                                                                     Fig 7. Add Multiple tag

 

· Add library huskylens in arduino cloud 

 

Fig 8. Library Huskylens

                                                                                     Fig 8. Library Huskylens

 

 

Codding test huskylens with arduino cloud

CODE
#include "HUSKYLENS.h"

HUSKYLENS huskylens;
//HUSKYLENS green line >> SDA; blue line >> SCL
int ID0 = 0; //not learned results. Grey result on HUSKYLENS screen
int ID1 = 1; //first learned results. colored result on HUSKYLENS screen
int ID2 = 2; //second learned results. colored result on HUSKYLENS screen
int ID3 = 3; //second learned results. colored result on HUSKYLENS screen
int ID4 = 4; //second learned results. colored result on HUSKYLENS screen
int ID5 = 5; //second learned results. colored result on HUSKYLENS screen
// and so on.....

void printResult(HUSKYLENSResult result);

void setup() {
    Serial.begin(115200);
    Wire.begin();
    while (!huskylens.begin(Wire))
    {
        Serial.println(F("Begin failed!"));
        Serial.println(F("1.Please recheck the \"Protocol Type\" in HUSKYLENS (General Settings>>Protocol Type>>I2C)"));
        Serial.println(F("2.Please recheck the connection."));
        delay(100);
    }
}

void loop() {
  if (huskylens.requestLearned())          //request blocks and arrows tangged ID != 0 from HUSKYLENS
    {
        
        Serial.println(String()+F("Get all blocks and arrows tagged ID1. Count:")+huskylens.count(ID1));
        for (int i = 0; i < huskylens.count(ID1); i++)
        {
            HUSKYLENSResult result = huskylens.get(ID1, i);
            printResult(result);
        }
        Serial.println(String()+F("Get all blocks and arrows tagged ID2. Count:")+huskylens.count(ID2));
        for (int i = 0; i < huskylens.count(ID2); i++)
        {
            HUSKYLENSResult result = huskylens.get(ID2, i);
            printResult(result);
        }
        Serial.println(String()+F("Get all blocks and arrows tagged ID3. Count:")+huskylens.count(ID3));
        for (int i = 0; i < huskylens.count(ID3); i++)
        {
            HUSKYLENSResult result = huskylens.get(ID3, i);
            printResult(result);
        }
        Serial.println(String()+F("Get all blocks and arrows tagged ID4. Count:")+huskylens.count(ID4));
        for (int i = 0; i < huskylens.count(ID4); i++)
        {
            HUSKYLENSResult result = huskylens.get(ID4, i);
            printResult(result);
        }
        Serial.println(String()+F("Get all blocks and arrows tagged ID5. Count:")+huskylens.count(ID5));
        for (int i = 0; i < huskylens.count(ID5); i++)
        {
            HUSKYLENSResult result = huskylens.get(ID5, i);
            printResult(result);
        }
    }
    else
    {
        Serial.println("Fail to request objects from Huskylens!");
    }
}

void printResult(HUSKYLENSResult result){
    if (result.command == COMMAND_RETURN_BLOCK){//result is a block
        Serial.println(String()+F("Block:xCenter=")+result.xCenter+F(",yCenter=")+result.yCenter+F(",width=")+result.width+F(",height=")+result.height+F(",ID=")+result.ID);
    }
    else{//result is unknown.
        Serial.println("Object unknown!");
    }
}

 

Step 4 - DIY Pegboard

 

Fig 9, diy pegboard

                                                                                        Fig 9, diy pegboard

 

Our Pegboard

1. Select Material:Material pegboard from acrylic and cutting with laser

2. Plan tool placement : Before start hanging the tools, plan the layout on the pegboard.

3. Select the right hooks: Pegboard hooks come in various shapes and sizes, such as single hooks, double hooks, loop hooks, and specialized holders. for hooks we use simple hooks from cable clamp and cable ties.

4. Hang the tools: Start by attaching the appropriate hooks or holders to the pegboard. Tools completed with tag barcode. 

 

Fig 10. Test Tag in pegboard

                                                                                Fig 10. Test Tag in pegboard

 

 

Step 5 - PrepareDatabase for combine with conventional system in SRI

In conventional system we have more table in database, but we must add 1 table again to support IOT system.

 

Fig 11.2. Table Structure item_iot

                                                                                Fig 11.1, add new table 'item_iot'

 

Fig 11.1, add new table 'item_iot'

                                                                               Fig 11.2. Table Structure item_iot

 

after create new table in database, use php code to running in webserver / local webserver.

 

Fig 12. Folder and file in webserver

                                                                               Fig 12. Folder and file in webserver

 

Fig 13.2 Web Display if tool not in pegboard

                                                                    Fig 13.1 Web Display if tool complete in pegboard

 

Fig 13.1 Web Display if tool complete in pegboard

                                                                      Fig 13.2 Web Display if tool not in pegboard

 

 

Step 6. Packaging

We modified plastic box to make packaging

 

Fig 14. Packaging

                                                                                       Fig 14. Packaging

 

 

Step 7. Result

After all step prepare try to integrate with local webserver and get result like in a video

 

Fig 15. integrated Huskylens, FireBeetle 32 and local webserver

                                                      Fig 15. integrated Huskylens, FireBeetle 32 and local webserver

 

 

 

 

Custom parts and enclosures

enclosure

 

 

 

Schematics

 

 

Smart Laboratory IOT

Huskylens, DFPlayer, Webserver

CODE
#include <DFRobot_DF1201S.h>

DFRobot_DF1201S DF1201S;


#include <WiFi.h>
#include <HTTPClient.h>
#include <Arduino_JSON.h>

//==== HUSKY ====
#include "HUSKYLENS.h"
HUSKYLENS huskylens;
int toolid[]={0,0,0,0,0,0};
int datatool1,datatool2,datatool3,datatool4;

// Defines the Digital Pin of the "On Board LED".
#define ON_Board_LED D9 

//======================================== SSID and Password of your WiFi router.
const char* ssid = "Sekolah Robot Indonesia";
const char* password = "sadapsadap";
//======================================== 

//======================================== Variables for HTTP POST request data.
String postData = ""; //--> Variables sent for HTTP POST request data.
String payload = "";  //--> Variable for receiving response from HTTP POST.
//======================================== 

//________________________________________________________________________________ Subroutine to control LEDs after successfully fetching data from database.
void get_fromdatabase() {
  Serial.println();
  Serial.println("---------------get database()");
  JSONVar myObject = JSON.parse(payload);

  // JSON.typeof(jsonVar) can be used to get the type of the var
  if (JSON.typeof(myObject) == "undefined") {
    Serial.println("Parsing input failed!");
    Serial.println("---------------");
    return;
  }

   // JSON.typeof(jsonVar) can be used to get the type of the var
  if (JSON.typeof(myObject) == "undefined") {
    Serial.println("Parsing input failed!");
    return;
  }

  if (myObject.hasOwnProperty("tool1")) {
    Serial.print("myObject[\"tool1\"] = ");
    Serial.println(myObject["tool1"]);
  }

  if (myObject.hasOwnProperty("tool2")) {
    Serial.print("myObject[\"tool2\"] = ");
    Serial.println(myObject["tool2"]);
  }

  if (myObject.hasOwnProperty("tool3")) {
    Serial.print("myObject[\"tool3\"] = ");
    Serial.println(myObject["tool3"]);
  }

  if (myObject.hasOwnProperty("tool4")) {
    Serial.print("myObject[\"tool4\"] = ");
    Serial.println(myObject["tool4"]);
  }
  
  datatool1 = myObject["tool1"];
  datatool2 = myObject["tool2"];
  datatool3 = myObject["tool3"];
  datatool4 = myObject["tool4"];
  
  if(datatool1 == 0 || datatool2 == 0 || datatool3 == 0 || datatool4 == 0)
  {
    Serial.println("not completed");
    DF1201S.playFileNum(1);
  }
  else
  {
    Serial.println("completed");
    DF1201S.playFileNum(2);
  }

  Serial.println("---------------");
}

void huskyData()
{
  if (huskylens.requestLearned())
  {
    if(huskylens.count(1)>0) toolid[1] = 1; else toolid[1] = 0;
    if(huskylens.count(2)>0) toolid[2] = 1; else toolid[2] = 0;
    if(huskylens.count(3)>0) toolid[3] = 1; else toolid[3] = 0;
    if(huskylens.count(4)>0) toolid[4] = 1; else toolid[4] = 0;
    if(huskylens.count(5)>0) toolid[5] = 1; else toolid[5] = 0;
  }
}


void setup() {
  // put your setup code here, to run once:
  
  Serial.begin(115200); //--> Initialize serial communications with the PC.
  Serial2.begin(115200);
  while (!DF1201S.begin(Serial2)) {
    Serial.println("Init failed, please check the wire connection!");
    delay(1000);
  }

  DF1201S.setVol(/*VOL = */20);
  DF1201S.switchFunction(DF1201S.MUSIC);
  delay(2000);
  DF1201S.setPlayMode(DF1201S.SINGLE);
  
  pinMode(ON_Board_LED,OUTPUT);
  
  Wire.begin();
  while (!huskylens.begin(Wire))
    {
        Serial.println(F("Begin failed!"));
        Serial.println(F("1.Please recheck the \"Protocol Type\" in HUSKYLENS (General Settings>>Protocol Type>>I2C)"));
        Serial.println(F("2.Please recheck the connection."));
        delay(100);
    }

  //---------------------------------------- Make WiFi on ESP32 in "STA/Station" mode and start connecting to WiFi Router/Hotspot.
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  //---------------------------------------- 
  
  Serial.println();
  Serial.println("-------------");
  Serial.print("Connecting");

  int connecting_process_timed_out = 20; //--> 20 = 20 seconds.
  connecting_process_timed_out = connecting_process_timed_out * 2;

  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    //........................................ Make the On Board Flashing LED on the process of connecting to the wifi router.
    digitalWrite(ON_Board_LED, HIGH);
    delay(250);
    digitalWrite(ON_Board_LED, LOW);
    delay(250);
    //........................................ 

    //........................................ Countdown "connecting_process_timed_out".
    if(connecting_process_timed_out > 0) connecting_process_timed_out--;
    if(connecting_process_timed_out == 0) {
      delay(1000);
      ESP.restart();
    }
    //........................................ 
  }
  //---------------------------------------- 
  
  digitalWrite(ON_Board_LED, LOW); //--> Turn off the On Board LED when it is connected to the wifi router.
  
  //---------------------------------------- If successfully connected to the wifi router, the IP Address that will be visited is displayed in the serial monitor
  Serial.println();
  Serial.print("Successfully connected to : ");
  Serial.println(ssid);
  //Serial.print("IP address: ");
  //Serial.println(WiFi.localIP());
  Serial.println("-------------");
  //---------------------------------------- 

  delay(2000);
}
//________________________________________________________________________________ 

//________________________________________________________________________________ VOID LOOP()
void loop() {
  // put your main code here, to run repeatedly

  //---------------------------------------- Check WiFi connection status.
  if(WiFi.status()== WL_CONNECTED) {
    HTTPClient http;  //--> Declare object of class HTTPClient.
    int httpCode;     //--> Variables for HTTP return code.
    
    //........................................ Process to get LEDs data from database to control LEDs.
    postData = "id=pegboard1";
    payload = "";
  
    digitalWrite(ON_Board_LED, HIGH);
    Serial.println();
    Serial.println("---------------getdata.php");
    http.begin("http://192.168.0.101/dataiot/firebeetle/getdata.php");  //--> Specify request destination
    http.addHeader("Content-Type", "application/x-www-form-urlencoded");        //--> Specify content-type header
   
    httpCode = http.POST(postData); //--> Send the request
    payload = http.getString();     //--> Get the response payload
  
    Serial.print("httpCode : ");
    Serial.println(httpCode); //--> Print HTTP return code
    Serial.print("payload  : ");
    Serial.println(payload);  //--> Print request response payload
    
    http.end();  //--> Close connection
    Serial.println("---------------");
    digitalWrite(ON_Board_LED, LOW);
    //........................................ 
    get_fromdatabase();
    
    
    delay(1000);

    huskyData();
    postData = "id=pegboard1";
    postData += "&tool1=" + String(toolid[1]);
    postData += "&tool2=" + String(toolid[2]);
    postData += "&tool3=" + String(toolid[3]);
    postData += "&tool4=" + String(toolid[4]);
    payload = "";

   
    Serial.println();
    Serial.println(postData);
    http.begin("http://192.168.0.101/dataiot/firebeetle/updatedata.php");  //--> Specify request destination
    http.addHeader("Content-Type", "application/x-www-form-urlencoded");  //--> Specify content-type header
   
    httpCode = http.POST(postData); //--> Send the request
    payload = http.getString();  //--> Get the response payload
  
    Serial.print("httpCode : ");
    Serial.println(httpCode); //--> Print HTTP return code
    Serial.print("payload  : ");
    Serial.println(payload);  //--> Print request response payload


    http.end();  //Close connection
    Serial.println("---------------");
    digitalWrite(ON_Board_LED, LOW);
    //........................................ 
    
    delay(4000);
    
    
  }
  //---------------------------------------- 
}

 

Smart Lab Github

https://github.com/sekolahrobot/IOT-smartlab

 

 

The article was first published in hackster, June 16, 2023

cr: https://www.hackster.io/sekolahrobot/smart-laboratory-asset-management-system-4bf229

author: SekolahRobot

License
All Rights
Reserved
licensBg
0