Programmable System on Chip Distributed Communication and Control Approach for Human Adaptive Mechanical System

: Problem statement: Communication and control are two main components in any Mechatronics system. They can be designed either by centralized or decentralized approach. Both approaches can be chosen based on application designed and specific requirements of the designer. In this study, decentralized or normally called distributed approach was selected to solved communication and control of a human adaptive mechanical system namely Intelligent Chair Tools (ICT). The ICT seating system is powered by thirty six intelligent pneumatic actuators to facilitate investigation of chair shapes from spring and damping effect of seating and backrest surface. Three studies are proposed from the sitting experiments namely chair shapes, chair spring and chair damping properties. Approach: PSoC microcontroller was selected based on its features of having configurable analog and digital blocks. Its flexible modules and programmable peripherals ease designer in designing the communication and control of ICT in improved and faster way. Three protocols of USB, SPI and I 2 C were used for the communication system of ICT using PSoC. Flow charts of each communication protocols algorithms were discussed. On the other hand, the control system used PSoC’s ADC and counter modules to read inputs of pressure and encoder respectively. PWM module is used to control the valve and data communication was achieved using I 2 C module. Block diagram of unified control was discussed for further understandings of the control algorithms. Results: The PSoC specification, development design and experimental evaluation of ICT system are presented and discussed. Three studies of chair shapes, chair spring property and chair damping property from sitting experiment were shown. Conclusion/Recommendations: The PSoC microcontroller selection was discussed and application of its distributed communication and control was successfully applied to ICT. This distributed approach can be applied to other application suitable for local control approach for easy debugging, more modular design and intelligence in deciding output based on feedback inputs.


INTRODUCTION
Programmable System on Chip (PSoC) represents a whole new concept in microcontroller development. The mixed signal arrays of Cypress integrate an 8 bit microcontroller with analogue and digital components in an embedded system. This architecture allows designer to create customized peripheral configurations to match the requirements of each individual application making PSoC different from other microcontroller (Jayapandian, 2006;Micakovic, 1998). This difference makes it now being applied not only to industrialized application in user end tools but also used as subject syllabus in educational subjects. Additionally, a fast CPU of 24 MHz, 16 kb of Flash program memory, 256 bytes SRAM data memory and configurable Input/Output (I/O) are included in a range of pinouts. The configurable logic allows designer to create serial port, timer, PWM generator and other devices and ability to choose the suitable clocking frequency easily without any additional circuit. The technical reference manual contains a block diagram that illustrates this structure as shown in Fig. 1 (Cypress Semiconductor, 2006).
Many researches had applied PSoC as the technology to ease in designing process. For instance, Bachinskyy (2006) had created a voice player with an Adaptive Differential Pulse-Code Modulation (ADPCM) Decoder. The device used ADPCM for sound compression to play voice recording downloaded to the external Flash memory via a USB interface. PSoC is also used in devices as simple as Philips's Sonicare toothbrushes and Adidas sneakers. New models of Adidas sneakers can adjusts the cushioning of the shoe to the runners' style and the running surface via an embedded PSoC. Therma Blade also makes a replacement ice hockey skate blade that heats up to reduce friction between the blade and the ice surface, increasing its performance. These devices are controlled by PSoC (Faulkner, 2007).
In this research, PSoC was used to realize distributed architecture of communication and control for a human adaptive mechanical system namely ICT. The distributed architecture applying several PSoC enables multitasking and parallel processing of the microcontroller. This will increase efficiency of the data processing and giving shorter access time. In this distributed approach, each PSoC has its own private memory and information is exchanged by passing data between the microcontrollers. By applying this methodology, the overall system will be enhanced with simpler connections and reduced the numbers of wires between PC and the ICT system. The proposed ICT system which consists of multiple actuators is built to facilitate investigation of ergonomics chair shapes by adapting with human characteristics. Various studies have been done on sitting postures and shapes of chairs resulted in many different points of view in designing them. Goossens and Snijders (1995) reported that the inclination angles of backrest and seat are among important design criteria. On the other hand, researchers such as Vergara et al. (2006) and Lengsfeld et al. (2000) claimed that mobility of lumbar spine is important in improving comfort by locating the lumbar spine curvature on chairs properly. Reichel (1958) started to focus the attention on shear force, defined as a force parallel to a surface which relates to the chair design. Nevertheless, literatures on research tool developments are still less and application of the theories are more on simulation and mathematical modeling and derivation. The need for research tool Communication of the whole system uses three communication protocols on the communication board, while the control algorithm of the system was done on the circuit board mounted on each intelligent actuator. The states of each actuator are locally controlled using PSoC microcontroller. This will make the system having high reliability and intelligent to decide the output from the input given by the interaction of human weight and body shape.

Intelligent chair tool:
The ICT structure is made of aluminum pillars and plates. Two aluminum plates formed the base of seat and the backrest as shown in Fig. 3. On each plate, sixteen and twenty intelligent actuators are mounted for seat and backrest panel respectively. The numbers of actuators on seat and backrest panel are decided based on the surface of human sitting area and human back to be covered. The ICT can support user weight of more than 120 Kg with ability of each actuator that can support up to 12 Kg weight. ICT is equipped with only two lines of communication and air line. The distributed approach reduces the numbers of wires in the communication lines making it reliable for any movements. Previous work detailed the development of intelligent actuators and ICT (Faudzi et al., 2009a).
For air system, the air compressor sends the air supply to the system and regulated by air regulator to stable 0.6 Mpa air pressure. The air is connected to the actuator and will be driven by the PWM duty cycle on the PSoC control board to control the valve movement.  Figure 4 shows the communication board which consists of main circuit and sub circuit. On the main circuit, an EZ-USB connector and a USB/SPI_M PSoC are assembled. On the other hand, 4 pieces of SPI_S/I 2 C_M PSoC, power supply connection and four I 2 C connectors are attached on the sub circuit. All together, five pieces of PSoC CY8C27443 chip were used for the communication board. C programming was employed for easier implementation and fast execution using PSoC Designer software. Both PSoC in main and sub circuit applies SPI modules. The different settings of master and slave differentiate the main circuit and sub circuit function. shows system configuration diagram of ICT communication system. The communication protocol between PC and communication board applies USB protocol. Then, SPI protocol communicates between master and sub circuits. Finally I 2 C protocol is performed between sub circuits to the ICT system. I 2 C protocol only needs two connectors which are Serial Clock Line (SCL) and Serial Data Line (SDA) thus reduces the number of wirings for the system.
The USB/SPI_M PSoC apply USB and SPI Master communication modules. This PSoC realizes USB protocol from PC and initialize data transferring using SPI to send data to sub circuit. From the main circuit, the SPI protocol is applied between four chips on the sub circuit SPI_S/I 2 C_M. Each chip contains SPI_Slave and I 2 C_Master modules. These chips will receive data from SPI Master and initialize data to be sent through I 2 C protocol. The I 2 C protocol communicates in serial connection with the actuators on the ICT. The I 2 C protocol communicates in serial 8, 8.10 and 10 links to make combination of all thirty six links of actuators. This methodology allows distributed data transmit and receive from PC to ICT and vice versa. The numbers of PSoC in sub circuit was decided based on the data transfer capability of each protocol of USB, SPI and I 2 C and numbers of actuators on ICT. The control functions are performed locally in each actuator for high reliability of data transfer and control in real time. Each actuator controls the valve movements from the sensors input and communicates through I 2 C communication.
The I 2 C_S PSoC on each actuator is equipped with I 2 C slave module to receive and transmit data back to the communication board.
Flow chart of algorithms: USB/SPI_M PSoC: Figure 6 shows the flow chart algorithm for the USB/SPI_M PSoC. The USB communication protocol from PC was realized using EZ-USB connector. When the communication is occurred, USB flag will be set to 1 and program will start to receive data from PC through the USB connection. The sending data are 108 bytes of data which are the 3 initial data of position, stiffness and viscous coefficient to 36 actuators. These data are also ready to be sent through SPI interrupt function. SPI_M will wait for SPI_S signal to sent the data. Here, the data is divided to four (24, 24, 30 and 30 bytes each) to the SPI_S/ I 2 C_M PSoC. Wait time is included in between sending and receiving data. Once SPI_Master receive the data (length and pressure data) from SPI_S/ I 2 C_M PSoC, the data will be sent back to PC through USB protocol. The above procedure is repeated and flag check is done for the communication confirmation.  Fig. 7. This PSoC program consists of two parts of SPI interrupt and I 2 C communication. Four pieces of this PSoC will have the same algorithm with different values of data handling. Two PSoC will receive 24 bytes of data and another two will receive 30 bytes of data. The data amount is different depending on the connected actuators from each PSoC to I 2 C connection in 8 or 10 links. The data from USB/SPI_M PSoC will be sent to this PSoC once the interrupt loop is occurred. The interrupt route will receive signal of read and write data from the SPI_Master. If the interrupt loop receive data, it will set flag (a), a = 0. Setting of a = 1 will be done after data transmit was succeeded.
Concurrently, after sending and receiving data from USB/SPI_M through SPI interrupt, the program will initiate I 2 C communication and check the values of flag (a). If the values of a = 1, which means one loop of data transfer finishes, the next communication protocol of I 2 C will take place. Sending and receiving data will be carried out using I 2 C master and correspond with I 2 C slave connection. This procedure is repeated and flag (a) value is checked for continuity of the program to receive and transmit data. Distributed PSoC control system: The PSoC control system is programmed on I 2 C_S PSoC circuit board which is attached to every intelligent actuator. The intelligent actuator developed is equipped with five elements of encoder, pressure sensor, valves, laser stripe code and PSoC control board. Hardware design of the intelligent actuator and details of parts used are presented in previous research (Faudzi et al., 2009b). On the actuator, two types of sensors are applied. A micro optical encoder chip is used to detect cylinder rod position and a pressure sensor is used to detect the chamber pressure reading. For driving the cylinder movements, two unit valves of two ports, two positions (2/2 valves) are used by manipulating Pulse Width Modulation (PWM) cycles. The laser stripe codes enable the cylinder to detect its motion through the encoder thus determining the position value. Figure 8 shows the front and back side of the control circuit board. On this board, several supporting components are assembled. The input voltage, 24 V is used to drive the valves in controlling the actuator movements and to supply the pressure sensor. A voltage regulator is used to regulate 5 V for the PSoC. An LED will indicate the circuit is in working condition and 2 pairs of Darlington pair are used to drive the valve from PWM signal. There are 5 connectors attached at the board to be connected to valves, pressure sensor, 2 for power supply and I 2 C communication and 1 for re-burning programs. Figure 9 shows the schematic diagram of the I 2 C_S PSoC control board. Five PSoC modules, 2 for inputs, 2 for outputs and 1 for communication are used. The inputs are from the MEMS encoder and pressure reading. The encoder will read the laser stripe code on the guide rod and send the signal to counter module inside PSoC to decide the position of the actuator stroke. Whereas a miniature pressure sensor will read the chambers pressure for feedback through ADC module. The outputs parts of the system are the duty cycle from PWM module to drive the valves and output signal from I/O module to LED. I 2 C module inside PSoC was used for the communication between intelligent actuator and the communication board. PSoC has ability of embedding both digital and analog modules in a single chip thereby making the development process of the actuator communication and control easier. I 2 C_S PSoC control algorithm: This PSoC controls the input and output of the actuators to provide the three characteristics of shapes, spring and damping. The position can easily be controlled by setting the target position, X r and comparing the current position reading from the encoder. The error value will be minimized using PI control and the valves will be driven based on the PWM duty cycle. On the other hand, damping and spring characteristics were realized using Voigt model where a viscous damper and purely elastic spring are connected in parallel (Meyers and Chawla, 1999). An ideal spring-damper system with stiffness, k s and viscous damper of damping coefficient, c is subject to a spring force, F s : and a damping force, F d From Eq. 1 and 2, the equation that relates spring and damping characteristics is given below: where, F r , k s , x, c and x ɺ are corresponding force, stiffness, position, viscous coefficient and speed respectively. By combining all three characteristic of position, spring and damping, the equation of corresponding force, F r is given below: This equation is shown in the control block diagram as in Fig. 10. The control system is designed inside PSoC with an inner loop to control force by receiving chamber pressure feedback, while an outer loop of position control for tracking the desired position and commands desired force to the inner loop.

Fig. 10: Control block diagram
A PI controller is used in the force control loop to minimize the error and gives certain PWM duty cycle to drive the valve. PWM module in PSoC drives the on/off valve and moves the actuator to achieve the control objective. The actuator designed will realize this spring and damping characteristics with the mechanical effect from the pneumatic system for the ICT function.

RESULTS
Sitting experiment: From the communication and control of ICT system, sitting experiment was done to study the shape, spring and damping effects to User A. Fig. 11 shows User A with weight of 80 Kg and height of 178 cm.
The control principle used in this experiment applied Eq. 4. The values of position, X r , stiffness, k s of spring property and viscous coefficient, c parameters of damping property will be changed to see the response to the user.
Chair surface property: Using ICT, the initial surface of seat and backrest can be set by giving target position, X r from PC to all 36 intelligent actuators. Different user have different height, therefore various initial setting can be done before the sitting experiments. One indication of correct setting of sitting height is from toe to the popliteal area (Lueder and Noro, 1994). Several chair shapes also can be changed easily using the position control in PSoC. Two different shapes are shown in Fig. 12. Figure 12 (left) shows flat surface of backrest and seating panel with 95° inclination between each panel and Fig. 12 (right) shows non-flat surface with 105° inclination between each panel.
Flat surface chairs are normally used in schools and offices while inclination type chairs are used in automobiles. Being able to adjust initial position of the seat, backrest panel and the desired angle easily, the targeted application of the chair design can be decided. From Fig. 13, the surface of backrest and seat panel deforms from plate's movements (red square). The blue dotted line which is the connection of each plate's centre point displayed the changing surface for easier understanding.
Chair spring property: For this study, the user will sit on the ICT with position, x, stiffness, k s and viscous coefficient, c that are set apriori from PC. Values of stiffness are changed while other parameters are kept constant. Figure 14 shows the responses for four stiffness values; two for seating panel, k s 1 = 6 N mm −1 , k s 2 = 2 N mm −1 and two for backrest, k s 3 = 1 N mm −1 , k s 4 = 0.5 N mm −1 at constant value of viscous coefficient c = 0.2 Ns mm −1 . Stiffer spring values are set to seat panel because the seat panel will support the weight of the user in normal position. Initial position for backrest is x1 = 180 mm and x2 = 95 mm for seat panel. The angle between seating and backrest panel is 95°.  Fig. 14 we can study the spring effect to the user where different values of stiffness will give different surface shapes. Bigger k s value will give stiffer spring responds and less displacement from the initial position. However, less stiff values follow contour of the body giving more comfort effect. The user's comfort is confirmed with interview session during the test. From the shapes of the chair surface, we can see that the user has curved body back (a) and need equivalent value of stiffness to support his back. The lumbar curve also can be identified roughly at point (b).
Current experiment proves that the spring property was realized using ICT. Further analysis is needed to study the suitable range of stiffness to the target user. The actuators also succeeded in realizing this function from the communication and control of PSoC.
Chair damping property: Damping study involves dynamic movements of the user. The effect of damping can be seen during the initial sitting process. The damping function will absorbs the user weight giving more comfort to the user and act like absorber of cars. In this study, damping effect is focused only on the seat panel. The user was asked to sit on ICT with same sitting style (sit normally) at two different viscous coefficient values. The values of viscous coefficient is varied at c 1 = 0.2 Ns mm −1 , c 2 = 0.6 Ns mm −1 and the stiffness is kept constant at k s = 6 N mm −1 . The initial seating height is set at 95 mm suitable to the user's height. Figure 15 and 16 show the responses of seating panel for the user at different viscous coefficient, c in 2D side view perspective. The feedback data of position from each actuator are used to present these data for this function. From Fig. 15 and 16, in each 0.1s time change, we can see that bigger viscous coefficient (c 2 = 0.6 Ns mm −1 ) supports the user weight better compared to smaller c, c 1 = 0.2 Ns mm −1 . Different line colors represent the chair surface condition in each time. This shows that the damping property also influences the shape of the seating panel.