Sunday, May 6, 2012

Week 17 - Learning about Relays

This week I connected a relay to act as a switch between two LED lights on the Arduino. The Code for this, uses the very basic "Blink" sketch found in the default library (Flies > Examples > Basic > Blink). That said the wiring is complicated enough for me to bring up at tomorrow nights Arduino meeting. The cool thing with the relay is that it makes a actual clicking sound as it switches back and forth. There's a transister being used and I need to understand its function better in this schematic as well as the flow of electricity.



Also this week I gave myself some time to actually allow myself to get out and have some fun fishing. This has been more difficult than it sounds as I find myself making excuses with work and other events to actually do some of these activities. Before you know it, a season or opportunity has ended and you find yourself wishing you should of - could of - would of.

To be clear, I'm my own worst enemy of this. Work or other events are not forcing me out of these things. It's me, I need to learn how to stop and smell the roses more often. Life moves pretty fast... If you don't stop and look around once in a while, you could miss it [Ferris Bueler's Day Off]. So I'm really happy to report I had a great time finally getting out for two days to do so.

Here's a picture of my cousin pulling in the big haul of 'lil stockies from Casadaga Creek...

On that same note, I finally got out and went turkey hunting after 5 long years of missing the season! I only got one morning in with no luck, but I am extremely grateful for doing this none the less. With a little luck, I'll be out again in 2 more weeks.

Sunday, April 29, 2012

Week 16 - Photo Resistor with Arduino!

This week I connected a Photo Resistor to the Arduino. After following the kit and controlling an LED to fade on and off, I decided to connect it to a Servo. Using the Knob example in the Arduino Library, the photo resister just worked. Very Cool. Seeing how the mapping was set differently for the LED vs the SERVO was good to see. It makes sense to.



Also this week we had a drive at work to donate or old computer hardware. I've been wanting to give a bunch of computers to those who can find use for it, but instead I kept piling more computers up in the house. Ugh!

Well, with this oportunity to have it right at work, I dove into different places I stacked old computers and moitors up and brought it all on in. I was able to find and give 6 desktops, 1 17inch monitor, and a 2 printers for the cause. Happy to help out knowing they will be put to use again, and glad to see some room back in storage. WOOT!

Sunday, April 22, 2012

Week 15 - Fix Computer and Clean

So this week was fairly uneventful due to a time sync of fixing a family member's computer. Ugh I hate doing these. I only do it now for friends and family, but I don't think anyone who doesn't do this realizes just how much time goes into this.

I could have done an Arduino thing this week as well, but the weekend and spring cleaning got the better of me when I wasn't working on this laptop. Also there was an emergency dog sitting tonight as our neighbor was rushed to the hospital, and that kinda of diverted my time here where I am finding myself type this up as fast as I can. Just hoping everything is alright with neighbor.

So yes the laptop, basically I have been putting this task off for a few weeks now. Family/friend Larry had his laptop's hard drive go down. I went to install a new drive and realized the potential hell of going through finding and installing drivers for it was going to be a real pain. I started the install and found the Ethernet even after the drivers not working ... great I saw this project getting worse.

I then remembered I happen to have a much better laptop I was no longer using anymore. It was just lying around collecting dust. Another friend claimed dibs on it 2 months ago and never called back, and after leaving many messages, I figured it was time to pass it on to someone who was going to really appreciate it. The nice thing was, that all the OS was installed, but it needed driver and OS updates. It also needed a major cleaning as Larry was not going to need half the stuff I had on it.

So I started initial clean on Monday. The week went and I picked up the work again on Friday night, most of the day Saturday and Sunday afternoon. Let's just say there were issues and the Microsoft updates took forever as well as updating the antivirus and cleaning out my files.

Happy to say in the end - this XPS laptop beast is running very smooth and has everything Larry needs to enjoy his new system.

Other than that - got more cleaning done around the house, and hopefully next weekend I'll get a chance to work on the backyard and maybe even the boat.

Sunday, April 15, 2012

Week 14 - Arduino Potentiometer

This week I connected a Potentiometer to the Arduino. After following the kit and controlling an LED to fade on and off, I decided to connect it to a Servo. I had some basic info to hook it up sine I already connected a Servo in a previous project. Once I had it working, I then used the button project from last week to activate and deactivate the potentiometer and servo from working.

This worked as I hoped it would. I already had the buttons still connected on the breadboard from last week so all I had to do was add its code to this weeks code and add an on/off state again to handle whether the servo and knob should respond or not.

It was also cool to see many elements working together as well.



Also this week I've been really wanting to make it to the Albright Knox Gallery to see the works of Joan Miro, which was ending this Sunday. I was able to make it the last day with friends and really enjoyed it. there wasn't as much as I had hoped, but was happy to fit this in with my busy schedule.

Doh! sorry here's the code for the Arduino if anyone is interested...


// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott
// modfied by naiJenn
/* servo vars*/

#include

Servo myservo; // create servo object to control a servo

int potpin = A0; // analog pin used to connect the potentiometer
int knobval; // variable to read the value from the analog pin

/*set button info*/
const int buttonPin1 = 2; // the number of the ON pushbutton pin
const int buttonPin2 = 3; // the number of the OFF pushbutton pin
const int ledPin = 9; // the number of the LED pin
boolean onOff = false; // button state

void setup()
{
myservo.attach(11); // attaches the servo on pin 9 to the servo object
pinMode(ledPin, OUTPUT); // initialize the LED pin as an output:
// initialize the pushbutton pin as an input:
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
}

