Category Archives: PCOMP

Pumpkin Dash_Documentation

Oct 17, 2022

My partner Anna and I wanted to make a game, and it was Halloween-themed. We took inspiration from the pie face challenge and decided to make a racing game.

Pie Face Challenge

Regarding the format of the game, we wanted the game to have an interface just like an arcade and also for the player to interact with the physical space during the game.

w6p1 sketch

So we plan to have FOUR buttons available to two players. One player will only have the move-up and left buttons and the other player will only have the move-up and right buttons.

The two buttons would be distributed at opposite ends of a distance, and both players would bounce back and forth to press the button to move their character quickly across the interface to the end within the distance. Each button can only be pressed once at a time, and that’s the rule. So it’s all about the speed of the two players.

The winner who reaches the finish line first will trigger a spider web to fall over the other player’s head as a punishment for the loser.

For this idea, we faced TWO difficulties. The first was the serial communication between the Arduino and the p5js, and the second was about the design of the spider web, as it needed to be light enough and big enough.

For the fabrication, Tom recommended we find inspiration from a pit trap. We discovered the Drop Net Kit System video on the internet thanks to Tom’s suggestion, and we believed we could apply this approach to construct a spider web.

Drop Net Kit System

We found a sheet of fabric on the floor, and after several tests, we chose to use magnetic tape to attach the web to the ceiling pipe. Anna used a 3D printer to make a big button. The button base is nice, but the lid is not very satisfactory. We need to make more attempts at it.


For the code: we couldn’t figure out how to build one press for one step at first since the Arduino readout is continuous and the control object on the p5js continues to go along with each reading. Therefore, I adjusted the game’s rules 😂 so that the player not only needs to reach the destination quickly but also avoids obstacles. I established a time threshold for entering an obstacle, and if the player does not avoid it in time, the game ends when the time to touch the obstacle exceeds the threshold. The game might then result in two losers and no winner, or with one winner and one loser. However, although modifying the game’s rules solved the input problem, we still had issues with the output. The first version of the game was suspended. 

It was then that, thanks to Yonata’s assistance with our code, he provided me insights on how to construct one press for one step, allowing me to fix the initial problem and return the game rules to their original state. As a result, in the second version, the majority of the logic is coded in Arduino, which is simpler to operate and understand than the previous version, in which the majority of the logic was coded in p5js, and even the output problem was fixed.

However, there are always twists and turns!😮‍💨 The page lag becomes so severe after completing the serial input and output that the game cannot be played at all. The game progresses smoothly if one player’s output is commented on (I tried here initially by lighting the LED instead of the departure motor) and just one output is retained.


The great news is that after attending Tom’s office hours, both versions’ problems were resolved. Thank you again, Tom, for your assistance! 👏👏

The difficulty with not being able to get the Arduino to receive the p5 instructions in the first version was due to the misinterpretation of the code.

First, controlling the flow of asynchronous serial communication via handshaking does not necessitate control of all communications; rather, it could be managed independently for the specific logic settings. In my code, for example, when the LED must be turned on only under particular conditions, serial.available()>0 can be used to confine only this part of the whole logic. Second, when I manually enter a value as transmission data, I don’t have to convert the byte to ASCII. Giving the value manually is different from inputting the data on the keyboard.

Most of the logic of this version was coded in p5js. (for testing, just one player’s part)

w6p2

w6p6

w6p3

w6p4

w6p5.    p5js code

w6p7

w6p8.  Arduino code


The problem with the second version is still a coding issue. Tom suggests I add some delay after each if statement, as the extremely laggy response, may be caused by the numerous loops. But it didn’t work. Then Tom gave me another train of thought, reorganizing the code with an array to decrease the number of repeating loops. And it works! The code is much cleaner, too! The page no longer becomes stuck!

Most of the logic of this version was coded in Arduino. 

w6p9                        Modified Code

w6p11BEFORE          w6p10AFTER


So we have two versions of the game. After discussing with Anna, we decided to use the second version since the game was more straightforward, allowing players to focus on speed. The first version demanded that the player not only be swift but also avoid obstacles, so the game became more difficult. 

 

♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠

Oct 25, 2022

After we finished the code part last week, we are focusing on the fabrication this week. Anna spent lots of energy on the 3D printing button since we wanted it to be similar to the arcade button. She also made an excellent base for fixing the two servos and found the best solution for the falling web.  The fabrication details can be found on Anna’s Blog.

w7p2 w7p3

Anna makes the pretty stand for the servos.

w7p1 3D printing buttons (base) and lots of soldering work.

And the schematic diagram.

w7p8

I continue to work on the p5js to give a better visualization for the game, using Illustrator to draw the Halloween theme background. And add some sound to give the game a start and end, making it more organized. 

w7p4

And then we step into the user testing stage.  We invited several ITP mates to join the game, and luckily most stuff is going well. But we still have some parts that should be adjusted.

  1. we need to take care of the long wires and organize it.
  2. The distance of the racing area should be adjusted since the web should cover the people when it falls.
  3. The button needs to be fixed because some participants will hit it hard, so the button will be pushed farther, and the distance will be longer, which will be unfair. On the other hand, it’s a tricky spot for a game, and it’s fun if not to fix it. But anyway, we don’t want to complicate the racing game.
  4. We also find the best way to connect the rope of the web and servo, we need to find the right Angle. It should be able to either pull on the rope when the servo is still or quickly release it when the servo starts rotating.

The testing process is quite interesting and testees said the game makes space to be the ITP’s sports room. 😂

1st Testing Group. Running back and forth 😄, for some technical reason, the first round hasn’t triggered the web to fall.

 

2ed Testing Group. It’s hard to play the game without screaming!

 

3rd Testing Group. It’s a sports game, so tried cause it’s the third time for us to test it.

 

The first and also the last Testing Group, after we set it all up for the class show. Everything goes well, and the web looks much better after we stick the spider!    (Oh, I have to hate the spider, it took me 1 hour to bend it and stick it 😭)

w7p7 w7p5w7p6

The show in class:

 

 

SHAN_Documentation

Nov 14, 2022

Inspiration: I am fascinated by structural beauty and Eastern culture. My family is a traditional Chinese family that instilled in me an early passion for porcelain, pottery, Zisha, and other Chinese-crafted artworks, including hand fans. I wanted to demonstrate some Eastern aesthetics with machinery after I accessed PCOMP.

The current design: A work on Eastern aesthetics that uses servos to portray the structural elegance of the fan. The viewer interacts with the installation through the gesture sensor, and the hand swipes left and right across the sensor to control the hand fan’s opening and shutting. The action is a little like Taichi, a Chinese martial arts performance.

User experience problem: how to guide people to swipe their hands without any text or description. How do I achieve the interaction through some icons or signals? 

sketch

sketch

folding fan Folding Fan fan-anatomy Anatomy of Fan

About the fan: I want the piece to be able to speak across Eastern and Western cultures in both directions. While bringing Eastern aesthetics to Western culture, it also provides the viewer from the East with more possibilities in Eastern aesthetics. The art is intended to break away from a stereotypical image of Eastern culture, hence the choice of material for the hand fans is critical.

fan-3

Throughout Chinese history, there have been many Chinese fans, usually classified into folding fans and regimental fans. There was also a fan, where separate sticks were fastened together at one end like the folding fan, but they did not use fabric or leather.

There are two types of traditional Chinese folding fans, the fire painting fan and the Sandalwood fan, which display scenes of landscapes or stories on the fan sticks through painting or carving techniques.

fan-1 Fire Painting Fanfan-2 Sandalwood Fan 

Most traditional Chinese artworks are figurative, but I am personally fascinated by abstract expression. So I wanted to make the hand fans show a certain scene or just a feeling in a relatively abstract way through materials and colors. However, the hand fan itself is a particularly figurative existence, so I thought of using light to get the shadow of the fan on the wall, so that the visual experience may be more abstract but also more intense. At this time, I thought that I could use transparent material to make the fan so that the shadow effect could achieve flow and permeability similar to that of a lake, water, or pond. It’s like a glass material, but of course, I can’t use glass to make hand fans.

In the transparent material, I can find the easiest way to use acrylic, but I tried to play the light through the acrylic on the wall, and did not have the effect I wanted—only a silhouette, no sense of transparency. Then I found UV resin, many people use it to make jewelry. I found a picture of a bookmark made with UV resin, the shadow through the sun on the wall is the effect I want. So I’m going to make the hand fans with UV resin.

uv resin

Moreover…

There was another type of folding fan named the cockade fan, which was made at the end of the Qianlong period of the Qing Dynasty. The cockade fan was an ivory-carved figure story fan, and it could be unfolded in all 360 degrees. It later spread to the West and became a “cockade fan” in the old collections of European royalty. If the previous plan works well and I have extra time, I can also add the fan that unfolds 360 degrees.

cockade fan

♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠

Nov 21, 2022

Current Progress:
This week I tried to use the UV resin to make the fan stick, and I am satisfied with the shadowing effect on the wall, which is precisely what I want. Before waiting for the fan mold to arrive, I tried to make an uneven, water-ripple-like condition of the fan sticks without the mold, which worked well. I attempted to connect it to the servo and control the switching with the gesture sensor. As demonstrated in the video below.

 

Problems:
1. Because the contour edge of each fan stick is irregular and has too many angles, it is very easy to be trapped by the fish line between the fan stick when the fan blade spins. As a solution, the fan blade mold is still required.
2. I want the shadow to be colored; I attempted to paint a carp using acrylic paint, but it didn’t work out due to the opaqueness of acrylic paint.

w10-1 w10-2

Solutions:
On Sunday, the mold was delivered, and I attempted to produce a few pieces, the results of which are seen below.

w10-3 w10-4
1. The regular fan stick should avoid getting trapped in the fishing line and should rotate smoothly. (This is still being tested.)
2. The interior hollowing of the fan stick could provide a sensation of flow.
3. Mix the colorant with the UV resin so that a color reflection appears on the wall.

Next…

1. Fabrication for the fan and stand.

2. Think about the fan at 360 degrees.

♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠

Nov 28, 2022

For code works, please check it out HERE.

Work on folding fan

Because last week I found a way to make the fan I wanted, this week I worked on the fan-making and the stand of it continuously.

th-12 th-11 th-10

One trouble with the fan stand is that as the sticks rotate, the center of gravity of the fan changes between right and left, which means the support stand needs to have a specific support range rather than a shaft point. I discovered that my ring box was roughly the proper size for support, and I tested the feasibility of the little box as support by manually rotating the fan sticks.

th-2

th-4 th-3

(The laptop stand was used as weight.) And I learned to use laser cutting this time. Thanks, Xiaoran for teaching me how to use the machine! 😊 

th-5

                            

In the video, I used a laptop stand and kitchen scissors to hold down the box to prevent it from falling over as the sticks turned. This is not a long-term solution; I need to add weight to the box, so I considered the most basic and best-molded weight, clay.

th-6

Well, I’d previously played with baked clay, but it was time-consuming and unnecessary. This time, I tried with air-dried clay.
However, because the box is encased in clay, the clay attached to it is relatively thin, so the clay on all sides is easily cracked. Since when the water evaporates, the density of the clay increases and the mutual support between the clay is insufficient, cracks occur.
It looked ugly, so I painted some patterns to cover the cracks with acrylic paint.

th-13 th-14 th-14

      th-7

I’m hoping that the fans can open and close one by one, creating a feeling of flow and structural beauty. So, my current objective is to build four, and the next step is to keep making them in this way.

Cockade fan

Cockade fans have a similar fabrication for the fan itself, add more sticks.

Problem:

The main issue here is that no motor can rotate 360 degrees forward and then 360 degrees backward. The servo can regulate the precise position, but only within 180 degrees. In comparison, the DC motor and stepper motor can continue to rotate 360 degrees forward and backward but cannot be configured to rotate only 360 degrees and then stop. 

Solution:

Thanks to my dad! ❤️❤️ I had a chat with him over the holidays about my recent situation. When he heard about my problem, he immediately suggested that I use the limit switch. Okay, that’s a new word to me. My father used to be an electrical engineer, but he hasn’t designed anything in more than twenty years. Limit switches, he claims, are a really common component of electrical equipment. 

