Jump to content

Recommended Posts

Hi.

Having seen a few people on this site put LED's into there models I thought it would be nice to have a flickering candle lamp for the period ship.

Its cost is low and the effect is real.

The brightness and the duration of the flickering are randon on each candle.

I found this on the Arduino page and its is freeware IE no lisence to use.

I used surface mount LED's as they are very small and easy to put into almost any scale of model.

Step by Step instructions below.

 

Equipment needed :-

 1  Arduino nano chip. Source  Ebay  261232492487

Very thin wire (Copper will hold its shape after bending). Insulated or un insulated will do.

6  SMT 1206 White LED’s . Source  Ebay   121077374673 or you could use 3mm LED’s (much bigger).

6  Resisters 820 Ohms.  Grey, Red, Brown.

1  Battery holder for 4 AAA batteries.

4  Batteries AAA  Rechargeable.

1  Simple On/Off switch.

 

1 orange shopping bag. For the colour.

Computer with USB.

Total cost £18

 

Step 1 Download the Arduino  software from :- http://www.arduino.cc/  Second Tab click the Download.

A little way down the page click on Windows Installer and it will install the Environment.

Now click the Getting started to the Right of the Windows Installer.

Agree with the download (varies with Windows version) and click to install.

It will ask if you want to install the drivers Yes install.

Next click the Chip you are using ”Arduino Nano”. There are two types check the type you have.

 

Run the Arduino software and use the information on selecting the Arduino Nano.

A small box area will appear. Copy and paste the Code below into the white area.

Next plug in the Arduino Nano into the USB and the computer will find the Arduino Nano.

Now under File in the Arduino Environment select File in the Top left corner move down to Upload and click.

The Arduino should flicker when uploading. And the Arduino Environment will display any messages relating to the uploading. You may need to change the COM port to get a successful upload.

That’s the programming Done.

Step 2.

The Arduino Nano Chip Has no Headers soldered in place.  This makes it easy for us to connect the LED and Power.

Refer to picture.

Connect the + on the battery box to the Switch

Connect the + from the switch to Pin No 27

Connect the Ground from the battery Box to Pin No 29

Now solder a resister into Pin’s numbers. 6.8.9.12.13. and 14.

Next you solder the SMT LED’s to the Wire.

You can test each one as you complete the soldering by connecting the Anode to the 5 volt power supply. And the cathode to the Unconnected en of a resister.

With the battery on the connected LED should flicker.

Repeat the same for all 6 LED’s.

Next we tear off strips of the Orange bag and wrap it around the LED. Do not buy Orange LED as the effect is not the same.

Mount the LED inside lanterns around the ship. Careful planning will hide all the wires.

The Anode of each resister can be connected to the same wire. Common Power.

The LED’s and wire can be built into the model as it’s rare for a Led to fail.

The Arduino Nano and the Battery box can be hidden in the base.

 

Code Below this line. ******************************************************

 

/*http://forum.arduino.cc/index.php/topic,7115.0.html

 * randomly flickering LEDs

 */

 

int ledPin[] = {

  3,5, 6, 9, 10, 11};              // pwm pins only

int ledState[6];                 // last state of each led

long randNumber;

 

void setup() {

 

    pinMode(ledPin[0], OUTPUT);   // Just tells the Arduino that this is a output

    pinMode(ledPin[1], OUTPUT);

    pinMode(ledPin[2], OUTPUT);

    pinMode(ledPin[3], OUTPUT);

    pinMode(ledPin[4], OUTPUT);

    pinMode(ledPin[5], OUTPUT);

 

  randomSeed(analogRead(0));     // seed the random generator with noise from unused pin

    ledState[0] = random(20, 201);

    ledState[1] = random(20, 201);

    ledState[2] = random(20, 201);

    ledState[3] = random(20, 201);

    ledState[4] = random(20, 201);

    ledState[5] = random(20, 201);

}

 

void loop(){

    analogWrite(ledPin, ledState);     // set the pwm value of that pin determined previously

    randNumber = random(-70, 71);            // generate new random number and add that to the current value-40,41

    ledState += randNumber;               // that range can be tweaked to change the intensity of the flickering

    if (ledState > 200) {                 // clamp the limits of the pwm values so it remains within

      ledState = 200;                     // a pleasing range as well as the pwm range

    }

    if (ledState < 10) {

      ledState = 10;

    }

  }

  delay(100);    // the delay between changes

}

 

post-2328-0-51576100-1373314576_thumb.png

 

 

Any questions ..PLease ASK.

 

Regards Antony.

Link to comment
Share on other sites

Hi.

 

You can find ready made things like this for model RRs. Not topo expencive either. Doesn't give the satisfaction of building it yourself though.

 

Von Stetina

Yes there are a few things that flash led's on the market.

The only difference is that thease LED's flicker as a real candle do.

