Home

Digital Waste Management System - UBC Sustainability

image

Contents

1. The application should initialize the indicator and button panel refer to tests UI3 3 and UI3 4 UI6 3 If the indicator fails to initialize the application should return back and allow the user to connect again UI6 4 If the button panel fails to initialize the application should return back and allow the user to connect again UI6 5 If the user cannot connect to the server after 10 seconds the application should return back and allow the user to connect again UI6 6 If the user closes the settings window the application should terminate UI7 Log UI7 1 If the user successfully connects and initializes the application a log window should show up UI7 1 1 Errors and successful weight measurements should be displayed on the log window UI7 1 2 Errors and successful weight measurements should be saved to a log txt file in the selected file directory UI7 1 3 Successful weight measurements should be saved to a yyyy mm dd txt file where yyyy is the year mm is the month 01 to 12 and dd is the day 01 to 31 UI7 1 4 Unsuccessful weight measurements should show an error on the log but should not be saved in the yyyy mm dd txt file UI7 2 If the user closes the log the application should fully terminate UI7 2 1 The server connection should be closed UI7 2 2 The indicator and button panel serial ports shou
2. Purpose Writes a string to the serial port to send Input data The string to send public synchronized void sendData String data try output write data getBytes catch IOException e e printStackTrace Purpose Writes a byte of data to the serial port to send Input data The byte to send public synchronized void sendData byte data try output write data catch IOException e e printStackTrace Purpose Event listener for the serial port used for receiving and parsing data Input event The serial port event public synchronized void serialEvent SerialPortEvent event Overridden in the child classes WasteTable package server import java sql Connection import java sql Date import java sql PreparedStatement import java sal ResultSet import java sql SQLException import java sql Statement import java sql Time public class WasteTable private static final String CreateTableWasteManagement CREATE TABLE WasteStreamManagement WasteStream CHAR 20 dDay DATE dTime TIME 0 weightnum float 2 WID INT IDENTITY 1 1 NOT NULL PRIMARY KEY WID private static final String DropTableWasteManagement DROP TABLE WasteStreamManagement private static final String createSequence CREATE SEQUENCE WIDCounter n START WITH 1 n INCREMENT BY 1 public void createWaste Connection con throws SQLException Statemen
3. 7 Scale com v 8 Button Panel com v 0 Refresh Available Ports r Waste Streams 10 v Stream 1 Recyclables 11 Tare 12 5 2 kg 13 Enable second tare 14 kg v Stream 2 Paper Tare 12 5 kg Enable second tare kg v Stream 3 Organics Tare 12 5 kg Enable second tare kg v Stream 4 Other Tare 12 5 kg Enable second tare kg Stream 5 Tare kg Enable second tare kg r8 T5 Fo Start Application Start in Offline Mode Save Settings The numbers in red show the different settings and fields Username The server account username Password The server account password IP Address The IP address of the server Port The port on which the server is hosted on Database name The name of the SOL table to be used by the server Note If the table name does not exist a new table will be created 6 File directory The folder in which the log and backup files will be located Press Browse to open up a window to select a folder or type in the directory manually 7 Scale serial port The serial port that the indicator is connected to Note You will need a null modem on one end of the RS 232 cable connecting the indicator and the computer 8 Button Panel serial port The serial port that the button panel is connected to 9 Refresh If a serial port has been added and is not in the drop down lists press this button to repopulate the lists aa
4. i amp amp buffer 3 t initialize Appendix C Testing Documents and Other Documentation Main Application Testing Document Note Many test cases will require a weight measurement The values to be used for each of these test cases marked with an asterisk will be all applicable combinations of Streams 1 5 Tares 1 2 Weight 10 0 1 0 0 100 0 1 over capacity Take note of any failed tests and their input values at the end of this document User interface testing UI1 Server login UI1 1 User should be able to log in given the correct username and password combination UI1 2 User should not be able to log in given the incorrect username and password combination UI1 2 1 User should receive a message alert given an incorrect username and password combination UI1 2 2 User should be able to try to log in again after a failed attempt UI1 2 3 Given that three failed login attempts have occurred the application should notify the user that they have made too many failed login attempts and terminate UI1 3 Given a successful server connection SQL table CapstoneWasteManagement should be created given that it does not exist UI1 3 1 If the SQL table does exist no new table should be created and the previously existing CapstoneWasteManagement table should be used UD File directory UI2 1 User should be able to specify a fi
5. mode 0 else mode 1 System out printin Error Expected gross weight measurement return 6 Parse the status bits switch data substring 14 16 case status 0 break case CZ status 1 return 6 case BZ status 2 return 6 case MO status 3 return 6 case OC status 4 return 6 default status 1 System out printIn Error Invalid status bits return 6 Get the date calendar new GregorianCalendar time new Time calendar getTime getTime date new Date calendar getTime getTime return 0 System out printin Error Expected a 17 character string return 6 Purpose Prints a ticket containing all of the weight data collected Il on the console public void printWeight synchronized indicatorLock if mode 0 System out printIn The indicator was not in gross measurement mode switch status case 0 System out printIn this toString break case 1 System out printin The weight was too close to 0 break case 2 System out printin The weight was negative break case 3 System out printIn The weight was taken while the load was unstable break case 4 System out printin The weight was over capacity break default System out println There was some error break Purpose Sets the confirmation flag so that the next weight sample will Il be saved public void setConfirmation
6. try wasteTable createWaste getConnection catch Exception ex Attach the server to the indicator driver indicator withServer getConnection wasteTable Set the file path indicator setPath directoryField getText Connect to the COM ports if indicator connect indicatorPort 0 else System out printin Scale successfully connected JOptionPane showMessageDialog mainFrame Failed to initialize scale serial indicator close control close return if control connect controlPort 0 Send an initialization message control sendData Init n System out printIn Initializing button panel Check for a response for up to 5 seconds for int i 0 i lt 10 i if control getlnitialized break else try Thread sleep 500 catch InterruptedException e1 e1 printStackTrace if control getlnitialized System out printIn Button panel successfully initialized else System out printin Failed to initialize button panel JOptionPane showMessageDialog mainFrame Failed to initialize indicator close control close return else JOptionPane showMessageDialog mainFrame Failed to initialize button panel indicator close control close return Start reading from the scale indicator setUpTimer Done setting up hide the main window mainFrame dispose Show the log UI logUI showLog conne
7. Repopulate the list for int i 0 i lt portList length i indicatorField addltem String portList i controlField addltem String portList i Select the first element by default indicatorField setSelectedIndex 0 controlField setSelectedIndex 0 Il Iterate through and see if the old item could be found for int i 0 i indicatorField getltemCount i if indicator equals String indicatorField getltemAt i f indicatorField setSelectedIndex i for int i 0 i lt controlField getltemCount i if control equals String controlField getltemAt i controlField setSelectedIndex i else if browseButton e getSource int returnVal fileChooser showOpenDialog mainFrame if returnVal JFileChooser APPROVE_OPTION fileDirectory fileChooser getSelectedFile getPath directoryField setText fileDirectory else if saveButton e getSource try Set the settings txt file path setSettingsPath Open the file in write mode if it exists otherwise create a new file BufferedWriter fileWriter new BufferedWriter new FileWriter settingsPath Write the settings to the file fileWriter write username usernameField getText fileWriter newLine fileWriter write ipAddress ipAddressField getText fileWriter newLine fileWriter write port portField getText fileWriter newLine fileWriter write databaseName databaseNa
8. indicatorDriver setTare 1 sendData T10 n else Error Stream is not enabled sendData E n indicatorDriver setStream 1 indicatorDriver setTare 1 break case 2 Set the stream to Stream 2 send confirmation to if streamEnable 2 Check if the stream was already selected if indicatorDriver getStream 2 amp amp if indicatorDriver getTare 2 sendData T21 n else sendData T20 n else Another stream was selected indicatorDriver setStream 2 indicatorDriver setTare 2 sendData T20 n else Error Stream is not enabled sendData E n indicatorDriver setStream 1 indicatorDriver setTare 1 break case 3 Set the stream to Stream 3 send confirmation to tareEnable 3 indicatorDriver setTare 8 indicatorDriver setTare 3 select this one control panel tareEnable 4 indicatorDriver setTare 9 indicatorDriver setTare 4 select this one indicatorDriver getStream gt 4 stream first if streamEnable 3 Check if the stream was already selected if indicatorDriver getStream 3 amp amp if indicatorDriver getTare 3 sendData T31 n else sendData T30 n else Another stream was selected indicatorDriver setStream 3 indicatorDriver setTare 3 sendData T30 n else Error Stream is not enabled sendData E n indicatorDriver setStream
9. serverPanel add portField c Add in the password field c gridx 0 c gridy 1 c insets new Insets 5 5 5 0 serverPanel add passwordLabel c passwordField new JPasswordField 10 passwordField setEchoChar c gridx 1 c gridy 1 c insets new Insets 5 5 5 0 serverPanel add passwordField c Add in the database name field c gridx 2 c gridy 1 c gridwidth 2 c insets new Insets 5 20 5 0 serverPanel add databaseNameLabel c databaseNameField new JTextField 15 c gridx 4 c gridy 1 c gridwidth 3 c insets new Insets 5 5 5 5 serverPanel add databaseNameField c Purpose Creates the serial port settings section of the GUI private void createSerialPortUl GridBagLayout g new GridBagLayout GridBagConstraints c new GridBagConstraints JPanel serialPanel new JPanel g mainPanel add serialPanel Create the border TitledBorder title BorderFactory createTitledBorder BorderFactory createEtchedBorder EtchedBorder LOWERED Serial Ports title setTitleJustification TitledBorder LEFT serialPanel setBorder title Get the list of serial ports List lt String gt list getAvailableSerialPorts String portList list toArray new String list size indicatorField new JComboBox lt String gt portList indicatorField setSelectedIndex 0 indicatorField addActionListener this controlField new JComboBox lt String
10. 10 Waste stream enable Check the box to enable the given stream and uncheck it to disable the stream and any of its settings 11 Stream name The name of the given stream 12 Stream tare The average weight of the empty waste bin for the given stream to be subtracted from each waste bin of that stream measured 13 Second tare enable Check this box to enable the second tare value for the given stream in the event that two types of waste bins are in circulation 14 Second tare The average weight of the second type of waste bin while empty 15 Start application Starts the application in online mode requires an internet connection 16 Start in offline mode Starts the application while ignoring the server credentials and connection Data will only be saved in the log files 17 Save settings Saves the current settings so that when the application is re opened the currently selected settings will appear by default if possible 18 About Displays information about the application Upon starting the application in either online or offline mode the settings window will close and a log window will appear The log will display the status of the program as well as any measurements and errors that have occurred Closing the log will terminate the program and close any connections Scale Operation To operate the scale first ensure that the software is running and that both the indicator and button panel are powered on To take a measure
11. LOW digitalWrite streamPins 5 LOW else digitalWrite streamPins 0 HIGH digitalWrite streamPins 1 LOW digitalWrite streamPins 2 LOW digitalWrite streamPins 3 HIGH digitalWrite streamPins 4 LOW digitalWrite streamPins 5 LOW break case 1 if value 0 digitalWrite streamPins 0 LOW digitalWrite streamPins 1 HIGH digitalWrite streamPins 2 LOW digitalWrite streamPins 3 HIGH digitalWrite streamPins 4 LOW digitalWrite streamPins 5 LOW else digitalWrite streamPins 0 HIGH digitalWrite streamPins 1 HIGH digitalWrite streamPins 2 LOW digitalWrite streamPins 3 HIGH digitalWrite streamPins 4 LOW digitalWrite streamPins 5 LOW break case 2 if value 0 digitalWrite streamPins 0 LOW digitalWrite streamPins 1 LOW digitalWrite streamPins 2 HIGH digitalWrite streamPins 3 HIGH digitalWrite streamPins 4 LOW digitalWrite streamPins 5 LOW else digitalWrite streamPins 0 HIGH digitalWrite streamPins 1 LOW digitalWrite streamPins 2 HIGH digitalWrite streamPins 3 HIGH digitalWrite streamPins 4 LOW digitalWrite streamPins 5 LOW break case 3 if value 0 digitalWrite streamPins 0 LOW digitalWrite streamPins 1 HIGH digitalWrite streamPins 2 HIGH digitalWrite streamPins 3 HIGH digitalWrite streamPins 4 LOW digitalWrite streamPins 5 LOW else digitalWr
12. Load the Oracle JDBC driver Class forName com microsoft sqlserver jdbc SQLServerDriver catch Exception e e printStackTrace System exit 1 Purpose Creates the server settings section of the GUI private void createServerUI GridBagLayout g new GridBagLayout GridBagConstraints c new GridBagConstraints c fill GridBagConstraints HORIZONTAL JPanel serverPanel new JPanel g mainPanel add serverPanel Create the border TitledBorder title BorderFactory createTitledBorder BorderFactory createEtchedBorder EtchedBorder LOWERED Server title setTitleJustification TitledBorder LEFT serverPanel setBorder title Add in the username field c gridx 0 c gridy 0 c insets new Insets 5 5 5 0 serverPanel add usernameLabel c usernameField new JTextField 10 c gridx 1 c gridy 0 c insets new Insets 5 5 5 0 serverPanel add usernameField c Add in the IP address field c gridx 2 c gridy 0 c insets new Insets 5 20 5 0 serverPanel add ipAddressLabel c ipAddressField new JTextField 10 c gridx 3 c gridy 0 c gridwidth 2 c insets new Insets 5 5 5 0 serverPanel add ipAddressField c Add in the server port field c gridx 5 c gridy 0 c gridwidth 1 c insets new Insets 5 20 5 0 serverPanel add portLabel c portField new JTextField 5 c gridx 6 c gridy 0 c insets new Insets 5 5 5 5
13. Sets the tares as per the input taken from the startup GUI Il Input tares The tares Il size The size of the array public void setTares float tares int size for int i 0 i lt size i this tares i tares i Purpose Sets the enables as per the input taken from the startup GUI Input enables Whether stream x is enabled public void setEnabled boolean enable1 boolean enable2 boolean enable3 boolean enable4 boolean enabled streamEnable 0 enable1 streamEnable 1 enable2 streamEnable 2 enable3 streamEnable 3 enable4 streamEnable 4 enabled Purpose Sets the second tare enables as per the input taken from the startup GUI Input enables Whether the second tare value of stream x is enabled public void setTareEnabled boolean enable1 boolean enable2 boolean enable3 boolean enable4 boolean enabled tareEnable 0 enable1 tareEnable 1 enable2 tareEnable 2 enable3 tareEnable 3 enable4 tareEnable 4 enable5 Purpose Gets the stream given the index number Input i The index of the stream array Output The name of the stream public String getStream int i return streams i Purpose Gets the tare given the index number Input i The index of the tare array Output The tare value public float getTare int i return tares i Purpose Checks if the button panel was successfully initialized Output The value of the initia
14. 4 c gridy 0 c insets new Insets 5 5 5 0 streamPanel add tareFields 0 c c gridx 5 c gridy 0 c insets new Insets 5 5 5 0 streamPanel add tare1 UnitsLabel c taretaEnable new JCheckBox tare1aEnable setSelected false c gridx 6 c gridy 0 c insets new Insets 5 20 5 0 streamPanel add tare1aEnable c taretaEnable additemListener this c gridx 7 c gridy 0 c insets new Insets 5 5 5 0 streamPanel add tare1aLabel c tareFields 5 new JTextField 4 c gridx 8 c gridy 0 c insets new Insets 5 5 5 0 streamPanel add tareFields 5 c tareFields 5 setEnabled false c gridx 9 c gridy 0 c insets new Insets 5 5 5 5 streamPanel add tare1aUnitsLabel c Add the fields for stream 2 stream2Enable new JCheckBox stream2Enable setSelected true c gridx 0 c gridy 1 c insets new Insets 5 5 5 0 streamPanel add stream2Enable c stream2Enable addltemListener this c gridx 1 c gridy 1 c insets new Insets 5 5 5 0 streamPanel add stream2Label c stream2Field new JTextField 10 c gridx 2 c gridy 1 c insets new Insets 5 5 5 0 streamPanel add stream2Field c c gridx 3 c gridy 1 c insets new Insets 5 20 5 0 streamPanel add tare2Label c tareFields 1 new JTextField 4 c gridx 4 c gridy 1 c insets new Insets 5 5 5 0 streamPanel add tareFields 1 c c gridx 5 c gridy 1 c
15. ControlDriver controlDriver this controlDriver controlDriver Purpose Gets a reference to the server connection Input server The Connection object to reference Il table The WasteTable object to reference public void withServer Connection server WasteTable table this server server this table table Purpose Parses the string of data received from the indicator into weight Il units time and status bits Input data The string of data to parse Output 0 on success 6 if unsuccessful private int parseWeight String data synchronized indicatorLock int polarity if data length 17 Determine the polarity of the weight if data charAt 0 polarity 1 else Parse the weight for int i 1 i lt 8 i ignore the spaces find when the digits start if data charAt i ls gross polarity Float valueOf data substring i 8 break polarity 1 lunits equals g else weight Float valueOf d format gross tare Check that the weight is positive if weight lt 0 System out printIn Error Net weight is negative return 6 Parse the units units data substring 9 11 toLowerCase if lunits equals kg amp amp lunits equals Ib amp amp lunits equals oz amp amp System out printIn Error Invalid unit of measurement return 6 Parse the mode if data charAt 12 G
16. and 5 on the Arduino is connected to four pin header refer to Component P7 in the PCB Schematic in Appendix A to drive the PC which runs the 7 seg displays 11 3 3 Emulated Server The main goal of the digital waste management system is to collect data to display to the public The data will be displayed on an electronic dashboard developed by a third party firm but to do so a server is needed to store the waste data Since the AMS server is not yet ready an emulated server is set up according to specifications provided by the client The server is emulated through Virtual Box off site and uses Windows Server 2008 R2 64 bit as the operating system and Microsoft SQL server 2008 as the backend to run the database An application is designed and coded in Java utilizing the JDBC library to set up and maintain a connection to the server through either local area network or through the internet A list of server functions is created in a separate Java class and is responsible for sending queries to the server from which data could then be entered deleted or retrieved The database consists of a table to store values from the user inputs The columns of the table include fields for the stream name date time weight and a unique identification number WID The stream date time and weight are provided by the computer application and the unique identification number lelsd File Edit View Query Project Debug Tools Window Community Help Anewq
17. by unscrewing the nuts which mount it and then remove all cables from the back of the board 3 Unscrew the two screws that mount the button panel to the wall 4 To reinstall follow these steps in the reverse To install the software 1 Ensure that the computer meets the system requirements 2 Move the application folder to your preferred location 3 Start the software by double clicking Start bat Hardware connections 1 The scale 9 pin connector should connect to the LOAD CELL port on the indicator 2 The SERIAL port on the indicator should connect to one of the computer s RS 232 ports with an RS 232 cable Note A null modem must be connected to one side of the RS 232 cable for this connection to operate correctly 3 The 9 pin connector on the button panel should connect to one of the computer s RS 232 ports with an RS 232 cable 4 Both the indicator and button panel should be plugged in with their respective DC adapters The indicator must manually be turned on but the button panel will automatically turn on upon receiving power Operation Software In order to start the application open the file Start bat The following window should appear d r 1 Username user 31P Address 0 0 0 0 4Port 1433 2 Password 5 Database Name CapstoneWasteManagement File Directory 6 File Directory EXDesktopiCapstone Waste Scale v1 0 Scale Outputs Serial Ports
18. contains tare2aEnable tare2aEnable setSelected Boolean parseBoolean currentLine substring tare2aEnable length currentLine length else if currentLine contains tare3aEnable tare3aEnable setSelected Boolean parseBoolean currentLine substring tare3aEnable length currentLine length else if currentLine contains tare4aEnable tare4aEnable setSelected Boolean parseBoolean currentLine substring tare4aEnable length currentLine length else if currentLine contains tarebaEnable tare5aEnable setSelected Boolean parseBoolean currentLine substring tarebaEnable length currentLine length currentLine length currentLine length currentLine length currentLine length currentLine length else if currentLine contains tare1a tareFields 5 setText currentLine substring tare1a length else if currentLine contains tare2a tareFields 6 setText currentLine substring tare2a length else if currentLine contains tare3a tareFields 7 setText currentLine substring tare3a length else if currentLine contains tare4a tareFields 8 setText currentLine substring tare4a length else if currentLine contains tare5a tareFields 9 setText currentLine substring tared5a length fileReader close catch FileNotFoundException e System out printin Settings file not foun
19. out printin Data V indicatorData Check if this sample will be saved assuming everything is alright if confirmation Reset the confirmation flag confirmation false Parse the weight sample int result parseWeight indicatorData Print the weight sample to the log printWeight if result 0 if table null Send the data to the server table insertWaste server weight stream date time Write to the file String fileName date toString substring 0 10 bxt writeToFile fileName this toString controlDriver sendData S n else setStream 1 setTare 1 else Construct a weight sample message for the Arduino String message W controlDriver sendData E n if indicatorData substring 14 16 equals OC message O else if indicatorData substring 14 16 equals MO message U else message S if indicatorData contains message indicatorData substring 4 8 n else message indicatorData substring 3 8 n controlDriver sendData message catch Exception e e printStackTrace Purpose Gets a references to the ControlDriver so that the IndicatorDriver Il can call methods from the ControlDriver i e to send confirmation Il messages Il Input controlDriver The ControlDriver object to reference public void withControlPort
20. server we will have to ensure that our system is compatible with it In addition the electronic dashboard has not yet been designed and is being developed by a third party firm so we will have to ensure that our data is kept in a sufficiently organized manner so that it conforms to the specifications of the dashboard Because of the status of these third party systems our project will first be constructed as a stand alone system with a private emulated server to store data on The most important goal is extend our stand alone system by designing a dashboard simulator to show that data on our server can be pulled and interpreted Also of importance is ensuring that the system can be ported to other buildings and is adaptable We should allow for streams to be changed added and removed as also take into consideration the waste bin tares 3 0 Architectural Design The waste management system consists of a floor scale and indicator a button panel and backend software installed on a computer Janitorial staff will pull a waste bin across the scale and use the button panel to measure the weight of the bin and then pull the bin off the scale and to the waste collection area after a successful measurement Until the AMS procures the server in which the waste stream weight time and date will be stored an emulated server is used to provide the same functionality In addition a dashboard simulator is designed to show that data can be pulled and manip
21. user has selected a stream send 0x05 in hex through the indicator serial port to get a weight ticket and set the indicator s confirmation flag to true INT1 6 2 If the currently selected stream is null i e the user has not selected a stream return an error and send E n to the button panel serial port INT1 7 If the button panel serial port receives I then set the initialized flag to true INT1 8 If the button panel serial port receives a byte other than the ones mentioned above the application should discard the byte read and do nothing INT2 Indicator serial port INT2 1 A weight ticket request 0x05 in hex should be sent through the indicator serial port every half second INT2 2 If the indicator serial port receives a message starting with Weight ticket then the message and the four subsequent lines of text received should be discarded as that means the user pressed the Print button on the indicator INT2 3 If the indicator serial port receives OCAP then WO should be sent through the button panel indicator INT2 4 The indicator receives a 17 character string INT2 4 1 If the weight is negative then character 0 should be INT2 4 2 If the weight is not negative then character 0 should be INT2 4 3 Characters 1 through 7 should make up the weight as an ASCII decimal number with one decimal point o
22. 1 indicatorDriver setTare 1 break case 4 Set the stream to Stream 4 send confirmation to if streamEnable 4 Check if the stream was already selected if indicatorDriver getStream 4 amp amp if indicatorDriver getTare 4 sendData T41 n else sendData T40 n else Another stream was selected indicatorDriver setStream 4 indicatorDriver setTare 4 sendData T40 n else Error Stream is not enabled sendData E n indicatorDriver setStream 1 indicatorDriver setTare 1 break case 5 Check to make sure the user has selected a stream if indicatorDriver getStream lt 0 System out printin Error Please select the waste sendData E n else Set the stream then send a weight request to the indicator indicatorDriver setConfirmation indicatorDriver sendData byte 0x05 break case l Arduino initialization complete initialized true break default Send an error response by default sendData E n break catch Exception e e printStackTrace Purpose Sets the streams as per the input taken from the startup GUI Input streams The names of the streams public void setStreams String stream1 String stream2 String stream3 String stream4 String stream5 streams 0 stream1 streams 1 stream2 streams 2 stream3 streams 3 stream4 streams 4 stream5 Purpose
23. If a field is left blank on the application UI the value to be saved should n be an empty string UIS 2 Given that there is a settings txt file in the directory where the application is stored if the user starts the application the file should be read and the settings saved on it should be automatically set to their corresponding fields UI5 2 1 The server username IP address port and waste table name should be saved but the password should not be loaded and set to their respective fields UIS 2 2 The file directory should be loaded and set to their respective fields UI5 2 3 The serial ports should be loaded and set to their respective fields UI5 2 4 Streams 1 5 should have their enable status name tare 1 value tare 2 enable status and tare 2 values loaded and set to their respective fields UIS 2 5 If a field is left blank on the application UI the field should remain empty or in its default state UI6 Starting the application UI6 1 If the user selects online mode the application should attempt to log in with the provided username and password values refer to test UIL Given that the user has entered the correct username password the application should initialize the indicator and button panel refer to tests UI3 3 and UI3 4 UI6 2 If the user selects offline mode the application should not attempt to log in
24. Kyle Lee n Luis Gan n n Special thanks to n The Java RXTX serial port library Adafruit LED matrix libraries Leo Stocco Capstone instructor n Maan Almarghalani Capstone teaching assistant Constructor public StartupUI mainFrame new JFrame Capstone Waste Scale mainFrame setResizable false mainPanel new JPanel mainPanel setLayout new BoxLayout mainPanel BoxLayout PAGE_AXIS mainFrame setContentPane mainPanel Open up the log UI logUI new LogUI logUI redirectSystemOutput Create the server panel createServerUI Create the file directory panel createDirectoryUI Create the serial port panel createSerialPortUl Create the stream settings panel createStreamUl Create the start up panel createStartupUl Open the settings file openSettings Anonymous inner class for closing the window mainFrame addWindowListener new WindowAdapter public void windowClosing WindowEvent e System exit 0 D size the window to obtain a best fit for the components mainFrame pack center the frame Dimension d mainFrame getToolkit getScreenSize Rectangle r mainFrame getBounds mainFrame setLocation d width r width 2 d height r height 2 make the window visible mainFrame setVisible true Il place the cursor in the text field for the username usernameField requestFocus try
25. Reader path Read the line of text result fileReader readLine Close the file fileWriter close catch IOException e e printStackTrace return result Purpose Sets up the timer to read the weight every 1s public void setUpTimer new Timer schedule new TimerTask public void run sendData byte 5 1000 pollRate MainUI public class MainUI public static void main String args IndicatorDriver indicator new IndicatorDriver ControlDriver control new ControlDriver Attach the indicator driver to the control driver and vice versa control withIndicatorPort indicator indicator withControlPort control Connect to the COM ports indicator connect COM9 control connect COM10 Create a new thread Thread t new Thread public void run while true E t start Serial Driver package scale import gnu io CommPort import gnu io CommPortldentifier import gnu io SerialPort import gnu io SerialPortEvent import gnu io SerialPortEventListener import java io BufferedReader import java io IOException import java io InputStreamReader import java io OutputStream public class SerialDriver implements SerialPortEventListener SerialPort serialPort protected BufferedReader input protected OutputStream output Purpose Attempts to connect to a serial port given the port name Il Also creates a SerialReader and
26. SerialWriter thread for reading writing Il Input portName The COM port as a string Eg COM1 Output 0 on success 1 if port does not exist 2 if port is in use public int connect String portName try Parse the port name CommPortldentifier portldentifier CommPortldentifier getPortldentifier portName Check if the port is in use if portldentifier isCurrentlyOwned System out printin Error portName is already in use return 2 else CommPort commPort portldentifier open this getClass getName 2000 Check that it is a serial port if commPort instanceof SerialPort Set the serial port to 8 data bits 1 stop bit no parity 9600 baud SerialPort serialPort SerialPort commPort serialPort setSerialPortParams 9600 SerialPort DATABITS 8 SerialPort STOPBITS_1 SerialPort PARITY_NONE Create the input and output streams input new BufferedReader new InputStreamReader serialPort getInputStream output serialPort getOutputStream Add the event listener serialPort addEventListener this serialPort notifyOnDataAvailable true return 0 else System out printin Error portName is not a serial port return 1 catch Exception e return 1 Purpose Closes the serial port to avoid port locking from other applications public synchronized void close if serialPort null serialPort removeEventListener serialPort close
27. StackTrace public void deleteWaste Connection con int Date LogUI package ui import java awt Dimension import java awt GridBagConstraints import java awt GridBagLayout import java awt Rectangle import java io BufferedWriter import java io FileWriter import java io lOException import java io OutputStream import java io PrintStream import java sql Date import java sql Time import java util GregorianCalendar import javax swing JFrame import javax swing JPanel import javax swing JScrollPane import javax swing JTextArea import javax swing SwingUtilities public class LogUI extends JPanel private static final long serialVersionUID 1L private JTextArea textArea private JFrame frame private String fileDirectory null public LogUI frame new JFrame Log textArea new JTextArea 20 40 textArea setEditable false JScrollPane scrollBar new JScrollPane textArea Layout components using the GridBag layout manager new GridBagLayout GridBagConstraints c new GridBagConstraints c gridwidth GridBagConstraints REMAINDER c fill GridBagConstraints BOTH c weightx 1 0 c weighty 1 0 add scrollBar c Set the application to be killed when the window is closed frame setDefaultCloseOperation JFrame EXIT ON CLOSE Dimension d frame getToolkit getScreenSize Rectangle r frame getBounds frame setLocation d width r width 2 d he
28. UBC Social Ecological Economic Development Studies SEEDS Student Report Digital Waste Management System Brandon Lowe Brian Yim Kyle Lee Lu Gan University of British Columbia EECE 409 429 419 439 400 469 July 15 2014 Disclaimer UBC SEEDS provides students with the opportunity to share the findings of their studies as well as their opinions conclusions and recommendations with the UBC community The reader should bear in mind that this is a student project report and is not an official document of UBC Furthermore readers should bear in mind that these reports may not reflect the current status of activities at UBC We urge you to contact the research persons mentioned in a report or the SEEDS Coordinator about the current status of the subject matter of a project report Digital Waste Management System Brandon Lowe Brian Yim Kyle Lee Lu Gan Team 47 The Alma Mater Society AMS of the University of British Columbia UBC is building a new Student Union Building SUB As a means of measuring solid waste production at the SUB a digital waste management system consisting of a floor scale button panel and computer software backend is designed allowing the weight waste stream date and time to be recorded and saved on a server The system is also functionally tested at all stages of development to verify the correctness of the solution The digital waste management system aims to be cheaper and faster than the alternative of co
29. a to interface between the waste scale and indicator and to write data to the server once a successful weight measurement has been taken The application consists of RS 232 serial port drivers for the indicator and button panel a driver to access the server as well as a graphical user interface GUD The RXTX serial port libraries are used to implement the drivers for the indicator and button panel A superclass is created to implement the basic RS 232 connection and communication functions and both the indicator and button panel drivers extend this superclass The button panel driver is responsible for handshaking with the button panel and handling the user input received from the button panel Event based serial communication is used in order to save computer processor time and upon receiving data from the button panel the data is parsed and the appropriate action is taken either changing the currently selected waste stream or confirming and saving the weight sample The button panel driver also interfaces with the indicator driver and is responsible for updating the currently selected stream and tare for the indicator driver The indicator driver sends a weight request to the indicator every 500 milliseconds and then parses the weight data into a weight and various status flags The parsed weight is sent to 13 the button panel through the button panel driver so that the current weight can be displayed to the user The indicator driver al
30. anel serial port receives 1 in ASCII INT1 2 1 If Stream 2 is enabled and is not currently selected then set the current stream to Stream 2 set the current tare to Tare 1 and send T10 n through the serial port INT1 2 2 If Stream 2 is enabled and is currently selected the second tare is enabled and the first tare is currently selected set the current stream to Stream 2 and the current tare to Tare 2 and send T11 n through the serial port INT1 2 3 If Stream 2 is enabled and is currently selected the second tare is enabled and the second tare is currently selected set the current stream to Stream 2 and the current tare to Tare 1 and send T10 n through the serial port INT1 2 4 If Stream 2 is enabled and is currently selected and the second tare is disabled set the current stream to Stream 2 the current tare to Tare 1 and send T10 n through the serial port INT1 2 5 If Stream 2 is disabled set the current stream to null the current tare to 0 and send E n through the serial port INT 1 3 The button panel serial port receives 2 in ASCII INT1 3 1 If Stream 3 is enabled and is not currently selected then set the current stream to Stream 3 set the current tare to Tare 1 and send T20 n through the serial port INT1 3 2 If Stream 3 is enabled and is currently selected the second tare is enabled and the first tare is currently selected set the current stream to Stream 3 an
31. ble to query the sum of weight given a wastestream Y 2 User should be able to query the sum of weight given a date or dateperiod Y Dashboard Simulator Testing Document User interface testing UII Server login UI1 1 Application should log in automatically a message is displayed on console on success UI2 Date selection UI2 1 User should be able to specify the start and end dates UI2 1 1 Error message will appear if date is incorrect incorrect format UI3 Graph selection UI3 1 User should be able to select deselect checkboxes UI3 1 1 If none are selected message will appear prompting user to select at least one UI4 Generate Graph UI4 1 When pressed will display appropriate graph s UI4 1 1 Error message will appear if date is incorrect incorrect format UI4 1 2 If no checkboxes are selected message will appear prompting user to select at least one UI4 1 3 The user should not be able to press generate graph before the first graph appears UI4 2 Time graph should be zoomable UI4 2 1 User may zoom in on desired portion of graph and zoom out by clicking and dragging cursor to the left Appendix D User Manual Overview The digital waste management system is designed to offer a fast simple and effective method of measuring the amount of waste produced by the new Student Union Building SUB The
32. c tareFields 9 new JTextField 4 c gridx 8 c gridy 4 c insets new Insets 5 5 5 0 streamPanel add tareFields 9 c tareFields 9 setEnabled false c gridx 9 c gridy 4 c insets new Insets 5 5 5 5 streamPanel add tare5aUnitsLabel c Purpose Creates the button of the GUI private void createStartupUI JPanel startupPanel new JPanel new GridLayout 1 4 10 10 mainPanel add startupPanel Create start button startButton new JButton Start Application startButton addActionListener this startupPanel add startButton Create start button offlineModeButton new JButton Start in Offline Mode offlineModeButton addActionListener this startupPanel add offlineModeButton Create save button saveButton new JButton Save Settings saveButton addActionListener this startupPanel add saveButton Create credits button creditsButton new JButton About creditsButton addActionListener this startupPanel add creditsButton SuppressWarnings unchecked public List lt String gt getAvailableSerialPorts List lt String gt portList new ArrayList lt String gt By default contain a bunch of spaces portList add Enumeration lt CommPortldentifier gt ports CommPortldentifier getPortldentifiers while ports hasMoreElements CommPortldentifier port CommPortldentifier ports nextElement if port getPortType CommPortldentifi
33. cted true Arduino Code PEERS AS EASE ER IO IA RARA RARE Button Panel code for the Arduino Uno Author Brandon Lowe Student Number 82090101 Jetix AEDES SES EON ONE ON OE include lt Wire h gt include Adafruit LEDBackpack h include Adafruit GFX h Il Stream LEDs are set to pins 2 7 2 4 select 5 data 6 7 stream 5 const int streamPins 6 2 3 4 5 6 7 Il Status LEDs are set to pins 8 11 8 stream selected 9 stable 10 success 11 error const int statusPins 4 8 9 10 11 Il Buttons are set to pins 12 17 12 16 streams 17 confirm const int buttonPins 6 16 15 14 13 12 17 Il 7 segment display Adafruit_7segment matrix Adafruit 7segment int weight 0 Il Flags boolean overCapacityBit false boolean stableBit false boolean positiveWeightBit false boolean validWeightBit false boolean streamBit false boolean errorBit false boolean readyBit false boolean successBit false const unsigned int debounceTime 20 Debouncing time period in milliseconds const int bufferSize 128 Serial port read buffer size in bytes unsigned int buttonStates 6 10 0 0 0 0 0 Previous states of the buttons used for debouncing unsigned long statusStates 4 0 0 0 0 Status LED timing char buffer bufferSize Buffer for receiving serial data void setup Set up the serial connection S
34. cted false c gridx 6 c gridy 2 c insets new Insets 5 20 5 0 streamPanel add tare3aEnable c tare3aEnable additemListener this c gridx 7 c gridy 2 c insets new Insets 5 5 5 0 streamPanel add tare3aLabel c tareFields 7 new JTextField 4 c gridx 8 c gridy 2 c insets new Insets 5 5 5 0 streamPanel add tareFields 7 c tareFields 7 setEnabled false c gridx 9 c gridy 2 c insets new Insets 5 5 5 5 streamPanel add tare3aUnitsLabel c Add the fields for stream 4 stream4Enable new JCheckBox stream4Enable setSelected true c gridx 0 c gridy 3 c insets new Insets 5 5 5 0 streamPanel add stream4Enable c stream4Enable addltemListener this c gridx 1 c gridy 3 c insets new Insets 5 5 5 0 streamPanel add stream4Label c stream4Field new JTextField 10 c gridx 2 c gridy 3 c insets new Insets 5 5 5 0 streamPanel add stream4Field c c gridx 3 c gridy 3 c insets new Insets 5 20 5 0 streamPanel add tare4Label c tareFields 3 new JTextField 4 c gridx 4 c gridy 3 c insets new Insets 5 5 5 0 streamPanel add tareFields 3 c c gridx 5 c gridy 3 c insets new Insets 5 5 5 0 streamPanel add tare4UnitsLabel c tare4aEnable new JCheckBox tare4aEnable setSelected false c gridx 6 c gridy 3 c insets new Insets 5 20 5 0 streamPanel add tare4aEnable c tare4aEnab
35. d catch IOException e e printStackTrace connects to Oracle database named ug using user supplied username and password private boolean connect ipAddress ipAddressField getText port portField getText databaseName databaseNameField getText username usernameField getText String connectURL jdbc sqlserver ipAddress port databaseNames databaseName try connection DriverManager getConnection connectURL username new String passwordField getPassword connection DriverManager getConnection connectURL Dash ubccapstone 47 return true catch SQLException ex System out println return false Message ex getMessage public void itemStateChanged ItemEvent e int state e getStateChange Object source e getltemSelectable if source stream1 Enable if state ItemEvent DESELECTED stream1Field setEnabled false tareFields 0 setEnabled false tareFields 5 setEnabled false taretaEnable setEnabled false else if state ItemEvent SELECTED stream1Field setEnabled true tareFields 0 setEnabled true tareFields 5 setEnabled true taretaEnable setEnabled true else if source stream2Enable if state ItemEvent DESELECTED stream2Field setEnabled false tareFields 1 setEnabled false tareFields 6 setEnabled false tare2aEnable setEnabled false else if state I
36. d be able to change the stream name and the stream name should show up in any subsequent measurements taken with that stream UI4 1 2 The user should be able to change the first tare value to 10 0 100 500 and any subsequent measurements with that tare should have a net weight value of gross tare UI4 1 3 The user should be able to enable and set the second tare value to 10 0 100 500 and any subsequent measurements with that tare should have a net weight value of gross tare UI4 1 4 The user should be able to disable the second tare and the user should not be able to select the second tare from that stream and instead receive an error UIA 2 If the stream is disabled then the user should not be able to make measurements and should receive an error UI4 2 1 The user should not be able to change any of the settings for a disabled stream UIS Saving and loading settings UIS 1 If the user presses Save Settings the current settings should all be saved in a text file named settings txt in the directory where the application is stored UIS 1 1 The server username IP address port and waste table name should be saved but the password should not be saved UIS 1 2 The file directory should be saved UIS 1 3 The serial ports should be saved UI5 1 4 Streams 1 5 should have their enable status name tare 1 value tare 2 enable status and tare 2 values saved UIS 1 5
37. d the current tare to Tare 2 and send T21 n through the serial port INT1 3 3 If Stream 3 is enabled and is currently selected the second tare is enabled and the second tare is currently selected set the current stream to Stream 3 and the current tare to Tare 1 and send T20 n through the serial port INT1 3 4 If Stream 3 is enabled and is currently selected and the second tare is disabled set the current stream to Stream 3 the current tare to Tare 1 and send T20 n through the serial port INT1 3 5 If Stream 3 is disabled set the current stream to null the current tare to 0 and send E n through the serial port INT1 4 The button panel serial port receives 3 in ASCII INT1 4 1 If Stream 4 is enabled and is not currently selected then set the current stream to Stream 4 set the current tare to Tare 1 and send T30 n through the serial port INT1 4 2 If Stream 4 is enabled and is currently selected the second tare is enabled and the first tare is currently selected set the current stream to Stream 4 and the current tare to Tare 2 and send T31 n through the serial port INT1 4 3 If Stream 4 is enabled and is currently selected the second tare is enabled and the second tare is currently selected set the current stream to Stream 4 and the current tare to Tare 1 and send T30 n through the serial port INT1 4 4 If Stream 4 is enabled and is currently selected and the second tare
38. e Waste Scale v1 0 Scale Outputs Serial Ports Scale COM1 Button Panel Refresh Available Ports Waste Streams v Stream 1 Recyclables 4 kg Enable second tare Stream 2 Paper d kg Enable second tare Stream 3 Organics kg Enable second tare Stream 4 Other i 3r 5 kg Enable second tare Stream 5 Tare kg Enable second tare Start Application Start in Offline Mode Save Settings Figure 4 The settings screen for the computer application 14 3 5 Dashboard Simulator A simple dashboard program that displays data collected in the form of graphs shown in Figure 5 is created for demonstrative purposes The dashboard program is written in Java and runs as an executable jar file The application connects to the SQL server and sends queries for each of the 4 streams between the dates specified by the user The data is manipulated and stored into a single variable then displayed using the JFreeChart libraries A simple GUI is created for the user to specify dates and type of graph as shown in Figure 6 Breakdown of Waste Waste streams over time Amount of waste kg 2 A 1 Mar 2 Mar 3 Mar 4 Mar S Mar Date Waste Recyclables Paper Compost Recyclables Paper Waste Compost Figure 5 Example graphs created by t
39. ectoryPath path Purpose Checks whether fileName exists then writes data to the end of Il the file if it does exist then closes the file Input fileName The name of the file will be appended to the folder path Il data The data to write to the file public void writeToFile String fileName String data synchronized indicatorLock try Get the file path from the directory and the file name path directoryPath fileName Open the file in append mode if it exists otherwise create a new file fileWriter new BufferedWriter new FileWriter path true Write the weight data to the file fileWriter write data fileWriter newLine Close the file fileWriter close catch IOException e e printStackTrace Purpose Writes the current data to the server provided the weight is stable public void writeToServer synchronized indicatorLock table insertWaste server weight stream date time Purpose Reads a line of text from the given file if it exists otherwise returns Il a null string Output The line of text or null if the file does not exist public String readLine String fileName synchronized indicatorLock String result null try Get the file path from the directory and the file name path directoryPath fileName Open the file in append mode if it exists otherwise create a new file fileReader new BufferedReader new File
40. el new JLabel Enable second tare private JLabel tare3aLabel new JLabel Enable second tare private JLabel taredal abel new JLabel Enable second tare private JLabel tarebaLabel new JLabel Enable second tare private JLabel tare1UnitsLabel new JLabel kg private JLabel tare2UnitsLabel new JLabel kg private JLabel tare3UnitsLabel new JLabel kg private JLabel tare4UnitsLabel new JLabel kg private JLabel tare5UnitsLabel new JLabel kg private JLabel tare1aUnitsLabel new JLabel kg private JLabel tare2aUnitsLabel new JLabel kg private JLabel tare3aUnitsLabel new JLabel kg private JLabel tare4aUnitsLabel new JLabel kg private JLabel tareSaUnitsLabel new JLabel kg private JTextField stream1 Field private JTextField stream2Field private JTextField stream3Field private JTextField stream4Field private JTextField stream5Field private JTextField tareFields new JTextField 10 Startup buttons private JButton startButton private JButton offlineModeButton private JButton saveButton private JButton creditsButton private JFrame mainFrame private JPanel mainPanel private LogUI logUI Credits private String credits UBC Digital Waste Management System v1 0 n UBC Electrical and Computer Engineering Capstone Design Course n September 2013 April 2014 n n Designed by n Brandon Lowe n Brian Yim n
41. empts Application will now close connected false mainFrame dispose System exit 1 else JOptionPane showMessageDialog mainFrame Incorrect username or password Clear the password passwordField setText connected false return Set the file path for the log file logUI setFileDirectory directoryField getText Instantiate the RS 232 drivers IndicatorDriver indicator new IndicatorDriver ControlDriver control new ControlDriver Set up the streams and tares control setStreams stream1Field getText stream2Field getText stream3Field getText stream4Field getText stream5Field getText for int i 0 i lt 10 i try tares i Float valueOf tareFields i getText catch NumberFormatException ex tares i 0 control setTares tares 10 control setEnabled stream1Enable isSelected stream2Enable isSelected stream3Enable isSelected stream4Enable isSelected stream5Enable isSelected control setTareEnabled tare1aEnable isSelected tare2aEnable isSelected tare3aEnable isSelected tare4aEnable isSelected tarebaEnable isSelected Attach the indicator driver to the control driver and vice versa control withIndicatorPort indicator indicator withControlPort control port button panel serial port if startButton e getSource Instantiate the waste table WasteTable wasteTable new WasteTable
42. er PORT SERIAL portList add port getName return portList private void setSettingsPath try settingsPath new File getCanonicalPath settings txt catch IOException e e printStackTrace public Connection getConnection return connection public boolean checkConnection return connected private void openSettings try Set the settings txt file path setSettingsPath Open the file in write mode if it exists otherwise create a new file BufferedReader fileReader new BufferedReader new FileReader settingsPath String currentLine Parse the file and enter fields while currentLine fileReader readLine null if currentLine contains username usernameField setText currentLine substring username length currentLine length else if currentLine contains ipAddress ipAddressField setText currentLine substring ipAddress length currentLine length else if currentLine contains port portField setText currentLine substring port length currentLine length else if currentLine contains databaseName databaseNameField setText currentLine substring databaseName length currentLine length else if currentLine contains directory directoryField setText currentLine substring directory length currentLine length else if currentLine contains indicator String indica
43. erial setTimeout 5000 Serial begin 9600 initialize void loop int buttonPressed int bytesToSend int i Il Check the buttons buttonPressed checkButtons if buttonPressed gt 0 amp amp buttonPressed lt 5 bytesToSend buttonPressed 0 Serial write bytesToSend Il Check the RS232 port if Serial available Read until we receive a new line character the buffer is full or we time out Serial readBytesUntil n buffer bufferSize Parse the data read parseSerial Il State machine outputs LEDs 7 seg RS232 checkReady setStatusLEDs Il Check temporary LED states i e success error LEDs which only turn on for 3s if digitalRead statusPins 2 HIGH amp amp statusStates 2 lt millis successBit false digitalWrite statusPins 2 LOW if digitalRead statusPins 3 HIGH amp amp statusStates 3 lt millis errorBit false digitalWrite statusPins 3 LOW Purpose Initializes the Arduino void initialize int i Il Set stream LEDs as outputs for i 0 i lt 6 i pinMode streamPins i OUTPUT Il Set status LEDs as outputs for i 0 i lt 4 i pinMode statusPins i OUTPUT Set push buttons as inputs for i 0 i lt 6 i pinMode buttonPins i INPUT Reset all of the things resetFlags setStatusLEDs setStreamLEDs 1 1 Il Set up the 7 segment disp
44. ering recommendations to minimize these risks The most important risk to take into consideration is the safety of our system The scale and ramps are low profile and as such are a hazard for passersby As a result we have determined a safe placement for the scale and ramps which is out of the main traffic pathway through the waste facility The Anyload FSP floor scale is chosen over its alternatives because it fulfills the requirements of being durable and water resistant to lower the risk of damage to it while also being inexpensive Checker plate is used for the ramps to provide extra traction and side rails are used to prevent the waste bins from falling off the side of the ramps The button panel is mounted to the wall at shoulder height and is located right next to the scale to prevent people from having to reach to access the buttons In order to minimize the loss of data in the event of an outage or workstation failure Dropbox is used as a form of version control Source documents are uploaded and organized upon implementation of any major feature or milestone in order to back up a copy of functional code Since there are only one or two people working on a given software component a more advanced version control system such as Git is determined to not be necessary Testing documents allow us to verify the correctness of our hardware and software and also help us to predict potential user scenarios 17 6 0 Client Hand Off Protocol T
45. error and write E n to the button panel serial port and set the flag to false INT2 4 13 If the confirmation flag is set to true and the weight is unstable return an error and write E n to the button panel serial port and set the flag to false INT2 4 14 If the confirmation flag is set to false and the weight is set to 100 0 1 and is stable send WSxxxxx where x is the weight in ASCII right justified e g a weight of 8 0 would be WS008 0 INT2 4 15 If the confirmation flag is set to false and the weight is set to 10 0 1 and is stable send WS xxxx where x is the absolute value of the weight in ASCII right justified e g a weight of 8 0 would be WS 08 0 INT2 4 16 If the confirmation flag is set to false and the weight is set to 100 0 1 and is unstable send WUxxxxx where x is the weight in ASCII right justified e g a weight of 8 0 would be WU008 0 INT2 4 15 If the confirmation flag is set to false and the weight is set to 10 0 1 and is unstable send WU xxxx where x is the absolute value of the weight in ASCII right justified e g a weight of 8 0 would be WU 08 0 Server Testing Document Use Cases Pass Server logistics User should be able to create modify login properties and credentials Y Server Connectivity User should be able to login into the server provided a valid username passwo
46. f precision and it should be right justified i e the number 10 0 should appear as 10 0 INT2 4 4 Characters 9 and 10 should be kg INT2 4 5 Character 12 should be G INT2 4 6 Given the weight is 0 0 characters 14 15 should be CZ INT2 4 7 Given the weight is 10 0 1 characters 14 15 should BZ INT2 4 8 Given the weight is 100 0 1 and is stable characters 14 15 should be INT2 4 9 Given the weight is 100 0 1 and the weight is unstable characters 14 15 should be MO INT2 4 10 If the confirmation flag is set to true the weight minus the tare is determined to be positive and stable and the application is in online mode the date and time should be taken and the stream weight units date and time should all be saved in the yyyy mm dd txt file and on the server and the confirmation flag should be reset to false INT2 4 11 If the confirmation flag is set to true the weight minus the tare is determined to be positive and stable and the application is in offline mode the date and time should be taken and the stream weight units date and time should all be saved in the yyyy mm dd txt file and the confirmation flag should be reset to false INT2 4 12 If the confirmation flag is set to true and the weight minus the tare is negative return an
47. float tare 0 private float gross private float weight private String units private String stream private int mode 0 gross 1 error private int status 0 none 1 centre of zero 2 below zero 3 over capacity 1 error private Date date private Time time private boolean confirmation Determines whether the weight sample will be saved private final int pollRate 500 Weight polling rate in milliseconds Purpose Event listener for the serial port used for receiving and parsing data Input event The serial port event Override public void serialEvent SerialPortEvent event synchronized indicatorLock Il Check if data is available if event getEventType SerialPortEvent DATA_AVAILABLE try Save the data byte by byte to an array indicatorData input readLine Make sure the user didn t press the Print button on the indicator if indicatorData contains Weight ticket System out printin Error Do not press the Print button on the indicator Discard the next 4 lines these are part of the weight ticket input readLine input readLine input readLine input readLine controlDriver sendData E n Check if the weight was over capacity if indicatorData contains OCAP controlDriver sendData WOW Check the length to make sure the data is of the correct format if indicatorData length 17 Parse the weight data here Il System
48. gt portList controlField setSelectedIndex 0 controlField addActionListener this Add the indicator port field c gridx 0 c gridy 0 c insets new Insets 5 5 5 0 serialPanel add indicatorLabel c c gridx 1 c gridy 0 c insets new Insets 5 5 5 0 serialPanel add indicatorField c Add the button panel port field c gridx 2 c gridy 0 c insets new Insets 5 20 5 0 serialPanel add controlLabel c c gridx 3 c gridy 0 c insets new Insets 5 5 5 0 serialPanel add controlField c Add the refresh button refreshButton new JButton Refresh Available Ports refreshButton addActionListener this c gridx 4 c gridy 0 c insets new Insets 5 10 5 5 serialPanel add refreshButton c Purpose Creates the file directory section of the GUI private void createDirectoryUI GridBagLayout g new GridBagLayout GridBagConstraints c new GridBagConstraints JPanel filePanel new JPanel g mainPanel add filePanel Create the border TitledBorder title BorderFactory createTitledBorder BorderFactory createEtchedBorder EtchedBorder LOWERED File Directory title setTitleJustification TitledBorder LEFT filePanel setBorder title Add the file directory field c gridx 0 c gridy 0 c insets new Insets 5 5 5 0 filePanel add directoryLabel c directoryField new JTextField 32 c gridx 1 c gridy 0 c insets new Inset
49. he AMS server until it is procured The waste scale indicator and button panel will be stored on site in the waste facility and the computer will be stored in a separate room for safety and security In addition a dashboard simulator will be designed in order to show that data on the server can be pulled and interpreted This and other terms marked with an asterisk will be defined in the Glossary on page 5 2 0 Scope and Purpose The purpose of the project is to design a method of measuring the weight of the four solid waste streams produced by the SUB so that the data can ultimately be shown to the public via graphs and statistics to promote sustainability The required measurements are the weight up to 500kg stream date and time of each waste bin recorded and these measurements must be able to be taken in under 10 seconds This data must be stored on a server hosted by the AMS as well as backed up locally The system is operated by janitorial staff so we must minimize the amount of physical labour involved In addition it must be easy to learn and operate to maximize the user buy in Because the system will be placed in the waste facility it must also be safe and unobtrusive as well as durable enough to have an expected lifetime of 10 15 years The time frame for the project is nine months A total of 5000 has been allocated to this project from the AMS and 650 has been allocated by the ECE department Since the AMS is providing the
50. he dashboard simulator This application is a vertical prototype to show that it is possible to pull data off the server through the internet and display it in the form of graphs Additional features such as selecting which streams to display and other graphs may be implemented in a stand alone system The final implementation for the client will not include this dashboard simulator program as they will be hiring a company to do a more elaborate and customized dashboard system amp Dashboard fale Server Start date YYYY MM DD End date YYYY MM DD 2014 01 01 2014 03 31 7 Pie Chart x Waste vs Time Graph Generate Graph Figure 6 The graphical user interface for the dashboard simulator 15 4 0 Formal Testing In order to verify the correctness of the software and hardware components a test plan is needed As all of the software components require external I O from either the hardware or through a serial port it is difficult to write automated unit tests to verify the correctness of the software As such most of the testing suites consist of functional tests with manual user inputs The focus of the test plan for the computer application software is to verify that the application can correctly interface and handshake with the indicator and button panel as well as the server The test suite includes white box test cases to verify that the correct actions are taken given certain serial port data
51. he software on the button panel also increases the portability of the system as the computer would no longer be necessary 19 Appendix A Drawings and Schematics Button Panel cover drawing measurements in millimetres Fi OD OS OD fe Stream Ready SUCCESS amp Error E Fi ES L 254 Push Button Bracket left and Confirmation and 7 Segment Bracket right drawings measurements in millimetres 220 128 Em Button Panel Box layout drawing measurements in millimetres 40 12 63 500 Button Bracket Confirmation and 7 Segment Bracket Button Panel Circuit Schematic PCB Schematic p DI EG c m n ci Bas f M Ij Appendix B Source Code Java Application Control Driver package scale import gnu io SerialPortEvent public class ControlDriver extends SerialDriver private Object controlLock new Object private IndicatorDriver indicatorDriver private byte controlData private boolean initialized false private boolean streamEnable new boolean 5 private boolean tareEnable new boolean 5 private String streams new String 5 private float tares new floatf10 Purpose Event listener for the serial port used for receiving and parsing data Input event The serial port event Override public void serialEvent SerialPortEvent event synchronized co
52. he waste management system is currently installed in the SUB waste facility Pending the installation of power and cabling and the procurement of the AMS server and computer the final implementation can be installed This includes the waste scale and ramps indicator button panel and software The system will initially be used to only measure the weight of the waste bins and store the data locally and on the server and once the electronic dashboard is designed the data on the server will be accessed In addition to the system implementation our client will receive a short user manual in order to train users as shown in Appendix D The manual contains instructions for installation and maintenance as well as operation instructions for both the janitorial staff operating the button panel and scale and the IT staff in charge of running the software application The focus of this user manual is for use as an aid for training the users to correctly operate the system In addition the basic specifications such as the capacity of the scale are included The client will also receive complete documentation of the project including the source code testing documents schematics and project reports 18 7 0 Conclusion A tested and stable waste management system is created capable of recording the weight of waste bins as well as classifying the waste into different waste streams through user input The designed computer application can connect to a SQL
53. i int tempWeight 0 Il Check if the data is a weight stream or status update if buffer 0 W if buffer 1 O Weight is over capacity overCapacityBit true positiveWeightBit true updateDisplay return else if buffer 1 U Il Weight is unstable stableBit false overCapacityBit false else if buffer 1 S Il Weight is stable stableBit true overCapacityBit false ll Parse the weight if buffer 2 positiveWeightBit false for i 3 i lt 7 i if buffer i gt 0 amp amp buffer i lt 9 tempWeight 10 tempWeight buffer i 0 weight tempWeight else positiveWeightBit true for i 2 i lt 7 i if buffer i gt 0 amp amp buffer i lt 9 tempWeight 10 tempWeight buffer i 0 weight tempWeight updateDisplay return else if buffer 0 E Turn on error LED errorBit true ll Reset the state setStreamLEDs 1 1 streamBit false readyBit false successBit false else if buffer 0 S Turn on success LED turn off error LED successBit true ll Reset the state setStreamLEDs 1 1 streamBit false readyBit false errorBit false else if buffer 0 T Update the waste stream LEDs setStreamLEDs buffer 1 0 buffer 2 0 else if buffer 0 T amp amp buffer 1 n amp amp buffer 2
54. id checkReady if loverCapacityBit amp amp positiveWeightBit amp amp stableBit validWeightBit true else validWeightBit false if validWeightBit amp amp streamBit readyBit true else readyBit false Il Purpose Checks the various flags to determine the states of the status LEDs void setStatusLEDs if streamBit digitalWrite statusPins 0 HIGH else digitalWrite statusPins 0 LOW if readyBit digitalWrite statusPins 1 HIGH else digitalWrite statusPins 1 LOW if successBit digitalWrite statusPins 2 HIGH digitalWrite statusPins 3 LOW statusStates 2 millis 2000 successBit false if errorBit digitalWrite statusPins 3 HIGH digitalWrite statusPins 2 LOW statusStates 3 millis 2000 errorBit false Il Purpose Sets one of the stream LEDs to state 0 or 1 with 0 being green Il and any other number being red Also turns off all other stream Il LEDs so that at most one of the 5 LEDs is on at any given time Il Input led The corresponding LED to turn on from 0 4 Send any other Il value to turn all LEDs off Il value The value to set the LED to void setStreamLEDs int led int value streamBit true switch led case 0 if value 0 digitalWrite streamPins 0 LOW digitalWrite streamPins 1 LOW digitalWrite streamPins 2 LOW digitalWrite streamPins 3 HIGH digitalWrite streamPins 4
55. ight r height 2 frame add this frame pack public void showLog frame setVisible true public JFrame getFrame return frame public void setFileDirectory String path fileDirectory path private void updateTextArea final String text SwingUtilities invokeLater new Runnable public void run String textToWrite new String if text contains n GregorianCalendar calendar new GregorianCalendar Time time new Time calendar getTime getTime Date date new Date calendar getTime getTime textToWrite textToWrite concat date toString time toString textToWrite textToWrite concat text textArea append textToWrite Print the log outputs to a file also if fileDirectory null f try BufferedWriter fileWriter new BufferedWriter new FileWriter fileDirectory log txt true fileWriter append textToWrite fileWriter close catch IOException e e printStackTrace public void redirectSystemOutput OutputStream output new OutputStream Override public void write int b throws IOException updateTextArea String valueOf char b Override public void write byte b int off int len throws IOException updateTextArea new String b off len Override public void write byte b throws IOException updateTextArea new String b E System setOut new PrintStream o
56. insets new Insets 5 5 5 0 streamPanel add tare2UnitsLabel c tare2aEnable new JCheckBox tare2aEnable setSelected false c gridx 6 c gridy 1 c insets new Insets 5 20 5 0 streamPanel add tare2aEnable c tare2aEnable addltemListener this c gridx 7 c gridy 1 c insets new Insets 5 5 5 0 streamPanel add tare2aLabel c tareFields 6 new JTextField 4 c gridx 8 c gridy 1 c insets new Insets 5 5 5 0 streamPanel add tareFields 6 c tareFields 6 setEnabled false c gridx 9 c gridy 1 c insets new Insets 5 5 5 5 streamPanel add tare2aUnitsLabel c Add the fields for stream 3 stream3Enable new JCheckBox stream3Enable setSelected true c gridx 0 c gridy 2 c insets new Insets 5 5 5 0 streamPanel add stream3Enable c stream3Enable addltemListener this c gridx 1 c gridy 2 c insets new Insets 5 5 5 0 streamPanel add stream3Label c stream3Field new JTextField 10 c gridx 2 c gridy 2 c insets new Insets 5 5 5 0 streamPanel add stream3Field c c gridx 3 c gridy 2 c insets new Insets 5 20 5 0 streamPanel add tare3Label c tareFields 2 new JTextField 4 c gridx 4 c gridy 2 c insets new Insets 5 5 5 0 streamPanel add tareFields 2 c c gridx 5 c gridy 2 c insets new Insets 5 5 5 0 streamPanel add tare3UnitsLabel c tare3aEnable new JCheckBox tare3aEnable setSele
57. is disabled set the current stream to Stream 4 the current tare to Tare 1 and send T30 n through the serial port INT1 4 5 If Stream 4 is disabled set the current stream to null the current tare to 0 and send E n through the serial port INT1 5 The button panel serial port receives 4 in ASCII INT1 5 1 If Stream 5 is enabled and is not currently selected then set the current stream to Stream 5 set the current tare to Tare 1 and send T40 n through the serial port INT1 5 2 If Stream 5 is enabled and is currently selected the second tare is enabled and the first tare is currently selected set the current stream to Stream 5 and the current tare to Tare 2 and send T41 n through the serial port INT1 5 3 If Stream 5 is enabled and is currently selected the second tare is enabled and the second tare is currently selected set the current stream to Stream 5 and the current tare to Tare 1 and send T40 n through the serial port INT1 5 4 If Stream 5 is enabled and is currently selected and the second tare is disabled set the current stream to Stream 5 the current tare to Tare 1 and send T40 n through the serial port INT1 5 5 If Stream 5 is disabled set the current stream to null the current tare to 0 and send E n through the serial port INT 1 6 The button panel serial port receives 5 in ASCII INT1 6 1 If the currently selected stream is not null i e the
58. it matrix writeDigitNum 3 weight 10 10 true Fourth digit matrix writeDigitNum 4 weight 10 false Write the numbers to the display matrix writeDisplay Il Purpose Polls and debounces each of the six button input pins Il Only takes the last button press that registers to prevent Il the user from pressing multiple buttons at once Il Output The button that has been pressed 0 5 1 if no button pressed int checkButtons int i int tempButtonState int result 1 unsigned long timeLimit Il Check each of the buttons return the last button state change detected for i 0 i lt 6 i Read the button state tempButtonState digitalRead buttonPins i Il Check that the button state is different from the previous state if tempButtonState buttonStates i Determine the time to stop debouncing timeLimit millis debounceTime Il Check that the reading is stable while millis lt timeLimit if tempButtonState digitalRead buttonPins i goto nextButton Button reading is stable check if it s low to high if tempButtonState HIGH Il Overwrite the result only take the last button pressed result i Record the button state change for future debounces buttonStates i tempButtonState nextButton return result Il Purpose Checks the various flags to determine whether the system is ready Il to take a weight measurement vo
59. ite streamPins 0 HIGH digitalWrite streamPins 1 HIGH digitalWrite streamPins 2 HIGH digitalWrite streamPins 3 HIGH digitalWrite streamPins 4 LOW digitalWrite streamPins 5 LOW break case 4 if value 0 digitalWrite streamPins 0 LOW digitalWrite streamPins 1 LOW digitalWrite streamPins 2 LOW digitalWrite streamPins 3 LOW digitalWrite streamPins 4 HIGH digitalWrite streamPins 5 LOW else digitalWrite streamPins 0 LOW digitalWrite streamPins 1 LOW digitalWrite streamPins 2 LOW digitalWrite streamPins 3 LOW digitalWrite streamPins 4 LOW digitalWrite streamPins 5 HIGH break default streamBit false digitalWrite streamPins 0 LOW digitalWrite streamPins 1 LOW digitalWrite streamPins 2 LOW digitalWrite streamPins 3 LOW digitalWrite streamPins 4 LOW digitalWrite streamPins 5 LOW break ll Purpose Parses the data in the buffer containing data received from the Il serial port and updates the state accordingly Notes Example weight WS 394 stable weight of 39 4kg Il WU4218 unstable weight of 421 8kg Il WS 8 stable weight of 0 8kg Il WO over capacity note that that is a capital o not a zero Il Example error E Il Example success S Il Example stream T01 set stream 0 to the second bin weight Il T40 set stream 4 to the first bin weight void parseSerial int
60. lay matrix begin 0x70 matrix setBrightness 2 matrix writeDigitRaw 0 0 matrix writeDigitRaw 1 0 matrix writeDigitRaw 3 0 matrix writeDigitRaw 4 0 matrix writeDisplay Il Send initialization confirmation Serial write l Il Purpose Sets all of the flags to their default values void resetFlags int i overCapacityBit false stableBit false positiveWeightBit false validWeightBit false streamBit false errorBit false readyBit false successBit false for i 0 i lt 6 i buttonStates i 0 for i 0 i lt 4 i statusStates i 0 Purpose Updates the 7 segment display to show the weight void updateDisplay if overCapacityBit Il Write OCAP matrix writeDigitRaw 0 63 matrix writeDigitRaw 1 57 matrix writeDigitRaw 3 119 matrix writeDigitRaw 4 115 else boolean leadingZero true int digit weight 1000 Il First digit depends on the weight being positive or negative if positiveWeightBit Il Write first digit if digit 0 matrix writeDigitRaw 0 0 else matrix writeDigitNum 0 weight 1000 false leadingZero false else Write negative sign matrix writeDigitRaw 0 64 Il Second digit digit weight 100 10 if leadingZero true amp amp digit 0 matrix writeDigitRaw 1 0 else matrix writeDigitNum 1 weight 100 10 false Il Third dig
61. ld be closed Button panel and indicator interfacing Note The following tests assume that proper serial port connections have been established and should be conducted once in online mode assuming a proper server connection and once in offline mode INTI Button panel serial port INT1 1 The button panel serial port receives 0 in ASCII INT1 1 1 If Stream 1 is enabled and is not currently selected then set the current stream to Stream 1 set the current tare to Tare 1 and send TOO n through the serial port INT1 1 2 If Stream 1 is enabled and is currently selected the second tare is enabled and the first tare is currently selected set the current stream to Stream 1 and the current tare to Tare 2 and send TO1 n through the serial port INT1 1 3 If Stream 1 is enabled and is currently selected the second tare is enabled and the second tare is currently selected set the current stream to Stream 1 and the current tare to Tare 1 and send TOOM through the serial port INT1 1 4 If Stream 1 is enabled and is currently selected and the second tare is disabled set the current stream to Stream 1 the current tare to Tare 1 and send TOO n through the serial port INT1 1 5 If Stream 1 is disabled set the current stream to null the current tare to 0 and send E n through the serial port INT1 2 The button p
62. le additemListener this c gridx 7 c gridy 3 c insets new Insets 5 5 5 0 streamPanel add tare4aLabel c tareFields 8 new JTextField 4 c gridx 8 c gridy 3 c insets new Insets 5 5 5 0 streamPanel add tareFields 8 c tareFields 8 setEnabled false c gridx 9 c gridy 3 c insets new Insets 5 5 5 5 streamPanel add tare4aUnitsLabel c Add the fields for stream 5 stream5Enable new JCheckBox stream5Enable setSelected true c gridx 0 c gridy 4 c insets new Insets 5 5 5 0 streamPanel add stream5Enable c stream5Enable additemListener this c gridx 1 c gridy 4 c insets new Insets 5 5 5 0 streamPanel add stream5Label c stream5Field new JTextField 10 c gridx 2 c gridy 4 c insets new Insets 5 5 5 0 streamPanel add stream5Field c c gridx 3 c gridy 4 c insets new Insets 5 20 5 0 streamPanel add tare5Label c tareFields 4 new JTextField 4 c gridx 4 c gridy 4 c insets new Insets 5 5 5 0 streamPanel add tareFields 4 c c gridx 5 c gridy 4 c insets new Insets 5 5 5 0 streamPanel add tare5UnitsLabel c tare5aEnable new JCheckBox tare5aEnable setSelected false c gridx 6 c gridy 4 c insets new Insets 5 20 5 0 streamPanel add tarebaEnable c tarebaEnable addltemListener this c gridx 7 c gridy 4 c insets new Insets 5 5 5 0 streamPanel add tarebaLabel
63. le directory path for the files to be stored UI2 1 1 Log and data files should be saved in the specified directory UI2 1 2 If a folder does not exist it should be created UI3 Serial ports UI3 1 User should only be able to select from available serial ports UI3 2 User should be able to refresh the list of available serial ports UI3 2 1 Given that a port was previously in the list if the port is disabled removed and the list is refreshed the serial port should no longer appear UI3 2 2 Given that a port was not previously in the list if the port is enabled added and the list is refreshed the serial port should appear on the list UI3 3 Given that the indicator is connected to a serial port and the serial port is selected for the indicator port if the user attempts to connect the user should be able to send and receive a weight ticket from the indicator by sending 0x05 in hex UI3 4 Given that the button panel is connected to a serial port and the serial port is selected for the button panel if the user attempts to connect the application should send Init n to the button panel and wait for button panel driver s initialized flag to be set to true by the button panel driver receiving I from the serial port UI4 Streams UIA 1 If stream is enabled then the user should be able to make measurements with that stream UI4 1 1 The user shoul
64. lity a means of measuring the waste produced by the four solid waste streams recyclables paper organics and other is needed However the traditional method of conducting waste audits to measure waste production is both time consuming and expensive so an alternative is needed As such a digital waste management system will be created aiming to be faster and cheaper than the waste audit The system will also store weight data on a server where it can be displayed to the public via an electronic dashboard The required measurements are a weight of up to 500 kilograms the stream name and the date and time of the measurement This data must be stored locally and on a server provided by the AMS The users will consist of janitorial staff and as such the system must be easy to use There are approximately 100 waste bins to be measured so the measurements must be taken in under 10 seconds to maximize efficiency The system must also be robust and have an expected lifetime of 10 15 years The project duration is nine months and the budget allocated for this project is 650 from the Electrical and Computer Engineering ECE department and 5000 from the AMS The goals focus on the ability to port the system to other buildings The design consists of a waste scale and indicator a button panel and a computer to support the back end software to interface between the components A private server will be emulated in order to provide the functionality of t
65. lized variable public boolean getlnitialized return initialized Purpose Gets a references to the IndicatorDriver so that the ControlDriver Il can call methods from the IndicatorDriver i e to send weight Il requests Input indicatorDriver The IndicatorDriver object to reference public void withIndicatorPort IndicatorDriver indicatorDriver this indicatorDriver indicatorDriver Indicator Driver package scale import gnu io SerialPortEvent import java io BufferedReader import java io BufferedWriter import java io FileReader import java io FileWriter import java io lOException import java sql Connection import java sql Date import java sql Time import java text DecimalFormat import java util GregorianCalendar import java util Timer import java util TimerTask import server WasteTable public class IndicatorDriver extends SerialDriver private DecimalFormat d new DecimalFormat private ControlDriver controlDriver private Connection server private WasteTable table private GregorianCalendar calendar private Object indicatorLock new Object private String indicatorData new String private String directoryPath private String path private BufferedWriter fileWriter private BufferedReader fileReader private int currentStream 1 The index of the currently selected stream private int currentTare 1 The index of the currently selected tare private
66. meField getText fileWriter newLine fileWriter write directory directoryField getText fileWriter newLine fileWriter write indicator String indicatorField getSelectedltem fileWriter newLine fileWriter write control String controlField getSelectedltem fileWriter newLine fileWriter write stream1Enable stream1Enable isSelected fileWriter newLine fileWriter write stream2Enable stream2Enable isSelected fileWriter newLine fileWriter write stream3Enable stream3Enable isSelected fileWriter newLine fileWriter write stream4Enable stream4Enable isSelected fileWriter newLine fileWriter write stream5Enable stream5Enable isSelected fileWriter newLine fileWriter write stream1 stream1Field getText fileWriter newLine fileWriter write stream2 stream2Field getText fileWriter newLine fileWriter write stream3 stream3Field getText fileWriter newLine fileWriter write stream4 stream4Field getText fileWriter newLine fileWriter write stream5 stream5Field getText fileWriter newLine fileWriter write tare1 tareFields 0 getText fileWriter newLine fileWriter write tare2 tareFields 1 getText fileWriter newLine fileWriter write tare3 tareFields 2 getText fileWriter newLine fileWriter write tare4 tareFields 3 getText fileWriter newLine fileWrite
67. ment drag the bin onto the scale and wait 1 2 seconds until the weight settles The current weight should display on the button panel display Then select the correct stream by pressing one of the five push buttons on the left side of the button panel Assuming the stream is enabled the LED to the right of the stream should light up and the Stream LED should also light up If the stream is disabled then an error will occur and the Error LED will light up If the second tare is enabled for that stream pressing the same stream button will toggle between the two tare values showing a green light beside the button for the first tare and a red light for the second tare After a stream has been selected wait for the Ready LED to turn on as that means that the weight has stabilized and an accurate reading can be taken Once the Ready LED turns on the green confirmation button at the bottom right of the panel can be pressed If the reading is successful then the Success LED will turn on and the bin can be taken off the scale and if the reading is unsuccessful the Error LED will turn on If the Error LED turns on double check that everything is set up correctly and try again In short 1 DN ID p Ensure everything is plugged in turned on and the software is started Put the bin on the scale Select a stream Wait for the Ready light to turn on Press the green confirmation button If the green Success light
68. n order to power the scale process the output signal from the scale s load cells and account for calibration A Cardinal 204 Indicator is used as it has a lot of documentation and is capable of outputting weight data on demand through an RS 232 serial connection The indicator connects to the floor scale via a 9 pin D connection and is powered by a DC adapter The indicator is set up so that a string containing the weight data along with any status flags that denote information such as whether the weight was stable or unstable is sent through RS 232 upon receiving a weight request 0x05 in hexadecimal from the computer connected to it The string can then be parsed by the computer A top loading scale requires ramps to be attached so that the user can approach the scale without having to lift the load Two ramps are created out of aluminum checker plate and these ramps sit beside the scale Aluminum is used because it is more lightweight and easier to work with than steel and as such the ramps are more portable The ramps also contain guard rails to lower the risk of a waste bin falling off the side of the ramp 3 2 Button Panel A button panel is mounted on a wall beside the waste scale as a means of allowing for the user to select the waste stream and to provide visual feedback regarding the status of the system The button panel must be durable enough to operate in the waste facility and must be able to send and receive data from a computer
69. nducting periodic waste audits all the while being safe and easy to use Table of Contents Da3st of UVES CARTONS inne act cane Stee hes illeso 3 List of Abbreviations ees Des iragatea isti eese eg Snes Gee ita lati De ee GE 4 ERE a Cocos Gute do Used in Mi E M A E SG cli agio 5 1 0 Introduction E 6 2 0 Seope and PHED SG ER EES EE E ERO 7 340 Architectural Dei ON EE Ge ee ides EE Ge ed 8 3 1 Floor scale and Indicatori i a Ee 9 32 IV ICT ek 10 2 3 MAU ALEC SR 12 3 4 Computer Applications rr RU Ee koe desee eue e ha rd Mode GEES GR GEES DE UNE ges 13 2 2 Dashboard SIImuldtOE cuoio pe SEE Nee iste e M e DM tesi a ctos 15 4 0 Formal Testing arnie AA LR 16 5 0 Risk Management 2359 EE E E EE EE ME 17 60 C ent Hand OE aineena ie p RODEADO aa GN N wade Aca 18 PAVE ONCLUSIONS crei RE lA Ar 19 Appendix A Drawings and Schematics Appendix B Source Code Appendix C Testing Documents and Other Documentation Appendix D User Manual List of Illustrations Figure High Level Block Diagrammi urca eleonora 8 Figure 2 Button Panel Inside View a ubicate lillo IE GE SE Gee td 10 Ligure 3 Server Table Example liscio olor e eei lora dat ie ele riali 12 Figure 4 Computer Application Settings Window eene nennen 14 Figure 5 Dashboard Simulator Graphs rs rl 15 Figure 6 Dashboard Simulator Graphical User Interface sse 15 List of Abbreviations AMS Alma Mater Socie
70. ng BoxLayout import javax swing JButton import javax swing JCheckBox import javax swing JComboBox import javax swing JFileChooser import javax swing JFrame import javax swing JLabel import javax swing JOptionPane import javax swing JPanel import javax swing JPasswordField import javax swing JTextField import javax swing border EtchedBorder import javax swing border TitledBorder import scale ControlDriver import scale IndicatorDriver import server WasteTable public class StartupUl implements ActionListener ItemListener Login variables private Connection connection private boolean connected private String settingsPath private String indicatorPort private String controlPort private String fileDirectory private String username private String databaseName private String port private String ipAddress private float tares new floatf10 User is allowed 3 login attempts or else the program will close private int loginAttempts 0 Server settings fields private JLabel portLabel new JLabel Port private JLabel ipAddressLabel new JLabel IP Address private JLabel databaseNameLabel new JLabel Database Name private JLabel usernameLabel new JLabel Username private JLabel passwordLabel new JLabel Password private JTextField portField private JTextField ipAddressField private JTextField databaseNameField private JTextField usernameField private JPass
71. ntrolLock Check if data is available if event getEventType SerialPortEvent DATA AVAILABLE try controlData byte input read Il System out printIn Data read controlData switch controlData case 0 Set the stream to Stream 0 send confirmation to control panel if streamEnable 0 Check if the stream was already selected if indicatorDriver getStream 0 amp amp tareEnable 0 if indicatorDriver getTare 0 indicatorDriver setTare 5 sendData T01 n else indicatorDriver setTare 0 sendData T00 n else Another stream was selected select this one indicatorDriver setStream 0 indicatorDriver setTare 0 sendData T00 n else Error Stream is not enabled sendData E n indicatorDriver setStream 1 indicatorDriver setTare 1 control panel tareEnable 1 indicatorDriver setTare 6 indicatorDriver setTare 1 select this one control panel tareEnable 2 indicatorDriver setTare 7 indicatorDriver setTare 2 select this one control panel break case 1 Set the stream to Stream 1 send confirmation to if streamEnable 1 Check if the stream was already selected if indicatorDriver getStream 1 amp amp if indicatorDriver getTare 1 sendData T11 n else sendData T10 n else Another stream was selected indicatorDriver setStream 1
72. of the bi colour stream LEDs are operated through a 74HCT4051 8 input analog demultiplexer connected to pins 2 5 on the Arduino The 7 segment display is controlled through the Inter Integrated Circuit PC bus on analog pins 4 5 using the Adafruit LED Backpack libraries The Arduino communicates with the computer using an RS 232 shield for the Arduino Handshaking is achieved by the button panel waiting for a response from the computer application before registering a button press or state change For example if the user presses the Stream button the button panel will notify the computer and only when the button panel receives a confirmation message from the computer will it reflect the state change ensuring that both the button panel and computer keep the same state The 5 stream push buttons are connected to a 10 pin header refer to Component P in the PCB Schematic in Appendix A and the confirm button is connected to a 2 pin header The five stream push button headers on the PCB are connected with 10k pull up resistors to analog pins 0 to 3 of and digital pins 5 to 6 on the Arduino Each of the 9 LEDs are separately mounted directly into their own respective 2 pin headers The stream LED headers are connected to a 16 pin DIP socket for the demultiplexer The demultiplexer is then wired to digital pins 2 to 5 on the Arduino The status LED headers are connected with 220 ohm limiting resistors to digital pins 8 to 11 on the Arduino Analog pins 4
73. project was a response to the Alma Mater Society s AMS plans to build a new more sustainable SUB as means of quantifying the amount of waste produced ultimately to educate faculty and students and to reduce the amount of waste produced by the building It was designed by fourth year Electrical and Computer Engineering students Brandon Lowe Brian Yim Kyle Lee and Lu Gan as part of the Capstone Design Course from September 2013 to April 2014 The digital waste management system consists of an Anyload FSP floor scale and Cardinal 204 Indicator as well as a wall mountable button panel and computer software backend This document will provide instructions for setting up and operating the digital waste management system Specifications System Requirements e Windows 7 64 Bit Operating System e Atleast 128 MB of RAM e Java JRE 7 or higher installed e Internet connection e Two RS 232 serial ports OR two USB ports AND two RS 232 to USB adapters System Specifications and Features e Scale capacity of up to 500 0 kg and resolution of 0 1 kg e Support for five different waste streams each of which has e Achangeable stream name e Support for up to two custom tare values the second tare value can be enabled or disabled e Enable disable e Support for Microsoft SQL Server 2008 Installation To remove the button panel from the wall 1 Remove front cover be careful not to damage the LEDs or push buttons 2 Remove the printed circuit board
74. r write tare5 tareFields 4 getText fileWriter newLine fileWriter write tare1aEnable taret aEnable isSelected fileWriter newLine fileWriter write tare2aEnable tare2aEnable isSelected fileWriter newLine fileWriter write tare3aEnable tare3aEnable isSelected fileWriter newLine fileWriter write tare4aEnable tare4aEnable isSelected fileWriter newLine fileWriter write tarebaEnable tare5aEnable isSelected fileWriter newLine fileWriter write tareta tareFields 5 getText fileWriter newLine fileWriter write tare2a tareFields 6 getText fileWriter newLine fileWriter write tare3a tareFields 7 getText fileWriter newLine fileWriter write tare4a tareFields 8 getText fileWriter newLine fileWriter write tareba tareFields 9 getText fileWriter newLine Close the file fileWriter close Notify the user JOptionPane showMessageDialog mainFrame Settings successfully saved catch IOException ex ex printStackTrace else if creditsButton e getSource JOptionPane showMessageDialog mainFrame credits About JOptionPane PLAIN MESSAGE else if startButton e getSource offlineModeButton e getSource if startButton e getSource if connect false loginAttempts if loginAttempts gt 3 JOptionPane showMessageDialog mainFrame Too many failed login att
75. rd Y 2 User should be able to connect to server over local area network provided a valid v login 3 User should be able to change the IP address of the server given a server is hosted at v the ip address 4 User should receive a response if server cannot connect Y 5 User should receive a response if incorrect login password Y 6 User should be able to connect to server over the internet Y 7 User should be receive a message if connection is terminated or interrupted Y 8 User should be able to specify a database name Y 9 User should receive a response if specified database name does not exist Y Server Functionalities 10 User should be able to create a SQL wastestream table given no previous table exists 11 If a SQL wastestream table exists a new table will not be created and the existing table should be used 12 User should be able to input an entry into the database table Given v weight time date stream 13 User should be able to pull all data from the table Y 14 User should be able to Query for data from the table based on stream Y 15 User should be able to Query for the data from the table using dates Y 16 User should receive a response if no data is pulled From stream Y 17 User should receive a response if no data is pulled from dates Y 18 User should receive an exception if date is invalid when querying using dates Y 19 User should receive an exception if stream is invalid when querying using stream v 20 User should be a
76. received and combinations of user inputs The test cases surrounding the user scenarios are shown in Appendix C The test plan for the server is to ensure that a connection can be established to the server and data can be pushed and pulled The test suite includes black box test cases to ensure that each input triggers a correct output The test cases are exhaustive therefore all possible cases are covered within these test cases The test cases involving the server are shown in Appendix C The test plan for the dashboard application focuses on user functionality The test suite includes black box test cases to ensure that dates entered are valid and queries sent are correct The test cases are conducted using manual user input and accounts for as many scenarios as possible The test suites for the computer application and button panel were conducted individually while the components were stand alone as well as while collectively This results in an integration test of sorts and also allowed us to verify that the system would function correctly under actual operating conditions and user scenarios with the complete system 16 5 0 Risk Management The major forms of risk involved with our project include operational risks such as safety and hardware durability and risk during project development As the operational risks are most apparent to the users and to the client throughout the lifetime of the project we have focused on minimizing and off
77. s 5 5 5 0 filePanel add directoryField c Add the browse button browseButton new JButton Browse browseButton addActionListener this fileChooser new JFileChooser fileChooser setFileSelectionMode JFileChooser DIRECTORIES_ONLY c gridx 2 c gridy 0 c insets new Insets 5 6 5 5 filePanel add browseButton c Creates the stream settings section of the GUI private void createStreamUI GridBagLayout g new GridBagLayout GridBagConstraints c new GridBagConstraints c fill GridBagConstraints HORIZONTAL JPanel streamPanel new JPanel g mainPanel add streamPanel Create the border TitledBorder title BorderFactory createTitledBorder BorderFactory createEtchedBorder EtchedBorder LOWERED Waste Streams title setTitleJustification TitledBorder L EFT streamPanel setBorder title Add the fields for stream 1 stream1 Enable new JCheckBox stream1Enable setSelected true c gridx 0 c gridy 0 c insets new Insets 5 5 5 0 streamPanel add stream1 Enable c stream1Enable addltemListener this c gridx 1 c gridy 0 c insets new Insets 5 5 5 0 streamPanel add stream1Label c stream1Field new JTextField 10 c gridx 2 c gridy 0 c insets new Insets 5 5 5 0 streamPanel add stream1 Field c c gridx 3 c gridy 0 c insets new Insets 5 20 5 0 streamPanel add tare1 Label c tareFields 0 new JTextField 4 c gridx
78. se if source tare2aEnable if state ItemEvent DESELECTED tareFields 6 setEnabled false else if state ItemEvent SELECTED tareFields 6 setEnabled true else if source tare3aEnable if state ItemEvent DESELECTED tareFields 7 setEnabled false else if state ItemEvent SELECTED tareFields 7 setEnabled true else if source tare4aEnable if state ItemEvent DESELECTED tareFields 8 setEnabled false else if state ItemEvent SELECTED tareFields 8 setEnabled true else if source tare5aEnable if state ItemEvent DESELECTED tareFields 9 setEnabled false else if state ItemEvent SELECTED tareFields 9 setEnabled true hi false event handler for startup UI window public void actionPerformed ActionEvent e if indicatorField e getSource indicatorPort String indicatorField getSelectedltem else if controlField e getSource controlPort String controlField getSelectedltem else if refreshButton e getSource Save the currently selected ports String indicator String indicatorField getSelectedltem String control String controlField getSelectedltem Get the list of serial ports List lt String gt list getAvailableSerialPorts String portList list toArray new String list size Remove all of the items indicatorField removeAllltems controlField removeAllltems
79. server interface with the indicator and button panel and save collected data online The waste system is currently installed in the SUB although the AMS server has not been created and the dashboard has not been designed yet Our client will be delivered the necessary hardware and software needed to operate the waste scale This includes the floor scale indicator button panel and the software application to run on a computer Additionally our client will receive a short user manual to help train the users as well as complete documentation of the testing source code and schematics Our ECE budget consisted of 650 of which 605 16 was spent The majority of the ECE budget was spent on hardware and electrical components for the push button panel In addition to our ECE budget the AMS provided 5000 of additional funding Of the AMS funding 2951 20 of which was spent on purchasing the floor scale the indicator and the two ramps leading up to the scale As the project will hopefully be ported to track waste at other buildings at UBC it is likely that another group of students or engineers will expand on this project It is recommended to research and try implementing a RS 485 or other serial port connection between the Arduino and the computer as RS 232 is less reliable with longer cable lengths A driver for the indicator and for the server can be created on the button panel microcontroller effectively cutting out the computer Placing all of t
80. so handles the status flags that the indicator sends alongside the weight sample and as such is responsible for handling the scale errors such as the weight being negative or over capacity In addition once the user presses the confirmation button the indicator will asynchronously send a weight request to ensure that the most recent weight sample is saved If the weight sample is valid and the user has selected a stream the weight stream time and date are then saved in a text file on local memory as well as written to the server A GUI is developed to allow the IT to adjust the application settings as well as view a log of events and errors The settings are broken down into different sections as shown in Figure 4 In particular the waste stream settings allow the user to enable or disable streams as well as edit the names and tare values In the event that a new waste bin model is introduced into the SUB and there are two different types of waste bins an option exists for a second tare value to be implemented All of the settings can be saved in a file called settings txt and these settings are automatically loaded upon application start up In addition the application can be started in either online or offline mode offline mode will disable any server functionalities Username user Port 1433 Password Database Name CapstoneWasteManagement File Directory File Directory E Desktop Capston
81. so that the user input and waste data can all be processed A 10 x 10 x 4 electrical box is used to contain the electrical components push buttons and Arduino microcontroller Five 22mm plastic push buttons from Automation Direct are used for the waste stream selection as they come in enough colours to be able to colour code the different waste streams Another 22mm push button is used as the confirmation button These buttons as well as a 7 segment display and a printed circuit board PCB are mounted on brackets that are attached to the electrical box Bi colour LEDs are used to display the currently selected waste stream and single colour LEDs are used to display the status of the system The layout of the electrical box is 40 127 63 500 T shown in Figure 2 In addition to the parts attached to the box a 2 1mm barrel jack connector and female RS 232 connector are i Confirmation and mounted on the side of the box d op 7 Segment Bracket The lid of the box is water jet cut to contain holes for the push buttons 7 segment display LED indicator lights and labels Figure 2 An overhead view of the inside of the button panel 10 The button panel is controlled by an Arduino Uno microcontroller The Arduino contains a state machine which reads and debounces the push buttons and also controls the LEDs and 7 segment display Since the Arduino Uno has a limited number of I O pins four
82. synchronized indicatorLock confirmation true Purpose Sets the waste stream type Input i The index of the stream array that is currently selected 1 if null public void setStream int i synchronized indicatorLock if i gt 0 this stream controlDriver getStream i this currentStream i else currentStream 1 this stream null Purpose Gets the waste stream type Output The currently selected waste stream public int getStream return currentStream Purpose Sets the tare value Input i The index of the tare array that is currently selected public void setTare int i synchronized indicatorLock if i gt 0 this tare controlDriver getTare i this currentTare i else this tare 0 this currentTare 1 Purpose Gets the tare value Output The currently selected tare public int getTare return currentTare Purpose Returns a string containing all of the data collected of the format Il date weight units stream Output The string representation of the weight sample public String toString synchronized indicatorLock return date toString time toString weight units stream Purpose Sets the weight data log file directory to the folder Input path The absolute path of the folder containing the logs public void setPath String path synchronized indicatorLock this dir
83. t state null state con createStatement state executeUpdate CreateTableWasteManagement Il state executeUpdate createSequence con commit public void DropTableWaste Connection con Statement state null try state con createStatement state executeUpdate DropTableWasteManagement Jcatch SQL Exception e e printStackTrace public void showWasteTable Connection connect Statement state ResultSet r try state connect createStatement r state executeQuery SELECT FROM WasteStreamManagement while r next String entry r getlnt WID r getTime dTime toString r getDate dDay toString r getFloat weightnum 4 r getString WasteStream trim System out printin entry catch SQLException e e printStackTrace public void insertWaste Connection con float number String wastestream Date day Time time PreparedStatement p float weight number String Waste wastestream try p con prepareStatement INSERT INTO WasteStreamManagement VALUES GregorianCalendar calendar new GregorianCalendar Iljava sql Date daytime new java sql Date calendar getTime getTime p setString 1 Waste p setDate 2 day p setTime 3 time p setFloat 4 weight p executeUpdate con commit p close catch SQLException error System out println INSERTION ERROR n error print
84. temEvent SELECTED stream2Field setEnabled true tareFields 1 setEnabled true tareFields 6 setEnabled true tare2aEnable setEnabled true else if source stream3Enable if state ItemEvent DESELECTED stream3Field setEnabled false tareFields 2 setEnabled false tareFields 7 setEnabled false tare3aEnable setEnabled false else if state ItemEvent SELECTED stream3Field setEnabled true tareFields 2 setEnabled true tareFields 7 setEnabled true tare3aEnable setEnabled true else if source stream4Enable if state ItemEvent DESELECTED stream4Field setEnabled false tareFields 3 setEnabled false tareFields 8 setEnabled false tare4aEnable setEnabled false else if state ItemEvent SELECTED stream4Field setEnabled true tareFields 3 setEnabled true tareFields 8 setEnabled true tare4aEnable setEnabled true else if source stream5Enable if state ItemEvent DESELECTED stream5Field setEnabled false tareFields 4 setEnabled false tareFields 9 setEnabled false tarebaEnable setEnabled false else if state ItemEvent SELECTED stream5Field setEnabled true tareFields 4 setEnabled true tareFields 9 setEnabled true tarebaEnable setEnabled true else if source tare1aEnable if state ItemEvent DESELECTED tareFields 5 setEnabled false else if state ItemEvent SELECTED tareFields 5 setEnabled true el
85. tor currentLine substring indicator length currentLine length for int i 0 i lt indicatorField getltemCount i if indicator equals String indicatorField getltemAt i f indicatorField setSelectedIndex i else if currentLine contains control String control currentLine substring control length currentLine length for int i 0 i lt controlField getltemCount i if control equals String controlField getltemAt i controlField setSelectedIndex i else if currentLine contains stream1 Enable stream1Enable setSelected Boolean parseBoolean currentLine substring stream1Enable length currentLine length else if currentLine contains stream2Enable stream2Enable setSelected Boolean parseBoolean currentLine substring stream2Enable length currentLine length else if currentLine contains stream3Enable stream3Enable setSelected Boolean parseBoolean currentLine substring stream3Enable length currentLine length else if currentLine contains stream4Enable stream4Enable setSelected Boolean parseBoolean currentLine substring stream4Enable length currentLine length else if currentLine contains stream5Enable stream5Enable setSelected Boolean parseBoolean currentLine substring stream5Enable length currentLine length else if currentLine contains stream1 stream1Field setText currentLine s
86. turns on the weighing process is complete if the red Error light turns on double check everything and try again Common causes of the Error light 1 2 3 4 Trying to select a stream when it is disabled Pressing the green confirm button without a stream selected Pressing the green confirm button while the weight was unstable The load was too light and came out negative after subtracting the weight of the empty bin
87. ty UBC University of British Columbia SUB Student Union Building ECE Electrical and Computer Engineering PCB Printed circuit board PC Inter Integrated Circuit IT Information technology GUI Graphical user interface Alma Mater Society Waste stream Waste audit Indicator Tare Glossary A body at the University of British Columbia in charge of operating student services as well as representing student needs and issues The different categories of waste as a means of classifying the waste produced In this project four solid waste streams will be considered Recyclables paper organics and other A process where all of the waste produced by a building is collected for a period of time and then the waste is sorted and measured A formal report is then produced showing the different weights and statistics regarding all of the waste streams An electronic device which powers a floor scale and accounts for calibration and units The Cardinal 204 Indicator that is used in this project also supports communication with a computer to send weight data over a serial port connection A constant amount of weight to subtract from the gross measurement of a load in order to account for the weight of an empty bin The net weight or the weight of the contents is the gross weight minus the tare 1 0 Introduction The Alma Mater Society AMS is building a more sustainable Student Union Building SUB To promote sustainabi
88. ubstring stream1 length currentLine length else if currentLine contains stream2 stream2Field setText currentLine substring stream2 length currentLine length else if currentLine contains stream3 stream3Field setText currentLine substring stream3 length currentLine length else if currentLine contains stream4 stream4Field setText currentLine substring stream4 length currentLine length else if currentLine contains stream5 currentLine length currentLine length currentLine length currentLine length currentLine length currentLine length stream5Field setText currentLine substring stream5 length else if currentLine contains tare1 tareFields 0 setText currentLine substring tare1 length else if currentLine contains tare2 tareFields 1 setText currentLine substring tare2 length else if currentLine contains tare3 tareFields 2 setText currentLine substring tare3 length else if currentLine contains tare4 tareFields 3 setText currentLine substring tare4 length else if currentLine contains tare5 tareFields 4 setText currentLine substring tare5 length else if currentLine contains tare1aEnable tare1aEnable setSelected Boolean parseBoolean currentLine substring tare1aEnable length currentLine length else if currentLine
89. uey D dd P US ET ld c3 e is automatically generated 8 Bilkceseweseaneceneni g teen Pn v 35 afd 8 OO S ise itg Ole A N SQLQuery1 sql istrator 57 x 1 select from WasteStreamManagement Current a E DA Databases 4 A System C QQ Database au Capsium 2014 02 10 18 41 31 Da Datal El 3 Table E s 2014 02 10 19 35 54 aod 2014 02 10 19 41 34 m d 2014 02 10 194201 E D View 2014 02 10 19 42 09 amp Da Syno 20140210 194216 Gi Progr Sera 44 4 ea il ILO upon inserting a table entry 2014 02 10 18 43 28 The table allows the computer to input data into it query for specific data sorted by stream Output time and date and deletion of certain inputs Figure 3 shows Ready ini Coli INS a sample table Figure 3 Example SQL table for storing waste samples 12 3 4 Computer Application A desktop computer is used to act as the middleman for all of the components of the System the waste scale and indicator the button panel and the server An application is created to interface between these components compatible with 64 bit Windows 7 The users should not have to interact with the computer other than to start up the software as the button panel handles all of the external user input needed to weigh the waste bins AMS Information Technology IT will be responsible for operating the software An application is designed using Jav
90. ulated from the server The high level design for the implementation of the project is shown in Figure 1 Button Panel Indicator Server Dashboard Computer System Hard Disk Figure 1 High level design of the digital waste management system p The final implementation of the system will instead use a server hosted by the AMS and will also include an electronic dashboard instead of the dashboard simulator The dashboard will function similar to the dashboard simulator we have designed although it will include more statistics and graphics 3 1 Floor Scale and Indicator In order to measure the weight of the waste bins a floor scale is needed The scale must be large enough to safely support a waste bin without a high risk of the bin falling off the scale and the load cells in the scale must have a capacity of at least 500 kilograms An Anyload FSP 36 x 36 floor scale is used as it is large enough to support a bin and has a capacity of 500 kilograms The scale is made of powder coated steel so it is sufficiently water resistant to operate in the waste facility The floor scale is top loading meaning that the scale will not undergo as much lateral stress as a scale with built in ramps would and as a result the expected lifetime is much longer In addition the scale is inexpensive compared to other scales on the market and is locally available A floor scale typically requires an indicator i
91. utput true MainUI package ui public class MainUI public static void main String args Instantiate the server login GUI and server connection refresh connection status Il every second StartupUI startupUl new StartupUI while startupUl checkConnection try Thread sleep 500 catch InterruptedException e e printStackTrace Create a new thread Thread t new Thread public void run Everything is done Print a confirmation message to the log System out printIn Ready while true E t start StartupUI package ui import gnu io CommPortldentifier import java awt Dimension import java awt GridBagConstraints import java awt GridBagLayout import java awt GridLayout import java awt Insets import java awt Rectangle import java awt event ActionEvent import java awt event ActionListener import java awt event ItemEvent import java awt event ItemListener import java awt event WindowAdapter import java awt event WindowEvent import java io BufferedReader import java io BufferedWriter import java io File import java io FileNotFoundException import java io FileReader import java io FileWriter import java io lOException import java sql Connection import java sql DriverManager import java sal SOLException import java util ArrayList import java util Enumeration import java util List import javax swing BorderFactory import javax swi
92. wordField passwordField File system directory fields private JLabel directoryLabel new JLabel File Directory private JTextField directoryField private JButton browseButton private JFileChooser fileChooser Il Com port settings fields private JLabel indicatorLabel new JLabel Scale private JLabel controlLabel new JLabel Button Panel private JComboBox lt String gt indicatorField private JComboBox lt String gt controlField private JButton refreshButton Il Waste stream settings fields private JCheckBox stream1 Enable private JCheckBox stream2Enable private JCheckBox stream3Enable private JCheckBox stream4Enable private JCheckBox stream5Enable private JCheckBox tare1aEnable private JCheckBox tare2aEnable private JCheckBox tare3aEnable private JCheckBox tare4aEnable private JCheckBox tare5aEnable private JLabel stream1Label new JLabel Stream 1 private JLabel stream2Label new JLabel Stream 2 private JLabel stream3Label new JLabel Stream 3 private JLabel stream4Label new JLabel Stream 4 private JLabel stream5Label new JLabel Stream 5 private JLabel tare1Label new JLabel Tare private JLabel tare2Label new JLabel Tare private JLabel tare3Label new JLabel Tare private JLabel tare4Label new JLabel Tare private JLabel tare5Label new JLabel Tare private JLabel tare1aLabel new JLabel Enable second tare private JLabel tare2aLab

Download Pdf Manuals

image

Related Search

Related Contents

(取扱説明書)シャワー付き散水タイマ一 塵離  user`s manual - Smart  Sharp XG-F262X data projector  Samsung WB850F Kasutusjuhend  http://us1.campaign-archive.com/?u  Pourquoi le collectif ? - no  三フッ化ホウ素エチルエーテル    

Copyright © All rights reserved.
Failed to retrieve file