Posts Mentioning RSS Toggle Comment Threads | Keyboard Shortcuts

  • Piterwilson 8:56 pm on October 4, 2009 Permalink | Reply
    Tags: ,   

    Learning Arduino – project 6 – Interactive chase light 

    Over the weekend i had some time to take out the Arduino board out of the box and onto my desk for some starter kit exercises.

    I went trough exercise 5, which introduced the concept of a tactile button (basically just a switch). I had a bit of trouble as the diagram on the manual seems to be layed out incorrectly, i could never get it to work the way it was drawn there. It would seem that the digital pin that goes to the ground (in yellow wire in the graphic bellow), is positioned just after the resistor and connected directly to it (am i missing something?)

    pushbutton

    It was only until i did some googling and found other examples, ( this one was very useful ), where i found the correct wiring that made the tactile button work.

    After this it was not hard to understand how the button worked and i moved on to project #6 on the manual, which introduces an analog input playing together with a bunch of shinny LEDS. You turn the knob and you can read it’s value and use that on your circuits. In this case, it makes the lights go faster.

    At this point, i have made a couple of notes to make wiring the physical prototype easier:

    • The holes in the breadboard are stiff the first time you use them. This is really annoying when you are trying to connect a resistor because its legs are very weak and will bend out of shape trying to go into the stiff hole. Also the legs are way too long and start to get in the way if you are connecting things next to them.
    • The best way to prevent this is by pre-opening the breadboard holes with the tip of the jump wire before attempting to connect the resistors.
    • Also it helps to cut the legs of the resistors to about half the length so they are bit sturdier and don’t bend so easily.
    • Talking about jumper wires, i have separated them by length so that it’s easy to use the shorter ones whenever possible and not end up with a mess of wires all over the place.
     
  • Piterwilson 7:29 pm on September 29, 2009 Permalink | Reply  

    Learning Arduino – Project 3 – Traffic lights 

    Project 3 of the Arduino Starter Kit was pretty easy to complete. It’s a variation of the previous two projects except we are handling multiple LEDs at once and they are wired in parallel. Nothing much to note except for a couple of thing i noticed about the equipment itself (not necessarily relating to the projects) :

    • The solder-less board that came with my kit is not the same as the one drawn on the diagrams. Mine only has one row on each of the opposite ends, instead of the two shown on the board on the diagrams. It’s not a big deal now, but perhaps this is gonna make things a bit harder at some point as i will have to re-interpret and adapt the wiring slightly to get the same effect as the diagram on the manual.
    • To no surprise the latest project i had worked on was still loaded on the Arduino until i replaced it with the new one. This is the intended behavior, but the old program started to run in the moment before i uploaded the new one (with the new wiring on the board). It was not a problem now, but maybe in the future i can damage the parts if the board is trying to run a old program and the wiring is set differently for the new project. That’s why i decided to create a “reset” program to empty the board of any programs in between projects.

    This is what the traffic lights look like when completed. Now my skill level is equivalent to lights on a christmas tree!

    The next project introduces a switch to make things interactive. I hope to get some time to work on it soon.

     
  • Piterwilson 7:30 pm on September 25, 2009 Permalink | Reply
    Tags: ,   

    Learning Arduino – Project 1 – Blinking LEDs 

    [ Update : I have resolved my confusion regarding the resistor color band system after i found out that there are actually 3 types of system : 4,5 and 6 band. My particular resistor is a 5 band, and it's color code brown-green-black-black-brown does in fact correspond to 150 with 1% tolerance. This page was useful to find out about this 3 different systems ]

    After the installation of the Arduino board, exercise number 1 dictates the easiest of tasks : make those damn sexy lights turn on and off on command.

    The lesson i followed can be found on this manual under project 1 “LED FLASHER” (By the way, what’s up with that font they use in the beginning of each project? Why are Arduino boards all “street like” all of the sudden? ). This project is just a variation of the test you do to confirm that your Arduino board is in correct working order, The “Blink” example. The only difference is that you are using a different pin number for your digital output and that you are involving the solderless breadboard included with the kit and you are introduced to the idea that you have to use resistors in front of your LEDs to keep them from blowing up. The concept seems easy enough but honestly im having some trouble with the color coding on the resistors.

    Maybe im getting old and my eyes are starting to fail me, but the first problem i had is that the “lines” that note the capacity of the resistors are too small. Maybe i need to add a magnifying glass to my Arduino hobby kit. The second problem, or confusion i have, is that i have used the 150ohm resistor that comes clearly marked and included with the kit, just like the manual says, and that ,according to the color coding chart and these google image results, should have brown-green-brown lines plus the quality and tolerance lines. Instead this little guy, seems to have brown-green-black-black-brown lines.

    sos_2

    I know this is the right one because the plastic bag said so and because this worked and the LED didn’t blow up, but from what i can tell, the shades of the colors and even the distribution of these lines are not really that standardized, which would beat the whole porpoise of having a color code system. Maybe it would have been better to just write down the actual numbers on the resistors?

    In any case the whole project took just a couple of minutes to complete and there i had an LED blinking 1 second on and 1 second off. Because i was bored but didn’t feel confident enough to start project 2 i decided that i would do something a bit more exciting with this first skill of making happy shinny lights go on and off. I thought about making a morse code machine to broadcast my SOS distress signal of confusion regarding the resistor to make myself feel better about the whole thing. Using the info on the morse code wikipedia page it wasn’t long before i had my red little LED asking for help with little bursts of light going on into the Buenos Aires night.

    sos_1

    The code i ended up with looks like this:

    // SOS I'm a n00b
    int ledPin = 10;
    int unitLength = 100;
    void setup(){
      pinMode(ledPin,OUTPUT);
    }
    /*short mark, dot or 'dit' (·) — one unit long*/
    void shortMark(){
      digitalWrite(ledPin,HIGH);
      delay(unitLength);
    }
    /*longer mark, dash or 'dah' (–) — three units long*/
    void longMark(){
      digitalWrite(ledPin,HIGH);
      delay(unitLength*3);
    }
    /*intra-character gap (between the dots and dashes within a character) — one unit long*/
    void intraCharGap(){
      digitalWrite(ledPin,LOW);
      delay(unitLength);
    }
    /*short gap (between letters) — three units long*/
    void shortGap(){
      digitalWrite(ledPin,LOW);
      delay(unitLength*3);
    }
    /*medium gap (between words) — seven units long*/
    void medGap(){
      digitalWrite(ledPin,LOW);
      delay(unitLength*7);
    }
    void sayS(){
      shortMark();
      intraCharGap();
      shortMark();
      intraCharGap();
      shortMark();
    }
    void sayO(){
      longMark();
      intraCharGap();
      longMark();
      intraCharGap();
      longMark();
    }
    void loop(){
      sayS();
      shortGap();
      sayO();
      shortGap();
      sayS();
      medGap();
    }
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel