SciFi Model Action

The Arduino Exchange => The Arduino Exchange => Topic started by: Gadgetron_3000 on February 24, 2015, 04:36:15 pm

Title: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 24, 2015, 04:36:15 pm
Hi, Everyone.

I recently got an Arduino Nano three-pack (http://scifimodelaction.com/sfmaforum/index.php?topic=232.msg64236#msg64236 (http://scifimodelaction.com/sfmaforum/index.php?topic=232.msg64236#msg64236)).

(https://lh3.googleusercontent.com/-LwON_mBzGjQ/VOz3p27XtWI/AAAAAAAAFZY/sommwRaLF98/s1152/Nano%2520-%25203-Pack.jpg)

(https://lh3.googleusercontent.com/-Vf8BgNXTrh4/VOz3qbMxQyI/AAAAAAAAFZg/YDD2buMYL-A/s720/Nano%2520-%2520Board.jpg)

I chose to go with the Nano because of its size and price.  It's only 1.6875-inches (42.8625mm) x 0.625-inches (15.875mm), so it's small enough to fit almost anywhere.  The price was $10.95 U.S.D. for three with free shipping which comes out to $3.65 U.S.D. each.

Within a day, I was able to find out how to program the Nano to do some basic Starfleet starship running and strobe light effects.  I already have a stock of various LEDs, resistors, power supplies, power switches, magnet wire, solder, and USB cables, so why wouldn't I want to use those things and a $3.65 board that will do the exact same thing as something that would cost anywhere from $35.00 to $40.00 or greater?  And as a bonus, the Nano has so many pins (14 digital and 8 analog), that they can be reconfigured to be reused for anything else I might learn to do in the future (such as LED chasers, LED chaser wheels / rings, RGB and bi-color LED fading, etc.)

I wanted to start this thread for all us Arduino / coding newbies out there.  I'll make the steps as detailed as possible so that you can feel comfortable with doing things.  In the end, I think you'll be surprised how fast it is to program for and flash the Nano and to get things ready to go for your model kits.

:)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 24, 2015, 04:41:49 pm
First, you may need to get the device drivers for the Nano itself.  Since the Nano I bought is a Chinese-made one, it doesn't use the FTDI FT232RL serial communication chip to work over USB like original Arduino boards.  It uses a WCH CH340G chip for which you can get device drivers from:


Next, lets get things installed on your PC so that you can program that Nano.  There are versions of the open-source Arduino Software (IDE) for Windows, Mac OS X, and Linux.  Go to http://arduino.cc/en/Main/Software (http://arduino.cc/en/Main/Software) to get the version that is right for you.

NOTE: my PC is running Windows 8.1 64-bit so my instructions will reflect that.

1. Attach a USB cable with a male Mini-B USB connector to the the Nano's female port.

(https://lh4.googleusercontent.com/-8u8COKcKwPk/VOz3sMDvebI/AAAAAAAAFZo/OHAYQ6hII_E/s720/Nano%2520-%2520USB.jpg)

2. Plug the other end of the USB cable to your computer.  The USB port will power the Nano and Windows will begin trying to install drivers for the device.  If you need to manually install the device driver, do so from the set downloaded from the WCH website.  NOTE: on my Windows 8.1 machine, the drivers for the Nano automatically installed.

(https://lh6.googleusercontent.com/-cJlTX8Sss-4/VOz2L_mWjkI/AAAAAAAAFYs/WyyLlw7EAx0/s720/Nano%2520-%2520Device%2520Manager.jpg)

3. Download the Arduino Software (IDE) for Windows .EXE file from http://arduino.cc/download_handler.php?f=/arduino-1.6.0-windows.exe (http://arduino.cc/download_handler.php?f=/arduino-1.6.0-windows.exe).
4. Run the .EXE file and follow the on-screen installation instructions.  NOTE: you don't need to install the Arduino Software bundled drivers if your WCH CH340G chip Nano is already confirmed to be properly detected and working in Windows.

(https://lh6.googleusercontent.com/-IE0lc4w4-M0/VOz5fNYduoI/AAAAAAAAFZ0/3XTbPkOboFg/s462/Nano%2520-%2520Device%2520Manager%2520-%25202.jpg) (https://lh3.googleusercontent.com/-xmLiJyCd3UY/VOz5gkCM3DI/AAAAAAAAFZ8/XlcwnSxntt8/s462/Nano%2520-%2520Device%2520Manager%2520-%25203.jpg)

5. Launch Arduino.exe.

(https://lh3.googleusercontent.com/-bBimCgrH2o4/VOz2M5mXQzI/AAAAAAAAFY0/AU6unsM1XW4/s912/Arduino%2520IDE%2520-%25201.jpg)

(https://lh5.googleusercontent.com/-XiaiWcpsOso/VOz2Ny2lD9I/AAAAAAAAFY8/OBoVQSZBQwE/s512/Arduino%2520IDE%2520-%25202.jpg)

6. Ensure that the correct board and COM port number (which is shown in Device Manager) has been selected.

(https://lh3.googleusercontent.com/-36air50b1tg/VOz2PG2uuKI/AAAAAAAAFZE/-A0f5URM8wQ/s512/Arduino%2520IDE%2520-%25203.jpg) (https://lh4.googleusercontent.com/-Q0zUJle0qXk/VOz2QYKaDZI/AAAAAAAAFZM/JEYKHKFZVo4/s512/Arduino%2520IDE%2520-%25204.jpg)

And that's it!  Easy!
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 24, 2015, 04:47:17 pm
Now onto programming the attached board.  Let's do the easiest one...TOS Starfleet Starship Running and Strobe Lights.  This Arduino sketch (the code itself) will have the Nano control four LEDs: two flashing running lights and two strobe lights.

This is intended for the Polar Lights / Round 2 1:1000 TOS Enterprise where the two running lights can be used in the primary hull and the two strobe lights can used in the secondary hull for the ion pods.

1. Copy the following code:
Quote
/*
  TOS Starfleet Starship Running & Strobe Lights:

    - Turns on two running lights LEDs on for 1.5 seconds (1500 milliseconds),
      then off for 0.5 second (500 milliseconds), repeatedly.

    - Turns on two strobe lights LEDs on for 0.5 second (500 milliseconds),
      then off for 0.5 second (500 milliseconds), repeatedly.
     
    - 1 second = 1000 milliseconds
   
    - TOS starship blink / flash rates researched by 'RossW'
      (http://www.hobbytalk.com/bbs1/showpost.php?p=4824675&postcount=15).

    - Based on original Arduino sketch by Jack Christensen
     (http://forum.arduino.cc/index.php?topic=220026.msg1607277#msg1607277).

  NOTE:

    - On the TOS Enterprise, the port-side running light is RED and
      the starboard-side running light is GREEN.

    - On the TOS Enterprise, the strobe lights are the 'ion pods'
      toward the rear of the secondary hull near the hangar bay doors.

*/

//LED pin numbers
const byte LED1 = 12;                           //running light LED 1
const byte LED2 = 10;                           //running light LED 2
const byte LED3 = 8;                            //strobe light LED 1
const byte LED4 = 6;                            //strobe light LED 2

void setup(void)
{
    pinMode(LED1, OUTPUT);                      //make each LED pin an output
    pinMode(LED2, OUTPUT);
    pinMode(LED3, OUTPUT);
    pinMode(LED4, OUTPUT);
}

void loop(void)
{
    runLED1();                                  //call the function for each LED 
    runLED2();
    runLED3();
    runLED4();
}

void runLED1(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1500;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED1, state);                 //**CHANGE the pin argument for each LED
}

void runLED2(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1500;         //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED2, state);                 //**CHANGE the pin argument for each LED
}

void runLED3(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 500;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED3, state);                 //**CHANGE the pin argument for each LED
}

void runLED4(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 500;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED4, state);                 //**CHANGE the pin argument for each LED
}

2. Replace the existing code in the Arduino software window with the copied code.
3. Save the sketch.  NOTE: for your reference, saved Arduino sketches are located in the C:\Users\<Windows user name>\Documents\Arduino folder.
4. Click the 'Verify' check-mark icon to allow the Arduino software to compile the code and check for issues.  When finished, the software status bar will say 'Done compiling.'
5. Click the 'Upload' right-arrow icon to allow the Arduino software to program the Nano.  When finished, the software status bar will say 'Done uploading.'

And that's it!  Once again...easy!

Here is a pin diagram picture that will show where to make all your connections:

(https://lh4.googleusercontent.com/-dD3KuekG0v0/VOz2HyC4fwI/AAAAAAAAFYU/6bojrof-OoM/s720/TOS%2520Starfleet%2520Starship%2520Running%2520x2%2520and%2520Strobe%2520x2%2520LEDs.jpg)

Don't forget to use resistors for your LEDs!  You should be able to use a 9- or 12-volt power supply.  For the purposes of my testing, I used the computer's 5-volt USB port that the Nano was already connected to.

I used researched timing for the LED blink / flash effects, but you can always change the values to whatever you want to fit your needs.  You can also add more pin outputs to the code, if you want.

Check out the code in the Arduino software window to study it a bit.  There may be more efficient ways to code what is being done here, but the example I learned from went for a more straightforward and easy to understand approach.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 24, 2015, 04:50:29 pm
Next lets reprogram the attached board to add two more running lights so that the Nano will control six LEDs: four flashing running lights and two strobe lights.

This is intended for the AMT / Round 2 1:650 TOS Enterprise where the four running lights can be used in the primary hull and the two strobe lights can used in the secondary hull for the ion pods.

1. Copy the following code:
Quote
/*
  TOS Starfleet Starship Running & Strobe Lights:

    - Turns on four running lights LEDs on for 1.5 seconds (1500 milliseconds),
      then off for 0.5 second (500 milliseconds), repeatedly.

    - Turns on two strobe lights LEDs on for 0.5 second (500 milliseconds),
      then off for 0.5 second (500 milliseconds), repeatedly.
     
    - 1 second = 1000 milliseconds
   
    - TOS starship blink / flash rates researched by 'RossW'
      (http://www.hobbytalk.com/bbs1/showpost.php?p=4824675&postcount=15).

    - Based on original Arduino sketch by Jack Christensen
     (http://forum.arduino.cc/index.php?topic=220026.msg1607277#msg1607277).

  NOTE:

    - On the TOS Enterprise, the port-side running light is RED and
      the starboard-side running light is GREEN.

    - On the TOS Enterprise, the strobe lights are the 'ion pods'
      toward the rear of the secondary hull near the hangar bay doors.

*/

//LED pin numbers
const byte LED1 = 12;                           //running light LED 1
const byte LED2 = 11;                           //running light LED 2
const byte LED3 = 10;                           //running light LED 3
const byte LED4 = 9;                            //running light LED 4
const byte LED5 = 8;                            //strobe light LED 1
const byte LED6 = 6;                            //strobe light LED 2

void setup(void)
{
    pinMode(LED1, OUTPUT);                      //make each LED pin an output
    pinMode(LED2, OUTPUT);
    pinMode(LED3, OUTPUT);
    pinMode(LED4, OUTPUT);
    pinMode(LED5, OUTPUT);
    pinMode(LED6, OUTPUT);
}

void loop(void)
{
    runLED1();                                  //call the function for each LED 
    runLED2();
    runLED3();
    runLED4();
    runLED5();
    runLED6();
}

void runLED1(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1500;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED1, state);                 //**CHANGE the pin argument for each LED
}

void runLED2(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1500;         //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED2, state);                 //**CHANGE the pin argument for each LED
}

void runLED3(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1500;         //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED3, state);                 //**CHANGE the pin argument for each LED
}

void runLED4(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1500;         //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED4, state);                 //**CHANGE the pin argument for each LED
}

void runLED5(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 500;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED5, state);                 //**CHANGE the pin argument for each LED
}

void runLED6(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 500;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 500;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED6, state);                 //**CHANGE the pin argument for each LED
}

2. Replace the existing code in the Arduino software window with the copied code.
3. Save the sketch.  NOTE: for your reference, saved Arduino sketches are located in the C:\Users\<Windows user name>\Documents\Arduino folder.
4. Click the 'Verify' check-mark icon to allow the Arduino software to compile the code and check for issues.  When finished, the software status bar will say 'Done compiling.'
5. Click the 'Upload' right-arrow icon to allow the Arduino software to program the Nano.  When finished, the software status bar will say 'Done uploading.'

And that's it!  Once again...easy!

Here is a pin diagram picture that will show where to make all your connections:

(https://lh3.googleusercontent.com/-c8BPSCke0kI/VOz2JAVGYAI/AAAAAAAAFYc/Qce-6harc40/s720/TOS%2520Starfleet%2520Starship%2520Running%2520x4%2520and%2520Strobe%2520x2%2520LEDs.jpg)

Don't forget to use resistors for your LEDs!  You should be able to use a 9- or 12-volt power supply.  For the purposes of my testing, I used the computer's 5-volt USB port that the Nano was already connected to.

I used researched timing for the LED blink / flash effects, but you can always change the values to whatever you want to fit your needs.  You can also add more pin outputs to the code, if you want.

Check out the code in the Arduino software window to study it a bit.  There may be more efficient ways to code what is being done here, but again the example I learned from went for a more straightforward and easy to understand approach.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 24, 2015, 04:53:16 pm
For this third example, let's go from TOS to TMP...TMP Starfleet Starship Running and Strobe Lights.  This Arduino sketch will have the Nano control twelve LEDs: eight flashing running lights and four strobe lights.

This is intended for the AMT / ERTL 1:537 Enterprise Refit, the Polar Lights / Round 2 1:350 Enterprise Refit, and the Polar Lights / Round 2 1:1000 Enterprise Refit where the eight running lights can be used in the primary hull and the four strobe lights can used in the back of the bridge, the bottom of the secondary hull, and in the rear of the warp nacelles.

1. Copy the following code:
Quote
/*
  TMP Starfleet Starship Running & Strobe Lights:

    - Turns on eight running lights LEDs on for 1.083 seconds (1083 milliseconds),
      then off for 1.083 seconds (1083 milliseconds), repeatedly.

    - Turns on four strobe lights LEDs on for 0.0417 second (41.7 milliseconds),
      then off for 0.75 second (750 milliseconds), repeatedly.
     
    - 1 second = 1000 milliseconds
   
    - TMP starship blink / flash rates researched by 'Marc111'
      (http://www.showcase.netins.net/web/marc111creations/PL_Enterprise_Refit_WIP_1.htm).

    - Based on original Arduino sketch by Jack Christensen
      (http://forum.arduino.cc/index.php?topic=220026.msg1607277#msg1607277).

  NOTE:

    - On the Refit Enterprise, the port-side running lights are RED, the
      starboard-side running lights are GREEN, and the bow running lights
      are WHITE.

*/

//LED pin numbers
const byte LED1 = 12;                           //running light LED 1
const byte LED2 = 11;                           //running light LED 2
const byte LED3 = 10;                           //running light LED 3
const byte LED4 = 9;                            //running light LED 4
const byte LED5 = 8;                            //running light LED 5
const byte LED6 = 7;                            //running light LED 6
const byte LED7 = 6;                            //running light LED 7
const byte LED8 = 5;                            //running light LED 8
const byte LED9 = 4;                            //strobe light LED 1
const byte LED10 = 3;                           //strobe light LED 2
const byte LED11 = 2;                           //strobe light LED 3
const byte LED12 = 13;                          //strobe light LED 4

void setup(void)
{
    pinMode(LED1, OUTPUT);                      //make each LED pin an output
    pinMode(LED2, OUTPUT);
    pinMode(LED3, OUTPUT);
    pinMode(LED4, OUTPUT);
    pinMode(LED5, OUTPUT);
    pinMode(LED6, OUTPUT);
    pinMode(LED7, OUTPUT);
    pinMode(LED8, OUTPUT);
    pinMode(LED9, OUTPUT);
    pinMode(LED10, OUTPUT);
    pinMode(LED11, OUTPUT);
    pinMode(LED12, OUTPUT);

}

void loop(void)
{
    runLED1();                                  //call the function for each LED 
    runLED2();
    runLED3();
    runLED4();
    runLED5();
    runLED6();
    runLED7();
    runLED8();
    runLED9();
    runLED10();
    runLED11();
    runLED12();
}

void runLED1(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1083;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 1083;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED1, state);                  //**CHANGE the pin argument for each LED
}

void runLED2(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1083;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 1083;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED2, state);                  //**CHANGE the pin argument for each LED
}

void runLED3(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1083;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 1083;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED3, state);                  //**CHANGE the pin argument for each LED
}

void runLED4(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1083;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 1083;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED4, state);                  //**CHANGE the pin argument for each LED
}

void runLED5(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1083;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 1083;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED5, state);                  //**CHANGE the pin argument for each LED
}

void runLED6(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1083;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 1083;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED6, state);                  //**CHANGE the pin argument for each LED
}

void runLED7(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1083;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 1083;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED7, state);                  //**CHANGE the pin argument for each LED
}

void runLED8(void)                              //**CHANGE the function name for each LED
{
    const unsigned long onTime = 1083;          //**CHANGE the on and off times for each LED
    const unsigned long offTime = 1083;
    static unsigned long lastChangeTime;        //last time the LED was turned on or off
    static boolean state = true;                //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {    //on long enough?
            state = false;                      //yes, set state to off
            lastChangeTime = ms;                //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {   //off long enough?
            state = true;                       //yes, set state to on
            lastChangeTime = ms;                //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED8, state);                 //**CHANGE the pin argument for each LED
}

void runLED9(void)                             //**CHANGE the function name for each LED
{
    const unsigned long onTime = 41.7;         //**CHANGE the on and off times for each LED
    const unsigned long offTime = 750;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED9, state);                 //**CHANGE the pin argument for each LED
}

void runLED10(void)                            //**CHANGE the function name for each LED
{
    const unsigned long onTime = 41.7;         //**CHANGE the on and off times for each LED
    const unsigned long offTime = 750;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED10, state);                //**CHANGE the pin argument for each LED
}

