Mittwoch, 8. April 2015

Arduipong - Arduino and Processing

For this project I needed two components: the Arduino and Processing. The Arduino is attached to a very simple potentiometer circuit. The Arduino analogReads the potentiometer value and sends it via serial communication to Processing.

In Processing I am using and altering a sketch I found online by Thomas Koberger. He, however, did not connect the Arduino, so I needed to manipulate the sketch to add serial communication. The Arduino value from the potentiometer was then used in the Processing sketch to move the paddle.

For laser cutting I wanted to add an esthetic to the project. I really like wood and I thought it would be a nice material for a tech project. A laser cutter can be used to cut as well as etch on wood. So I used it to cut out the hole for the potentiometer and etch an image of Pong Pagong (the Philipino version of Big Bird on "Sesame!").


Here are the results of the laser cutting:
 
Top view

Side view
For improvements I would add a second potentiometer to the mix because right now it is only a single version. For a two player version I would make a squash type where both paddles are on the same side.

It was fun to learn about lasercutting in this assignment. It seems to be very easy once you have figured it out. Also, it makes projects look a lot better with relatively minimal effort. 


Freitag, 27. März 2015

Midterm - plan of work

This blog post outlines our project and which work has already been done. Stay tuned for more!

Title: Facebook Alarm Clock - never snooze

Concept:
When hitting the snooze button in the mornings, you are instantly rewarded with five extra minutes of sleep. However, you should really be punished for it. This project turns hitting the snooze button into a bad thing. So our project will give you an incentive to not hit the snooze button and an incentive to get out of bed if you do hit the button. This is achieved by building a circuit that is connected to your Facebook account. Every time you hit the button, the Facebook Alarm Clock will post some embarrassing message to your Facebook account, instantly punishing you for snoozing your alarm. So if you still dare to hit the alarm, you have an incentive to get up as soon as possible to delete that post

Target audience:
Initially the target audience was I because I developed bad sleeping habits in the mornings keeping me from waking up in time. However, since waking up to an alarm is part of almost everyone’s routine, this project could really be used by anyone (with bad snoozing habits and a Facebook account).

Technical:
For this project we will be using:
  • an Arduino circuit
  • Processing
  • Facebook/the Graph API
The circuit is really quite simple. All you need is a button (which will be an analog button made from two wires) that gives a digital input to the Arduino, which will use serial communication, to trigger the Processing code that interacts with the Graph API.
All embarrassing posts will be stored in an array, from which the code will randomly pick one message that will be passed on to the graph API.

**update** now using the Twitter API instead. see below for details

Manufacturing:
For manufacturing we will attach two wires to the alarm clock that will touch when the snooze button is hit. This is the analog switch I mentioned above.

Problems:
The biggest problem is that we have not done extensive work in Processing and that I have no previous experience with the Graph API. So these are two fields I will have to explore. Luckily, there is some code online that I’ll be able to use to work with the Graph API.

After having talked to Kate (our tutor), we switched to the Twitter API since the integration appears to be easier than the Facebook/Graph API. We will probably use this project as a test run and then dabble with the Graph API once we are comfortable with the prototype.

Source codes/libraries taken from online sources:
  • Twittjer4j library for connecting to twitter: http://twitter4j.org/en/index.html
  • Processing and Twitter API for querying Twitter: https://github.com/ThomasLengeling/QueryProcessing2.0/blob/master/twitterQuery/twitterQuery.pde

Team:
Nataliya and I decided to be working on this together.

Nataliya will take care of making the actual alarm clock circuit (I have been working with the breadboard and a simple push button switch) that triggers the posting on Twitter. She will also change the ThomasLegeling code so that we will post to Twitter rather than querying Twitter.

I have set up the Twitter app account (which gives us the access tokens needed to connect to the Twitter API), established the serial communication, and added this code to the ThomasLengling code. So the push of the button on the breadboard triggers the processing code to query the Twitter API.

Montag, 16. März 2015

Lab 5 - Processing

Oscillating circle with Processing

  1. Processing is based on Java
  2.  a local variable is defined and can only be called within a function. A global variable is defined outside of a function and any function can call it.
  3. None, since it is a void method.
  4. In short, the code makes sure that the ellipse stays within the bounds of the screen. Since the ellipse only moves along the y axis, only the y coordinate has to be checked while the x coordiante can be ignored. Thus, this code makes sure that the ellipse stays within bounds by checking that y (indicating the center of the ellipse) plus the radius of the ellipse never exceed the height (600) and that y minus the radius of the ellipse never is lower than the top border (0). Once the ellipse reaches either limit, its direction is reversed.

Sending Serial Data from an Arduino Circuit to a Processing Application

