Monday, September 24, 2012

Sept 24-Analog Input

Introduction:
This week in lab, we were working on sending analog input for our Arduino. At first I was worried since we had so many issues learning how to do digital input, but surprisingly the analog went quite well. This lab covered using analog input with a potentiometer, a photo-resistor, a thermometer, and a force sensitive resistor (FSR).

Procedure:
My lab partner and I decided to start with the potentiometer. This required hooking up a basic circuit with an LED and running a code that caused the LED to blink. The potentiometer pin was set to change the speed in which the LED blinked based on how much resistance there was. Here's a video showing our results.

Next it was time to tackle using the photo-resistor. The photo resistor gives resistance based on the amount of light that it senses. Once again, it was connected to our basic LED circuit, allowing the LED to get brighter or dimmer based on the amount of light the resistor sensed. Here is a picture of our circuit when we were shining a light on the photo-resistor.


Using the thermometer was next. For this step, we simply plugged the thermometer into our Arduino and placed it in warm water. We tracked the temperature using the serial monitor window. We then removed it from the water and compared the temperatures.

Lastly, we used the FSR. This was connected to our LED circuit. The more pressure applied to the sensor, the brighter the LED was. 




Conclusion:
Overall I was happy with the lack of struggle that we had completing this lab. I finally feel like I'm getting the hang of circuitry and am beginning to get a better grasp on programming in C.

Monday, September 17, 2012

Sept 18-Thoughts on an Article



For this assignment, we were supposed to list (in bullet form) some of the most important developments that we saw from this article: http://www.doc.ic.ac.uk/~frk/frank/da/hci/The%20Psychopathology%20of%20Everyday%20Things%20(Norman).pdf

Here are some of the ones that I observed:
     
·        The author makes it clear that form follows function. A pretty object does nothing if it is not functional.

·        Along those same lines, the function needs to be clear and obvious. If a user cannot determine how to use the object, it is considered non-functional.

·        To make sure that the object is functional, you need to test it and make sure that its function is fairly intuitive and user friendly.

·        If there is something about your object that is not intuitive or obvious to the user, you need to make sure to provide clear concise documentation on how to use the object.

·        If you’re going to provide documentation, it needs to be understandable and easily accessible so that the user can actually find and comprehend the information being communicated.

·        If there are pieces of the object that the user will often have to manipulate like buttons or switches, put them in an easily accessible location where it is convenient for the user to reach them.

·        Functions that are not necessary and not particularly useful in ordinary situations are often better left out, simply because they complicate the device and make it harder for the user to interpret operational procedures.

Sept 17-Digital I/O


Introduction:
For this week’s homework project, my partner and I decided to recreate the Pirate Isle game that I had to program in Racket last semester for CSC 120. It is a simple game that requires two inputs and seven outputs.  At first I was intimidated as I tried to think through what all was going to be involved, remembering the painful hours I spent last semester trying to hammer out exactly how to make the game work, but once we got started, it was a lot easier to break it all down and accomplish our task.

There were definitely more than a few moments where I felt like this,

But after fiddling with all of the hardware and debugging the code, everything came together and works exactly as intended.

Procedure:

The Game

This is what the game map looked like in Racket.

The user began on Pirates’ Island and tried to navigate to Treasure Island by pressing either the “A” or “B” on the keyboard.  The green circle would move to indicate which island you were currently on.
Rather than just using an image, we decided to use LEDs to represent Islands and Pushbuttons instead of a keyboard.  The game consists of 2 buttons and 7 islands. There is a set path that the LEDs will follow based on which button is pushed. The user will have to discover the path to make it to treasure isle.  Rather than a moving green circle, the currently occupied island will be indicated by the LED being turned on. Once the game is completed, the LEDs will trace the path that the user followed and flash the Treasure Island LED

Programming and Circuitry