I can build in a simple switch to adjust the timing and the brightness that's activated by draft.

 

Regards Antony.

Link to comment
Share on other sites

Bruce, I'm with you on the model railroad angle.... Although I'd go a step further and put in a DCC function only decoder. These are specially for lighting effects in rolling stock. The bottom line, you could have multiple LEDs flickering at different rates (steam loco "fire-box" flicker option). With careful wiring you can have also multiple ships operating off the same base station.

 

I'd only choose to go this way because I'm no ESP (electrical smarty pants).... :P

 

Andy

Link to comment
Share on other sites

  • 1 month later...

Hi Brian.

 

I like to develop things and I am a hobby programmer for the Arduino chip.

That's as far as I want to go.

That's why I shared this .. It's easy to construct very simple soldering.

It gives six flickering led all with random timeings that use the Pulse Width Modulation to adjust the brightness.

You can run two LED's from one PWM output which gives you twelve lights but two will be flickering at the same time.

This can be adapted into the mega chip that gives 15 PWM outputs. Overkill on a model ship.

 

Regards Antony.

Link to comment
Share on other sites

Hi All, I came across this ebay item in the UK, 

http://www.ebay.co.uk/itm/121139376306?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

 

Flickering Amber LED Lights for 6v 9v 12v DC

(Hope the link worked, 
 
I did buy two of them and they seam very effective..
hope this may help
 
Rich
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Antony, 

     I just received my Arduino Nano and dropped your code into the software.  When I try to upload the code I get the following error message: 'i' was not declared in this scope.  The software highlights the first line under the void loop(){.  Suggestions?  I am running Arduino 1.0.5.  

     I have exactly no experience with microcontrollers but your post sparked a lot of interest.  These are wonderful little devices and I can't wait to get started.

Thanks, 

Trevor

Link to comment
Share on other sites

Hi Trevor.

  I made a error when copying.. My Bad.

 

 

int ledPin[] = {
  3,5, 6, 9, 10, 11};              // pwm pins only
int ledState[6];                 // last state of each led
long randNumber;

void setup() {
 
    pinMode(ledPin[0], OUTPUT);   // Just tells the Arduino that this is a output
    pinMode(ledPin[1], OUTPUT);
    pinMode(ledPin[2], OUTPUT);
    pinMode(ledPin[3], OUTPUT);
    pinMode(ledPin[4], OUTPUT);
    pinMode(ledPin[5], OUTPUT);
 
  randomSeed(analogRead(0));     // seed the random generator with noise from unused pin
    ledState[0] = random(20, 201);
    ledState[1] = random(20, 201);
    ledState[2] = random(20, 201);
    ledState[3] = random(20, 201);
    ledState[4] = random(20, 201);
    ledState[5] = random(20, 201);
}

void loop(){
  for (int i=0; i<=5; i++){                  // for each led:// counts from 0 to 5  =6
    analogWrite(ledPin, ledState);     // set the pwm value of that pin determined previously
    randNumber = random(-70, 71);            // generate new random number and add that to the current value-40,41
    ledState += randNumber;               // that range can be tweaked to change the intensity of the flickering
    if (ledState > 200) {                 // clamp the limits of the pwm values so it remains within
      ledState = 200;                     // a pleasing range as well as the pwm range
    }
    if (ledState < 10) {
      ledState = 10;
    }
  }
  delay(100);    // the delay between changes
}

 

 

There Just tested it and its fine.

Regards Antony.

Link to comment
Share on other sites

Hi Rowan?

This project is very easy and you only need basic soldering expearance.

If you solder the wires direct into the Arduino Nano board it is real easy.

The resisters are very easy along with the LED's.

If you are using surface mount then you need a steady hand as the 1205 size LED's are very small.

 

Regards Antony.

Link to comment
Share on other sites

I am not very familiar with the arduino yet but would be glad to share my experiences. I'm presently searching for a lantern design that would be appropriate for the battle station. I'm still trying to figure out where to hide the wires. Perhaps I will find a solution and share it in a separate thread as a build log.

 

By the way, your new code worked flawlessly.

Trevor

Link to comment
Share on other sites

Hi Trevor.

There are many ways to hide the wireing.

As the wire needs very little voltage and current you can use very small single core wire.

 

I have just built the Orlop deck on my Victory and here I lammanated the wires into the beams. This will have a very small loop at the end of the wire.

And the LED's have a small hook. And they just hang in place.

 

Another way would be to use foil tape along the beams before planking the decks ( Another member's clever idea )

 

Another method is to score the timber with a sharp knife then press the wire into the timber with the back of a spoon.

Does not work well with cross grain :(

 

If you are good with knots ... Get two pieces of wire and loop them to make chain. (for the drop to the lantern.)

 

Please add any ideas.

 

Hope this helps.

 

Regards Antony.

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...