Plastic Injection Machine: How to Implement our Software Architecture

Capstone project 2020
Muhammad Rafay Ashfaq (Electrical Engineering) and the team working on their Capstone project.

1. Introduction

For our capstone project, my colleagues and I worked on improving an existing  Plastic Injection Molding Machine from an electrical and mechanical engineering standpoint. Maintaining the machine’s overall vertical layout, an improvement in its usability and performance was required. To improve its user friendliness, The new design includes wall mounting capability with position height control, electric screw jack to provide a force up to 1000N, PID band-heater temperature controllers and a touch interface to operate these systems. Unfortunately due to COVID-19 restrictions, we were unable to implement the screw-jack feature but you will find it in the schematics and it is an important part of the overall design. 

This blog post will provide you with instructions on how to set up your very own injection machine electrical architecture based on our redesign and give you an understanding of how the different components come together to operate as one.


3D model of the designed injection machine.

2. Components Required

The brains of the machine are the Raspberry Pi and Arduino. The pi runs the User Interface while the Arduino runs the PID heating system. For our project we used Raspberry Pi 3 and an Arduino Uno. With slight modifications, all Arduino versions can be employed to our use. 

The basic materials required are therefore: 

      1. Raspberry pi
      2. Raspberry pi touch screen
      3. Type-K thermocouple
      4. Sparkfun MAX-31855K temperature sensor
      5. Arduino Uno
      6. SSR relay
      7. Band heaters
      8. Switch
      9. Some cables

A detailed version of this list is available here.

3. Operation and Schematics

The raspberry pi is responsible for running the interface. Interface graphics are interactive and feed information serially to the Arduino that runs the heating system.

electrical diagram
The code for the raspberry pi (python), Arduino (C++) and the electrical wiring diagram (see screenshot above) can be found here.

The heating system consists of the Arduino, heaters, temperature sensors and relays, all of which work in unison to achieve the required temperature. The comments on the code will help you understand what the function of each  line is. To put it simply, the temperature sensors read the current temperature, and if it is lower than the set-point (which is set using the interface), the code will turn the relays on until the required temperature is reached. Our version uses 2 temperature sensors, one is attached to 3 band-heaters and one is attached to 2. More can be added as per your requirements.

The raspberry pi runs the interface on a python script. The script also provides serial communication between the Arduino and raspberry pi. Temperature information is sent to the Raspberry pi to be displayed on the Interface and set-point information is sent from the interface to the Arduino for the heating system.

4. Detailed Setup Instructions

The first step is to download and install an operating system of your choice into your new raspberry pi, or use whatever is existing. Once that is done it is a good idea to install vncviewer to make the setup easier and allow for remote control. You must also install Tkinter, time, syslog and serial libraries using apt-get. These are necessary for the interface. The instructions for this installation can be easily searched online and the process does not take very long. You can install Arduino IDE to upload code to the Arduino but a laptop can also be used.

Following this, you must set up a touch screen on your raspberry pi to interact with the interface and send commands. The screen should come with a set of unique instructions to be followed. For our project, a 4 inch screen was used, other sizes can be made compatible after making slight changes to the code.

Our code specifically works with the MAX31855K by SparkFun. To purchase them click here. The schematics can be used to wire the sensor together with all the other components. The Arduino code comments will also help you wire the chip to the right inputs and outputs.

After everything is wired,  you can connect the Arduino to any port on the raspberry pi and the script will detect which one the Arduino is connected to automatically. To run the interface, it is best to use terminal to execute the commands.

The following UI was implemented on our machine:
user interface

5. Support

For any questions regarding installation, please feel free to contact me at mrafay.ashfaq@nyu.edu