Thus, I test the code that can achieve control of the motor ( I choose to use a 360-degree continuous servo here since it is smaller and lighter than the DC motor or stepper motor.) And it works. Then I think about the mechanical issue, the design shown below.

                                           

th-8

                                    

As you can see, as the servo-mounted stick spins to the desired position, all of the remaining sticks rotate with the force of acceleration. So, exactly like the previous folding fan, I need to fix the first stick facing outside (the first stick of the folding fan is fixed to the front board of the box).

th-9

th-9

Tip: The clay should be placed on a sponge to ensure that the bottom is breathable, allowing the clay to dry quickly and not stick to the table. I use dish sponges if anyone wants to play with clay.

th-17 th-15 th-16

                                         

Next to do

  1. Work on the fans.
  2. Make something as an interactive interface for the gesture sensor.

♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠

Dec 5, 2022

This week, I continued working on the other three folding fans and the interactive interface for the gesture sensor.

There are 3 iterations when I design the interactive interface. (I forgot to take photos of it.)

1st version:  The hole is too small, and the sensor can NOT detect ANY actions.

w12-1 

 

2ed version: The gesture sensor can detect actions for this version, but since the narrow height of the new hole, it’s easy for the sensor to detect the wrong gesture.

w12-2      w12-3

3rd version: The sensor works well at this time. The hole should be big enough to ensure the interface’s appearance, so I made a fan-shaped hole.

w12-5 w12-4

Video Demo:

 

🤔️ Questions:

When I tested it, I found that 5 fans can open and close smoothly about 3 times later, it will be like a power failure. The serial monitor shows the sensor also did not have any response. After reconnecting the Arduino or re-uploading the code, it will resume. I guess it’s because of the motor?? Because I have checked the code and power supply, there should be no problem.

♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠

Dec 12, 2022

Feedback & iteration from user testing:

1. Sensors are not responding.

The sensor did not respond in class, and Tom recommended that it may be because the ambient light had changed and that I attempt the calibration code to fix it. The unfortunate thing is that the sensor started working again once I brought it home, and it worked in both conditions where I switched on the brightest lamp and pointed it at the sensor, and when I shut off the lights, it was reasonably dark. I’m not sure why this is happening. When I was at home on the weekend, it suddenly stopped working again, I checked each link several times, but it is still not stable. The servos are powered by an external power supply via the servo driver, and all of the chip lights are illuminated. I began to suspect the most obvious explanation: poor contact somewhere. The sensor functioned well once I replaced the Nano with a Uno. Poor contact with nano! 😭

2. Interactive explanation problem.

It’s not enough to just rely on icons to explain; testers know to use their hands to control but still don’t know which side to start from. Everyone understands icons differently. To make the UI as readable, simple, and nice as possible, I added arrows and text.w13-p2

3. Consider the state of the installation when no one is interacting with it. David’s suggestion!

This is a fantastic suggestion! Just like a book’s foreword, a foreword can attract more readers and give a rough idea of what the book is about. However, due to the simplicity of my interaction design, the fan only has two states: open and closed. If the iteration is based on the present 5 fans, partitioning may be the only way to accomplish this. For example, 2 fans would open and close on their own, whereas only 3 fans would interact with people, resulting in a poorer user experience.

I still want to keep the existing five fans involved. And, because I only have one week left, I intend to create two more simple flat fans that are attached to the 360-degree servos. When no one is interacting, the 2 fans are in a reversed active state. When someone interacts with them, the 7 fans turn forward (open) and reverse (close) with hand gestures. This is a fairly simple and straightforward plan, but I’d like to try it out. In the future, I plan to do further experiments on this topic.

w13-p1

The “foreword” fan (similar mechanical structure to the cockade fan).

🤔️ The remaining question: 

For the rotational speed of the 360-degree servos, I’m using pulses to regulate the speed, but the speed is quite unstable, so I have to continually modify the value of the pulses. I‘m guessing it’s due to unstable voltage? If so, I’m wondering if adding a capacitor directly would improve it. But how big of a capacitor should I use? Should I use a voltage stabilizer instead?

The lighting

The installation, the light source, and the sensor should be placed in this order, from distant to near. I tested at school with a strong spotlight and tablet light source, with the two light sources presenting a distinct texture and atmosphere due to the different light temperatures

The brightness of the professional spotlight device is indeed extremely bright; however, owing to distance limits (the sensor’s line is not long enough, and I do not wish the interaction interface to be too far away from the installation), the lighting canvas that reached the wall was insufficient to cover the left and rightmost fans. The warm lighting is similar to sunshine, and the whole aesthetic is reminiscent of northern China, particularly Beijing culture and Hutong culture.

With a strong spotlight.

The light source of the iPad is cold light, which is much less bright, so I stand it directly on the desk in front of the device, which is not a very desirable setup position. However, the cool light enhances the texture of the shadows and adds to the atmosphere of the water villages in southern China. It was the picture I had in mind. It is ideal if the light source is cool, spherical, and large enough to cover all of the fans. 😂

With the iPad light.

Indeed, a large part of the installation’s design is based on ongoing testing and iteration, step by step, to get better outcomes. The image I see now, and the image I anticipate in the future, are both similar but unlike what I previously planned.

Testing at home.

Final code

Week 13/14 – Final Documentation & Semester Review & Summary

Feedback & Iteration from User Testing:

1. Sensors are not responding.

The sensor did not respond in class, and Tom recommended that it may be because the ambient light had changed and that I attempt the calibration code to fix it. The unfortunate thing is that the sensor started working again once I brought it home, and it worked in both conditions where I switched on the brightest lamp and pointed it at the sensor, and when I shut off the lights and it was reasonably dark. I’m not sure why this is happening. When I was at home on the weekend it suddenly stopped working again, I checked each link several times, but it is still not stable. The servos are powered by an external power supply via the servo driver, and all of the chip lights are illuminated. I began to suspect the most obvious explanation, poor contact somewhere. The sensor functioned well once I replaced the Nano with an Uno. Poor contact with nano! 😭

2. Interactive explanation problem.

It’s not enough to just rely on icons to explain, testers know to use their hands to control but still don’t know which side to start from, everyone understands icons differently. To make the UI as readable, simple, and nice as possible, I added arrows and text.w13-p2

3. Consider the state of the installation when no one is interacting with it. — David’s suggestion!

This is a fantastic suggestion! Just like a book’s foreword, a foreword can attract more readers and can give a rough idea of what the book is about. However, due to the simplicity of my interaction design, the fan only has two states: open and closed. If the iteration is based on the present 5 fans, partitioning may be the only way to accomplish this. For example, 2 fans would open and close on their own, whereas only 3 fans would interact with people, resulting in a poorer user experience.

I still want to keep the existing five fans involved. And, because I only have one week left, I intend to create two more simple flat fans that are attached to the 360-degree servos. When no one is interacting, the 2 fans are in a reversed active state. When someone interacts with them, the 7 fans turn forward (open) and reverse (close) with hand gestures. This is a fairly simple and straightforward plan, but I’d like to try it out. In the future, I plan to do further experiments on this topic.

w13-p1

The “foreword” fan (similar mechanical structure to the cockade fan).

🤔️ The remaining question: 

For the rotational speed of the 360-degree servos I’m using pulses to regulate the speed, but the speed is quite unstable, so I have to continually modify the value of pulses. I‘m guessing it’s due to unstable voltage? If so, I’m wondering if adding a capacitor directly would improve it. But how big of a capacitor should I use? Should I use a voltage stabilizer instead?

The lighting

The installation, the light source, and the sensor should be placed in this order, from distant to near. I tested at school with a strong spotlight and tablet light source, the two light sources presenting a distinct texture and atmosphere, since the different light temperatures

The brightness of the professional spotlight device is indeed extremely bright, however owing to distance limits (the sensor’s line is not long enough, and I do not wish the interaction interface is too far away from the installation), the lighting canvas that reached the wall was insufficient to cover the left and rightmost fans. The warm lighting is similar to sunshine, and the whole aesthetic is reminiscent of northern China, particularly Beijing culture and Hutong culture.

With the strong spotlight.

And the light source of the iPad is cold light, which is much less bright, so I stand it directly on the desk in front of the device, which is not a very desirable setup position. However, the cool light enhances the texture of the shadows and adds to the atmosphere of the water villages in southern China. It was the picture I had in mind. It is ideal if the light source is cool, spherical, and large enough to cover all of the fans. 😂

