Geoff Bunza geoffb

Many modelers have used Arduino Pro Mini’s to get great animated lighting effects in their buildings (MRH November 2014, Starting from Scratch with an Arduino Pro Mini (or Moteino) http://mrhpub.com/2014-11-nov/land/#99 and SMA8 Starting Projects and Virtual Rooms for Modeling. Even more modelers are using some variation of the Pro Mini-based cheap DCC 17 function DCC decoder (SMA15, SMA13, SMA12, and SMA10 ( [topic:id=20739] , [topic:id=19775] , [topic:id=19446], and [topic:id=19446] ). But leave it to a fellow modeler, Joe Daddy ( http://www.joe-daddy.com) to come up with the idea to combine the two. Well… here it is, and it’s pretty easy.

[attach:fileid=/sites/model-railroad-hobbyist.com/files/users/geoffb/BuildingCollage800.JPG?420] [attach:fileid=/sites/model-railroad-hobbyist.com/files/users/geoffb/Decoder%26Pins.JPG?219]

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
Geoff Bunza geoffb

New Sketch for Random Building Lighting

As a reminder, the above references to the building lighting articles tell you how to build a controller to randomly turn lights on and off in any model structure so equipped.  With almost the same sketch for controlling building lighting, you can drop one of the light control pins (pin 2 in this case) and make it a control pin to turn on/off the entire sequence. Pin 2 would normally be HIGH or open (nothing connected to it) for normal operation. Pull the pin LOW, or connect it to circuit Ground, and whatever lights were on will eventually (and randomly) turn OFF until all lights go OFF. If it is LOW or Grounded on power-on, the lights will not come on.

Now if you configure your cheap DCC decoder for simple on/off control of LEDs, and connect one of the 17 “Function Pins” to Pin 2 of your Lighting controller (with the new sketch below) you can turn on and off your building(s) under DCC control! Obviously you can configure your decoder either as an accessory or function decoder to control your model “city.”

Many thanks again to Joe Daddy for the idea. I hope you will also start (if not continue) to realize how you can utilize some of these projects in tandem.

Have fun![smile]

Best Regards,

Geoff Bunza

The new controllable Building Lighting Sketch follows and can also be downloaded here:  http://mrhpub.com/files/users/geoffbfiles/SMA18_Building%20Lighting.zip

#define numleds  15                                                       
byte ledpins [ ] =  { 0,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 } ;
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 ( 900 ) ;                   
}
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)> 40 ) return LOW ;
   else return HIGH ;
}

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
Joe Baldwin

Thanks Geoff, I'll work to

Thanks Geoff, I'll work to implement these changes.   Reading your write up it looks as if we are using two Arduinos, one to run the lights and one to run the decoder program.  

As an aside, while I am waiting for my DFPlayer MP3 chips my current project is to 'safely' use DCC and my automation software (CTI-ELectronics.com) to control the layout behind the valence lighting.  Combining both control of the layout lighting and the individual building lighting should contribute to the realism we all seek.  

A friend of mine has an Arduino powered thunderstorm with lighting all randomized using high intensity photo flash technology for the lightning.  He also has timed the sound system to accurately and randomly vary the thunder from the lightning flash.

 

Thanks again for the changes, Geoff!

 

Joe 

 

Joe Baldwin

Northern Colorado 

http://www.joe-daddy.com

Reply 1
Geoff Bunza geoffb

@Joe

Hi Joe,

If you get up to the NMRA national in Portland next month you can "experience" my "Thunderstorm in a Box" at one of my clinics on animation too.

Have fun! 

Best regards,

Geoff

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
robteed

Lightning

Hi Joe,

I have wondered if Lightning Strikes could be simulated by cutting slots/lines shaped to effect into the backdrop then putting paper over the cuts which could be painted same color as the sky ( Overcast/light white ) with Flash bulbs mounted behind. In a darkened room would they be effective?

Reply 1
Prof_Klyzlr

Yes

Dear Rob,

If the experience of over-a-century of theatre lighting techs is any indication,
the answer would be "yes"...

NB We have the benefit of being able to use styrene sheet,
painted black on the backside, 
with "lightening bolt" patterns engraved in the black paint,
and "sky painting" on the front/viewer side...
(believe such techniques have been in MR articles previously,
seem to recall Rand Hood DRGW layout being involved?

Furthur, IIRC Kermit Paul of the Lone Pine an Tonopah may also have a similar lighting effect deployment?)

or If one wanted to optimise _both_ the back "lightening strobe" and foreground "layout lighting" rigs,
a straight-up theatre "scrim" could be interesting to play with...
("scrim" is specific material which presents as visually opaque when the light _in front_ is brighter than the light _behind_,
and is nearly perfectly transparent when the light _behind_ is brighter than the light _in front_)

https://en.wikipedia.org/wiki/Scrim_(material)

https://www.google.com.au/search?q=theatre+scrim&safe=off&espv=2&biw=1366&bih=643&tbm=isch&tbo=u&source=univ&sa=X&ei=XvidVcumHIOg8QXu34Iw&sqi=2&ved=0CCIQsAQ

Happy Modelling,
Aim to Improve,
Prof Klyzlr

PS for those wanting to investigate "scene design" from the P.O.V. of sightlines and lighting optimisation,
esp on small/shelf/micro layouts where a fraction of an inch has to seem like miles...
http://www.sewwhatinc.com/images/Backdrops/CutDropColLG.jpg 