Etch a Sketch
(sorry for the bad quality. The blogspot upload compressed it a lot. I hope you can see it!)


Montag, 9. März 2015

Interactive toy

Front view

Top view

Side view (right)

Back view

Side view (left)

Intended audience:
This toy is intended for children over the age of 6 years old. The box invites the user to explore its shape and its functions. There are three triggers/sensors - a potentiometer, a photometer, and a press sensor. When a sensor is deactive - a corresponding green LED is pulsating. After triggering, the green LED is turned off and in turn a red LED is turned on (not pulsating). 
Only after the first sensor (the potentiometer) is dialed it to the correct resistance, the next sensor (the photosensor) can be triggered. This is done physically (i.e. no Arduinoe needed in this step) by connecting a wire from the potentiometers red LED to the photosensor circuit.
Once the photosensor circuit triggers the red LED, the press sensor can be manipulated. Once all three sensor are at the correct value, the blue LED in the middle/top will be turned on. 

Capibilities:
The shape of the toy invites the user to explore the toy in three dimensions, i.e. the user needs to turn and the box in order to discover all the sensors. Also, the placement of the LEDs seems random, i.e. the LEDs corresponding to a sensor are displaced so the user needs to trigger a sensor and observe all sides to see which LED just turned off/if anything happened. 

Limitations:
I first wanted to build a sphere, making the interaction a little more abstract. This is because a sphere does not have difinitive sides, making it harder for the user to explore and navigate the object. The wiring also is very sensitive - I used wrapping wire which was very good. However, I was unsure how to really connect the sensors to the Arduino. After sleeping a night over it, I came up with a better idea I will be able to use next time. 

Affordance:
There are 3 affordances: turning (potentiometer), covering (photometer), and pressing (press sensor). All of these are of course connected to/reliant on observation of the LEDs.

Testing:
Unfortunately I do not know any small children in NYC so I used my roomates.
I tested my toy with my roomates in two stages: in the breadboard stage and the physical stage (i.e. the final product). During the breadboard stage, my roomates had a very easy time figuiring out the triggers becasue the LEDs where placed right next to the tirggers. Thus, there was no exploration of the actual object needed. 
During the final test, my roomates needed to inspect the object in order to understand the sensor layout as well as to explore the effects of the triggers. Thus, the physcial object added another layer of complexity and interactivty to the toy.


Sonntag, 8. März 2015

Lab 4 - Servos

Servo motor controlled by PMW from Arduino

 

  1. The delay is added in order for the servo to move at a slower speed. Before i is incremented or decremented by 1, the loop will pause for 45 milliseconds resulting in a slower speed of the servo.
  2. It would b:
                         for(int i = 0; i <=45; i++){
                              toyServo.write(i);
                              delay(Servopause);
                          };

                         for(int i = 45; i >=0; i--){
                              toyServo.write(i);
                              delay(Servopause);
                          };
     3. It is because tone() and servo.attach() use the same timer. Thus, the two components are
         conflicting in their operations.


Servo motor controlled by potentiometer and Arduino




Servo motor controlled by a pushbutton momentary switch


Dienstag, 24. Februar 2015

Lab 3 - Transistors

Force-sensitive Resistor and LED with Arduino


Give ideas of 2 applications of this sensor in the field of improving accessibility for handicapped people.
  1. For people in wheelchairs, FSRs could be embedded in tiles in front of doors in order to trigger servos to open the door. 
  2. FSRs could be used in order to control a servo for lifting objects. The power of a circuit is measured in Watts and Watts = Voltage * Current. Since FSRs influence the current in circuits, pressure sensors can be used to perform lifting of objects based on how hard a handicapped person is pushing on the sensor. 


Temperature Sensor and LED circuit with Arduino

 (the temperature difference between the window and the rest of the room was pretty drastic that day)
  1. We use a voltage divider circuit for potentiometers, force-sensitive resistors, and many other sensors. Why do we not need to use a voltage divider circuit with this temperature sensor?
    • Because a temperature sensor essentially is a potentiometer just like FSRs and other sensors. 
  2. Unlike pressure sensed by force-sensitive resistors, or rotation sensed by potentiometers, ambient temperature sensed by temperature sensors almost always changes very gradually and slowly. How does this affect the design of interactions based on this sensor?
    •  FSRs or rotation sensed by potentiometers are very useful when intercting with people, since people can elicit a direct response from the prototype. A design relying on temperature sensors could be used for the prototype to interact with the environment, rather than a human being. This is because the gradual change does not give the user instant gratification.
  3. Given the range of temperatures at which this sensor works, please give 2 ideas for applications of this sensor. Applications may involve anything from scientific research to artistic endeavors, but they should necessitate the use of this sensor, as opposed to other sensors.
    • professional coffee brewing requires the perfect water temperature. A temp sensor could be used to control a hot plate, ensuring consistant water temperatures.
    • during my final exams in high school I always wondered how much the room temperature was changing during the course of long exams as all students were concentrating and producing heat. A temperature sensor could record the data and through a serial connection this data could be fed to python for algorithmic manipulation. This data could the be outputted to a speaker to create a song/audio art project. 

Transistor as a Switch

(it is very hard to see but the other LED is lighting up dimmly)
  1. Why is the LED turned on by the switch dimmer than the LED turned on by the transistor?
    • because the current is running through a 10kΩ resistor before reaching the LED. In the "high power line" there is only a 560Ω resistor, resulting in a higher current reaching the LED.
  2. Give the approximate current flowing through each leg of the circuit (ignore any affect the transistor might have on the current flow or voltage drop).
    • high power line:
      • initial current = 5V
      • resistor = 560Ω
      • using Ohm's law we can solve fore I (current)
      • 5V = I * 560Ω
      • 5V/560Ω = I
      •  8.92mA = I
    • switch line:
      • initial current = 5V
      • resistor = 10kΩ
      • 5V = I * 10kΩ
      • 5V/10kΩ = I
      • 0.5mA = I

Transistor Amplifier

  • How does turning the potentiometer to maximum resistance affect the sensitivity of the circuit to the photo-resistor’s signal, as compared to turning the potentiometer all the way to minimum resistance?
    • The wire going into the transistor to activte/"zap" is placed between two resistors. Thus, we have to use the voltage diver formula (Vout = Vin(R2/(R1+R2))) to understand how turning the potentiometer to a maximum or minimum affects the circuit. 
      • at a maximum, R1 is at 20kΩ, decrasing the ratio of R2 to R1. Thus, the circuit is less sensitive to the photo resistor's signal.
      • at a minimum, R1 is at 10kΩ, increasing the ration of R2 to R1. Thus, the circuit is more sensitive to the photo resistor's signal.

Transistor Controlled by Arduino

Arduino as a switch


Arduino as an amplifier

Donnerstag, 12. Februar 2015

Lab 2 - Microcontrollers

Blinking LED with Arduino




Switch and LED circuit with Arduino

How would you modify the circuit (without altering the code) so that the LED was turned on by default, and only went off when someone pressed the switch?



Potentiometer and LED Circuit with Arduino


  1. The reading is 1023. To convert to voltage we have to multiply this sensor value by 5/1023. This equals 5V.
  2. The reading is 0. Doing the above math, we geth 0V.
  3. To find the reading we have to solve for X in this equation. 2.5 = (5/1023) * X. 2.5/(5/1023) = 592. 
  4. The analogRead ranges from 0 to 1023. The LED output value, however, only ranges from 0-255 because it is digital. Thus, you need to convert the analog reading to a digital reading. This is done by multiplying by 0.25 or dividing by 4.

Potentiometer and Speaker Circuit with Arduino


  1. No, because the speaker is dropping some voltage
  2. The volume of the speaker is dictated by the current running through it. So, in order to have the volume be higher, you'd need a high current to reach the speaker, i.e. amplify it.
  3. YES!

Photoresistor and Speaker Circuit with Arduino


  1. You need to change the 10kΩ resistor with the photoresistor. That is because as there is light shining on the photoresistor its resistance of it is low. Hence, more current flows into ground directly. However, when the light source is low, the resistance of the photosensor is high and less current flows into ground and rather through the 10kΩ resistor to the Arduino. 
 

Instrument


 
  • Crawford defines interactivity as "a cyclic process in which two actors alternately listen, think, and speak". In this case, the two actors are the instrument and I. First, let's break the listening, thinking, and speking down for each actor.
    • instrument: the instrument has two ways of listening: the photosensor and the pressure sensor. The thinking is done by the arduino. The photosensor and pressuresensor are programmed to give input. This input is calculated from analog to digital for the output of the speaker (which obviously does the speaking of the instrument).  The spoons, however, do not give input; they merely complete the second circuit.
    • I: I do the listening with my ears, the thinking with my brain, and the speaking with my hand movements
  • In the video, I first listen, then think what I can do to change the sound, and decide to move my hand. As soon as I move my hand, the insturment listens, thinks, and speaks. (Almost) instantly I listen again, think, and then speak. Then it's the instrument's turn again. This process keeps on going until I decide to no longer use the instrument and turn it off. 
  • For improvements I could do the following:
    • in the video I am using a row of coins as conductors between the spoons. I could have set up different conductors to manipulate the sound more with the spoons. Further, it is difficult to both slide the top of the box and activate the pressure sensor simulateously. Next time I should fix the pressure sensor under the box, so I can slide the top of the box and press down on the sensor at the same time.