void runLED11(void)                            //**CHANGE the function name for each LED
{
    const unsigned long onTime = 41.7;         //**CHANGE the on and off times for each LED
    const unsigned long offTime = 750;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED11, state);                //**CHANGE the pin argument for each LED
}

void runLED12(void)                            //**CHANGE the function name for each LED
{
    const unsigned long onTime = 41.7;         //**CHANGE the on and off times for each LED
    const unsigned long offTime = 750;
    static unsigned long lastChangeTime;       //last time the LED was turned on or off
    static boolean state = true;               //current LED state, true=on, false=off. start on
   
    unsigned long ms = millis();
    if (state) {    //LED on?
        if (ms - lastChangeTime >= onTime) {   //on long enough?
            state = false;                     //yes, set state to off
            lastChangeTime = ms;               //and record the time
        }
    }
    else { //LED is off
        if (ms - lastChangeTime >= offTime) {  //off long enough?
            state = true;                      //yes, set state to on
            lastChangeTime = ms;               //and record the time
        }
    }
    //set the LED's state
    digitalWrite(LED12, state);                //**CHANGE the pin argument for each LED
}

2. Replace the existing code in the Arduino software window with the copied code.
3. Save the sketch.  NOTE: for your reference, saved Arduino sketches are located in the C:\Users\<Windows user name>\Documents\Arduino folder.
4. Click the 'Verify' check-mark icon to allow the Arduino software to compile the code and check for issues.  When finished, the software status bar will say 'Done compiling.'
5. Click the 'Upload' right-arrow icon to allow the Arduino software to program the Nano.  When finished, the software status bar will say 'Done uploading.'

And that's it!  Once again...easy!

Here is a pin diagram picture that will show where to make all your connections:

(https://lh5.googleusercontent.com/-gT05rmNLG-0/VOz2KQFfBEI/AAAAAAAAFYk/zTXwasyrcUE/s720/TMP%2520Starfleet%2520Starship%2520Running%2520x8%2520and%2520Strobe%2520x4%2520LEDs.jpg)

Don't forget to use resistors for your LEDs!  You should be able to use a 9- or 12-volt power supply.  For the purposes of my testing, I used the computer's 5-volt USB port that the Nano was already connected to.

I used researched timing for the LED blink / flash effects, but you can always change the values to whatever you want to fit your needs.  You can also add more pin outputs to the code, if you want.

Check out the code in the Arduino software window to study it a bit.  There may be more efficient ways to code what is being done here, but again the example I learned from went for a more straightforward and easy to understand approach.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 24, 2015, 04:58:08 pm
As I learn more and add more lighting effects for the Nano to control, I will start new forum threads for whatever the topic will be.

I hope you found this one useful.

Have fun, Everyone!

:)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: MarkW on February 24, 2015, 06:46:28 pm
First, these are great examples with the real world application. That is something that is too often lacking in many of the Arduino tutorials.

Have you tried running the fourth example for a very long time?  I'm curious if they would ever end up getting out of sync. Granted at the speed at which the processor runs, it shouldn't be an issue.

 An alternative approach to having each LED controlled by one pin on the Arduino, which pulls a lot of current through the Arduino, would be to have all eight of the LEDs running off of one pin on the Arduino, and connected with a transistor to a string of LEDs. Otherwise you will soon run out of available current and pins if you try to just do one LED at a time per pin .
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Armandodlc on February 24, 2015, 06:52:02 pm
Fantastic...gonna run out and get me these boards now and give this all a try.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Tankton on February 24, 2015, 06:56:17 pm
Just uploaded the last one to a Pro Mini will see how it works on the breadboard. Will let you know.