With the iPad light.

Indeed, a large part of the installation’s design is based on ongoing testing and iteration, step by step, to get better outcomes. The image I see now, and the image I anticipate in the future, are both similar but unlike what I previously planned.

Testing at home.

Final code

 

Semester Review & Summary

First and foremost, this semester’s course introduced me to physical interaction for the first time, and it felt as if a new world had opened up to me. I think physical computing can achieve lots of what I want to convey, and I can empathize with mechanical or physical expression better than screen expression. I enjoy expressions with a strong feeling of impact.

Personally, I’ve always been interested in subjects relating to Eastern aesthetics and Emotional expressions, and I wish to explore these topics more next semester. At the same time, I am engaged in Marketable interactive products. Building a relatively ideal user experience process is never formalized and needs repeated research and testing, which is the part that interests and challenges me.

During the final assignment, I developed a more multidimensional grasp of user experience than I had previously.

First, the UX dimensions that need to be considered vary based on the size of the installation. Using my final as an example, the seven fans at the end of the period were clearly more aesthetically appealing than the two fans at the beginning. And, in order to make the narrative of a relatively large-scale installation more complete and fluid, I need to consider the interaction behavior more thoroughly, just as David suggested on the day of user testing, that the installation is running without people interacting with it, and the state of the installation can be used to attract people and as an “introduction” for the interaction behavior later on. When I’m attempting to tell a “larger” story (either in terms of physical scale or content design), I have to think about what happens before, during, and after human interaction.

The second is a description of the installation’s interaction. For my final project’s interaction interface, I insisted on utilizing solely icons to guide rather than words. However, I discovered that people perceive icons differently. People have the time and energy to comprehend the meaning of these icons if it is a marketable/lifestyle products, and most products have manuals, and mobile applications include first usage instructions. The spectator may only stop in front of an installation for a few minutes, and it is a superb challenge to be able to figure out the precise meaning quickly in a few minutes for the graphic representation. Text may be an indispensable aid sometimes.

Concerning the follow-up study
1. More attempts to gain a better understanding of electrical-related knowledge, as I mentioned above regarding the voltage question, are necessary for more experiments to uncover the problem and find the solution.
2. Continuous code learning, which allows for more complex interactions.
3. Fabrication: In the spring, I plan to attend an Introduction to fabrication class, which will help me develop new skills.
4. The most significant thing I’ve learned in a long time: Reading, writing, and thinking; feeling the world, appreciating and employing my heightened sensitivity, and sustaining high-quality input and output.

 

 

Week 12 – Final (4)

This week I continued working on the other three folding fans and the interactive interface for the gesture sensor.

There are 3 iterations when I design the interactive interface. (I forget to take photos of it…)

1st version:  The hole is too small, and the sensor can NOT detect ANY actions.

w12-1 

 

2ed version: The gesture sensor can detect actions for this version, but since the narrow height of the new hole, it’s easy for the sensor to detect the WRONG gesture.

w12-2      w12-3

3rd version: The sensor works well at this time. The hole should be big enough to ensure the interface’s appearance, so I make a fan-shaped hole.

w12-5 w12-4

Video Demo:

 

🤔️ Questions:

When I tested it, I found that 5 fans can open and close smoothly about 3 times later, it will be like a power failure. The serial monitor shows the sensor also did not have any response. After reconnecting the Arduino or re-uploading the code, it will resume. I guess it’s because of the motor?? Because I have checked the code and power supply, there should be no problem.

Week 11 – Final(3) – Code

For fabrication works, please check it out HERE.

The code is logically divided into 3 parts and I test the code’s feasibility independently before putting it together.
The three sections are the connection between the gesture sensor and the 180-degree servos, the logic of the gesture sensor, the 360-degree servo, the limit switches, and the connection between the 16-servo driver and the Arduino.

Test 1 – Gesture sensor & 180-degree servos

#include “Adafruit_APDS9960.h”
#include<Servo.h>Servo myServo;Adafruit_APDS9960 apds;
int pos = -45;// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(115200);if (!apds.begin()) {
Serial.println(“failed to initialize device! Please check your wiring.”);
}
else Serial.println(“Device initialized!”);//gesture mode will be entered once proximity mode senses something close
apds.enableProximity(true);
apds.enableGesture(true);
myServo.attach(3);
myServo.write(pos);
}// the loop function runs over and over again forever
void loop() {
//read a gesture from the device
uint8_t gesture = apds.readGesture();
if (gesture == APDS9960_DOWN) Serial.println(“v”);
if (gesture == APDS9960_UP) Serial.println(“^”);
if (gesture == APDS9960_LEFT) {
Serial.println(“<“);
for (pos = -45; pos < 132; pos += 1) {
myServo.write(pos);
delay(10);
}
}
if (gesture == APDS9960_RIGHT) {
Serial.println(“>”);
for (pos = 132; pos > -45; pos -= 1) {
myServo.write(pos);
delay(10);
}
}
}

Test 2 – Gesture sensor & 360-degree servo & limit switches

There are 2 factors to consider when triggering limit switches: 1) Torque depends on current, and 2) the mounting position of the limit switches and the speed (pulse, voltage-dependent) and torque (current-dependent) of the servo determine whether the trigger is successful.

#include “Adafruit_APDS9960.h”
#include<Servo.h>
#include <ezButton.h>ezButton limitSwitch1(6);
ezButton limitSwitch2(10);Servo myServo360;Adafruit_APDS9960 apds;//define the value of dif behaviors by 360c servo:
//int sc[] = {1500, 1800, 1200};
int sc[] = {92, 97, 88};
//stand for:STOP,CCW,CW// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(115200);limitSwitch1.setDebounceTime(50);
limitSwitch2.setDebounceTime(50);if (!apds.begin()) {
Serial.println(“failed to initialize device! Please check your wiring.”);
}
else Serial.println(“Device initialized!”);

//gesture mode will be entered once proximity mode senses something close
apds.enableProximity(true);
apds.enableGesture(true);
myServo360.attach(3);
//myServo360.writeMicroseconds(sc[0]);
myServo360.write(sc[0]);
}

// the loop function runs over and over again forever
void loop() {
// MUST call the loop() function first
limitSwitch1.loop();
limitSwitch2.loop();

int state1 = limitSwitch1.getState();
int state2 = limitSwitch2.getState();

//read a gesture from the device
uint8_t gesture = apds.readGesture();
if (gesture == APDS9960_DOWN) Serial.println(“v”);
if (gesture == APDS9960_UP) Serial.println(“^”);
if (gesture == APDS9960_LEFT) {
Serial.println(“<“);
//myServo360.writeMicroseconds(sc[1]);
myServo360.write(sc[1]);
delay(10);
}

if (gesture == APDS9960_RIGHT) {
Serial.println(“>”);
//myServo360.writeMicroseconds(sc[2]);
myServo360.write(sc[2]);
delay(10);
}

// set 2 limit switches:
if (state1 == LOW) {
//myServo360.writeMicroseconds(sc[0]);
myServo360.write(sc[0]);
Serial.println(“The limit switch1: TOUCHED”);
}

if (state2 == LOW) {
//myServo360.writeMicroseconds(sc[0]);
myServo360.write(sc[0]);
Serial.println(“The limit switch2: TOUCHED”);
}
}

Test 3 – 16-servo driver & Arduino

Due to the torque and the number of 5 servos currently set, I chose to use a servo driver. It is possible to drive 16 servos at the same time and even add multiple drivers (unique addresses need to be assigned) so that the servos can be powered by an external power supply and the Arduino by a USB cable.

th-18Adafruit 16-Channel 12-bit PWM/Servo Driver – I2C interface – PCA9685

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();#define servoMIN 150
#define servoMAX 600
#define servoFREQ 60byte servoNum = 0;void setup() {
Serial.begin(9600);
pwm.begin();
pwm.setPWMFreq(servoFREQ);
}void loop() {for (int pulse = servoMIN; pulse < servoMAX; pulse++) {
pwm.setPWM(servoNum, 0, pulse);
Serial.println(servoNum);
}
delay(100);for (int pulse = servoMAX; pulse > servoMIN; pulse–) {
pwm.setPWM(servoNum, 0, pulse);
Serial.println(servoNum);
}
delay(100);

servoNum++;
if (servoNum > 3) {
servoNum = 0;
}
}

