Pcomp Assignment 1
This week I created the High Five Dragon – a toy dragon that gives you a high five every time you take a break from working in front of the computer (or in front of something else.).
My first idea for the project was to simply trigger a toy dragon to move a certain way once interacted with in a specific method, this was because I attached the servo motor to the dragon’s arm for last week’s lab and really enjoyed seeing an usually inanimate toy move upon interaction.
At first I thought of making the dragon lift its hand when a correct passcode is entered. Something can be put underneath the hand and the interaction could be designed so that dragon lifting its hand can signify that it is offering you whatever object is underneath it. The buttons being programed to move the motor when pressed in the right order can have words attached to them, and the correct order of button can form a sentence with a word attached to each button (eg. can-you-lift your-hand?).
For my second iteration of the idea I decided to make the interaction more related to real world actions rather than a closed loop of action based solely on the device itself. Having been busy working on my laptop the past month, I was inspired to make the dragon give out a high five to its user whenever some work has been completed on the computer.
Initially, I thought of having the user press “ctrl+s” as the input signal to trigger the arm movement, since saving one’s file is usually a sign that some work has been done. However, after some research I found out that while keyboard input is possible with an Arduino DUE, it can only be done with the serial monitor open and not when another window is selected. This will not work for my idea of detecting keyboard input when an user saves their file on a different window than the serial monitor.
Eventually I decided to use PIR motion sensor as a way to detect weather or not the user is moving in front of the computer since little movement will be present when a user work in front of the laptop and bigger movements will occur if the user stretches or get up to get water in between work. I was able to order some PIR motion sensors from amazing and integrate a modified version of an Arduino sketch from online into my own sketch in order to get the motion sensor to work with my setup.
This is how I arrived at the final setup plan for the project: A toy dragon which raises its hand to give a high five when the user stretches/gets up from the desk after working, and lowers its hand when the user returns the high five.
The main components of my circuit for this project consist of an Arduino with a PIR sensor providing digital input for when to move the servo motor which is attached to the dragon’s arm, and a force sensitive resistor sensing when the user touches the dragon’s hand to signal the motor to lower the arm again. I also added an LED which lights up when the motion sensor detects motion just as an indication/aesthetic element.
Writing the sketch for the interaction took longer than expected. I didn’t encounter problems when coding the motor, LED, and FSR, but the PIR sensor was tricky to get right. I found a sketch for using a motion sensor with an Arduino online which reports when motion is detected on the sensor, the confusing part of this sketch is that there are two separate variables for the value from the sensor and the state which the sensor is in (motion detected or no motion detected). I had a hard time understanding the relationship between those variables and how they are placed in the “if” statements, and a harder time trying to integrate the instructions for the FSR and motor with the sensor. The current functional sketch for the project was arrived through a lot of confused trial and error. Once the setup is functional, I adjusted the values for the motor angle and FSR sensitivity in the sketch. The motion sensor sensitivity was also adjustable on the sensor itself but I find that even after adjustments it is still way to sensitive for my liking (it triggers the dragon to raise its arm even if I make a tiny movement instead of only when I make a big movement).
The circuit components on the breadboard was put into a small box which the dragon lays on top of with holes cut in the box for the components that needs to reach outside (sensor, power cable, motor, FSR).
Alligator head wires were used to extend the components to reach their locations (FSR to dragon arm, sensor to computer). For the final touch I placed polyester stuffing all around the setup so it looks like the dragon is laying down on a piece of cloud instead of a plain cardboard box with wires coming out. I also placed the LED inside the cloud stuffing so we can see it lighting up when the dragon gives out the high five.