HORIZONTAL AUTOMATED STORAGE AND RETRIEVAL SYSTEM

This article describes an innovative automated storage and retrieval system (AS/RS) based on Raspberry Pi. It substantiates the grounds of the undertaken subject and presents an overview of existing automated storage and retrieval solutions. Moreover, the machine is described in terms of type and structure of, following the analysis of the kinematics and dynamics, conducted as a part of the project. The article presents the mechanical design of the machine, describes the choice of structural elements and actuators, and develops the control system with an algorithm using Raspberry Pi. Furthermore, an interface based on a touch-screen display cooperating with a single board computer was designed. One of the key features of the device is its modularity and the individual configurability of the storage module, depending on available storage space where an automated storage and retrieval system is to be installed: vertically by defining the number of containers in width and height, horizontally by defining the number of containers in width and depth, horizontally and vertically by defining the number of containers in width and depth, and modules responsible for storage in height. The final stage of the project consisted in verifying the designed solution in tests on a prototype storage device. More precisely, it was tested on a machine prepared for a particular customer and a chosen configuration, which is a combination of the triune manipulator of vertical storage controlled in an open loop.


INTRODUCTION
Warehousing and storage of products is an integral part of the process of production and distribution.Along with the increase in the number of stored objects and their dimensions, conventional storage methods may prove to be insufficient.Each part of the storage process can be improved in terms of efficiency, speed and reliability through automation [9].Main advantages of automation are: reducing the area of storage space and increasing the speed of retrieving and distributing stored items [16].
Classic warehouses used in the industry are increasingly being replaced by AS/RS.An exam-ple of such a machine is shelf storage MonoTower, which allows storage and transport of materials between the place of receipt and the place of storage.The fitted elevator moves rows of shelves to the proper storage.The storage of objects of different overall dimensions is possible due to the height measurement system, which dynamically adjusts the height of shelves for storage to the stored material.The position of the shelves also depends on the frequency of collecting objects [4,11].Shelves can be further equipped with load sensors that prevent exceeding the permissible load for each shelf [1,20].
Another example of storage techniques are circular shelves, divided into shelves with verti-cal and horizontal movement.Those devices consist of several shelves arranged on an industrial truck.When moving storage shelves remain vertical, irrespective of the position.Shelves move like a carousel on an ellipse, the direction of rotation depends on the location of the desired item.
Rotary shelves are used for storage of standardized small-sized objects such as screws, nuts, spare parts, which can fit on the shelves.Automatic devices of this type are equipped with a control panel connected to a database that describes the current state of the warehouse.The disadvantage of these solutions is lack of automatic control of the inventory, i.e. storage and retrieval of items from the warehouse is done by an employee.Any employee errors, such as placing incorrect items in an incorrect partition or incorrectly transcribed in the database, point to the need for periodic inventories [8].

