Go Down

Topic: Electronics Newbie, Programming Professional (Read 758 times) previous topic - next topic

Shuko

Hi everyone! I'm a newbie to this community, though I've lurked for a couple weeks already. ^_^ Nice to meet you all.

I'm posting because I'm beginning to feel a little overwhelmed, and I'm pretty sure I'm just not starting right. See, I've a project in mind that I've wanted to tackle for quite a long time, and now that I have the time and funds, I'm ready to get started. The only problem is that I don't know how to begin!

First, a bit of background. I am a software designer by profession, so as far as programming an Arduino is concerned, I'm not too bothered by it. When I was in college, C was my bread and butter, and besides, there are so many tutorials out there that seem perfect for the problem I'm trying to solve, so that part of it doesn't bother me a bit. For me, it's the electronics themselves that have me flustered. I have absolutely NO background in building circuits. None. We're talking baby's first steps here, folks.

As for my project, here is what I'm trying to do: I'm sewing a handbag for a costume, and I want it to have LEDs incorporated into the design. The actions of the LEDs are actually very simple. I need seven of them, and I want them all to blink in unison (all at the same time) for a statically defined span of time, over and over again. The blinking will be initiated and halted by the pressing of a button on the top of the handbag. In other words, when I press the button, the LEDs will begin to blink, and they will continue to do so until I press the button a second time. Odd button presses will allow the LEDs to blink, and even ones turn the blinking off.

Very simple, ne? But for me, with my total lack of understanding of how microcontrollers interact with power supplies, resistors, voltage, amperage, and all the other necessary concepts for a project like this (much less what these things even ARE), I'm totally baffled. I'm not asking anyone to solve my problem for me; that would take the fun out of it. I like finding solutions on my own. All I'm asking for is some guidance on where I should turn for good, fundamental, foundational information about building circuits with Arduino. Right now I don't even have enough knowledge to figure out how many batteries (or which ones) I need to power my LilyPad, the push button, and my seven LEDs.  =(

Extraneous info: I've already bought a Lilypad, so that is the microcontroller I'll be using. I would prefer not to use conductive thread, since I need my project to be hardy and long-lasting. I'd rather use insulated wire. I'll have plenty of room to house the circuitry anyway, so I'd rather have the less resistance insulated wire would offer me.
Being an adult shouldn't be about maturity; it should be about being old enough to go out and do bigger and better things with your time.

MarkT

OK here's a starting point:

Firstly I'll assume you'll be using standard LEDs (not high power) which typically are rated at 20mA or so.

The Arduino pins can source or sink an absolute maximum of 40mA - so lets stick to 20mA per pin to be safe.  Lilypad has enough pins for 7 LEDs so its straightforward to wire one LED per pin, each in series with a resistor.

This series limiting resistor is needed because LEDs when conducting have a forwards voltage that is less than 5V.  It actually depends on the colour and manufacture of the LED, typically red LEDs are about 2V or a bit less, green/blue/white are 3.5 to 4V, and orange/yellow somewhere between.

The series resistor controls the current - you choose the value than will carry the wanted current when it has 5.0 - Vf volts across it (5V supply less the Vforward of the LED).  For a 2V red LED at 5V supply this voltage is 5.0 - 2.0 = 3.0V and for 20mA that means a 150ohm resistor (V = IR).


So your first experiment is to connect an LED in series with such a resistor, connect one end to an Arduino pin and the other to ground (or 5V - you have to ensure that the LED is the right way round - cathode is at the most negative end (ground).  Then write code to drive that pin (set the pinMode, try digitalWrite() and delay()...
[ I won't respond to messages, use the forum please ]

liudr

Here is a tutorial of how to hook up an LED:

http://arduino.cc/en/Tutorial/Blink

Very basic stuff but once you master it, you can expend it to several LEDs blinking in certain sequence. If you need a couple dozen of LEDs, you will likely construct an LED matrix and address them by row and column (only one turns on at a time in this scenario) or use shift registers to control more than a couple dozen of them:

http://www.arduino.cc/en/Tutorial/ShiftOut

If you get more comfortable and want to do more, say swing the handbag and show a persistence of vision image, read this:

http://liudr.wordpress.com/2011/04/03/persistence-of-vision-2/

buteman

All good advice and I have no problem with it. Be aware though that an Arduino is Massive overkill for such a project.
A 555 timer I.C, a switch, a battery, a capacitor, 2 resistors, 7 LEDs and a bit of circuit board would do this for probably 1/4 the cost and in less space.

liudr

Bare with me, the OP is a good programmer, I suppose logic makes more sense than understanding circuits made with 555 timer. So I would spend the extra money and stick with arduino :)

Go Up