added the mini pinout to your pic looks the same.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: simi on February 24, 2015, 08:04:07 pm
Awesome info.  Just as an FYI (this is for people like me...) you can get the Arduino clones with the header pins already soldered on if that's your preference (link below).  These things are dirt cheap and not too terribly difficult to program.  And if programming isn't your thing - you can use your google-foo to find existing sample code (like all the great stuff Gadgetron provided) to get you 80% to your destination.

http://www.ebay.com/itm/Mini-USB-Nano-V3-0-ATmega328P-5V-16M-Micro-controller-Board-For-Arduino-1pcs-/171488914920?pt=LH_DefaultDomain_0&hash=item27ed892de8 (http://www.ebay.com/itm/Mini-USB-Nano-V3-0-ATmega328P-5V-16M-Micro-controller-Board-For-Arduino-1pcs-/171488914920?pt=LH_DefaultDomain_0&hash=item27ed892de8)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 26, 2015, 12:21:01 pm
Have you tried running the fourth example for a very long time?  I'm curious if they would ever end up getting out of sync. Granted at the speed at which the processor runs, it shouldn't be an issue.

I've run tests with the third example (TMP Starfleet Starship Running & Strobe Lights) for over an hour and did not experience any kind of sync issue.

Quote
An alternative approach to having each LED controlled by one pin on the Arduino, which pulls a lot of current through the Arduino, would be to have all eight of the LEDs running off of one pin on the Arduino, and connected with a transistor to a string of LEDs. Otherwise you will soon run out of available current and pins if you try to just do one LED at a time per pin .

Each of the Nano's digital pins can output 5-volts with up to 40mA of current.  That is more than enough to run single LEDs attached to each pin.  The setups I created for this thread are simplistic, but I wanted them to be purposely so.  This way, someone can just throw the Nano (or other compatible Arduino device) into his/her mix of already-stocked electronic parts and almost instantly have a basic, decent control board.

In the near future, I will be ordering some 2N5551 NPN transistors to create a different setup where the LEDs aren't powered by the Nano and where I can have multiple LEDs controlled by single pins.  In the end, that should be more efficient...especially as I hopefully learn other effects that can be programmed into the Nano to make it part of a more complete lighting solution.

:)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 26, 2015, 12:34:14 pm
Fantastic...gonna run out and get me these boards now and give this all a try.

Give it a try.  I think you would be pleasantly surprised with the results.

I will eventually post new threads with new effects that can be used in many different ways.


Just uploaded the last one to a Pro Mini will see how it works on the breadboard. Will let you know.

added the mini pinout to your pic looks the same.

How did it work out with your Mini Pro?

I just recently saw the Mini Pro on eBay, and I couldn't believe that it was even smaller than the Nano.  I know this is because the USB component is separate on the Mini Pro to allow for its shorter length.  But I guess I'll stick with the Nano since it's still a good best-bang-for-the-buck board.


Awesome info.  Just as an FYI (this is for people like me...) you can get the Arduino clones with the header pins already soldered on if that's your preference (link below).  These things are dirt cheap and not too terribly difficult to program.  And if programming isn't your thing - you can use your google-foo to find existing sample code (like all the great stuff Gadgetron provided) to get you 80% to your destination.

Yep, the Chinese-made Arduinos can be had for so little and they work just fine.  I'm actually about to order a bunch more of the Nanos.  So many model kits can benefit from them!

:)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 26, 2015, 01:04:54 pm
I posted a demo of the TMP Starfleet Starships Running & Strobe Lights test setup on YouTube...

http://youtu.be/hzdCkOwSJkc (http://youtu.be/hzdCkOwSJkc)

(https://lh3.googleusercontent.com/-YwwP6HJvx80/VO92vMpnDyI/AAAAAAAAFaQ/qlYl1AHPTWo/s720/IMG_1732.jpg)

(https://lh5.googleusercontent.com/-ouaZg86xlHc/VO92wizz2uI/AAAAAAAAFaY/usukWbRQNdc/s720/IMG_1733.jpg)

:)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 26, 2015, 02:28:48 pm
I also posted a demo of the TOS Starfleet Starships Running & Strobe Lights test setup on YouTube...

http://youtu.be/pbFnVqfHq2M (http://youtu.be/pbFnVqfHq2M)

(https://lh6.googleusercontent.com/-zgYOAGr5XCI/VO-ALms0wJI/AAAAAAAAFa0/Urd4lTNJTv4/s720/IMG_1736.jpg)

:)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: TK Iain on February 26, 2015, 02:52:54 pm
I was with you right up to when you said "Hi Everyone". :-[ Then my brain went fart!


Still - nothing ventured, nothing gained so I have bought one of these boards to try it out. ;)

Who knows if I can suss this out I will use it on my 1701E build.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Tankton on February 26, 2015, 03:12:47 pm
I have had it running on the breadboard with the mini pro for 72 hrs without a hitch so far.
Good work.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 26, 2015, 03:30:55 pm
I was with you right up to when you said "Hi Everyone". :-[ Then my brain went fart!

Still - nothing ventured, nothing gained so I have bought one of these boards to try it out. ;)

Who knows if I can suss this out I will use it on my 1701E build.

Don't worry, setting up an Arduino board is about as complicated as adding a printer to your computer.

After that, if you just want to copy-paste code into the software and send it to the board, it can all be done with a few minutes more.

I also have code for a customizable LED flicker effect.  Should be perfect for impulse engines, Klingon Bird of Prey engines, and Enterprise-E bussards.  I just have to combine it with navigation and strobe code.  :)


I have had it running on the breadboard with the mini pro for 72 hrs without a hitch so far.

Good to hear!

I'll be adding a few more effects threads soon.  :)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: AnythingSciFi on February 26, 2015, 03:35:16 pm
Then my brain went fart!

So, that is what that smell is!!   :)

I bought some of these boards and watching this thread very closely!
Not quite ready to start the trial and error thing yet!

This will work great for me if I can pull it off cause most of my models I want to use this with
are just simple navs and strobes!! Like I want to add strobes to my shuttle Tydirium build! Also, very cost effective!!
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: MarkW on February 27, 2015, 12:03:35 pm
Keep in mind while each pin can out put 40 mA, that's a max rating. And the board usually is limited to 160-200 mA total, so you can burn up the board long before you run out of pins.

In reality, each LED takes about 15mA, and you'd need to have all of them on at the same time to approach the limit.  BUT, and it is a big but, in electronics you never want to run things close to their limits.  Derating components is common practice to extend life. 

Transistors are definitely the way to go if you are ever going to pull 100mA or more through an Arduino.

One other caution about the minis and nanos. The on board Usb ports tend to snap off real easily.  They are a bargain for sure, but very delicate.  I'm gonna look for an IC socket for my test articles so they survive bread boards better.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on February 27, 2015, 12:54:51 pm
Keep in mind while each pin can out put 40 mA, that's a max rating. And the board usually is limited to 160-200 mA total, so you can burn up the board long before you run out of pins.

In reality, each LED takes about 15mA, and you'd need to have all of them on at the same time to approach the limit.  BUT, and it is a big but, in electronics you never want to run things close to their limits.  Derating components is common practice to extend life. 

Transistors are definitely the way to go if you are ever going to pull 100mA or more through an Arduino.

Yep, I agree with you.  Once I get in the transistors I want, I will create a new test setup, refine the sketch to reflect the need for fewer pin outputs, and update this thread.