THE DESIGN OF THE AUTOMATED STORAGE AND RETRIEVAL SYSTEM
The article presents the design [3] and the construction of a prototype device [12,13] with an automated storage system, specialised for small objects such as, electronic components and consumer electronics resistant to shocks and scratches, as well as pharmaceutical products, screws, nuts or spare parts that can be placed in standardized containers with dimensions of 38×42×42 mm with a total mass of the container with a cargo up to 500 g (Fig. 1).
The Automated storage system consists of two functional units: • the storage module based on a carousel shelf with storage racks, • the ride platform, with a two-arm manipulator providing three degrees of freedom with an end effector.
Figure 1 shows the horizontal AS/RS capable of selecting a specified number of containers in width and depth.
The device is composed of two functional units.The first is a manipulator with four degrees of freedom.It consists of three parts: the ride platform and a two-arm manipulator at the end, where the gripping device is situated.The manipulator is responsible for transferring containers between the warehouse and the siding place, where the operator can unload or load boxes of stored items.The ride platform was placed on four vertical brackets welded to a rectangular frame base of a storage machine.The main element of the ride platform is a 5-mm-thick aluminium base with four linear bearings attached.The platform moves along linear shafts at a gauge of 150 mm, length of 450 mm and fixed to four vertical brackets of the frame of AS/RS.Power transfer is provided by a drive belt connected to the stepper motor drive of maximum torque equal to 0.4 Nm.In addition, there is a possibility to change the height of the base of the manipulator placed on the moving platform.This change in height is performed by another stepper motor with a screw ratio gear (Fig. 2).
A stepper motor with a planetary gear is placed on the base of the manipulator, which is used to drive the first robotic arm.Moreover, another planetary gear motor driving the second arm is situated at the end of the first 150-mm-long manipulator arm; while, a motor for driving the gripper at the end of the second 150-mm-long manipulator.High Gripper by MakeBlock drives the DC motor, which adjusts the width of jaw clamps.Through the direct power transmission from the motor to the manipulator arms, it is possible to build engines inside the robot, and place roller thrust bearings between the gears and the design elements, which prevent the abrasion of the switch surface and reduce friction [14].The stepper motors with planetary gears provide a self-locking and shift to the value of 0.067°.The use of planetary gear increased the maximum torque to 2.8 Nm (Fig. 3).
The second combination is a module responsible for the storage based on the principle of operation of the vertical carousel storage.The principle of operation of the carousel is similar to a chain where the connecting links are rows while the connectors are aluminium blades on both sides of the carousel.The simi-larity to the chain allows adjusting the amount of rows if required.Two gears can hold four rows of baskets, while four gears, can hold more than eight rows, depending on the gauge between the axes of gears and stiffness of the whole structure.
As shown in Figure 1, there are four rows in the carousel of the machine, each being able to hold four standard 38×42×42 mm containers.The module responsible for storage is attached to a rectangular base frame of the machine.On the base of the module responsible for storing, there are two horizontal brackets with a step motor attached.The engine is connected by a drive belt with a gear wheel.The gear wheel connects a roller with the first gear of the module responsible for storage.The roller bearing is attached on one of the four vertical supports of the structure.
The gear is connected to the next gear wheel of the module, responsible for storage, with a chain of aluminium blades flexibly connected together by means of links.First chain links are connected to corresponding moving links of the second chain with a connector, to which sheet metal baskets for standardized containers are attached That distance between modules responsible for storage and manipulator are is approximately 400 mm, which allows for unobstructed rotation of the carousel and prevents collision with operating manipulator.
One of the key features of the device is its modularity, which makes the device easily adaptable to expectations of customers regarding the volume and shape of the space available for the installation of the AS/RS i.e.: • vertically -by defining the number of containers in width and height, • horizontally -by defining the number of containers in width and depth, • horizontally and vertically -by defining the number of containers in width and depth, and modules responsible for storage in height.Moreover, another additional fastening was introduced in order to individually adapt the device to potential customer demands in terms of defining the geometry (the number of rows and the number of baskets in each row), vertical or horizontal positioning of the module responsible for storage, and also defining the number of these modules placed on top of each other.These fastenings are located in the upper, lower and vertical elements of the construction of the module responsible for storage.In addition, lateral legs were added in order to increase the stiffness of the design in vertical configuration.
The fasteners and screw connections included in the designed AS/RS greatly contribute to extending its configurability.Figure 4 shows the developed AS/RS in basic configuration, with two-wheel gears.Figure 5 shows the machine in vertical configuration, four-wheel gears.

KINEMATIC AND DYNAMICS THEORY
In order to propose a design solution for this type of device, as well as to select appropriate components for the client, it becomes necessary to conduct a detailed analysis of kinematics and dynamics of the manipulator [18].

Kinematic analysis
Spatial transformation between two consecutive links of a manipulator can be described by a set of parameters (φ i , d i , a i , α i ) in Figure 6.The first parameter is the joint angle φ i ,.The second parameter is the link offset d i .The third parameter is the link length a i .The fourth parameter is the link twist α i .The definitions of these parameters are given as follows: α i is the angle from the z i axis to the z i+1 axis measured about x i axis, a i the distance between from the z i axis to the z i+1 axis measured along x i axis, ϕ i the angle from the x i axis to the x i+1 axis measured along z i axis.Technical data is as follows: d 1 -length of link offset, a 1 -length of module 2, a 2 -length of module 3, φ 1 -module 2 joint angle, φ 2 -module 3 joint angle.The frame Ox 0 y 0 z 0 is attached to the base.The frame Ax 1 y 1 z 1 is attached to the base of module 1.The frame Bx-2 y 2 z 2 is attached to the base of module 2.
The frame Cx 3 y 3 z 3 is attached to the end of module 2. The model of manipulator is placed in one plane.These four parameters are known as the Denavit-Hartenberg (D-H) parameters and will be specified for the 3 DOFs arm model in the following section (Table 1).
Forward kinematics refers to the geometrical representation of a coordinate frame located at any part of the manipulator with respect to a fixed coordinate frame, usually attached to the base of ( (2) ( where the four quantities ϕ i , d i , a i , α i are parameters associated with link i and joint i (Table 1).Ai is the homogeneous transformation matrix.By doing multiplication to the equations 1÷3, the equation for the displacement of every module of manipulator is obtained as Equation 4. ( where the homogeneous transformation matrix that expresses the position and orientation of x 3 y 3 z 3 with respect to x 0 y 0 z 0 is called, by convention, a transformation matrix, and is denoted by T 3,0 . ( where c 12 = cos(φ 1 +φ 2 +φ 3 ) and s 12 = sin(φ 1 +φ 2 +φ 3 ).Matrix showed as Equation 5 describes displacement of an end-effector relative to the base frame and orientation of an end-effector relative to the base frame.The 3 DOFs manipulator model is placed in one plane therefore, there exist multiple solutions.

Dynamic analysis
Dynamic property of a robot is mentioned as the changing rate of arm configuration depending on the torque at a joint produced by the actuator.Dynamics of a robot explains the equation for a movement, which is the way of movement when a load is applied.There are two methods that can be used to find the movement equation; Newton-Euler and Lagrangian Formulation [17].Dynamics diagram of the arm model is shown in Figure 7.
The technical data is as follows: F -force of link offset, M 1 -torque motor 1, M 2 -torque motor, l S1 -distance between joint and centroid of module 2, l S2 -distance between joint and centroid of module 3, m 1 -mass of module 1, m 2 -mass of module 2, m 3 -mass of module 3, I 1 -moment of inertia module 2, I 2 -moment of inertia module 3, V 1 -velocity of module 1, V S1 -velocity of centre of module 2, V S2 -velocity of centre of module 3.
Inverse dynamics is used to determine the torque to be applied on a robotic arm to produce the desired movement.Euler-Lagrange equations of motion are then given by Equation 6. (6) where q and Q are generalized coordinates and generalized forces due to applied forces corresponding to the generalized coordinates, respectively.The Lagrangian is the difference between the kinetic and potential energy (Equation 7) of the mechanical system under study, i.e. (7) where L denotes the Lagrangian, and E and U are respectively the total kinetic and potential energy of the system.Note that the kinetic energy depends on both configuration, i.e. position and orientation, and velocity of links of the robotic system, whereas potential energy depends only on the configura-  The velocity equation for each module is calculated based on the kinematics analysis (Equations 12÷14). ( Generalized coordinates are presented on Equations 15-17: These equations are given possibility to define forces and torque motor (Equations 18-20): And then we can calculate: In Equation 15it is necessary to add resistance movement: (28) where: (32)

Kinematic and dynamic properties
Kinematics and dynamics of the robotic hand are simulated using the robotic toolbox in Matlab simulation software.With the input of start and end coordinates, and joint coordinates in the desired trajectory, the remaining properties such as velocity, acceleration and torque are determined.
Basic data for simulation:

SELECTION OF DRIVING MOTORS
Storage actuators are used for moving elements of automata stepper motors.Their selection is based on calculated torque using automata dynamics analysis, taking into account engineering requirements such as self-locking, motor size, small backlash etc.Both robot arms are driven by stepper motors with planetary gearboxes: 14GS13-0804S-PG19 and 17GS13-0404S-PG27.Stepper motor made by MICROCON with 1.4 Nm torque is used for carousel drive.The moving platform for manipulator is similarly driven by a stepper motor with 0.35 Nm torque via toothed belt.

AS/RS MACHINE CONTROL SYSTEM
The storage and retrieval machine is controlled with a touch screen.The user can choose one of three operating modes to start a series of commands for the database and the motor driver.
We can distinguish three operating modes of the storage machine: • adding new item, • removing selected item, • picking an item from storage.
The program also enables direct insight into the database and manual control of automata drives.

System components
The control system consists of two control units and two mechanical assemblies making up the whole machine [10].
The master controller or Raspberry Pi is responsible for generating control commands for the slave controller based on a 32-bit microcontroller.Control commands are generated and sent following user commands issued vie touch screen.The relations between automata components are shown on the block diagram presented on Figure 13.

Motor control algorithm
The stepper motor converts a series of electric impulses into a series of angular rotations.There is proportionality between the rotation angle of the motor shaft and the number of electric impulses as well as between the rotation speed and impulse frequency.
Rotation of motor shaft happens when a specific sequence of coil switches is achieved, making the shaft change its rotation in a stepping fashion.The step angle has a constant value, which commonly amounts to 1.8°.The major advantage of the stepping change of the rotation angle is a constant torque hold during shaft movement.However, the most serious disadvantage is the necessity of creating a control sys- The transformation allows us to recreate the linear velocity profile using a step change in rotation of the motor shaft.This gives a smooth acceleration and deceleration of the motor [5,7,19].

User interface
Raspberry Pi software allows sending commands to a slave controller and database management regarding stock levels.The user picks which item he wants to take or place in storage via touch screen.The software also makes it possible for the user to take manual control over the motors or have an insight into the storage database.
The software was written in the Python language, one of the most popular programming languages.Python gives provides uncomplicated creation of applications for embedded systems.Owing to such libraries as Qt, the process of writing the user interface is reduced to necessary procedures and event-handling algorithms.
In the main menu interface the user can choose the mode or turn off the machine control application (Figure 14).
Manual control allows the user to control the individual links of the manipulator.Before sending commands, the user has the possibility to check current configuration of the manipulator and the carousel.Manual control enables also homing of moving modules of the machine (Figure 15).The database holds records of stored item, including the name and number of items, their weight and total weight of all items in one container, derived from the built-in scales.The list of items is stored in a generated text file, giving insight into the database and its modification even in the case of power cut.In the lower left corner, the number of free storage containers is displayed (Figure 16).

Storage database
Acquired data, i.e. either manually entered by the user or automatically collected object parameters, such as mass measured by the built-in scales, is stored in a file.saved on the memory card used by the Raspberry Pi.The user can access the database through the interface of the program, however, any changes to the file are entered by the control algorithm.The database includes information such as: • the name of the stored item, • the number of items, • total mass of all items in one container, • weight of one item, • description of the item.
Total weight is measured by the weight localized under the pick-and-place platform.The

Storage control boards
The electronics of the AS/RS are divided into two drivers.The driver of motors, lighting and weight is based on a microcontroller STM, it is responsible for carrying out instructions from the master controller.The second driver is the Raspberry Pi, controlling the touch display and managing the storage database.Its main task is to generate commands for the first driver on the basis of data entered by the user.The main component is a 32-bit microcontroller STM-32F446RE clocked at 180 MHz.The microcontroller is a part of NUCLEO module, which is equipped with the necessary passive components and output signal pins.It is connected to four stepper motor drivers, and generates the appropriate sequences of control signals based on the predetermined direction of rotation and trigger signal.The motor operating the jaw clamps of the gripper is controlled by a single-channel controller DRV8835, hence, jaws are controlled with a PWM signal.Communication with the master controller takes place according to the RS-232 standard.
Raspberry Pi is a popular single board computer, equipped with a 900MHz processor ARM Cortex A7 RAM and 1GB equipped in a Linux distribution operating system, Raspbian.Programs written for the Raspberry are run just like on any other computer, assigned by the icon or using the commands in the command line.Raspberry Pi has 40 I/O outputs, which allows the use of the Raspberry as a microcontroller.Built-in serial communication standard RS-232 is used in this case to communicate with the slave controller.
The user communicates with a computer via the touch screen and keyboard.This allows for easy usage of the control program, without having to manually enter control commands.Figure 17 shows the connection diagram between the drivers of stepper motors and the gripper DC motor with the NUCLEO module.

PROTOTYPE CONSTRUCTION
The prototype was built in accordance with the design.The entire support structure is made with the use of standardized aluminium profiles, with a side of 15 mm.The manipulator arm was made of solid aluminium with motor mounting holes.The length of the first manipulator arm is 1500 mm and the second arm is the gripper mounting element for the planetary gear shaft.Manipulator arms are made of 5-mm-thick aluminium.The carousel gears are made by means of 3D printing technology [2,15].The locking elements and attachment of the carousel rows are made of ABS [6], and individual baskets were cut and bent to shape from a 1.5-mm-thick steel sheet.The main element of the moving platform The electronic components are placed behind the carousel in a protective enclosure.The housing includes two DB44 connectors, and a USB input.On the front there is a switch with a power socket.Cables for motors, limit switches and communication cables are guided in elastic cable carriers along the machine support structure.A cable carrier is placed along the linear track chain, so as to prevent damage to cables during the movement of the platform (Figure 18).

PROTOTYPE TESTING
The verification of the machine operation was carried out to determine the positioning accuracy and repeatability of the end effector.The tests were divided into five stages, in which the AS/ RS machine was tested under different loads and speeds of movement; the following stages can be distinguished: • measurement at half the maximum movement speed of the manipulator and carousel, • with no load gripper • with gripper load of 100 g, • with gripper load of 200 g, • with gripper load of 300 g, • measurement at the maximum speed movement of the manipulator with no gripper load.The maximum angular velocity of the manipulator arms is 220 deg/s, the carousel 50 deg/s while the maximum linear speed of the moving platform is 75 mm/s.
The first test is related to accuracy and repeatability of the machine for half the maximum speed of movement of the manipulator and the carousel without gripper load.The test involved the end effector positioning of the manipulator so that the container is located between the gripper jaws.Each test showed that there is a deviation in the distance between the commanded and attained positions.The difference is measured between the jaws of the gripper and the sidewall of the container.The spacing between the jaw and the container should be equal to 5 mm.The tests show that the largest deviation from the desired position is exhibited by the outermost container from the point of basing the manipulator (Figure 19).For the outermost container, or container number 16 the deviation amounts to 4.8 mm ± 0.1mm.Due to such large deviation of the gripper positioning there is a possibility of collision with containers 16, 12 and 8.
Machine repeatability is determined based on the data obtained by the accuracy measurement.Repeatability is defined as the size specifying how close the machine can reach the previously attained position.The average repeatability is in The test results measuring the accuracy and repeatability of the machine for half of the maximum movement speed of the manipulator and the gripper load of 100g show that upon increasing the gripper load, the accuracy of the machine de-creased.The maximum average deviation from the desired position amounted to 5 mm ± 0.1 mm.The decrease in the accuracy of movement applies to all containers placed in the carousel (Fig. 21).
The average value of the repeatability did not change upon addition of a 100 g load.Repeatability chart for the carried out tests in shown in Figure 22.
Accuracy in the case of a 200 g load takes the same value as in the case of work load 100 g.Increasing the load caused no decrease in the accuracy of the machine (Fig. 23).
As to the machine accuracy and repeatability, it was unaffected by the increased load.The average value of repeatability is in the range of <-0.1 mm, 0.1 mm>.Repeatability change is shown in Figure 24.
Increasing the load from 200 g to 300 g caused a decrease in accuracy, particularly visible moving towards the outermost container (Fig. 25).The value of average deviation in the case of container 16 is equal to 5.9 mm ± 0.1 mm, which results in an increase in deviation of the movement with the 200 g load of 0.7 mm.Similarly, average repeatability deteriorated.In the case of a 300 g gripper load the mean value of the repeatability is in the range of <-0.2 mm, 0.2 mm> (Figure 26).
The accuracy and repeatability test results for the maximum movement speed of the manipulator and the carousel without load is shown in Figure 27.Increasing the speed has a negative impact on the positioning accuracy of the end effector.The value of the average deviation for the last container is equal to 5.4 mm ± 0.1 mm.
The value of the average repeatability of the machine is in the range of <-0.1 mm, 0.1 mm>, as in the case of the movement at half the maximum speed (Figure 28).

CONCLUSIONS
This paper has given a general review of vending machines and automated storage systems, and given an account of the design and construction of an innovative AS/RS system based on the Raspberry Pi.The innovative nature of our solution is confirmed by the patent application for the developed automated storage and retrieval system.
The article presents the crucial stages of designing the system: the necessary calculations of kinematics and dynamics, the selection of motors, and the process of its implementation, including the project of electronics and software.Control algorithm runs in a closed-loop.The proposed solution allows the complete exclusion of the need for operator intervention in the disposal of objects and their removal and placement in the warehouse.
One of the most important features of the device is its modularity and the ability to individually configure the module responsible for storage, depending on the available storage space in which it is possible to install an automated storage and retrieval system, i.e.: • vertically -by defining the number of containers in width and height, • horizontally -by defining the number of containers in width and depth, • horizontally and vertically -by defining the number of containers in width and depth, and modules responsible for storage in height.
The major part of the work consisted in building a prototype and performing tests of its operation.
Due to the possibility of individual adjustment of the automated storage and retrieval system to the expectations of future customers, the article describes in detail the construction of the prototype in one of the selected configurations, and conducted elaborate tests of its operation.The tested solution is a combination of a three-link manipulator and vertical storage.In the tested configuration, an open loop control was used, i.e. without feedback on the angle and the speed of the stepper motors' shafts rotation.The tests have shown that the actuators without feedback control system recreate desired trajectory with a deviation ranging from 1.7 to 5.9 mm, depending on the load and movement speed of the manipulator and the carousel.

Fig. 2 .Fig. 3 .
Fig. 2. The trolley (view from the top on the platform)

Fig. 19 .Fig. 20 .Fig. 21 .
Fig. 19.Positioning accuracy change chart during 10 tests for no-load at half maximum movement speed of the manipulator and carousel

Fig. 22 .Fig. 23 .Fig. 24 .Fig. 25 .
Fig. 22. Repeatability change chart during the 9 tests for the work load of 100g at half the maximum movement speed of the manipulator and carousel

Fig. 27 .Fig. 28 .
Fig. 27.Positioning accuracy change chart during 10 tests for no-load maximum movement speed of the manipulator and carousel

Table 1 .
D-H parameters of the manipulator