BUS4TN007-3 / tehtävä 2 (assignment 2)

GROUP ASSIGNMENT

This is the assignment two where the objective was to install a sensor that we loaned from university. There was 6-7 different sensors available from distance sensors to Parallax 27401 that is a infrared receiver and emitter that we had as our group assignment where this particular sensor recognized the dimmer lighting. The sensor then outputs values depending on the lighting on the surface of it’s receivers. Unfortunately I did not have the opportunity to take a picture of the installed sensor but I will post it on later time, If will ever get my hands on it. The sensors are easy to use in the beginning so you can try it yourself, with the same materials as I have. Look for more information about the sensor that my group used from the web pages below.

LINK 1


LINK 2

Like I said, that we had many other sensors as well. The below link basically has some of the sensors that we used in the lab. If I remember correctly we had other sensors as well.

LINK 3

So to the assignment itself that we had to work on. Unfortunately, because I did not buy my own sensors, I had to loan from my university because of these reasons and huge number of students that also loaned the sensors, my group had to work on the sensors that were available in the lab namely the switch or button if you will.
We also had few LED’s and jump wires and switch board. In the first picture as you can see, there is no need for codes for it to work. The switch takes power from the Arduino board and basically, it will distribute the electricity to the LED when someone pushes the button.

IMG_0095

In the picture below a group member tries the switch button and as you can see, it works. Now again I have to emphasize that the wiring is not perfect.

IMG_1511

Now in the previous example we did not really have any code to take input and output but in the next picture as you can see, the led is connected to Arduino through the pin directly where to control it, you would need some sort automated software like I had in the previous assignment or through user interaction like switch that is connected to Arduino. Arduino then recognizes, in what state the switch is by taking input from the switch as values, and determines what to do with the LED that is connected through the code.

Its nothing more than if, else if statement machine.
I think that no matter what the action is that we are supposed to achieved with this Arduino is all about booleans meaning if something is true then do something and if the value is not what we wanted, do something else. By the way I thought it would be good to post some switchboard logic that I learned from a classmate if someone still has some problems with it.

IMG_0100

As you can see in the post above, I have drawn green lines. When you connect the jumper wires the logic works in a way that the red jumper wire in my case brings the electricity in meaning that from the third pin onward it will power the line and the switch and from the last leg of the switch the electricity will flow when the button is pushed through the whole line where the black jumper wire is connected. This way you can connect the GROUND to one line and connect many grounds on one line if needed.

 

I am going to post the code below but it is not without error’s but building prototype’s never was about creating fully working products right? here is the code without further delay

const int buttonPin = 12;
const int ledPin = 13;
int buttonState = 0;

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}void loop(){

buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}

The source that I used to help me connect the Arduino is below

http://arduino.cc/en/tutorial/button

Last but not least heres the link to the person to my classmates blog with whom I worked with.

p.s. I will update the blog post later with more content.

Prototyypin rakentaminen / BUS4TN007-3 / Tehtava1 (assignment 1)

Hello,

This is my first post/blog in the WordPress site. I am currently studying at Haaga-Helia University of Applied Sciences. My major is Information Technology
(Degree Programme In Information Technology), and this course is about trying to build small prototypes (or bigger ones if you are up to it). Here is the outcome for of my assignment. Please excuse me the quality and angle of the photo.

IMG_0093[1]

IMG_0092[1]

The first assignment was to build a small code for Arduino to control the LED’s/LED.
The Arduino that is used for this assignment is Arduino Mega 2560.
The book that was assigned as our reading material is called
“Make: Arduino Bots and Gadgets” by Kimmo Karvinen & Tero Karvinen.

For the first assignment I tried the code and software for my Windows 7. The first hour I encountered my first  problem namely the grayed out ‘Serial Port’,

where choosing the port for Arduino was crucial to make the code work. I did manage to find help for my first problem from the source given below

http://emayssat.wordpress.com/2012/03/29/installing-windows-7-on-the-arduino-ide-or-vice-versas/ 

When I first started the led project I had no Idea, what I should do my project about so I thought to make Morse-code of my own name. In no way does the program follow the International Morse Code standards but you will get the idea when you implement the code. The code itself is ridiculous, but just for the sake of the assignment and practice I thought to start it easy. Here is a Wikipedia source for more information about the Morse Code

http://en.wikipedia.org/wiki/Morse_code

Last but not least, here is the link to my code. I have posted the whole code below this blog also.

http://www.2shared.com/file/gv2vagPF/Morse_Code_KUROSH.html

The compiler is version 1.5.1, and you can download it from their main page

http://arduino.cc/en/main/software

My next project will be a robot car. The sensor that would be good for this project is
direction sensor module, but I still have to think more about the project and the components that I will/have money to use in it but here is the link for starters.

http://dx.com/p/robox-arduino-compatible-ir-direction-sensor-module-145084

Here is the code for the Arduino board (UPDATED VERSION)

Updated 26.1.2013

.// The integers below are connected to Digital Pins

int greenPin = 13;     // LED that is connected to pin 13
int redPin = 12;          // LED that is connected to pin 12

void setup()
{
pinMode(greenPin, OUTPUT); // sets the digital pin as output
pinMode(redPin, OUTPUT);
}

void small()
{
digitalWrite(greenPin, HIGH); // sets the LED on
delay(500); // waits for a second
digitalWrite(greenPin, LOW); // sets the LED off
delay(1000);
}

void big()
{
digitalWrite(greenPin, HIGH);
delay(3000);
digitalWrite(greenPin, LOW);
delay(1000);
}

void red()
{
digitalWrite(redPin, HIGH);
delay(2000);
digitalWrite(redPin, LOW);
delay(1000);
}

void k()
{
big();
small();
big();
red();
}

void u()
{
small();
small();
big();
red();
}

void r()
{
small();
big();
small();
red();
}

void o()
{
big();
big();
big();

red();
}
void s()
{
small();
small();
small();
red();
}

void h()
{
small();
small();
small();
small();
red();
}

void loop()
{
k();
u();
r();
o();
s();
h();
}

Where the red LED signifies the change of the alphabet. Now before you start to do anything, you must never add components to your Arduino when it is plugged to your computer because it might damage the Arduino or the components that you are using. This should be common sense. Another thing that I must warn you about is that you should always do a good background research of any electronic component you want to install be it a laptop keyboard or Arduino sensor because you might do something stupid and short circuit the whole thing.