Saturday, August 18, 2012

And After 7 days I decided...let there be coloured light

Hey Everyone,

Well today is Saturday so that means more Micro Controller FUN TIME!
Today we will be playing with my RGB LED and using various sensors to control the color.

Lets first start just with the RGB LED. I've written a simple for loop that loops through each color separately once, while the other colors are set off. The color simply gets brighter as the value sent to the LED varies from 0 to 255.  Then I use the same scale but increase RED from 0-255, decrease GREEN from 255 to 0 and leave BLUE set to 255.  Lastly I set RED to 255, increase GREEN from 0-255 and decrease BLUE from 255 to 0. All this takes is 5 simple for loops.  Simple.

Next I decided to use my photoresistor to change the color.  I set RED to 255, GREEN to be dependent on the light level and blue to be 0. I scaled the output from the photoresistor to be within 0-255.  As you can see in this video, when I shine the light from my iPhone onto the photoresistor, the color changes. Because the sensor is less resistive under more brighter light, the color switches from yellowy green to red.  You can see in the video below that the response is very very quick, and quite sensitive to the light  on the sensor.


Next is a quick video showing the use of the soft potentiometer.  As you can see as I move my finger along the softpot, the color of the LED changes! HORRAY!!!



After that I thought, well lets see if we can use the temperature to control the light color.  Using the map function I was able to get this work quite well, at least I think so. Here it goes from blue when less than 18 Celsius degrees to red when more than 25 degrees Celsius. I could have just as easily mapped this to be very sensitive to small changes in color. Or even a easier, a threshold value, but I wanted to do a gradient.

Okay, so I think you get the message that you can control many variables with many other variables.  This will most definitely come in handy during my quest to build a time lapse device as I believe I may also build a high-speed shot set up, whereby a flash going off triggers my camera to take a picture.  People have used this to dramatic effect to capture pictures of slashes, balloons bursting.


Next we will be trying to convince Nicole's old Canon A520 to become a time-lapse camera using CHDK (Canon Hack) and the Arduino.

Sunday, August 12, 2012

And then there was light, LED light that is.

On Friday afternoon my Arduino Inventors Kit from Spark Fun Electronics (purchased through RobotShop.ca) arrived in the mail. While I had originally planned on doing a video blog, I quickly realized that I am quite terrible at video blogging. So Instead I think I will write out my processes, thoughts and include some photographs and videos of the experiments.

The box the kit came in was a bit over stuffed and bulging on one side, but once I opened it up, I found this was due to the amount of protective padding they have placed around the actual kit box.
RobotShop Box containing my Kit

In the box was my beautifully packaged Inventors Kit from SparkFun Electronics.

My SparkFun Inventors Kit
 Everything inside was nicely organized and packaged.  The kit contains numerous jumper wires for connecting the Arduino Uno to the breadboard (pictured below), in addition to many 10K Ohm resistors and 330 Ohm resistors.

My Arduino Uno Rev 3 micro controller (right) and "breadboard" on the left.
Since I will invariably end up using many different types of resistors, I thought it might be interesting to present some information on the color codes that are used on resistors. A resistor always has 3 or four colored lines around it to indicate its resistance. A resistor with 4 color bands indicates the resistance  in the first two bands, the multiplier as the third band and the resistors tolerance value is the fourth band. A three band resistor does not report the tolerance. A 5 band resistor will have three resistance value bands, then the multiplier band and the tolerance band.
For more information I strongly urge you to just check Wikipedia or do a quick google search.


The Inventors Kit also contains 10 yellow LEDs, 10 red LEDs, one RGB LED (an LED that contains Red, Green and Blue components).   An RGB device can produce many colours.
Additionally the kit contains a piezo element that can be used to produce sounds, a temperature sensor, several push buttons, a servo, a DC motor, a soft potentiometer (a thin potentiometer whose resistance changes by pressing at different points along the potentiometer), a flex sensor (where the resistance of the device changes as the device is stretched/bent), a diode (basically a one way valve for electricity), a transistor (ampiflier/switch), a relay (a switch), a photoresistor (a resistor whose resistance changes with the amount of light that hits it), a regular potentiometer (an adjustable voltage divider (like a volume knob) , and a shift register (a type of integrated circuit).


Okay, well now to some of the fun that I had on the first day.
First I played with turning an LED ON and then OFF. Then using the kit instructuions I stepped it up and did this:



I modified the code slightly to bring the the side by side pairs on at the same time instead of following an order that went down the left side, then down the right side.All this took was modifying the codes for loops.

Next I played with the piezo element and following the instructions and sample code created the sample circuit and made it play the first line from Twinkle Twinkle Little Star. With more time/personaly interest, you could complete the full song and numerous other songs.  All you need to do is determine the notes that make up the song, the frequency of those notes, and thus the period and time to activate the piezo for.




Okay, well that is all for me from day 1. Next I think I"ll look at the RGB LED and the softpot (soft potentiometer), there is an example experiment showing how to use the softpot to change the color of the RGB LED.  After that example I think I'll start moving on to my ultimate goals, controlling my DSLR. First I'll start by controlling an old digital camera I have and then move up from there, as I really really don't want to fry my DSLR.


Until next time.... 0100100001100001011101100110010100100000011001100111010101101110001000000110110101101001011000110111001001101111001000000110001101101111011011100111010001110010011011110110110001101100011010010110111001100111001000000111100101101111011101010111001000100000011101110110111101110010011011000110010000101110.....


....hint convert from binary to ASCII.


Wednesday, August 8, 2012

Introduction

As you may have guessed this blog is going to be about my learning experience with micro-controllers.
I just ordered an Arduino Uno Rev 3 Inventors Kit from Spark Fun Electronics.

I thought it might be fun to post some pictures, videos and other things as I learn about this, maybe it will be useful to me in the future or perhaps other people who are just starting out with micro-controllers.

I am not an engineer, my electronics experience is somewhat limited. I have experience with Campbell Scientific data loggers and various environmental sensors, some wiring and soldering experience.  I also have a bit of programming experience, in MatLab, Python, IDL, HTML, and PHP.  However, most of my experience is with MatLab and Python.

My kit hasn't even arrived yet, but I'm so excited I thought I would start the blog today just by writing this introduction.

It will only be linked to my main blog (justinbeckers.blogspot.com) a few times (i.e. this post and maybe one or two more). I don't want to get the blogs crossed up too much and I use the other blog/pages for my research activities.