Current version:

The servo’s speed and direction are controlled by adjusting the pulse value. I’ve done a lot of testing and adjusting here, including the value of the pulse and the position of the limit switches and fans. Especially for the 360-degree servo, the forward trigger switch is considerably quicker than the reverse trigger switch.

🤔️ Question: I guess it was due to the position of the mechanical installation. This issue might be resolved with more precise position calculations or a higher-power servo machine. 

#include “Adafruit_APDS9960.h”
#include <ezButton.h>
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();ezButton limitSwitch1(2);
ezButton limitSwitch2(5);#define servoMIN 150
#define servoMAX 600
#define MIN 600
#define MAX 1900
#define servoFREQ 50byte servoNum = 0;
int Num[] = {0, 1, 2, 3};
int sc[] = {1450, 1400, 1550};
//stand for:STOP,CCW,CWAdafruit_APDS9960 apds;
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(115200);
Serial.println(“4 channel Servo test!”);
limitSwitch1.setDebounceTime(50);
limitSwitch2.setDebounceTime(50);

if (!apds.begin()) {
Serial.println(“failed to initialize device! Please check your wiring.”);
}
else Serial.println(“Device initialized!”);

//gesture mode will be entered once proximity mode senses something close
apds.enableProximity(true);
apds.enableGesture(true);

pwm.begin();
pwm.setOscillatorFrequency(27000000);
pwm.setPWMFreq(servoFREQ);
delay(10);

for (int i = 0; i < 4; i++) {
pwm.writeMicroseconds(Num[i], MIN);
}
for (int i = 4; i < 7; i++) {
pwm.writeMicroseconds(i, 0);
}
}

// set the pulse length in second:
void setServoPulse(uint8_t n, float pulse) {
float pulselength;

pulselength = 1000000; // 1,000,000 us per second
pulselength /= servoFREQ; // Analog servos run at ~60 Hz updates
//Serial.print(pulselength); Serial.println(” us per period”);
pulselength /= 4096; // 12 bits of resolution
//Serial.print(pulselength); Serial.println(” us per bit”);
pulse *= 1000000; // convert input seconds to us
pulse /= pulselength;
//Serial.println(pulse);
pwm.setPWM(n, 0, pulse);
}

// the loop function runs over and over again forever
void loop() {
// CALL the loop() function first
limitSwitch1.loop();
limitSwitch2.loop();

int state1 = limitSwitch1.getState();
int state2 = limitSwitch2.getState();

//read a gesture from the device
uint8_t gesture = apds.readGesture();
if (gesture == APDS9960_DOWN) {
Serial.println(“v”);
//pwm.writeMicroseconds(6, 0);
}
if (gesture == APDS9960_UP) {
Serial.println(“^”);
//pwm.writeMicroseconds(6, 1300);
}

if (gesture == APDS9960_LEFT) {
Serial.println(“<“);
for (int servoNum = 0; servoNum < 4; servoNum++) {
for (uint16_t microsec = MIN; microsec <= MAX; microsec ++) {
pwm.writeMicroseconds(servoNum, microsec);
}
}

pwm.writeMicroseconds(4, 1325);
//pwm.writeMicroseconds(4, 1310);
}

if (gesture == APDS9960_RIGHT) {
Serial.println(“>”);
for (int servoNum = 3; servoNum >= 0; servoNum–) {
for (uint16_t microsec = MAX; microsec >= MIN; microsec –) {
pwm.writeMicroseconds(servoNum, microsec);
}
}

pwm.writeMicroseconds(4, 1225);
//pwm.writeMicroseconds(4, 1235);

}

//set 2 limit switch:
if (state1 == LOW) {
pwm.writeMicroseconds(4, 0);
//pwm.writeMicroseconds(5, 0);
Serial.println(“The limit switch1: TOUCHED”);
}

if (state2 == LOW) {
pwm.writeMicroseconds(4, 0);
//pwm.writeMicroseconds(5, 0);
Serial.println(“The limit switch2: TOUCHED”);
}
}