In this project, we were asked to build a box of some sort that houses our Arduino display and display the arrival time of the next 94 bus outside Anderson Hall. We created a code in Arduino which connects to the OLED screen for visual display. We were encouraged to try out the laser cutter or 3D printer and we decided on using 3D printer to print our box design.
Using the API link for the predicted stop times of the 94 bus, we constructed our diagram on LabVIEW to display the arrival time. Making use of SystemLink functions, we connected our diagram to SystemLink and our specified tag value, which is a String type. The diagram is displayed to the right.
As a further step, we had to edit the given Arduino code with necessary details and information. Following the comments written besides the codes after double slashes, we were able to figure out where to insert our SystemLink tag in GET_SystemLink("tag"). Checking our previously executed "Hello World" code and video tutorials on Arduino, we found the U8G2 library that would be useful for the code. We made use of relevant commands that belong to the U8G2 library to initialize our screen (u8g2.begin), specify our String variable as an input and then further print it in a specified font (u8g2.setFont, u8g2.setCursor and u8g2.print). We then decided to use the Full Screen Buffer mode to have a faster process and further included the associated constructor and clearBuffer and sendBuffer commands.
Our first challenge was to figure out how to print our tag value on the OLED screen with the GET_SystemLink code. The given function "Void" would not return any information or value as suggested in the name, so we changed it into a String function. This required us to actually define our String to be returned, which we referred to as "outcome" and further set it equal to GetStringValue(response). As a final point, in order to print and return our current String value from the String function "if" the conditions are met, we made use of the "return" function for the String named "outcome".
We further added a text into our code, writing "Arrival time of the next 94 MBTA bus outside Anderson Hall." Since the screen is too small, we had to edit the coordinates and use 3 lines of text which we found by trial and error.
After running the code, we ran into another challenge, as what we got on the display screen was only a two digit number that we could not understand first. After realizing that it actually represents the seconds part of the arrival time of the bus, we needed to figure out how to display the time as a whole, including hours and minutes. We were able to fix this issue by going to the section of the code that is displayed below. We added -5 after the colon ":" since there are 5 figures ( hours:minutes) before seconds and further added -1 to get rid of the extra quotation marks and "}" at the end.
For the box design part of the project, we decided to use the 3D printer and Onshape as a CAD software system. After measuring the board, the display and the cable in terms of width, length and height, we created our design on Onshape. We placed a rectangular hole that would fit the display on one side of the box and adjusted it according to the thickness of the physical display. There is a smaller rectangle inside the slightly bigger one to display only the digital screen, not the outside area. Another rectangular hole at the other side of the box is created for the cable to go in and connect to the board. Furthermore, we created a lid to place on top of the box so that the board would not be visible from the outside.
A challenge with the 3d printer was after getting our design printed, when we placed the board inside, it was highly tight and there was not extra space to move the board, it often got stuck at the middle when going down the box. Our display screen fitted the rectangular area perfectly, however, the cable would not go inside the other rectangular hole, the space was slightly smaller than the cable. So going back to Onshape, we had to edit the measurements accordingly to make the box and the rectangular hole slightly bigger in size, like about 2-3 millimetres bigger per edge.