void loop()
{
knobval = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
knobval = map(knobval, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)

if (digitalRead(buttonPin1) == LOW) { // button presed state = LOW
digitalWrite(ledPin, HIGH);
onOff = true;
} else if (digitalRead(buttonPin2) == LOW) { // button presed state = LOW
digitalWrite(ledPin, LOW);
onOff = false;
}
if (onOff) {
myservo.write(knobval); // sets the servo position according to the scaled value
delay(15);
}
}

Sunday, April 8, 2012

Week 13 - Arduino Buttons!

Hey this week had lots of fun playing around with push buttons on the Arduino. The original program was written differently and needed to be corrected as the LED was on from the start and pushing the button turned it off.

After fixing this I continued with the kit's notes and updated it to use two buttons - one to turn it on and one to turn it off. Then there was an addition to make the LED fade on and off, which was cool.

Then I wanted to change it to get more acquainted with both the programming and the elements involved. After playing around with the kit's final updates, I realized that you had to hold either button down for the LED to fade through it entire range on or off. So for starters, I changed the program to no longer hold the button down to fade through its entirety. One click and the LED faded through the whole range on or off. Clicking throughout the fade was controlled so that no button click was allowed until the fade was done.

Then I realized I could keep clicking the same button over and over again and it would repeat the the fade routine. So I modified it again to have an onOff state where it detected whether it was already on or off and that clicking the same button again would have no effect on the LED.






Here's the code with different stages commented out:
/*
Button
This example code is in the public domain.
*/

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin1 = 3; // the number of the pushbutton pin
const int buttonPin2 = 2; // the number of the pushbutton pin
const int ledPin = 9; // the number of the LED pin
int value = 0;
boolean onOff = false; // button state
boolean fadeIt = false; // button state

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
}

void loop(){
// fixed original example - naiJenn - used ARDX code to fix original
/*
if (digitalRead(buttonPin2) == HIGH) { // button unpresed state = HIGH
digitalWrite(ledPin, LOW);
} else if (digitalRead(buttonPin2) == LOW) { // button presed state = LOW
digitalWrite(ledPin, HIGH);
}
*/
// Use one button to turn on and one to turn off - ARDX
/*
if (digitalRead(buttonPin1) == LOW) { // button presed state = LOW
digitalWrite(ledPin, LOW);
} else if (digitalRead(buttonPin2) == LOW) { // button presed state = LOW
digitalWrite(ledPin, HIGH);
}
*/

//Now fade on/off while button pressed - ARDX
/*
if (digitalRead(buttonPin1) == LOW) { // button presed state = LOW
value--;
} else if (digitalRead(buttonPin2) == LOW) { // button presed state = LOW
value++;
}
value = constrain(value, 0 , 255);
analogWrite(ledPin, value);
delay(10);
}
*/

// naiJenn update -Fade on/off with only clicking button once - light will fade on/off through entire range
// also don't interrupt - once button is clicked - buttons won't respond till the LED is done fading through range
// also cant repeat the same button repetitively - it now holds an onOff state so once LED is on only the Off button will work and visa versa
if (!fadeIt) {
if ((digitalRead(buttonPin1) == LOW) && (onOff == true)) { // button presed state = LOW
fadeIt = true;
for (int i = 255; i >= 0; i--) {
analogWrite(ledPin, i);
delay(10);
}
analogWrite(ledPin, 0);
onOff = false;
fadeIt = false;
} else if ((digitalRead(buttonPin2) == LOW) && (onOff == false)) { // button presed state = LOW
fadeIt = true;
for (int i = 0; i <= 255; i++) {
analogWrite(ledPin, i);
delay(10);
}
analogWrite(ledPin, 255);
onOff = true;
fadeIt = false;
}
}
}



Well that's it - and Happy Bunny Day! I also built an entire rail system that controlled 4 different directions in minecraft - took some time but was a lot of fun, and I think I made it pretty efficient too.

Sunday, April 1, 2012

Week 12 - Arduino Music and Cleanup week

This week I have made Circuit 6 of the ARDX experiments for the Arduino. This experiment played with a Piezo Element which produces tones which you can then control to make notes. By setting durations and pauses you can make melodies.

The sample that the experiment plays is "Twinkle Twinkle Little Star" - and that worked fine as the setup was very easy. So I toyed with the tempo and the notes and changed it up to play "Row Your Boat", which helped me to understand how the original sketch worked. This was fun.





Ended up going to Toronto to watch the Sabres play against the Leafs. Sat just above Wayne Gretzky's Dad (cool) and Mike Myers was there. With family coming in, getting over being sick and now dealing with a food allergy (ugh), I've all to do this and clean up around the house. But, actually getting the house clean before family showed up was a big goal this week and mission completed in time. Woo hoo! Sometimes it's the little things.

So in summary got one more Arduino experiment out of the way, and got the house cleaned up in time. Not bad again considering the ailments and time constraints.

Sunday, March 25, 2012

Week 11 - Arduino & Water Transport Complete

This week I have made Circuit 5 of the ARDX experiments for the Arduino. This re-introduced the use of LEDs but this time using a shift register (or serial to parallel converter). The shift register allowed control of 8 LEDs with only using 3 pins on the Arduino instead of 8. This is more along the lines of what I wanted to play with, so I'm very excited to modify the program and see what this can do.





Also this week I managed to finish the Minecraft water transport system. Last week I only completed one direction and now both ways are operational.





If I haven't been busy this week, then I've been extremely sick, so I'm keeping my notes brief. Thanks!