:)

Quote
One other caution about the minis and nanos. The on board Usb ports tend to snap off real easily.  They are a bargain for sure, but very delicate.  I'm gonna look for an IC socket for my test articles so they survive bread boards better.

I haven't noticed any issue with the Nanos that I currently have.  But then again, I don't tend to plug and unplug them repeatedly.  As with most electronic components, try not to treat them with a heavy hand, and they should be okay.
 
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: MarkW on February 27, 2015, 02:15:52 pm
Think of all the fun you are having, and you haven't even gotten heavily into PWM programming!
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: TK Iain on March 02, 2015, 01:32:16 pm
Nah!

Got my Nano in today and I haven't a clue what the hell I'm doing. Time to order from Tena methinks. :-[
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: MarkW on March 02, 2015, 02:08:49 pm
It is a little intimidating at first, but once you see what you can do, and you can do a lot just by copying what others have done, it gets to be quite empowering.

I didn't know squat about programming in C, or C+, or C+++++++++++ or whatever the frack the little guy uses.  But I was able to glean enough from studying examples and playing with it.

If nothing else, you should never have to buy strobe kits again.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on March 02, 2015, 02:19:47 pm
Nah!

Got my Nano in today and I haven't a clue what the hell I'm doing. Time to order from Tena methinks. :-[

I think Ralph and TenaControls are great.  I have some of his products, and I have had a hand in providing ideas and details for a few things that he sells.

But I've always had a Do-It-Yourself mentality which very often lends itself to plastic model building.  Arduino (and other products like it) is a great DIY electronics platform.  One of the things about it is that to take full advantage of it, you need to understand how to code for it.  BUT...even if you don't know how or don't even want to code, there are so many resources out there with pre-written code that you can simply copy-paste-program an Arduino board to make it do things in just minutes.

That's why I started my two how-to threads here.  It's meant for you to just copy the code, shoot it over to the Arduino, and then solder everything together and you have yourself an under-$4.00 lighting effects control board.  And with each of the examples I provided, if you want to change settings or add more functionality, the range of difficulty to do so can go from very-easy on up depending on what you want to do.

Is there anything in particular you're trying to do with certain model kits where the Arduino examples here might be able to work for you?
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: TK Iain on March 02, 2015, 03:11:00 pm
Thanks guys!

I have been persevering and have now got 3 blinkies working and the damn thing hooked up to 9volts external power as well.

Still haven't a Scooby but I'm getting there. Feel a bit of a cheat basically copying/pasting other's work but this will be used on my Enterprise E build.

Will still be getting stuff from Ralph/Tena but this does give us more options.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: MarkW on March 02, 2015, 06:37:17 pm
It's all about empowerment, brother!  Maybe you can even figure out a way to not have to keep stealing Eleanor's board.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: TK Iain on March 03, 2015, 02:38:26 am
It's all about empowerment, brother!  Maybe you can even figure out a way to not have to keep stealing Eleanor's board.

Mm! Never thought of that and she is mega p***ed off that I keep "borrowing" her board ;)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on March 06, 2015, 03:20:40 pm
Very nice, Gadgetron! I've been programming with PIC microcontrollers for a number of years back when the only option was Stamps which are way too expensive. But PICs need more components and aren't as easy to configure & code as Arduinos, so I'm experimenting with them too. I really like this thread you've started since it does cover everything you need to get going.

And thanks for acknowledging me in your code! I got some details from Trek Ace on HT for the 2nd pilot version but then used my DVDs & counted frames to come up with the rates below. For anyone who's interested:

' The running light locations on the primary hull are (4):
'   - Saucer Port [top] (red) - 1
'   - Saucer Starboard [top] (green) - 1
'   - Saucer Port/Starboard [bottom (white) - 2

' The TOS E running lights flash at a base timing of 1-1/2 sec (36 frames) on,
' 1/2 sec (12 frames) off

' Alternate is 1/2 sec on, 1.5 sec off (reverse of above).

' In "The Corbomite Maneuver", the lights were on for 18 frames and off for 20

' For the 2nd pilot, the lights were on for 1 sec and off for 2/3 sec (Trek Ace)
' (http://www.hobbytalk.com/bbs1/showpost.php?p=4515070&postcount=10)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: MarkW on March 07, 2015, 09:10:27 am
Ross, I applaud your scientific, and scarily anal retentive attention to this detail!
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on March 07, 2015, 12:23:56 pm
Thanks Mark! But you have no idea how bad it is ...  ;)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: TK Iain on March 09, 2015, 08:35:59 am
Me again! :-[

Have trolled the forums for the answer to my next question but can't find anything so here it is:-

"Is there a limit as to how many LEDs can be plugged into one socket on the board"?. I am in no way an electronics expert but whilst mucking about about with the board I have (subsequently discovered it is a copy of an Arduino but it works for me) there ended being a medusa type mass of wires connected to the board.

I have shelved the 1701E after a bummer of a weekend but plan on using the board on my next build but plan on just having x4 red/green nav lights and at the most x4 strobes (probably only two) and I wondered if it would be safe enough to wire up the 2 circuits to only one corresponding hole/s on the board. Like it would be on a Tena board with the navs wired up to x1 +/- connection and so on with the strobes?

I have just read over that again and hopefully it makes some kind of sense.

Thanks for any pointers folks.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on March 09, 2015, 01:57:20 pm
"Is there a limit as to how many LEDs can be plugged into one socket on the board"?. I am in no way an electronics expert but whilst mucking about about with the board I have (subsequently discovered it is a copy of an Arduino but it works for me) there ended being a medusa type mass of wires connected to the board.

I have shelved the 1701E after a bummer of a weekend but plan on using the board on my next build but plan on just having x4 red/green nav lights and at the most x4 strobes (probably only two) and I wondered if it would be safe enough to wire up the 2 circuits to only one corresponding hole/s on the board. Like it would be on a Tena board with the navs wired up to x1 +/- connection and so on with the strobes?

Each output pin on an Arduino can provide or receive a maximum of 40mA.  That is enough to run single LEDs attached to each pin as one LED can draw between 20mA and 30mA.

If you want to add many LEDs to one pin, it can be done using transistors.  I'll actually be updating my threads to show how this is done once I get in the transistors that I will be ordering soon.  That should make the rat's nest of wires look a little more organized.

:)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on March 22, 2015, 04:18:44 pm
I'm a bit behind the class here, so please forgive me if I ask a question or ten that's been covered before. I just got these little buggers in the mail this past week, and just today had a chance to get started. I tried the link for the Windows driver download, but was lost immediately in Japanese text. I managed to connect to the website address listed on the card that came with them, but only on my desktop, not my laptop. Both are running 8.1 Windows (64bit). I think I downloaded the driver, but there was no notification of start or completion when I clicked the download button. My download folder is still empty, but when I clicked the button again a red '!' popped up with some Japanese text I took to mean it was done already or in progress. If I plug in the board and there is no driver, will it just give a cannot connect error code, or will something else unpleasant happen?
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on March 22, 2015, 07:42:32 pm
Have you tried plugging it in? I would think that Windows would already have a driver for it - you probably don't need to download a special one, unless it's not an Arduino board clone.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: DarthVader on March 22, 2015, 08:32:35 pm
Very nice work Gadgetron_3000,wish I had the knowledge how to work with Arduino,the only really good thing I am fairly good at is building computers which I been doing for the last 5 to 6 years now at least for myself the landlords and a couple friends I know..

Keep up the great work my good friend..

Clarence
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on March 22, 2015, 09:18:59 pm
Have you tried plugging it in? I would think that Windows would already have a driver for it - you probably don't need to download a special one, unless it's not an Arduino board clone.

There the same ones that Gadgetron bought. Got the EBay link from his post. Maybe that's why nothing happened when I tried to download the driver, it may already be there.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on March 22, 2015, 09:34:10 pm
There the same ones that Gadgetron bought. Got the EBay link from his post. Maybe that's why nothing happened when I tried to download the driver, it may already be there.

Check Device Manager in Windows.  If the drivers auto-installed like what happened with me, then you should see something like the following:

(https://lh6.googleusercontent.com/-cJlTX8Sss-4/VOz2L_mWjkI/AAAAAAAAFYs/WyyLlw7EAx0/s720/Nano%2520-%2520Device%2520Manager.jpg)

If you see that, you won't need to download or manually install the drivers.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on March 22, 2015, 09:41:01 pm
Very nice work Gadgetron_3000,wish I had the knowledge how to work with Arduino,the only really good thing I am fairly good at is building computers which I been doing for the last 5 to 6 years now at least for myself the landlords and a couple friends I know..

Keep up the great work my good friend..

Thanks, Clarence!

My goal with these particular threads is to encourage and allow people to have basic lighting effects functionality without having to learn much about the actual coding itself.  Just flash the Arduino board with the given code and away you go.

:)

Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on March 22, 2015, 10:13:37 pm
There the same ones that Gadgetron bought. Got the EBay link from his post. Maybe that's why nothing happened when I tried to download the driver, it may already be there.

Check Device Manager in Windows.  If the drivers auto-installed like what happened with me, then you should see something like the following:

(https://lh6.googleusercontent.com/-cJlTX8Sss-4/VOz2L_mWjkI/AAAAAAAAFYs/WyyLlw7EAx0/s720/Nano%2520-%2520Device%2520Manager.jpg)

If you see that, you won't need to download or manually install the drivers.

Nope, it's not there. Guess I can try again. Not tonight though. Thanks Gadgetron.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Gadgetron_3000 on March 23, 2015, 11:11:34 am
Nope, it's not there. Guess I can try again.

I plugged in the Chinese-made Arduino Nano for the first time into a Windows 7 64-bit system, and got the exact same result as when I plugged it into a Windows 8.1 64-bit system...the USB-SERIAL CH340 driver (version 3.3.2011.11 / driver date 11/4/2011 / driver provider wch.cn) automatically installed.

I was then able to manually update the driver to version 3.4.2014.8 (driver date 8/8/2014 / driver provider wch.cn) by downloading the driver ZIP file (CH341SER.ZIP) from here:

www.wch.cn/download/CH341SER_ZIP.html (http://www.wch.cn/download/CH341SER_ZIP.html)

If the initial driver is not automatically installing for you, it should still leave a USB serial port with an incomplete installation yellow bang (exclamation mark) in Device Manager.  It might be listed as something such as 'USB2.0-Serial' under 'Other devices' in Device Manger.  If you have that, then you should be able to download the version 3.4 driver mentioned above, unzip the contents, and then manually update everything through the Device Manager entry.

Let us know what you see in your Device Manager after you plug your Nano into your computer.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on March 23, 2015, 09:31:14 pm
Plugged in the Nano to my laptop, running Windows 8.1. No change in the Device Manager. The Nano had the 2 LEDs lit, one blinking and one static. Apparently the Nano was getting power but nothing transmitted the other way.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on March 23, 2015, 10:18:31 pm
Okay, not sure what's different, but I plugged the Nano into my desktop, also running 8.1, and the auto download worked. The driver is right where it should be. Wonder why the auto download didn't work on the laptop? I'll get to the updated driver in a day or two. Then I can start basic kindergarten for Arduino.

Edit: Ah-ha! I figured out the laptop question. The key is to plug in the USB cord/cable first, then plug in the Nano. Worked like a charm. Everything in their proper order. ;)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: sfmodeller on September 06, 2015, 12:42:40 pm
Boyd just put me onto this section of the forum last night (Labor Day Weekend 2015) hangout, so please excuse my lateness to the party.

I just bought a few of these on eBay (look like your pic on page 1), but am wondering if I'm the only Mac user here. Connected the board via USB - got steady on and blinking lights. Tried to use Arduino program, but it won't recognize the USB connection in the Port menu.

Installed the FTBI USB driver, restarted the program and the computer, still nothing USB in the Port menu.

Installed the CH341 driver, restarted the program and the computer, still nothing USB in the Port menu.

Using OS X.9.5.

If this doesn't work, guess my only lit kits will be with lighting kits, as I can't seem to get electronics/wiring down.

Or I could just sell off my stash...
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on September 06, 2015, 01:09:59 pm
Boyd just put me onto this section of the forum last night (Labor Day Weekend 2015) hangout, so please excuse my lateness to the party.

I just bought a few of these on eBay (look like your pic on page 1), but am wondering if I'm the only Mac user here. Connected the board via USB - got steady on and blinking lights. Tried to use Arduino program, but it won't recognize the USB connection in the Port menu.

Installed the FTBI USB driver, restarted the program and the computer, still nothing USB in the Port menu.

Installed the CH341 driver, restarted the program and the computer, still nothing USB in the Port menu.

Using OS X.9.5.

If this doesn't work, guess my only lit kits will be with lighting kits, as I can't seem to get electronics/wiring down.

Or I could just sell off my stash...

I'm also a Mac user (Mavericks 10.9.5, Arduino 1.6.5) but I had no problems connecting the board to my computer. Did you select the right board from the drop down? And what do you see when you look at the ports when it's connected?

I'd go to the Arduino support forum and post a question there.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Tankton on September 06, 2015, 01:59:07 pm
They should come up as a COM port not USB.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: sfmodeller on September 07, 2015, 09:22:41 am
Thanks, RossW.

Think I have it now. Had tried your suggestions, Arduino forum mostly talks about Yosemite. (Actually installed a 3rd driver set this morning as well, from a post on the Arduino forum.)

Had the board briefly working last night. Don't know how, and my computer shut iteslf down about 3 or 4 times (Your Mac is restarting because of a problem... screen came up each time.) Thought it was overheating, so I gave up and turned it off.

Long story short, got it to recognize by unplugging most of the USB stuff and checking for it in Systen Profiler.

Now it shows in Ports as dev.cu/wchusbserialfd140 - but it's very tempermental. Had to refresh via Profiler as it seems to drop from the Port menu when I switch from Arduino to another program (like Safari, to type this message) and back.

Do you remember what all you had to install to get yours working smoothly? Did you have to do anything with Terminal. (One post on the A. Forum had a command line to enter after the driver install, again for Yosemite.)

Need to be able to get this to recognize on a USB hub - can't very well connect it to a breadboard when it's sticking a couple inches out the back of my iMac.

Going to try uploading a different sketch to it, and using another of the 5 units I bought - maybe the 1st one is a little wonky.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: sfmodeller on September 07, 2015, 09:28:22 am
They should come up as a COM port not USB.

Thanks, Tankton.

On my iMac, everything under Port has the prefix "dev/cu." followed by the connection type somewhere in the name - mine shows 2 Bluetooth links, an iPhone and an iPod, but no COM.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on September 07, 2015, 11:31:45 am
Thanks, RossW.

Think I have it now. Had tried your suggestions, Arduino forum mostly talks about Yosemite. (Actually installed a 3rd driver set this morning as well, from a post on the Arduino forum.)

Had the board briefly working last night. Don't know how, and my computer shut iteslf down about 3 or 4 times (Your Mac is restarting because of a problem... screen came up each time.) Thought it was overheating, so I gave up and turned it off.

Long story short, got it to recognize by unplugging most of the USB stuff and checking for it in Systen Profiler.

Now it shows in Ports as dev.cu/wchusbserialfd140 - but it's very tempermental. Had to refresh via Profiler as it seems to drop from the Port menu when I switch from Arduino to another program (like Safari, to type this message) and back.

Do you remember what all you had to install to get yours working smoothly? Did you have to do anything with Terminal. (One post on the A. Forum had a command line to enter after the driver install, again for Yosemite.)

Need to be able to get this to recognize on a USB hub - can't very well connect it to a breadboard when it's sticking a couple inches out the back of my iMac.

Going to try uploading a different sketch to it, and using another of the 5 units I bought - maybe the 1st one is a little wonky.
I didn't have to install separate drivers; I think Mavericks has them already. Sorry I can't be more help 😕
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: model_noob on February 24, 2016, 07:36:04 pm
I noticed there was mention of transistor use on arduinos to control LEDS or anything with a load.  I made a pic showing how to use npn transistors for another post i have.
here is the link to it from this forum.

http://scifimodelaction.com/sfmaforum/index.php?action=dlattach;topic=3638.0;attach=31900;image
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: model_noob on February 24, 2016, 08:08:10 pm
sorry...   ;D  I couldn't leave well enough alone.

my code for strobe and nav lights:

int navstate=0;         // Track nav on or off for timing of flash
int strobestate=0;      // Track strobe on or off for timing of flash
long navMillis=0;       // Timer for nav LED
long strobeMillis=0;    // Timer forstrobe LED
long currentMillis=0;    // Current time
int strobeled1Pin = 2;    // Strobe LEDs
int strobeled2Pin = 3;    // Strobe LEDs
int navled1Pin = 4;       // Navigation LEDs
int navled2Pin = 5;       // Navigation LEDs

void setup()
{
  digitalWrite(navled1Pin, LOW);
  digitalWrite(navled2Pin, LOW);
  digitalWrite(strobeled1Pin, LOW);
  digitalWrite(strobeled2Pin, LOW);
}

void loop()
{
  currentMillis = millis();

  // nav LED timing
  // if navs are off and it has been .5 sec turn on nav lights.
  if ((navstate==0)&&(currentMillis-navMillis >= 500)) 
  {
    navMillis = currentMillis;
    digitalWrite(navled1Pin, HIGH);
    digitalWrite(navled2Pin, HIGH);
    navstate=1;
  }
  // if navs are on and it has been 1.5 sec turn off nav lights.
  if ((navstate==1)&&(currentMillis-navMillis >=1500))
  {
    digitalWrite(navled1Pin, LOW);
    digitalWrite(navled2Pin, LOW);
    navstate=0;
  }
 
  // strobe LED timing
  // if strobes are off and it has been .5 sec turn on strobe lights.
  if ((strobestate==0)&&(currentMillis-strobeMillis >= 500))
  {
    strobeMillis = currentMillis;
    digitalWrite(strobeled1Pin, HIGH);
    digitalWrite(strobeled2Pin, HIGH);
    strobestate=1;
  }
  // if strobes are on and it has been .5 sec turn off strobe lights.
  if ((strobestate==1)&&(currentMillis-strobeMillis >=500))
  {
    digitalWrite(strobeled1Pin, LOW);
    digitalWrite(strobeled2Pin, LOW);
    strobestate=0;
  }
}
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on April 14, 2016, 07:23:07 pm
First, I want to thank everyone for taking the plunge on these boards and trying to teach a a old dog-that would be me-a new trick. So please forgive a stupid question. I just got around to getting some jumper wires to set up my little bread board to try out some of these programs. I get everything positioned, but my connections don't seem to be good, as the LEDs only blink sporadically. Is it necessary to solder the breakaway header strip to the board even for testing purposes? If I just place the headers on the breadboard and plug the Arduino onto them, it doesn't seem to make good contact. The Arduino seems to sit a bit too loosely on the top pins of the headers. Thanks.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on April 14, 2016, 08:27:04 pm
First, I want to thank everyone for taking the plunge on these boards and trying to teach a a old dog-that would be me-a new trick. So please forgive a stupid question. I just got around to getting some jumper wires to set up my little bread board to try out some of these programs. I get everything positioned, but my connections don't seem to be good, as the LEDs only blink sporadically. Is it necessary to solder the breakaway header strip to the board even for testing purposes? If I just place the headers on the breadboard and plug the Arduino onto them, it doesn't seem to make good contact. The Arduino seems to sit a bit too loosely on the top pins of the headers. Thanks.
No, you shouldn't have to solder. I use breakaway jumper wires with no problem. Could be your breadboard as I've had problems in the past, but maybe a photo would help?

Also, have you tried just the simple Blink sketch from the Arduino examples? That blinks the onboard LED but it will tell you if your setup is right. I would then make a copy of that sketch and change the output pin to 10, say, and then hook that up to your LED on your breadboard.

What Arduino board are you using?
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on April 14, 2016, 09:13:03 pm
Thanks Ross. I'm using a Nano clone that I got from the same source that Gadgetron got his from initially on eBay. I copied the first sketch that he put up for the TOS Enterprise with 2 blinking navs and 2 strobes. It does work okay when I insert the jumper pins directly into the ports on the Nano and hold them in place with my fingers with the other ends plugged into the breadboard. Here's a photo of the Nano plugged onto the breadboard.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on April 14, 2016, 09:43:31 pm
Thanks Ross. I'm using a Nano clone that I got from the same source that Gadgetron got his from initially on eBay. I copied the first sketch that he put up for the TOS Enterprise with 2 blinking navs and 2 strobes. It does work okay when I insert the jumper pins directly into the ports on the Nano and hold them in place with my fingers with the other ends plugged into the breadboard. Here's a photo of the Nano plugged onto the breadboard.

Are you inserting the jumpers into the breadboard holes next to the relevant output pin? Maybe a photo of that would help. I've never had problems with wobbly connections using jumper wires; as long as they're inserted all the way into the breadboard holes it should work every time.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: MarkW on April 15, 2016, 06:02:28 am
pakratt--YES, it is necessary to solder the breakaway strips to the Arduino board.  That is exactly why you have the poor connection.

You will find once soldered, the Nano will be much better, but also really hard to remove from the bread board without bending the now soldered pins.  You might want to get a ZIF socket, or just leave that Nano in the breadboard as it will eventually break if you put it in and take it out of the breadboard repeatedly.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: simi on April 15, 2016, 06:08:33 am
Hey Dan,

I almost always buy my nano clones off of ebay WITH the header pins already soldered on.  Usually costs an extra $.50-$1.00 more per chip (but my time is worth more than a buck!).  In the future - might consider that route.

Cheers!

Simi
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on April 15, 2016, 06:51:29 am
I misunderstood the original question (I thought they were wondering if they should solder the jumper wires). Both Mark & Simi got it right.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on April 15, 2016, 07:07:10 pm
Thanks Ross, Simi, & Mark. That helps a lot.

@Simi, that's an option to consider, for sure. Have you installed one with the breakaway headers still attached inside a kit yet? That's my ultimate goal when I just want a simple nav/strobe function. I'll leave the complex stuff for Ralph at TenaControls ;)

@MarkW, that seems logical. I may just solder those and leave it in the breadboard for testing different sketches and modifications before installing one in a kit.

@RossW, for some reason the jumper wires are loose fitting even though they are pushed in as far as the shank above the pin will allow. In hindsight, I bought the jumper wires because it stated they were for Arduino, but maybe I should have looked for ones specified for breadboards. Maybe they're too thin to seat properly in the breadboard.

Again, thanks guys for the help and suggestions. Much appreciated!
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on April 15, 2016, 08:07:31 pm
@RossW, for some reason the jumper wires are loose fitting even though they are pushed in as far as the shank above the pin will allow. In hindsight, I bought the jumper wires because it stated they were for Arduino, but maybe I should have looked for ones specified for breadboards. Maybe they're too thin to seat properly in the breadboard.
I use the same jumper wires and they should be fine. Even though they move around a bit in the breadboard they'll make a good connection. I really feel the problem was with the unsoldered header pins on the board.

BTW, I usually do my prototyping with an Arduino Uno which has all the header sockets already there, plus you can plug in the USB cable directly for programming. Then, I'll use a cheaper and smaller board for inside the model. They're fairly cheap these days and the Uno is great to do all your testing with.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pakratt840 on April 15, 2016, 10:24:22 pm
@RossW, for some reason the jumper wires are loose fitting even though they are pushed in as far as the shank above the pin will allow. In hindsight, I bought the jumper wires because it stated they were for Arduino, but maybe I should have looked for ones specified for breadboards. Maybe they're too thin to seat properly in the breadboard.
I use the same jumper wires and they should be fine. Even though they move around a bit in the breadboard they'll make a good connection. I really feel the problem was with the unsoldered header pins on the board.

BTW, I usually do my prototyping with an Arduino Uno which has all the header sockets already there, plus you can plug in the USB cable directly for programming. Then, I'll use a cheaper and smaller board for inside the model. They're fairly cheap these days and the Uno is great to do all your testing with.

Thanks RossW, good advice. I'll look to pick up an Uno board here soon.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Arbiter on April 23, 2016, 09:22:42 am
Gadgetron,
you inspired me and I've received my nano boards today :) looking forward to playing with the codes and following your examples.
Thank you for your posts and your inspiration.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: Arbiter on April 26, 2016, 01:13:28 pm
Hi,
I'm having a problem with the first code on page 1.
I'm using 123D.circuits.io to test out the connections as I'm waiting on jumper cables. When I click on upload & run it comes back with the following error
 In function 'void loop()':
44:13: error: 'runLED1' was not declared in this scope
I'm a total newbie at this so I'm not sure what is wrong.
Thanks in advance :)

NB. Nevermind, I worked it out, I needed to add the digitalWrite and delay variables.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: NCC1966 on July 03, 2016, 04:04:25 pm
I think that it may be an important update: a bit more than one year later now you can buy an Uno R3 card for the same price as OP bought his nano - around $3 on eBay!
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: pocobor1470 on August 17, 2016, 09:01:46 am
I am very new to this and starting with the NX-01, do you have programing for lighting this model.  I am excited, and nervous at the same time.  You make this all sound so simple, but at the same time complicated.  Any help would be fantastic.  Oh, almost forgot....a list of what I need would be great too.   Thanks.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: NCC1966 on September 01, 2016, 10:34:23 am
I am very new to this and starting with the NX-01, do you have programing for lighting this model.  I am excited, and nervous at the same time.  You make this all sound so simple, but at the same time complicated.  Any help would be fantastic.  Oh, almost forgot....a list of what I need would be great too.   Thanks.

1) Start here:
https://www.arduino.cc/en/Guide/HomePage

2) Then register in their forum:
https://forum.arduino.cc/

3) Go to eBay and order an Arduino UNO R3 board (or check if you have it near to you). At eBay they can be really cheap:
http://www.ebay.com/itm/UNO-R3-ATmega328P-CH340-Mini-USB-Board-for-Compatible-Arduino-IB-/191927863166?var=&hash=item2cafcac77e:m:mkCgZWhcYLsULgWR0NZ9FsQ

Don't buy those "Super Arduino Kits" with a lot of parts even if it look tempting. If you are going to light spaceships you won't need mostly of the stuff that is included in the kits. Basically you will need only LEDs, resistors and a power supply to start.

4) Coding is a MUST. If you don't master C++ style code (Javascript, HTML5, etc) you MUST learn. Unfortunately it is not like just copy and paste someone else's code and watch your ship bring to life. You will need a minimum of coding knowledge to make things work. If you are still reading (LOL) learn it here (or anywhere else they teach this fantastic language):
http://www.learncpp.com/

If you already know C++ here it is the reference for the Arduino library:
https://www.arduino.cc/en/Reference/HomePage

I am starting with and like you I was nervous so I decided to start simple. I already have a good coding background -- I do coding for living -- but I am an almost zero in electronics. That's why I love Arduino concept: you can do electronics knowing almost nothing of electronics.

I suggest that you only step into it if you have some experience with coding and/or electronics. If you consider yourself a zero in both things get prepared to face a medium to long learning curve. Otherwise it's best to try the off-the-shelf electronic lighting kits that you can find around.

Read documentations, search online -- there is tons of tutorials and projects -- and ask questions! Be warned that Arduino is a digital circuit so it's fragile meaning that you cannot just hook dozens of LEDs on it without burn it. Read, learn and make your experimentation with care!

Good luck and have fun!

 ;D
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: MarkW on September 05, 2016, 08:46:33 am
I'd add a breadboard to prototype your work, and a soldering iron at some point too.  eventually you'll need to make a working prototype of your design (hence the breadboard), and you'll need to assemble the parts (soldering iron).  Without goign Arduino specific, you can pick up a lot of basic techniques from Youtube on soldering and such.
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on September 06, 2016, 03:45:39 pm
For prototyping on a breadboard, I highly recommend getting some jumper wires like these:

https://www.sparkfun.com/products/124 (https://www.sparkfun.com/products/124)

https://www.sparkfun.com/products/11026 (https://www.sparkfun.com/products/11026)
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: big_daddy24 on September 24, 2016, 07:24:06 pm
Sorry guys, I'm brand new to the arduino world, got my first board today. I've had a blast playing with it. I have a question, can you run more than 1 led per a pin on this code/board?
Title: Re: [How To - Arduino Nano] Starfleet Starship Running & Strobe Lights
Post by: RossW on September 24, 2016, 07:51:31 pm
Sorry guys, I'm brand new to the arduino world, got my first board today. I've had a blast playing with it. I have a question, can you run more than 1 led per a pin on this code/board?

The pins can sink a maximum of 20mA per pin which is typically 1 LED. You could try two in parallel or two in series and see if they light, but typically you would use a transistor or MOSFET in order to drive multiple LEDs.