View Full Version : Arduino LED's
Keyco Wood
11-30-2013, 12:26 PM
My sister asked me to buy and arduino for my nephew for christmas. I got him a starter set and I had to have one too. I am trying to set up and arduino to run a motor and lights for a project. It is a basic rotating wood gear with lights that will dance to music. I can get the motor and lights to work with my UNO. I have to use two power sources. One for the 5v uno and another for the 12v led string. I am trying to miniaturize this to a ATtiny45 chip or something else like the ATmega328 arduino boot loader.
Any thoughts
GeneMpls
11-30-2013, 01:24 PM
I cannot help with this but it is something on my list to learn
for programming red leds to flash perhaps 10 times in rapid
(fire) sequence followed by a second or two pause and then
cycling thru again. This will be to simulate the machine gun
fire in the wings of a P-51 Mustang I am building. I will butt
out now- please go on with your lives. Sorry and thank you, Gene
Keyco Wood
11-30-2013, 02:07 PM
I can help you with that. Sounds like you are looking to run a few LED's which run fine on the 5v arduino. I can even help shrinkify it to a single chip. When you get to the 12v led strips it get tricky. My problem is the 12v interface for led strips without paying for ardrino uno, mini, or galalio controller for each project.
dana_swift
11-30-2013, 06:57 PM
Ryan just gave good answers, so I wont duplicate those.
Gene, look a the blink program:
http://arduino.cc/en/Tutorial/Blink
it shows how to hook up the LED and how to write a simple program to blink the LED. For your app you could write something really simple like:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // muzzle flash for 1/100 second
digitalWrite(led, Low); // turn the LED on (HIGH is the voltage level)
delay(50); // wait for a 1/20 second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Its that easy to do! It just turns on and off as fast as you like. You can make really short flashes, and long pauses. Change the numbers around for some other effect.
It can get fancier with a "loop" to repeat the "firing" flashes instead of writing them out in sequence. Either way works, and something that works is the requirement.
No need to be afraid of these things. They are cheap and not easy to destroy. The programming software is a free download, that price is just right ;)
Oh.. one arduino can run multiple LED's so you can have multiple "guns" flashing in sequence if it was that way on the acft!
Go have fun! Feel free to PM me if you want more info, I will do my best :)
D
GeneMpls
12-01-2013, 08:40 AM
Thank you Gentlemen. Over the winter (to preserve what is
left of my sanity) I am building a quarter scale Mustang that
will attach to the monument sign in front of my building on
a busy suburban highway. I want the prop to turn and the
guns to flash and perhaps red leds in the exhaust pipes. It
will be mounted on a gimbal mount so the flight attitude
can be changed periodically. I took a year of computer
programing in 1967 so I am hoping I can dust off a few
cobwebs in whatever corner of my brain that resides. Thanks
for the help and the offer of help... and Dana- you were the
first person I thought of to get started. Gene
myxpykalix
12-01-2013, 10:02 AM
I can't help with the "thinking part" of what you're trying to put together but here is a source for some of the things you've talked about. I've used them for other things and they seem pretty good with decent prices.
http://www.mpja.com/
dana_swift
12-01-2013, 01:06 PM
Jack- thanks for the link! I had never heard of them. Decent prices and a wide assortment of stepper motors!
:)
D
jhedlund58
12-01-2013, 01:26 PM
Ryan... Is this is what your thinking?. May just work! change the 9v power supply to 12v. The voltage regulator in this pic may be a P2N2222 transistor, but i not sure. I don't think you need two power supplies.
19459
ATtiny45 and ATtiny85 are both under $1.50 and would just get the 85. The ATmega328 is $5.50 or so. According to this video you do not need the boot loader. either one is cheaper and smaller than a dedicated arduino regardless of model.
https://www.youtube.com/watch?v=30rPt802n1k
This should get the 12v lights to work with one output... the motor would be another and hopefully it works on 12v too... or you may have to do something with that. These chips have limited space for code i think 512k or so. You are limited basically by code size and 3 outputs with the tiny.
myxpykalix
12-01-2013, 06:13 PM
Hi Dana...I have bought a couple stepper motors for some projects i have yet to complete along with some wall warts for some lithopanes and some cold cathode lights and they deliver right quick.
I bought the steppers to control (forgot the word for moveable wall art) and haven't figured out how to make the steppers rotate back and forth different lengths of time. That's why i figured your arduino discussions might give me some hints.:confused:
steve_g
12-01-2013, 09:16 PM
A note to the wise regarding MPJA…
I’ve used MPJA for many years without issue on their part… Where I have gotten into trouble is designing a product around the parts they sell. These are often closeouts and obsolete items that may or may not be available in production quantities anywhere! Also, basing product price estimates on their part costs can get you in trouble when the time comes to mass produce!
That said, they are a fantastic source for tinkering quantities and proof of concept parts!
SG
myxpykalix
12-02-2013, 05:50 AM
That's all i buy is "onesy's and twosey's".
(We'll here's fivesey's!):eek: (obscure reference)
Here is also a place for cold cathode lights. I know a lot of guys like LED's but this is to me is a softer more even covering type of light like for litho's
http://www.xoxide.com/
Keyco Wood
12-03-2013, 12:40 PM
Jeff, that is exactly what I am trying to do. I was all over the web looking for an answer and got it here. Thanks all for the information. Hopefully this approach will help others too.
Keyco Wood
12-03-2013, 12:51 PM
I forgot to mention that the voltage regulator is not the transistor you thought. It a separate piece and cost 58 cents. I am not sure what the c1 and c2 are in diagram... can it be a magnetic switch?
ssflyer
12-03-2013, 01:00 PM
Capacitors
Powered by vBulletin® Version 4.2.2 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.