Wiznet makers

sekolahrobot

Published June 30, 2024 © GNU Lesser General Public License version 3 or later (LGPL3+)

0 UCC

0 VAR

2 Contests

0 Followers

0 Following

Warehouse IOT Monitoring

An Internet of Things (IoT) based search system for warehouses can be a very useful solution to increase operational efficiency.

COMPONENTS Hardware components

adafruit - NeoPixel Ring: WS2812 5050 RGB LED

x 1


Arduino - Arduino Nano R3

x 1


WIZnet - W7500P

x 1


WIZnet - Surf5

x 1

Software Apps and online services

microsoft - Visual Studio 2017

x 1


Arduino - Arduino IDE

x 1


PROJECT DESCRIPTION

 

Introduction

The warehouse management process is very important for the continuity of the company's business. Warehousing functions to store assets and availability of goods to ensure the smooth running of production and business processes. As companies grow, the need for assets and goods stored in warehouses increases, requiring larger warehouses and more human resources for operations.

However, problems arise when searching for goods in the warehouse manually, which takes a long time and hampers business processes. The process of monitoring goods availability also requires a lot of time and human resources. Implementing Internet of Things (IoT) technology can greatly help warehouse management activities. This is before the implementation of IoT, component management at the Sekolah Robot Indonesia was still done manually, causing inefficiency. Technological innovation is needed to increase warehouse management efficiency and ensure the distribution process runs well and accurately. Even though previous research has been carried out on warehouse management systems, the automation of goods recording and distribution processes has not yet been fully resolved.

Goal

create a simple database to store components on the shelf, and create a system to search digitally with the server website and show the location when looking for it, with LEDs as indicators

Bussiness Architecture
The business process section itself will be divided into three parts, namely the inbound process section, data processing on hardware and also data processing contained in the software system.

 

step 1. Inbound Process
This process is the part used to check goods that will enter the warehouse. In this process, manual entry will be carried out and components will be placed in the specified place. develop website inventory inspire by Mellow_Labs Inventory Management and Organization System Apparatus in their github. I modified some feature and output json.

For preparation, need web app using flask and SQLite3 in python,  Install flask to proceed tih the front end of the web app.

pip install flask
pip install db-sqlite3

for activate server, run a python as server, and than open browser use ip as show in command prompt

before entry inventory component, make sure SURF5 active and get IP public for communicate with browser (step activate server surf5 can show in step 2 - hardware processing), and then Entry Device SURF to website. in the right side can set about led sequence, in this case i use 16 shelves with 6 row and 3 coloumn,

for setting in website, 

after set device, now entry inventory and set the place with LED sign, example i place arduino uno in shelves number 1, 

data inventory after all component was entry

Step 2 Hardware Processing

Surf5 webserver

Data from website / python server will update and JSON data send via ethernet to process in surf5 hardware.

because this project need run a webserver in SURF5, i use project from example in this tutorial  (thankyou wiznet team). And then try json data, coding json need add new library , in this project use cJson Library provide by daveGamble in their github (thankyou Dave). copy library to folder library and make configuration in cmakelist.txt

 

#cJSON
add_library(cJSON_FILES STATIC)

target_sources(cJSON_FILES PUBLIC
        ${CMAKE_SOURCE_DIR}/Libraries/cJSON/cJSON.c
        )

target_include_directories(cJSON_FILES PUBLIC
        ${CMAKE_SOURCE_DIR}/Libraries/cJSON
        )

target_link_libraries(cJSON_FILES PUBLIC
        SYSTEM_W7500X_FILES
        WZTOE_FILES
        )

Try Json Data

file example WZTOE_WebServer, in file main.c add header cJson

#include "cJSON.h" // Include the cJSON header

 Add a new function to handle JSON data

void handle_post_request(uint8_t *buf, int32_t size) {
    cJSON *json = cJSON_Parse((char *)buf);
    if (json == NULL) {
        printf("Error before: [%s]\n", cJSON_GetErrorPtr());
        return;
    }

    cJSON *led = cJSON_GetObjectItemCaseSensitive(json, "led");
    cJSON *bri = cJSON_GetObjectItemCaseSensitive(json, "bri");
    cJSON *transition = cJSON_GetObjectItemCaseSensitive(json, "transition");
    cJSON *mainseg = cJSON_GetObjectItemCaseSensitive(json, "mainseg");
    cJSON *seg = cJSON_GetObjectItemCaseSensitive(json, "seg");

    if (cJSON_IsNumber(led) && cJSON_IsNumber(bri) && cJSON_IsNumber(transition) && cJSON_IsNumber(mainseg) && cJSON_IsArray(seg)) {
        printf("LED: %d\n", led->valueint);
        printf("Brightness: %d\n", bri->valueint);
        printf("Transition: %d\n", transition->valueint);
        printf("Main Segment: %d\n", mainseg->valueint);
        
        char result[256] = "[";
        cJSON *segment = NULL;
        cJSON_ArrayForEach(segment, seg) {
            cJSON *id = cJSON_GetObjectItemCaseSensitive(segment, "id");
            cJSON *start = cJSON_GetObjectItemCaseSensitive(segment, "start");
            cJSON *stop = cJSON_GetObjectItemCaseSensitive(segment, "stop");
            cJSON *col = cJSON_GetObjectItemCaseSensitive(segment, "col");

            if (cJSON_IsNumber(id) && cJSON_IsNumber(start) && cJSON_IsNumber(stop) && cJSON_IsArray(col)) {
                char segment_str[32];
                sprintf(segment_str, "(%d,%d)", start->valueint, stop->valueint);
                strcat(result, segment_str);
                strcat(result, ",");
            }
        }
        // Remove the last comma and close the bracket
        if (result[strlen(result) - 1] == ',') {
            result[strlen(result) - 1] = '\0';
        }
        strcat(result, "]");
        printf("Result: %s\n", result);
  
    }

    cJSON_Delete(json);
}

after upload, try to respon json data from server, in this case try with thunder client extension visual studio

post data json

{
  "led": 1,
  "bri": 0,
  "transition": 0,
  "mainseg": 0,
  "seg": [
    {"id": 1, "start": 0, "stop": 0, "col": [0, 0, 0]},
    {"id": 2, "start": 4, "stop": 4, "col": [14, 100, 255]},
    {"id": 5, "start": 8, "stop": 9, "col": [14, 100, 255]},
    {"id": 8, "start": 10, "stop": 10, "col": [14, 100, 255]}
  ]
}

receive json data (show in hercules monitor)

POST /test HTTP/1.1
content-length: 317
accept-encoding: gzip, deflate, br
Accept: */*
User-Agent: Thunder Client (https://www.thunderclient.com)
Content-Type: application/json
Host: 192.168.0.24
Connection: close

{
  "led": 1,
  "bri": 0,
  "transition": 0,
  "mainseg": 0,
  "seg": [
    {"id": 1, "start": 0, "stop": 0, "col": [0, 0, 0]},
    {"id": 2, "start": 4, "stop": 4, "col": [14, 100, 255]},
    {"id": 5, "start": 8, "stop": 9, "col": [14, 100, 255]},
    {"id": 8, "start": 10, "stop": 10, "col": [14, 100, 255]}
  ]
}LED: 1
Brightness: 0
Transition: 0
Main Segment: 0
Result: [(0,0),(4,4),(8,9),(10,10)]
1:Listen, Web server, port [80]

Program LED addressable ws2812b Led

After many time to try program with GPIO addressable ws2812b and iam not find solution, finnaly use arduino as controller addressable ws2812b led and then communication serial with SURF5.

Data from result json will send with serial UART0, combine programing in example serial (many thanks again for wiznet). Surf5 send data string [(0,0),(4,4),(8,9),(10,10)].

add new function to add serial UART0 

void UART0_SendString(char *str) {
    while (*str) {
        UART_SendData(UART0, *str++);
        while (UART_GetFlagStatus(UART0, UART_FLAG_TXFE) == RESET);
    }
}

send uart0 from result data json, add data in handle_post_request

UART0_SendString(result);

Pin PA13, PA14 as port UART0 Transmitter and pin digital 2,3 Software Serial Arduino Receiver

 

add function in arduino to parsing data serial from surf5

void parseBuffer(const char* input) {
  int values[20]; // Array to store unique values
  int valueCount = 0; // Count of unique values
  char* token = strtok((char*)input, "(),[] "); // Tokenize the input string

  while (token != NULL) {
    int value = atoi(token); // Convert token to integer

    // Check if the value is already in the array
    bool exists = false;
    for (int i = 0; i < valueCount; i++) {
      if (values[i] == value) {
        exists = true;
        break;
      }
    }

    // If the value is not in the array, add it
    if (!exists) {
      values[valueCount++] = value;
    }

    token = strtok(NULL, "(),[] "); // Get the next token
  }

  // Print the unique values
  Serial.print("Unique values: ");
  for (int i = 0; i < valueCount; i++) {
    Serial.print(values[i]);
    if (i < valueCount - 1) {
      Serial.print(", ");
    }
  }
  Serial.println();
}

Github

result data unique value

Implementation addressable LED ws2812b to board

Cut 18 led addressable, use superglue to mount led with board, and solder pad start from left top and until left bottom.

Test led addressable with data parsing from surf5

Now, papeboard led ws2812b can place in shelf box

Wiring all component

Test Warehouse IOT Monitoring

in webbase, arduino uno component storage at shelf number 1, so if click locate uno, LED addressable in number 1 is on.

Now we check another component, place at shelf number 9, so led number 9 is on.

Video Test (with Indonesian Language)

Documents
  • Github

    All program this project share in sekolahrobot github

  • Schematic

    schematic with fritzing

Comments Write