Circuitry was definitely our problem child with this project. It seemed like as soon as we got part of the circuit working, another part would stop. Pushbuttons seemed to be the root of all of our problems.
Finally, after moving around wires and trying several different layouts, we managed to get the LED to turn on when the button was pressed and turn off when the button wasn’t pressed. 
Next, we decided to try to get the button to turn on with the press of the button and stay on until the next press of the button, allowing the pushbutton to act like a light switch. At first it seemed that we had figured it all out, but the light would turn on or off erratically, or dim instead of turning off. After reading some documentation, we realized this was caused by “debouncing.” This is from an extra signal being sent to the Arduino because the contacts in the pushbutton bounce. Basically, when the button is pushed, it makes contact twice instead of once. While this happens in less than a second, the microcontroller is able to read the input even faster. So to fix this issue, we added a delay in our code so that the microcontroller would only react to the button push after half of a second. This eliminated the debouncing and allowed our light to work properly.
The next thing we wanted to do was connect a second LED so that we could start writing the program for multiple LEDs. We decided to write the program to have different states. State 0 was when both LEDs were turned on, State 1 was when the red LED was on and green LED was off, State 2 was when the red LED was turned off and the green LED was turned on, and the final state was the same as the initial-where both LEDs were turned off. We designed the program to change between states on the press of the button.

Once that was working properly, we redesigned the code for the specific needs of our project. Keeping in mind the idea of states, we designed if statements for each of the buttons to determine which LED should be lit up using our predetermined path. For example:


else if(button == 2){
    if(state == 7)
      {state = 8;}     


This tells the program that if the board is in state 7 (read: LED 7 is lit up and the rest are turned off) and button two is pressed, change to state 8 (where LED 8 is lit up and none of the others are). By having an if statement for each of the possible states (since the LEDs were plugged in to pins 7-13, states 7-13), we were easily able to tell the program which light should be on. To make sure that the other lights got turned off, we used another simple function.


void turnAllOff(){
 for (int i = 7 ; i < 14; i++)
  {digitalWrite (i, LOW);}


This walks through and writes each LED pin, starting at 7, and rewrites them at low (or, in simple terms, turns them off).

We decided the next step was to plug up all of the wires and both buttons to make sure that they all worked and to test our program. We encountered a few basic errors and made minor mistakes such as plugging an LED to a wrong pin, etc. but the majority of the process went smoothly.

Once all of that was successfully working, we decided to attack design-how to make the game look pretty. First, I cut a piece of foam board to the size I wanted the game to be, and printed an image of the island map. After hot gluing the map onto the board, I punched small holes in the middle of each island for the LEDs and cut two holes near the bottom for the pushbuttons to make a face plate. Then, I took two more pieces of foam board and made legs for the plate so that it would be suspended above our breadboard. I then took another piece of board and glued it to the bottom, making a 2-sided box so that the game would be neat, clean, and easy to transport, but so that it was still easy to see the wiring inside.
Next, we had to solder wires to each of the LEDs and to each of the pushbuttons so that they could be pushed into the faceplate without being too far from the breadboard. Soldering seemed much easier this time around and all of that went smoothly.
Now that all of the coding was taken care of, the hardware was prepared, and all of the exterior design was done, it was just a matter of plugging everything up. We pushed the LEDs and pushbuttons through the holes we had made in the map face plate and plugged in all of the wires.
Voila! The finished product.


Conclusion:
In the end, I learned a lot about circuitry as well as programming in C. It was really neat to go from being completely lost and confused on Thursday to halfway understanding the concepts over the weekend and then gaining mastery of everything and seeing it come together on Monday. I really enjoyed being able to do this project and can’t wait to do another! 


Monday, September 10, 2012

Sept 10-Find My Fido


This is Find My Fido.  It works through the utilization of magic fairy dust. I use it to find cute dogs in my area. I love it when it helps to save the life of a pound puppy. I hate it when it isn’t used because people don’t know about it.
The first function of this device is to analyze any dog that you point the device at. The device analyzes the angles of the head, body, legs, and tail as well as the size and shape to determine what type of dog it is. It’s incredibly easy to operate. You simply point the device at the animal and push the “Ancestor” button and it searches through billions of entries in a database to determine what breeds are in the dog’s pedigree. This device would be incredibly handy for animal lovers and shelter workers across the globe. Aside from being able to walk down the street and find out what kind of mutt your neighbor has, shelter volunteers would be able to more adequately identify the dogs that are in their shelters. By accurately knowing the breed of the dog, it is easier to find specific rescue organizations, foster homes, or adopters to take in the homeless animal.
Find My Fido correctly identified this dog as a Cardigan Welsh Corgi!
The second function of the device has to do with finding these homeless animals a family. Twenty years ago, the only options for finding a new friend was to get one from the local shelter, find a breeder in your area, or to pick up a stray off the side of the road. In this day and age, there are many websites that facilitate the adoption of animals that are in shelters all across the nation. This device would allow for easier and more widespread placements. On the bottom half of the device are several input buttons. There is a button for each “portion” of the animal. There are buttons for tail type, ear type, color, coat length, height, weight, leg length, shape of head, bark pitch and volume, and every other possible feature of a dog that you can think of. Shelters are then able to quickly scan the dogs in their cages using the first function of the device and then the device will upload the dog information to the database, categorizing the animals by their features. That way when a family is looking for a new pet, they simply have to pick up the device and search for the type of animal they’re looking for and the device will locate the top 50 matches for their specifications in the area.

Sept 4-Electricity


Introduction:
In this lab, we were learning how to create basic circuits on a breadboard, use multimeters, read resistors, and use a potentiometer.

Procedure:
In the beginning, we tried using a battery to power our breadboard, but after testing it, we realized that the battery was not putting out the right amount of voltage. So instead of using the battery, we decided to use the arduino. Next, what we needed to do was use the multimeter to ensure that the arduino was indeed putting out 5 volts. We did this by touching the leads on the multimeter to the wires that were plugged in to our arduino. Through following these steps, we confirmed that the arduino was putting out the right amount of power.
Next, we started to form our circuit. We user a Resistor Color Code Chart like the one above to calculate how much resistance each resistor gave so that we could make sure that our LED would be getting enough, but not too much power. We double checked our suspicions with the multimeter to make sure that our calculations were correct. It took a few tries to get the right resistor, but eventually we were successful.
To make a serial circuit, we plugged the red wire in to the arduino and then plugged that in to the first column on our breadboard. That supplied power to the first row. From there, we ran another read wire to the row where our resistor started. On the row where our resistor ended, we placed the LED’s. Then, we plugged a blue wire from the row with the LEDs to a higher row. From there, we plugged in a white wire that connected to our ground column, which was then connected via black wire back to our arduino. Really, we did not need the blue wire-we could have plugged the white wire directly from our LED row to our ground column.

Before power
After power
Next we decided to make a parallel circuit. Starting with our already completed serial circuit, we added a switch on the row with the read wire and first resistor. This switch was so that when the button was pushed, our second resistor would receive power. This second resistor ran to another row that had two more LEDs and a yellow wire. This yellow wire ran from the LED row back over to the row with the blue and white wires, completing that side of the circuit.
Before button pushing
During button pushing
Ideally we were hoping to design a circuit that would allow the first set of LEDs to be on when the button was not pushed and then the second set of LEDs to turn on while the first turned off when the button was pushed. However, we were informed that we did not have the materials on hand to complete this type of circuit.
Next we learned how to use the potentiometer. With the potentiometer we created a very simple circuit with only one LED. With the breadboard still connected to the arduino in the same way it was before, we connected an orange wire from the power column on the breadboard to the potentiometer to supply it power. Next, we connected the brown wire from the potentiometer to the ground column to provide ground for the potentiometer. Finally, we connected the green cable to the row on the breadboard that contained the LED and the white cable that was providing ground for the LED circuit. We did not need to use a resistor as that is what the potentiometer does. The potentiometer allows the resistance to be change with the twist of the knob on top.

Our circuit with the potentiometer






Conclusion: 
In this lab I learned a lot about how circuits work. Also, I had heard the term multimeter numerous times before, but had never actually used one. This lab was a good chance to be able to. I gained a lot of hands on experience that I think will help me in the future both in this class and hopefully in the real world (It also reaffirmed in my mind that my lab partner can’t follow instructions. At all. Ever.)

Monday, September 3, 2012

Sept 3-Sensor Walk

Today I took a walk around Centennial to observe what types of sensors are used every day.
This motion sensor detects whether there is someone who is about to open the door. It locks the door when there is no motion and unlocks it when there is motion.

These sensors are outside of and throughout every dorm building. They  require a scan from a key card . If the key card has the rights to enter the building or hall, the light turns green and the door unlocks. If there is no scan or the card isn't set to allow the user in that specific area, the door will remain locked and the light will stay red.


This is an example of a sensor that was designed to assist those with disabilities. This button is at a level that is reachable by those in wheelchairs and when pressed allows the door to open itself.

The sprinkler system is an example of a sensor that is for the safety of the residents. When smoke fills the room, this sensor is triggered, turning on sprinklers that will put out any fire.

An elevator button is also a good example of a sensor that we use in everyday life.

These hand sanitizers that are installed all across campus have motion sensors in them. When a hand is placed below the dispenser, the canister automatically deposits the correct amount of sanitizer. 
While those are only a few of the sensors that can be found around Centennial, I think it is clear that we all interact with sensors far more than we realize on an every day basis. This assignment was interesting to me since it gave me cause to pay more attention to my surroundings and notice sensors that I probably would not have thought about otherwise.

Aug 30-Soldering


Intro:
In class, we did an introduction on how to solder. Soldering is a term used to describe the process most commonly used to connect two metal objects together. It is done by heating up the metal and applying the solder (a compound that is usually made of tin or lead). The combination of the hot metal and the solder causes a chemical reaction that makes all three compounds bind together to form a bond that, once cool, is strong and allows electricity to flow through it.

Procedure:
In this lab, our instructions were to solder a battery snap to a power plug and then solder wires from a power jack to a header pin. We were then supposed to test our device using a pre-prepared breadboard that had an LED light. The desired result was that when the battery snap was placed on top of the battery and the header pin was placed in the breadboard, the LED would light up.

All of our materials before we started




We started out by preparing the wires that would run from our power jack to the header pin. First we had to cut the wires and strip the covering off of both ends so that the solder would stick to the metal. Next, we pre-applied the solder to the wires to hopefully make it easier to get the wire to stick to the header pin. Unfortunately, in our case, that seemed to make it more difficult to get the wire to meld, so we ended up applying more solder as we were trying to connect them. After adding more solder, the solder melted and the metals fused properly.

The other issue we ran into was not being careful when choosing how to connect the wire to the power jack. We soldered our wire on perpendicular to the jack, and then realized that it would not fit into the sleeve. Because of that error, we had to reheat the metal, take off the wire, and re-solder the entire piece.

After finishing the piece that would connect the breadboard to the jack, we began working on the piece that connects the battery to the plug. This time, we avoided the errors we made with the jack and managed to get everything soldered quickly and properly.
Our finished battery clip and header pin

Then the only thing left was to test our pieces using the breadboard. We placed the header pin in the breadboard, clipped the battery snap on the battery, and achieved success.

Success!
Conclusion:
Overall, I really enjoyed learning how to solder. It was really interesting to me to see how something that was liquid a few moments ago could cool off and form a strong bond. It was also neat to be able to make something so easily that could provide power for a breadboard. I learned a lot in this lab and I am excited to see what we get to make next!