Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Arduino LED's

  1. #1
    Join Date
    Feb 2013
    Location
    New Berlin IL
    Posts
    33

    Default Arduino LED's

    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

  2. #2
    Join Date
    Sep 2012
    Location
    Blaine Mn
    Posts
    340

    Default

    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

  3. #3
    Join Date
    Feb 2013
    Location
    New Berlin IL
    Posts
    33

    Default

    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.

  4. #4
    Join Date
    Mar 2008
    Location
    Tulsa Oklahoma
    Posts
    1,238

    Default

    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
    "The best thing about building something new is either you succeed or learn something. Its a win-win situation."

    --Greg Westbrook

  5. #5
    Join Date
    Sep 2012
    Location
    Blaine Mn
    Posts
    340

    Default

    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

  6. #6
    Join Date
    Mar 2006
    Posts
    7,832

    Default

    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/
    Words of Wisdom:
    “Words that sink into your ears are whispered…… not yelled”
    “The biggest trouble maker you’ll probably ever have to deal with, watches you from the mirror every morn’n”
    “The only difference between a rut and a grave is the depth”
    -----------
    Just remember...when it's time for the hearse to pull up..there's no luggage rack on top!
    -----------
    The beauty of the Second Amendment is that it will not be needed until they try to take it...Thomas Jefferson

  7. #7
    Join Date
    Mar 2008
    Location
    Tulsa Oklahoma
    Posts
    1,238

    Default

    Jack- thanks for the link! I had never heard of them. Decent prices and a wide assortment of stepper motors!



    D
    "The best thing about building something new is either you succeed or learn something. Its a win-win situation."

    --Greg Westbrook

  8. #8
    Join Date
    Jan 2011
    Location
    Springfield, IL
    Posts
    199

    Default

    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.


    ATtiny45 Chip with 9v.jpg


    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.

  9. #9
    Join Date
    Mar 2006
    Posts
    7,832

    Default

    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.
    Words of Wisdom:
    “Words that sink into your ears are whispered…… not yelled”
    “The biggest trouble maker you’ll probably ever have to deal with, watches you from the mirror every morn’n”
    “The only difference between a rut and a grave is the depth”
    -----------
    Just remember...when it's time for the hearse to pull up..there's no luggage rack on top!
    -----------
    The beauty of the Second Amendment is that it will not be needed until they try to take it...Thomas Jefferson

  10. #10
    Join Date
    Sep 2006
    Location
    Garland Tx
    Posts
    2,334

    Default

    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

Similar Threads

  1. Shopbot Talking to Arduino
    By jsolos in forum Project Ideas
    Replies: 25
    Last Post: 05-04-2014, 06:03 PM
  2. More fun with an Arduino and stepper motors
    By richards in forum Variations & Modifications of ShopBots
    Replies: 7
    Last Post: 06-18-2013, 09:11 AM
  3. Using an Arduino for quick interfacing
    By richards in forum Variations & Modifications of ShopBots
    Replies: 7
    Last Post: 12-13-2011, 06:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •