Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Random switching for structure lighting

8511 views
45 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    June 2016
  • 81 posts
Random switching for structure lighting
Posted by Ron Hume on Thursday, October 13, 2016 9:53 AM

I'd like to switch about a dozen individual structure lights on and off randomley at about a minute duration to simulate people movement. Any ideas as to how to go about it?

Ron Hume.

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Thursday, October 13, 2016 10:12 AM

Piece of cake Ron, Arduino Uno.  You can direct drive 12 LEDs from the UNO with a random sequence.  You can pick up a UNO for under $6, they run off 5 volts DC.
 
The Uno has a max current of 20 ma per output, if you’re not using LEDs you can make a 500 ma driver for about $6.
 
Edit:
This is a picture of my 12 port 500 ma driver
 
 
The 13 pin micro connector next to the ULN2003 chips is the high current output connector to my buildings.  The 13 pin connector next to the LEDs is the LED output connector.  The LEDs on the board are for testing the Uno, they plug in to sockets and are removable.
 
 
 
I haven’t tried to post an Arduino sketch before but I’ll figure out how to do it if you need one.
 
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.

 

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Thursday, October 13, 2016 4:34 PM

 Or make the driver anyway, and run a bunch of LEDs off each port. a bedroom in this house, an office window in that building over there, etc. all on one channel, then say another room in the house, a store, etc on the second channel. Just not multiple ones next to each other so it's obvious they are going on and off together.

                       --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Thursday, October 13, 2016 8:21 PM

Ron:

I'll second Mel's recommendation to use Arduinos. I'm just in the process of learning how to program them, but code for your purposes can be found on the internet already written for you. Model Railroad Hobbiest has had a series of articles on the Arduinos, at least one of which addresses random lighting.

http://model-railroad-hobbyist.com/

The on-line magazine is free and you can reference back issues.

 

One suggestion I read about house lighting is to set lights up in adjoining rooms so that one goes off and the other comes on after a very slight pause. That mimics the effect of a person turning the lights off as they leave a room and turning the lights on as they enter the next room.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    June 2016
  • 81 posts
Posted by Ron Hume on Thursday, October 13, 2016 11:32 PM

Thanks Mel,

Sadly I don't understand foreign languages or programming. I have a 12 volt 500 ma power source and I'm just looking for an off the shelf gizmo to do the job. A timer switch with half a dozen outputs? Something like that.

Ron Hume.

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, October 14, 2016 12:18 AM

Randy convinced me to go Arduino, I’m sure he can convince you too.  Unless you can find a cheap used mechanical cam/micro switch assembly anything else will be in triple digits.
 
Going fancy with an Arduino Uno is by far the cheapest way to go.  This forum is loaded with Arduino help.
 
You can use an Arduino Uno to drive 12 LEDs without even having to solder anything, everything plugs in.  The software is a freebee and the Uno will plug into a USB port on your computer for easy programming.  The Uno will run on a 5 volt wallwart, we are talking less than $15 to your door for all the components for 12 random 20 ma outputs.
 
Guys, jump in and convince Ron that he can do it.
 
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Friday, October 14, 2016 12:47 AM

Ron:

I think you would find that setting up an Arduino would be simpler than what you are picturing in your mind. If you can use a computer keyboard, which you obviously can, all you would need to do is plug a USB cable into your computer and copy some text. You don't have to understand computer programming with its "foreign language".

Wiring the system would be no different from what you would have to do to use a timer switch.

You will need to get a different power supply. The Arduinos operate on either 3.3 volts or 5 volts IIRC.

 

There are devices that will do what you want without any need for programming. Ngineering is one source that offers structure lighting animation systems. Unfortunately they will only drive three LEDs each so the cost will add up if you need to use a bunch of them. Go to the Lighting Effects Products page. If the website view is messed up try using Firefox:

http://ngineering.com/lighting%20effects%20for%20structures.htm

Your power supply will work with the Ngineering components.

Dave

 

 

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, October 14, 2016 10:22 AM

 There was an item in the new products section of last month's MRH that mentioned a 6 line device from NJ International but I don't see it on their web site. About the only sure thing is it will cost a lot more than an Arduino Uno board and a few hours poking through the standard LED blinking tutorials to see how you turn the lines on and off and set delays.

 Keep in mind the drive behind the Arduino was to enable ART STUDENTS to include high tech interactive stuff in their works - there are some that are designed to be sewn into clothing, for example. It's why what everyone else in the world calls a 'program', the Arduino world calls a 'sketch' Art students - not engineers.

                         --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, October 14, 2016 10:34 AM

RR_Mel

Piece of cake Ron, Arduino Uno.  You can direct drive 12 LEDs from the UNO with a random sequence.  You can pick up a UNO for under $6, they run off 5 volts DC.
 
The Uno has a max current of 20 ma per output, if you’re not using LEDs you can make a 500 ma driver for about $6.
 
Edit:
This is a picture of my 12 port 500 ma driver
 
 
The 13 pin micro connector next to the ULN2003 chips is the high current output connector to my buildings.  The 13 pin connector next to the LEDs is the LED output connector.  The LEDs on the board are for testing the Uno, they plug in to sockets and are removable.
 
 
 
I haven’t tried to post an Arduino sketch before but I’ll figure out how to do it if you need one.
 
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.

 

 

 Oh, LEDs, I was trying to figure out what that was on the right. If you really are using anywhere near the current limit of the ULN2003's, you probbaly wany yto feed the whole thing with a 5V power supply - the regulator on the Arduino (not to mention the USB port) can;t really supply that much current. If you put a barrel connector on your shield connected to the +5 and gnd lines, it will also power the Arduino. I'd also put something like a 10uF electrolytic across the pins of it for some decoupling. Use a 5V 500ma wall wart to run the whole thing - or if you already have a higher voltage power bus on your layout, build a simple 7805 regulator circuit on your board (a small heatsink might be needed on the regulator) and power that with your power bus, connecting the 5V and ground outputs to the proper pins.

 You should be able to copy and paste an Arduino skecth - however it will not have line feeds so it will appear as one big line until you go back and insert aa return at the end of each lines. Most of it you can get by doing a search and repalce and replace every ; with ;<cr><lf> since all code lines end with ;, and then fix up the function definitions and comments which won;t have ; in them. Otherwise the .ino files are plain text and can be opened in Notepad as well as the Arduino IDE. You can copy/paste right out of the Arduino IDE.

                                --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, October 14, 2016 11:01 AM

Ron
 
I bought an Arduino Kit to get started but that wasn’t necessary, I bought a second Arduino Uno from a USA seller on eBay for $6.89 free shipping.  His price has increased to $7.25 free shipping.
 
 
The Uno comes with a short USB cable ready for programming.
 
I bought a USB wallwart power supply like the ones to charge cell phones and tablets to power the Uno for operation.
 
 
I will either post the program or I can send it to you, it’s a simple copy and paste to the Arduino (free) software and point and click to upload to the Uno.  Piece of cake!
 
Total investment, $13.74 for a 12 port LED driver . . . . not bad, $1.15 per LED driver port.  
 
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Friday, October 14, 2016 11:34 AM

rrinker

 

 

 Oh, LEDs, I was trying to figure out what that was on the right. If you really are using anywhere near the current limit of the ULN2003's, you probbaly wany yto feed the whole thing with a 5V power supply - the regulator on the Arduino (not to mention the USB port) can;t really supply that much current. If you put a barrel connector on your shield connected to the +5 and gnd lines, it will also power the Arduino. I'd also put something like a 10uF electrolytic across the pins of it for some decoupling. Use a 5V 500ma wall wart to run the whole thing - or if you already have a higher voltage power bus on your layout, build a simple 7805 regulator circuit on your board (a small heatsink might be needed on the regulator) and power that with your power bus, connecting the 5V and ground outputs to the proper pins.

 

                                --Randy

 

 

Randy
 
I rarely ever drive my LEDs more than 10 ma, they probably average in the vicinity of 5 to 7 ma.  The LEDs on the expansion shield are running under 3 ma.  They only need to be visible for testing the Uno.
 
I built up three driver shields using ULN2003 chips to drive my incandescent structure lighting.  I use 12 volt 40 to 70 ma bulbs operating from a 9½ volt regulated power supply for realism and longer bulb life.  I feed the expansion shield with the 9½ volts and the drop through the 2003s is about .7 volts, the lighting looks great at just under 9 volts.
 
Ron won’t need the high current driver for single LED per port operation. The Arduino Uno spec is 20 ma per port.   
 
I made a USB power strip that plugs into the 2 amp USB wall wart, it’s powering all three Unos for my random lighting, the 36 ports run my entire layout.
 
By the way, Thanks Randy for pointing me to the Arduino and the ULN2003!  The 2003a sure beats using a dozen transistors.
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Sunday, October 16, 2016 1:03 PM

 And if you are afreaid of ripoffs on eBay, there are similar priced Arduino options on Amazon, even ones with Prime shipping. I have a stack of them now, an Uno, a Megas, about a dozen Nanos, and a half dozen ATTiny85's that I've installed the Arduino bootloader on so they can be programmed like any other Arduino, just less pins.

 For one or two LEDs per pin, no, no additional driver circuitry would be needed. I guess I just think bog - even on our temporary 4x8 we built each year, every structure had a light in it. If instead of one central light, that same small layout and same number of buildings, but with multiple LEDs to be lights in different rooms plus exterior lights, it would have been 40 or more LEDs. Lots of outputs especially in the Old West town if I wanted to have the lights flicker like candles and oil lamps. I don't even want to think how many I will have in my still planning basement size layout. Although I'm thinking in many cases, each structure would have its own small chip, like the Tiny85 (there are others witht he same 8 pins, same outputs, just less RAM and Flash, which should be fine for simple light on/off programs, but they aren't always cheaper). That way there's never be any synchronization between lights going on and off in different buildings close enough to make it obvious they are ont he same circuit. Plus each structure would just need a power supply connection, not multiple wires coming from the centralized controller to the individual LEDs. The thing is, it is super easy to crank these things out by the dozens - once you have one program that works, you edit a couple of numbers to change the cycle time, making some stay on longer and others run for shorter times, and just keep blasting the otherwise same program to each chip. A mini experimenter board (you used to get them at Radio Shack, they should be available at other places) with an 8 pin socket and pads around the outside to connect wires for the LEDs in another thing you cna mass produce with an hour at the workbench, and then install in every structure that will get lights.

                                 --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    June 2016
  • 81 posts
Posted by Ron Hume on Sunday, October 16, 2016 7:51 PM

Thanks to Mel, Dave and Randy for your responses. After a litle research, I decided to, "have a go mate" and bought an Arduino clone on ebay. (Unable to buy the genuine article in Australia.) I've downloaded the program and wait for the delivery, hoping the program language is compatible. I believe it should be "C++" but some clones are advertising "java" as the lingo.

I copied a sketch from the web to get me started, hoping I can tweek it to meet my needs. Had a quick look at a C++ tutorial, but it's too much of a steep learning curve at my age. Once again, thanks for the advice.

Ron Hume.

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Monday, October 17, 2016 6:53 AM

 The Arduino IDE includes all the sample coide to learn from. The very first one is pretty much all you'll need for 'random' lighting - it's called Blink because it makes an LED blink. You can access all the tutorials online at the Arduino site so you can get the explanations for each line of code. The default in blink is I think every second or every half second. It will be pretty obvious how you change that. Adding more output lines to control more LEDs is a later tutorial but it's really just a variation on the blink program.

 The language used in the Arduino IDE is mostly C++ but for what you are trying to do there is no reason to attempt to learn the entire language, you will only be using a minor subset of it to write the kind of Arduino programs you need to turn LEDs on and off.

 There are other ways to program Arduinos besides the Arduino IDE, but all of them are more complex than the standard IDE so those options are best left until you have some more experience. A true Arduino clone will have the Arduino bootloader already programmed and will plug in to your computer and the IDE will just work. Some of the ones I have came with the Blink sketch already loaded - as soon as I applied power, the LED started blinking. That almost requires you to adjust the delay times in the Blink sketch so you know you board successfully accepted the upload of code - if you just upload what's already there, nothing will change and the LED will blink away, but if you change the speed of the blinking, you will see it change when you upload.

 Unless you bought a starter kit that comes with a bunch of parts, you won;t be able to actually build the various demonstration circuits. Mostly you only need to work with the ones that control LEDs, because that it what you are trying to do, so if you don;t have them you might want to get some LEDs and resistors, a small breadboard, and some jumper wires so you cna play around with this while learning.

                             --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Monday, October 17, 2016 10:01 AM

Ron!

Congratulations on taking the plunge!

Don't hesitate to ask questions if you run into a roadblock.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Monday, October 17, 2016 11:07 AM

Ron
 
This is the Arduino Uno Sketch for my 12 port Random LED driver.
 
 
#define numleds  12                                                      
byte ledpins [ ] =  { 0,3,4,5,6,7,8,9,10,11,12,13 } ;
void setup( )  {                  
    for ( int  i=1; i <= numleds;  i++ )  {     
    pinMode ( ledpins [ i ], OUTPUT) ;
    digitalWrite ( ledpins [ i ] , HIGH) ;
   }
   pinMode (2,INPUT);      // Pin 2 will be the control pin for this lighting group
   digitalWrite (2,HIGH);    //This turns the Pull up ON
}
void loop ( )  {  
                digitalWrite ( ledpins [ random ( 0, numleds+1 ) ], lightsw ( ) ) ;
                delay ( 4000 ) ;                  
}
boolean lightsw ( )  {
 if (digitalRead(2)  == LOW) return LOW;  //If the group control pin is LOW ALL lights
                                                             // will eventually turn OFF
 if  ( random (0,100) > 60 ) return LOW ;
   else return HIGH ;
}
 
 
A simple copy and paste should work.  The output pins are:
 
0,3,4,5,6,7,8,9,10,11,12,13
 
The common is +5 volts
 
The timing is the numbers in red, changing the value changes the on/off timing . . . .  the timing doesn’t have any effect on the sequencing, it remains random.  I like long intervals.
 
Grounding pin two will eventually turn OFF the outputs.
 
 
  
 
 
I used 560Ω â…› watt resistors in series with each LED, the load at 5 volts is about .05 watts.
 
You can vary the series resistor from about 220Ω up for brightness.  I never run my LEDs higher than 12 ma, most are well under 5 ma.  Bright lights don't work for me on my layout, for me the realisum goes away rapidly with increased brightness.
 
Good Luck
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Monday, October 17, 2016 3:51 PM

 You can use 13 LEDs if you use one of the Analog pins as your control input Big Smile

Or use all 5 of them for control over 5 zones, each with 1 or more LEDs

Digital input on an Alalog port works. For the ultimate in crazy features - use some pots on the analog lines to adjust the delay and random factors, then you can adjust things without uploading a new program each time.

But that is quite straightforward and about the only 'advanced' feature is the use of the array for the pins.

                          --Randy

 

 

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    June 2016
  • 81 posts
Posted by Ron Hume on Tuesday, October 18, 2016 12:15 AM

Description: This is Arduino Uno R3. In addition to all the features of the previous board, the Uno now uses an ATmega16U2 instead of the 8U2 found on the Uno (or the FTDI found on previous generations). This allows for faster transfer rates and more memory. No drivers needed for Linux or Mac (inf file for Windows is needed and included in the Arduino IDE), and the ability to have the Uno show up as a keyboard, mouse, joystick, etc.

The Uno R3 also adds SDA and SCL pins next to the AREF. In addition, there are two new pins placed near the RESET pin. One is the IOREF that allow the shields to adapt to the voltage provided from the board. The other is a not connected and is reserved for future purposes. The Uno R3 works with all existing shields but can adapt to new shields which use these additional pins.

Note: The Arduino Uno R3 requires the Arduino 1.0 (or any other recent version)drivers folder in order to install properly on some computers. We have tested and confirmed that the R3 can be programmed in older versions of the IDE. However, the first time using the R3 on a new computer, you will need to have Arduino 1.0(or any other versions) installed on that machine.

Features:

  • ATmega328 microcontroller
  • Input voltage - 7-12V
  • 14 Digital I/O Pins (6 PWM outputs)
  • 6 Analog Inputs
  • 32k Flash Memory
  • 16Mhz Clock Speed

These are the specs for my Arduino Uno clone. It appears I can use my 12 volt 500 ma power source to fire it up. That being so, what size resistors do I need for a low light effect? Modelling in the Civil War era, candles, gas lights etc. And maybe a variable resistance on the main to control overall brightness.

Ron Hume from down under.

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Tuesday, October 18, 2016 12:50 AM

Ron!

Well sir, you certainly seem to have jumped in both feet first!

Seriously, for that level of lighting you will want to experiment with some fairly high value resistors.

I used 10,000 ohm resistors for the light over the conductor's desk in these cabooses (middle window). They look fine in daylight but they are a bit too bright at night:

 

I used 30,000 ohm resistors in this McKeen Motor Car and the LEDs are still too bright at night:

This picture was taken in a pitch black room but the LEDs are still a bit too bright when viewed in a night scene with normal lighting levels:

For your purposes I would suggest trying something around 48,000 ohms and maybe higher.

Mike Lehman is an expert in LED lighting. Hopefully he will chime in.

The nice thing about getting your resistance right is that resistors are cheap.

Good luck! Please show us your results.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Tuesday, October 18, 2016 6:44 AM

 The Arduino can use up to 12V because there is a 5V regulator on board. If you are going to low current gas light effects witht he LEDs, you should be fine with 10-12 LEDs connected to the Arduino. The voltage on the Arduino lines will be approximately 5V when on so Dave's resistor selection may be a little too high, since those are operating at 12V+. It's a good starting point though.

 Another example to look at is the one that dims the LED using one of the PWM outputs on the Arduino. Get the parameters right and instead of just a dim LED you get perceptable flickering - just the thing to simulator oil lamps and candles. Keep in mind that while a 10K resistor may be fine for the nicely glowing LED at a full 5V, it may be too mig for the LED to light under PWM especially when set for very low duty cycles for the dim/flickering appearance - what's happening is that when PWM is enabled, the voltage is varying between 0 and 5V at a rate you can control with the program, and the ratio betrween the on and off times determines the average voltage the LED sees. So some experimentation is in order before you wire things to your layout for good. If you get no resistors less than 1K, you won;t be able to blow any of the LEDs up/ They might be too bright for your application but even if connected to 12V instead of 5V, 1K limits the current to well within what the LED can handle. Go up from there to get the brightness level that works for you. And remember that LEDs are polarity sensitive, so if you hook one up and your program doesn't turn it on, check that the LED is connected the right way as well as checking for a mistake in the program.

                        --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    June 2016
  • 81 posts
Posted by Ron Hume on Tuesday, October 18, 2016 7:53 AM

Wow! lots of info to take in. The PWM (what is that?) effect sounds ideal for some of the lighting. I,m going to need help with THAT sketch when the time comes.

I have some 1k ohm 1/2 watt resistors left from my LED toggle swiches on the control panel, I could try a couple of those in series to see what happens, but at present I'm wrestling with turnout positions for motors to avoid the framework lurking beneath. As to the request to post any outcome with pictures, I can't seem to find the instructions to post pictures. Saw them when I first joined, but they are now lost in the ether somewhere...

Ron from down under.

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Tuesday, October 18, 2016 10:58 AM

 Simplistic explanation: PWM, at least in digital circuits like the Arduino, is usually based on a square wave. As opposed to the sine wave in your household AC power. Squar wave is exactly what it sounds like, looks like a series of squares (leaving off some highly technical stuff that causes the edges to never be nice perfect right angles like a square you would draw because, it doesn;t really matter here)

So, if you have a square wave that is on 50% of the time and off 50% of the time, you have a 50% duty cycle (how long it's on). In the case of an Arduino output, off is 0V and on is 5V. The peak voltage is 5V. But the AVERAGE voltage is determines by the peak and the duty cycle. This is the voltage 'seen' by most types of loads would in this case be 50% of the peak, or 2.5 volts. The duty cycle can vary from 0% (off) to 100% (full on - 5V). All the crazy timing stuff to generate this is taken care of by the Arduino. In place of the digitalWrite command (which just has 2 states, HIGH or LOW for on or off), there is the analogWrite command which takes a value from 0 to 255, where 0 is 0 % duty cycle and 255 is 100% duty cycle. There's yet another technical explanation for why the range is 0-255 and not 0-100 but suffice to say having more than 100 steps means each increment is less than 1%, so the control is fairly fine. Like the difference between one throttle that goes from stop to full speed in 90 degreees vs one that has a range of 320 degress.

 And the cool thing about Arduino being so popular - if you search you can probably find that someone has already written a setch that makes an LED behave like a gas light.

                        --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Tuesday, October 18, 2016 9:13 PM

Ron:

The 'How To Post a Photo to the Forums' thread is the very first thread in the General Discussion category.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    June 2016
  • 81 posts
Posted by Ron Hume on Wednesday, October 19, 2016 8:48 AM

 

 

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Wednesday, October 19, 2016 3:16 PM

 You just have a link to trains.com in front of the picture URL. If I take that out I can get to your pictures - so when you paste the link in your message make sure you erase the cs.trains.com/ part in the URL and it should work.

You have: http://cs.trains.com/i44.photobucket.com/albums/f34/ronhume79/Alice%20Rocks_zpsc2fjqhc1.jpg

SHould be:

http://i44.photobucket.com/albums/f34/ronhume79/Alice%20Rocks_zpsc2fjqhc1.jpg

 

                         --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    June 2016
  • 81 posts
Posted by Ron Hume on Thursday, October 20, 2016 9:50 AM

In the meantime Randy, a more pressing problem.

I connected the Uno to my computer and it began blinking right away. I copied a sketch ok without errors, but had a problem when the sketch wouldn't download to the board. Computer shows it's connected to COM3 but I don' think it knows that, because when I request board details, it asks to specify a COM port. Any clues?

Tried changing port from 3 to 2 as suggested in troubleshooting but no go.

Also, "This device is working properly".

Get "Can't work with USB 3.0"

Ron from down under.

Tags: All aboard!
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Thursday, October 20, 2016 12:34 PM

 How do you know it's connected to COM3? Are you seeing COM3 appear and disappear in Device Manage when you plug and unplug the Arduino? If so, then COM3 it is.  Next, with the Arduino plugged in, go into the Arduino IDE and under Tools you need to select the proper board and the port, If the board is the one you pictured, select Arduino/Genuino Uno for the board type. And under port it should list COM3 is that's the one being used. Just checking here on my laptop, which with nothing plugged in has a COM1 (it has a real serial porton it, not just USB) and that's all that shows up until I plug an Arduino into one of the USB ports. I don't have one with me but whatever port it gets shows up there along with the COM1 that is always there. Most of the cheap clones use a USB chip that doesn't register with the computer in any way, so if you plug it in to a different USB port it will likely be a different COM port - so always use the same USB port if possible so you don't have to keep changing the settings in the IDE.

 COM3 is fairly common. My workbench computer has a bunch of USB cables plugged in (my Uno and Mega use the big 'B' plug, the Nano uses a microUSB) so depending on which Arduino I plug in I have to swap the com port in the IDE, one gets COM4 and the other gets COM5  (I have a whole bunch of stuff connected to this computer - I think my oscilloscope gets COM3)

                    --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    June 2016
  • 81 posts
Posted by Ron Hume on Thursday, October 20, 2016 10:10 PM

Randy,

It appears the Arduino library was misplaced, fixed that and hey presto! My sketch works. Haven't found how to place the sketch into the library yet, but I guess I will eventually work it out. Time to purchase lots of LEDs!

Ron from down under.

 

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Thursday, October 20, 2016 10:20 PM

Ron:

EBay is a great source for LEDs of all kinds. If you want some pointers on what types are suited to structure lighting let us know.

By the way, congratulations on your rapid advancement in Arduino technology!

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Friday, October 21, 2016 6:57 AM

 DOn't worry too much about libraries. If you buy some add-on hardware that is not supported by one of the buitl in libraries, you will need to download and install the library for that hardware, but your own stuff you generally won't be building libraries at this point, just creating sketches that use existing libraries. Those get saved seperately from libraries. Unless there is something non-standard on your computer, best to let the IDE save things hwere it wants to, at least at first. Mine's a little more complicated, I save my stuff on my OneDrive so I can open them on any of my computers but for just one computer I'd let the IDE save sketches where it wants to when you click save. Once you get more comfortable you can experiment with saving files in different places. The IDE is very picky about everything having a folder though, and libraries in particular are expected to conform to a specific layout of folders where each of the files lives.

                               --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!