http://www.sewwhatinc.com/st_back_cut_drop.php

 

Reply 1
Geoff Bunza geoffb

@Prof re:Lightning

Hi John,

Thanks Prof! This is one of the more thought provoking posts I've seen in a long time!

I bet there are more interesting applications for this in animation than lightning displays.

As I've gotten further along with my own animation work, I find I am drawn into theater techniques from time to time.

Have fun! 

Best regards,

Geoff

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
JayBeckham

Random Building Lights

Geoff

Can I use the Mini to control random lights without using a DCC decoder to turn it on.  In other words can I build it to just control lights?  For example when I turn on my DCC power or when I turn on my CTC/Signaling power have the random lights start?

Thanks

Jay Beckham

Reply 1
Geoff Bunza geoffb

@Jay re: Random Building Lights

Hi Jay,

Quote:

Can I use the Mini to control random lights without using a DCC decoder to turn it on

By all means-- yes, you certainly can. If you use the sketch I presented above, load it into your Pro Mini or other Arduino, and then turn it on, it will automatically start and continue as long as power is applied. If you use this sketch, you can turn off the lights by connecting D2 to Ground (GND) via a panel switch-  no decoder involved. Leave D2 unconnected otherwise.

If you want the extra pin for a 16th light/LED switched with just power on/off use this:


#define numleds  16                                                       
byte ledpins [ ] =  { 0,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 } ;
void setup( )  {                   
    for ( int  i=1; i < = numleds;  i++ )  {      
    pinMode ( ledpins [ i ], OUTPUT) ;
    digitalWrite ( ledpins [ i ] , HIGH) ;
   }
}
void loop ( )  {   
                digitalWrite ( ledpins [ random ( 0, numleds+1 ) ], lightsw ( ) ) ;
                delay ( 900 ) ;                   
}
boolean lightsw ( )  {
 if  ( random (0,100)> 40 ) return LOW ;
   else return HIGH ;
}

This was the original sketch used in Starting from Scratch with an Arduino Pro Mini in the November 2014 MRH:  http://mrhpub.com/2014-11-nov/land/#99  (Corrected aboove for publishing typos).

Have Fun! 

Best regards,

Geoff

 

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
Joe Baldwin

It WORKS as advertised!

It WORKS as advertised!  Geoff, I am using one DIY DCC controller for the mezanine lights, the flashing TV antenna and the four corner lights and to control the randomizer for the 11 stories of other lights.  

 

Thanks for your sharing spirit!

 

Joe Baldwin

 

Joe Baldwin

Northern Colorado 

http://www.joe-daddy.com

Reply 1
Joe Baldwin

Change control becomes

Change control becomes critical when one has the 3rd or 4th one of these projects done.  I have 8 or 9 Arduinos  running on the layout all with different code of some sort.  Keeping track of them when I do maintenance was a real headache for me until I started setting them up so they will always print out their configuration data on power up or reset with the IDE serial monitor attached.  Has saved me from many headaches.

I include the actual name of the sketch, the DCC address assigned (REALLY important),  date, comments and if possible a print out ot the pin assignments.  I have a standard block of code I put at the top of my sketch with another block in the void setup() section to print out the details.  Thought it might be helpful to others.

Code to set the variables to be printed on the serial monitor

char version[] = "JLB_55_Santa_Fe_Twr_Base_V2A - "; 
char Comment[] = "DCC DIY Decoder for Santa Fe Trade Tower structure";
char Type_Decoder[] ="Function";
char pubdate[] = "12-23-2015" ;
int Accy_Adr = 140;
int Funct_Adr = 55;
char pubauthor[] = "Joe Baldwin";

code placed in the void setup() section.

  mySerial.begin(9600);          
  mySerial.print(version); 
  mySerial.println(pubdate);        
  mySerial.print("Decoder address - ");
  mySerial.println (Funct_Adr) ;    
  mySerial.println (Type_Decoder) ;
  mySerial.println(pubauthor);    

 

 

Joe

 

Joe Baldwin

Northern Colorado 

http://www.joe-daddy.com

Reply 1
Will_Annand

Thank You Geoff

Thank you Geoff, another thread to bookmark and add to my "To Try" list.

 

Reply 1
Geoff Bunza geoffb

@Will re: Another Project

Hi Will,

You're welcome sir!  I have found that slow animated background building lighting is one of the best things you can add to a layout. It kind of "creeps up" on visitors to very good effect, and is sometimes entertaining to the lone operator too!
Have fun! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
Will_Annand

Another Project.

On my list is:

1. A turntable with 180 degree rotation.

2. An indexed turntable 10 spurs.

3. Hobo camp fire.

4. Interior building lights simulating kerosene lamps.

5. Gas lights on Broadway in Orangeville.

 

Reply 1
Erik A. Erik84750
Hi  Geoff,

the downloaded zip http://mrhpub.com/files/users/geoffbfiles/SMA18_Building%20Lighting.zip does not open, "archive unknown or damaged".

Can you please provide a new link, or maybe verify what might be wrong?

Thank you!
Erik
Reply 1
Geoff Bunza geoffb
Hi Erik,

That link works just fine for me as is, but here is another that you can use for the same info:
https://www.scalemodelanimation.com/blog/SMA18_BuildingLighting.zip


Have fun!  🙂
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 1
Erik A. Erik84750
Thank you Geoff, that did it.

And let me wish you a pleasant, healthy and very awarding 2023!

Cheers, Erik
Reply 1
Reply