Things we have finished last week:
- Fabrication
- Arduino code and the circuit
- P5 sketch code – A bit of fine tuning needed to be done.
- Process to do projection but haven’t implemented yet.
Fabrication
We spent most of the time in fabrication. I originally wanted to make a box out of plywood using wood glue, however, the base is 17” by 22” which is larger than the laser cutter we have. So I went to Makerspace to use the big one. Yet, it was giving me some trouble so that one bottom is smaller than the bottom we wanted.
Also, the original design of the box is adapted from the website that helps making a box easier with slots. However, it makes glueing them together very time consuming and painful.
Therefore, I used band saw to cut the slots to make the border of the box straight line rather than rigged. Shannel and I got several L brackets to stable every piece of wood instead of the wood glue. It is sturdier for our box.
original design gluing to make sure the acrylic sheet will sit on top rather than slide inside laser cut design of the slotted panel
We discarded the design since it is hard for us to glue them especially with the bottom panel. I then cut them with the bend saw and and made sure the border of each panel is smooth and straight.
For the top of the box, we used two pieces of acrylic sheet. Given the size of the laser cutter on the floor. We decided to make two pieces rather than one for easier access to debug if there are any wiring issues in the future.
For the larger acrylic sheet, we engraved the outline of the circles so that we can find the place to glue the acrylic rod in.
I also designed the holes to make sure the ultrasonic distance sensor have enough space to detect. Since if the sensor is covered with anything, it won’t detect the hand movement.
For the smaller acrylic sheet, I designed two holes that fit the big push button and the encoder. For the QR code, we struggled to experiment on the acrylic sheet. We used the black marker and dry erase pen on top of the engraved QR code on the transparent acrylic sheet. It didn’t work on the phone. We then had to give it up and engrave on the piece of wood and then put it on top of the acrylic sheet. It is not optimal but it is still aesthetically pleasing.
Problems
Some problems we encountered during fabrication include the support for the ultrasonic sensors and the support for both acrylic sheets.
For the support for the sensors, I originally measured the distance between the sensors and laser cutted a piece of square to make a stand to hold it. Although the tiny stand will hold the sensor, it is not as stable as I wanted and it is not aesthetically pleasing since you can see the square from above through the transparent acrylic sheet.
Therefore, I redesigned the stand as below so that when you see from above through the acrylic sheet and won’t find it ugly.
I was having trouble securing the encoder since the hole is a bit smaller from the laser cut design. Therefore, I used a drill to widen it. I was quite scared at first but then I overcame the fear and increased the diameter of the hole. Now the encoder is secured with the 3D printed knob on top of it.
To be finished………
Arduino Code Here
I worked on the Arduino code. The goal is when the pushbutton is pressed once, it starts the game. When it is pushed twice, it starts the Indian layer; third, starts the Chinese layer; last, ends the game.
P5 sketch hERE
Shannel worked on code in terms of welcomeScreen, GameOverScreen, and checking the ingredients in the user input as well as the right ingredients. I worked on the part where the actual game happens. When user selects ingredients from the bowls, they will move to the big bowl.
welcome screen Shannel’s code on calculating the percentage game over screen
Combining the code
Before combining the code, Shannel created a class of bowls while I had a class of Circles. Since some of their functions overlap, I then combined the code to make sure the ingredients are displayed in the position of the bowls. I then went to Aidan’s office hour and figured out how to assign the name of the ingredient to the object of the bowl.
Creating objects in an array
I made each image into objects with assigned name. So for the use ingredients array, the names can be registered to compare with the right ingredient list.
this is an example of putting both name and image as an object in an array. this is the class Bowl Shannel created to check if the ingredient is picked or not. If the ingredient is picked, it will be added to the userIngredients array to store the information.
It was hard to warp my head around the concept but later, as more practices, I became very familiar with it.
Serial communication reading the data from arduino
I would not be able to receive the data at first since it only reads the data once. and I asked around about the possibility of doing serial output from arduino to p5 and p5 to arduino. But it becomes too complicated therefore, I stuck with the arduino and managed to read all the strings and had several conditional statements to call each function needed in p5.
In terms of p5 sketch, shannel and I worked separately. She managed to have several ingredients for the both Indian and Chinese cuisines and combined our code.
There was a period of time where I was working on Arduino code and she was struggling in the p5 sketched. Therefore, I helped out and started combining the code.
There was a period of time where I was working on Arduino code and she was struggling in the p5 sketched. Therefore, I helped out and started combining the code.
It was such a long process to combine the code since there are so many details that could be easily overlooked.
Mind the details
For the serial communication, I made sure each line of serial.println() from Arduino is transferred and translated into the p5.
example code to put each ingredient in each layer in the position of the four bowls updated welcome screen How I developed the serial communication
For some code, I have to make sure there is one function for the Indian Cuisine and another one for the Indian Cuisine since there are some trivial differences that don’t allow to be put in a universal function. For instance, the function below shows that I have to use the variable of userIngredientsChinese and layerName to show the user ingredients for the Chinese cuisine. Now looking back, I may create a universal code for both of the cuisine to make the lines shorter.
This is to show how the ingredients picked will appear in the bowl.
Projection
We tried to do projection on Monday morning. Thanks for Jake’s help, we got to secure the projector on the ceiling rod. However, when we tried to use the html link of our sketch, Syphon and Madmapper, the Syphon software doesn’t allow us to put the link in. So we tentatively gave up on that and will resolve the issue in the upcoming week.
Conclusion
I feel this week with the Thanksgiving break in between has allowed us to accomplish tons of work. I am proud of our progress and have more appreciation towards simple games around me. It takes lots of logic, efforts, and time to make a game that is user-oriented, and brings a smooth user-experience.
One thought on “Fusion or Not – update – Pcomp Week13”