Pages: [1]   Go Down
Author Topic: Electronics Newbie, Programming Professional  (Read 724 times)
0 Members and 1 Guest are viewing this topic.
My own little world
Offline Offline
Newbie
*
Karma: 0
Posts: 18
If at first you don't succeed, smack it harder.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone! I'm a newbie to this community, though I've lurked for a couple weeks already. smiley-kitty 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.  smiley-cry

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.
Logged

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.

0
Offline Offline
Shannon Member
****
Karma: 214
Posts: 12424
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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()...
Logged

[ I won't respond to messages, use the forum please ]

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 74
Posts: 7247
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
Logged


Bute, Scotland
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 74
Posts: 7247
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged


My own little world
Offline Offline
Newbie
*
Karma: 0
Posts: 18
If at first you don't succeed, smack it harder.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you all so much for your helpful advice! I really appreciate it. smiley

As it turns out, my father had this wonderful textbook in his library about electronics, and it goes into great detail about wiring diagrams, schematics, the relationships between voltage, current, and resistance (i.e. Ohm's Law), and a bunch of other stuff I haven't read yet. I've been reading it and doing the problems to help familiarize myself with the kinds of things I can expect, and it's turning out to be a lot of fun. smiley I'm hoping to try applying this new knowledge soon on some simple combinations of my leds, resistors, and my Lilypad. I'll move onto the button and multiple LEDs later.

Referring to the LEDs in the Arduino IDE isn't at all what concerns me. What concerns me is making sure I connect the proper power supply to all of this (in the right way) and make the connections to all the components without damaging anything. I've never soldered anything before in my life, and I'm scared to death I'll fry the circuit with a cheap soldering iron or something. I don't want to have to buy a new Lily pad. :x

And yes, I realize that a LilyPad is WAY overkill for a simple project like this, but try to see it from my own perspective. :p coding and software interfaces are in my comfort zone. Hardware components are not. When I bought my components, I bought the ones I thought would be the bare minimum I would need to deal with in order to achieve a workable solution. It's like liudr said; program logic is easier for me to deal with than hardware logic, so unfortunately, that's what I bought into. At this point it's already a done deal, anyway. I've already bought everything, and I want to give it a shot.

Thanks a bunch to all of you! I'll give this a good shot, and hopefully I'll have some good news to talk about later. :3
Logged

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.

Bute, Scotland
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am happy for you. I can see your situation is just about the opposite to mine and I am waiting for the arrival of my Uno, LCD module and RTC. So I am unconcerned about the electronics - it's been a hobby for over 50 years.
I too am excited about new projects which are boiling up in my brain since I came across John's tutorials.
I just wanted to log the fact that some might not be like either of us and  may see this and think 'Oh so that's what I need to flash a few LED's'.
best wishes,
Norman
Logged

Pages: [1]   Go Up
Jump to: