Pages: [1]   Go Down
Author Topic: a few basic well-thought out questions...  (Read 460 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, I can get 3 LEDs to fade, controlled by unique digital pins. I understand the code behind it.
I dont understand the voltage. I thought the Arduino was 5volts. So...each digital bin is delivering 5 volts, how is there enough voltage to do this? Is is wired in parallel...

I want to connect 9 LEDs and fade them, I want to group them in 3. I want to provide an external power source so I dont need my computer.

I want to run a motor off of my Arudino and control the speed. How can this simply be done? Id like it to be a 5volt motor.

THANKS SO MUCH, IM LOVING LEARNING THIS STUFF smiley smiley smiley smiley
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16523
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, I can get 3 LEDs to fade, controlled by unique digital pins. I understand the code behind it.
I dont understand the voltage. I thought the Arduino was 5volts. So...each digital bin is delivering 5 volts, how is there enough voltage to do this? Is is wired in parallel...

What you can do is look for a tutorial about DC fundamentals involving ohms law to explain the inseparable interrelationship between voltage, current, and resistance. It's not a hard concept to learn and the math is nice and gentle, but it will clearly answer your question better then just memorizing someone facts you might read here. As one gains experience in electronics one just starts thinking in ohms law without any need to reference the theory.

I want to connect 9 LEDs and fade them, I want to group them in 3. I want to provide an external power source so I dont need my computer.

I want to run a motor off of my Arudino and control the speed. How can this simply be done? Id like it to be a 5volt motor.

There are examples in the arduino playground section on controlling motors using PWM signals via the analogWrite() command and using a switching transistor to control a simple DC motor. It's not difficult.THANKS SO MUCH, IM LOVING LEARNING THIS STUFF smiley smiley smiley smiley

Yes, an arduino board is a very good way to enter into the world of electronics as a hobby.

Good luck on your journey

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks lefty. Yes, I understand ohms law. its very helpful.

WHat I want to know is if I plug in a 9 volt battery into the Arduino and I have a variety of LEDs and resistors, will the resistors absorb all the voltage that the 2-3 volts each LED does not.

thanks
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 439
Posts: 23783
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As you noted, Arduino puts out 0 or 5V.
The 5V is not necessarily on all the time.
If you switch it on/off/on/off fast enough, and you have an LED connected, your eye still sees it as on, only it perceives it as a lesser brightness compared to being just on all the time. The brightness will  depend on the amount of on time vs off time.
The same with motors, only there you have a mechanical mass moving, and every time you apply voltage (and there is enough current available) the motor will turn. If the voltage is done as a bunch of pulses, the motor speed will vary depending on how wide the pulse is and how long of a gap in time to the next pulse.
There is some inertia to overcome to get the motor to turn initially, and then it can be controlled with pulses of varying duration.

analogWrite creates those pulses at a rate of ~490Hz, the on/off time set by the value given. 1/255 for lowest on time up to 255/255 for on full.

You can have 3 LEDs in parallel, each with a resistor, going to 1 pin, be sure to keep the total current to under ~35mA total (and 20 would be better).
(Vsource - Vforward LED)/0.01 = resistor needed for each LED (10mA each)

For a motor, controlling a transistor which connects one motor leg to ground with the other motor leg at 5V, 9V, 12V whatever is definitely the way to go.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 439
Posts: 23783
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Some LED connection examples if you want to connect them to 9V vs 5v.


* LED_connections.jpg (62.18 KB, 960x720 - viewed 9 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 439
Posts: 23783
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And a motor connection example. Resistor in series with motor typically not needed.


* Motor_transistor.jpg (23.98 KB, 960x720 - viewed 13 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16523
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks lefty. Yes, I understand ohms law. its very helpful.

WHat I want to know is if I plug in a 9 volt battery into the Arduino and I have a variety of LEDs and resistors, will the resistors absorb all the voltage that the 2-3 volts each LED does not.

thanks

Plugging a 9vdc battery into an arduino just powers the on-board +5vdc regulator. The standard arduino board always operates with 5vdc logic levels for it's input and output pins. So if powering a led from an arduino output pin via a series resistor then the resistor is sized to drop the difference between the led forward voltage drop and the 5vdc source voltage of the output pin at the forward current you want to run the leds at. So if you wanted to run a led at 20ma that has a 3vdc forward voltage drop you would calculate the required resistance value need as

R = (5v-3v)/.02A = 100 ohms

Lefty

Lefty
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 439
Posts: 23783
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

9V battery are typically low in capacity too, just a few hundred mAH. A rechargeable 7.4V Li Ion or LiPo battery pack will give you much longer life.
Or 3 AAs or 3 Cs in series, connected to the 5V pin on the power header. DO NOT CONNECT THE BATTERY+ to GND and the BATTERY- to 5V, that will blow your board.
Or get a 7.5V or 9V wallwart to plug into the barrel jack.
https://secure.dipmicro.com/store/DCA-07510
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Crossroads, Lefty, your input is much appreciated.

It was a revelation that I dont power my higher voltage projects through the board, but through a transistor and signal the PWM info through the transistor. that makes sense and will keep my board safe.

So...is the number of LEDs that the Arduino can control really infinite as long as I have an external power source and enough pins to do the job?

I have another question, I want to use old cell phone batteries for my projects, I understand the risks of these batteries. Is there a casing or frame to put these into that will allow me to not soder directly onto them? Also if I put an inductive DC motor load onto one, will that be dangerous, how do I size the capacitor to ease that situation.

I realize Im jumping into a deep ocean of electronics and yall are really helpful. I also like adafruits tutorials.

Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 439
Posts: 23783
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

LEDs - sure, power as many as you want in a string with a transistor, as many as you can supply voltage for. Once you reach the voltage limit (say 5 with a 12V source) then start adding strings in parallel.
If you mean from Arduino pin, then yes 1 or 2 per pin (2 reds would work, 2 blues would not) or put 2 single LEDs in parallal with a resistor on each.
Observe the max current allowed per pin, per port, per the entire chip per the Electrical Characteristics of the datasheet.

For a '328:
3. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega48A/PA/88A/PA/168A/PA/328/P:
1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150mA.
2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150mA.
If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current
greater than the listed test condition.
4. Although each I/O port can sink more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega48A/PA/88A/PA/168A/PA/328/P:
1] The sum of all IOL, for ports C0 - C5, ADC7, ADC6 should not exceed 100 mA.
2] The sum of all IOL, for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100 mA.
3] The sum of all IOL, for ports D0 - D4, RESET should not exceed 100 mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater
than the listed test condition.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

oh yes, each pin has a max ampacity, that clears that up.

 smiley
Logged

Pages: [1]   Go Up
Jump to: