Geoff Bunza geoffb

Opening.JPG 

HO Scale Model Animated Rooms

Since writing and demonstrating animations using the Arduino Pro Mini, Iā€™ve received many questions in the last months about how to get started, particularly by modelers who have no interest in electronics or microcontrollers. As an advocate of using the right tools, I put fingers to keyboard to try to make this as straightforward as possible. You should get some good use of many projects big and small, no matter what kind of modeler you are or layout you have. And for the old hands lurking about, weā€™ll create some new virtual rooms for your modeling! You can jump to the last video and have a peek.

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

Starting from Scratch

OK, letā€™s get at it. These projects need an Arduino Pro Mini Board (At last check US$2.94 each with free shipping off ebay see: http://tinyurl.com/oamynj5 ) and a USB to TTL cable to set up the programs on the little board (Now US$8.60 off ebay see: http://www.ebay.com/itm/262042386245). While you are waiting to get these download the Arduino IDE (Integrated Development Environment) free software off the net from: http://arduino.cc/en/Main/Software  or http://arduino.googlecode.com/files/arduino-1.0.5-windows.zip (for Windows specifically) which has an editor, a library, and examples for you to use. Note this IDE will run on Windows, MACs, and Linux machines, so pick the right one for your computer. When you unzip the package, write down the full path name to the folder, like: C:\arduino-1.0.5 or wherever you put it. This will be important later.

Now take a glance at the Getting Started info: http://arduino.cc/en/Guide/HomePage and the info at http://arduino.cc/en/Guide/ArduinoProMini page. Just a quick read to give you some context. I had people get lost at this point, so Iā€™ll step you through the rest. The accelerated learners among you can also glean more info from: http://arduino.cc/en/Tutorial/HomePage and there are a lot of topics there for search for a subject or browse or http://www.instructables.com/files/orig/F3J/MTJN/FVW22MXN/F3JMTJNFVW22MXN.pdf
or  http://www.richardvannoy.info/arduino.php or http://arduino-info.wikispaces.com/TUTORIALS
These offer info at different learning levels so pick one you are comfortable with.

Now you should have at least one Pro Mini Board, a cable, and the IDE software loaded.

o%20Mini.JPG 

Arduino Pro Mini

%20Cable.JPG 

USB to Serial TTL Programming Cable

If you ordered the Pro Mini I referenced before it came with a set of header pins. So cut off a six pin group, and either solder it into the six holes on the end of the Pro Mini Board (either side will do, I prefer the header to stick out the component side with the button on it. In some model setting you may prefer not to solder the header on at all. Iā€™ll show you later how to deal with this. Notice that ends of the six holes are either labeled BLK and GRN, or GND and DTR. The black wire on the six pin USB to TTL Serial cable will connect to the BLK/GND pin, and the other end of the cable connector will connect to the GRN/DTR pin. (If you didnā€™t want to solder the 6 pin header to your board for some reason, insert the long end of the header pins into the 6 pin cable connector. When you are ready to load a program onto the board, insert the connector with pins into the top of the board, observing proper orientation I described above, and hold placing side pressure during the programming download.) Plug the USB side of the cable into your computer. In all likelihood Windows will need to load a driver. For Windows Xp, here: http://arduino.cc/en/Guide/UnoDriversWindowsXP is a good detailed, step by step. The drivers you want to install are in the Arduino folder (from my example above) C:\arduino-1.0.5\drivers\  You might also benefit from reading http://arduino.cc/en/Guide/Windows For other operating Systems go to http://arduino.cc/en/Guide/HomePage and poke around there. Remember the serial port number for the serial cable installation. Now start up the Arduino IDE software you loaded, and you should get a window like this: (All my examples will be MS Windows based)

ow_start.jpg 

This is the window for the Arduino Editor, where you can recall programs from libraries or create your own. Go to the top menu bar, mouse click on Tools, then Board, then Arduino Pro Mini (5V, 16MHz) w/Atmega328. This will place a black dot next to your selection, and corresponds to the Pro Mini Board I referenced before. Note well that there are many variations of Arduinos. They all can run the same examples we will use. The Arduino Pro Mini is small, low power, cheap, fast, and comes with a large program memory.

ow_Board.jpg 

Now go back to the top menu bar, mouse click on Tools, then Serial Port. Select the Serial Port corresponding to the USB cable you set up before. All that weā€™ve done so far only needs to be done ONCE.

OK, now we are ready to do something with the Pro Mini. In the open window of the Arduino IDE, click on File, then Examples, then 01 Basics, then Blink:

ow_Blink.jpg 

And the following window should open:

kProgram.jpg 

This is the editor screen in which you can load, edit, save, and download your programs, called sketches, for the Arduino. The program shown is from  the list of examples which are great starting points for you to learn just how much you can do. With NO modification, making sure your Pro Mini Board is connected and selected properly, click on the circled right arrow button below the edit menu pick, to the right of the circled checkmark. These two screens should appear in succession:

ompiling.jpg 

and

dow_done.jpg 

You will also see the LEDs on the Pro Mini Board blinking along. After a short time, a LED connected to Digital Pin13 will blink one second on, one second off. You have now successfully set up your Pro Mini Board! To prove a point, go back to your computer, and in the IDE window with the Blink program, highlight and change both of the delay(1000);  lines to delay(90); that is change the 1000 to 90. Hit the right arrow to download the now modified program and watch the change. Now the blink rate is 90 milliseconds (0.09 seconds) on and off. This is how simple it is to change the behavior of the Pro Mini.

Back to Model Railroading

While blinking a LED was instructive it is not particularly useful. So here are some small projects that might be of interest to modelers:

We do Windows!

One of the neatest animations I use is relatively simple to set up with a Pro Mini. This was built as an example for my animation clinics. This sketch (program) randomly turns on 16 LEDs used for room lights in my model structures. It can turn background buildings from lifeless shadows into hives of activity. Here is the sketch:

#define numleds  16                                                       

byte ledpins [ ] =  { 0,2,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 ;

}

Copy, paste , and save it as a text file, but name it with a ā€œ.inoā€ suffix like ā€œbuilding.inoā€

Then open the file with the Arduino IDE and load it into your Pro Mini. You can also copy and paste the text directly into the Arduino editor window.

Now letā€™s set up the Pro Mini Board. Since this will be part of a freestanding model, we need to power the board independently. A cheap and easy alternative is a ā€œwall wortā€ 5 Volt DC power adapter commonly available. I cut off the connector at the end. Strip the two wires exposing the bare wires, not allowing them to touch. Connect a LED in series with a 1000 to 3000 ohm resistor. Typically the longer length LED wire is the positive side. Touch the resistor/LED combination to the exposed power adapter wires. When the LED lights, you know which of the wires is positive and which is negative. Connect the Negative wire to GND on the pro Mini and the Positive wire to the hole on the Pro Mini marked VCC. Note this works for the Pro Mini mentioned before. There are other variations for which this will NOT work. Only use a 5 Volt DC adapter here, rated 400 milliamps or more.  Place you LEDs in building rooms or where ever you want them, connecting all LED anodes (Plus or positive sides) together and to the positive side of your power source (in my case the 5 Volt wall wort). For each LED connect a 1/8-1/4 Watt resistor of somewhere between 330 and 2000 Ohms depending on your LED and the LED brightness you desire (experiment a little here) to the LED cathode (Negative side). The other side of the resistor connects to one of the Arduino Pins Labeled 2-13 and A0-A3 on the Pro Mini Board. These are referred to as Arduino Digital Pins 2-17. The assembly pictured below is my demo of this very project. The LEDs will come on randomly, and, on the average, stay on for 60% of the time.

g%20Demo.JPG 

This is exactly the technique used in this Building animation:

Nowā€¦ Do You Want a Rooooooooom?  (With apologies to Peter Sellers)

I have mentioned before that one of the great values in using the Arduino is in the availability of existing libraries and examples to get going quickly. Below is a Pro Mini connected to a 1.8 inch LCD display available from Adafruit ( http://www.adafruit.com/products/358) , together with graphic libraries for the display. The little board also has a socket for a Micro-SD memory card, and, as you might guess, thereā€™s a library to use the SD card too! In this particular case, we can start by using the Adafruit display ($19) and libraries (Free) and follow their tutorials for connectionsā€”they are actually straightforward. Other, cheaper 1.8 inch displays are available, but they have a few design quirks that are not for the impatient, or faint of heart!

20Screen.JPG 

een_Back.JPG 

You can see the Micro SD card socket on the back of the display. The display is connected to the Pro Mini directly:

Wiring from the 1.8inch Display to Pro Mini :

Lite           to  VCC +5 Volts

MISO        to   12

SCK           to   13

MOSI        to   11

TFT_CS    to   10

Card_CS  to    4

D/C           to   9

RESET       to   8

VCC           to   VCC +5 Volts

GND          to   GND

Then download the libraries:

https://github.com/adafruit/Adafruit-ST7735-Library/archive/master.zip

and

https://github.com/adafruit/Adafruit-GFX-Library/archive/master.zip

Download and Unzip, and rename the folders: Adafruit_ST7735 and Adafruit_GFX and put them in your

Documents/Arduino/libraries/   

folder. If the folder doesnā€™t exist, create it for the libraries. You can verify everything works by running sketches in the Examples/ST7735/ menu in the Arduino IDE. You should note that one of the examples is: spitftbitmap.ino which will display a 160 X 128 Color BMP picture. By finding or creating an appropriate photo in perspective, you can resize and convert it to a BMP type 24 bit color picture and load it onto your Micro SD card ā€“ remember that little socket on the back of the display? If you position and glue the display towards the rear of a room, facing a clear window to the front, you can build this:

Room1.jpg  or Room2.jpg  or

m_people.jpg     om_tiger.jpg 

orā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦ā€¦.Grrrrrrrrrr!!!!

My rough estimates indicate the Pro Mini doesnā€™t quite have enough processing power to generate video without a hardware assist, but some of you might recall the ā€œflicker comicsā€ that used to come in a package of ā€œCracker Jacks.ā€ We can create an animation of sorts by rapidly repainting the display with multiple images. And with the additional help of the image editor, you can finish off our ā€œvirtual roomā€ with a little animation, randomly activated, and with changing speed of movement:

No sound of courseā€”because the doors and windows are closed! While itā€™s possible to drive the little display with other, more powerful processors, you probably canā€™t beat this little animation added to your structure for less than $25.

I hope you enjoyed this! As always, suggestions and new ideas are always welcome!

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 0
Dave K skiloff

Geoff

You are awesome.  This is really something I'm going to get into a lot, I'm certain.  I only concern myself now with spending "far too much" time on this, rather than first getting trains running.  I assume the language being utilized is Java?  

Dave
Playing around in HO and N scale since 1976

Reply 0
Geoff Bunza geoffb

Re: Comments

hi,

For Dave: Base language uses the gcc compiler (completely hidden from the user by the way) so it's C or C++.

Quote:

What is the price point for your CPU?

For AzBaja as I wrote in the first line of the blog the cost is US$2.94 including shipping-- kind of hard to beat. I gave links to all the sources too. The big deal with the Arduino is NOT the hardware, it's the availability of libraries, examples, and pre-written applications that will help model railroaders get started faster. Professionally I've designed with more than 10 other processors, any of which could substitute. If you have a favorite, I encourage you to use it. Most others offer a more complicated environment for construction.

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 0
rickwade

Geoff - let me say this ... WOW!

I am WOWed by your animation work and abilities! So, for us dummies that aren't there - do you sell the ready-to-run boards we can purchase? If not, have you thought about it? I'm sure that there are a few others out there that would be glad to purchase your brilliant work.

Rick

img_4768.jpg 

The Richlawn Railroad Website - Featuring the L&N in HO  / MRH Blog  / MRM #123

Mt. 22: 37- 40

Reply 0
Logger01

Good introduction

Good introduction to Arduino and the potential of these little boards. A few comments:

There are two versions of the Pro Mini: a 3.3 VDC version and a 5.0 VDC version, so you need to be aware of which one you are purchasing. The one Geoff referenced is the 5 VDC version.

Although I received my last order of Pro Mini's from the Evilbay source Geoff referenced in about four weeks, I have been waiting for my last order of boards for about 12 weeks. I reordered more from this supplier because they were cheep, had free shipping from China and seem to be exact copies of the SparkFun designed boards  https://www.sparkfun.com/products/11114. Since placing the second order I have had two of the ten I originally ordered die. If no more die eight for $28.99 is still cheaper than the $9.95 each at SparkFun, but for newbies starting an Arduino project buying a board from a known dealer with support might prevent some frustration.

Ken K

gSkidder.GIF 

Reply 0
Geoff Bunza geoffb

Comments for Rick and Ken

Hi Rick,

Thanks for your kind comments. Yes I have thought about looking into making these available, but haven't wanted to venture off without a lot of thought. I am always happy to help out a fellow modeler replicating or expanding my work.

and Hi Ken,

Yes I primarily use the 5 Volt Pro Mini's (hence the 5 Volt wall wort) and it is a good idea to point this out. I have personally destroyed four of the little boards, but all due to my haste or clumsiness at the wrong moment. I have yet to have one not work out of the package and as a rule I test all Pro Mini's by reloading the Blink program twice (slow and fast blink) to make sure I'm not wasting my time with a bad unit.

The price of these has come down from $12 to $2.94 in just a couple of years, and considering what's on the board (processor, memory, voltage regulator, LEDs, etc.) I don't understand how anyone can even ship them for this price let alone deliver the whole package. I have learned to ignore the lead time problems by ordering them in lots of 10 instead of one or two. If you consider even a simple control function, like blinking crossing gate signals, it's cheaper for me in total to use a Pro Mini rather than build a 555 timer circuit on a board with trigger logic-- and faster! The economics are a bit strange to me, but the costs are obvious, and so are the savings. I've tried this out on several projects.

Thanks for your interest and comments.

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 0
Bernd

Another unique project

Geoff,

Another interesting thread. You might yet get me over to the dark side of micro-cpu's yet.   You did get me to build an animated crane, remember?

Interesting project Geoff and I see somewhere down the line I may just build something like that, especially the one with the screen, outstanding.     

Bernd

New York, Vermont & Northern Rwy. - Route of the Black Diamonds - NCSWIC

Reply 0
Geoff Bunza geoffb

Inspiration Appears to go oth Ways

Hi Bernd,

Inspiration appears to go both ways!

One of the things I enjoy about the MRH forum is the experimentation people describe. Sometimes it's just trying something of theirs for the first time, but many times individuals give it their own twist, and if you have even a modest amount of curiosity it can lead to some eye-opening ideas.

I never would have rebuilt my crane in brass, but your approach has led me down alternate paths which have already affected my own modeling.

This is a great hobby!

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 0
Jim at BSME

Question about the pins

Geoff,

You mentioned about not soldering in the header for the USB/Serial cable, but aren't those pins available on the sides as well?

Of course you would need a USB/Serial cable that had individual connectors to reach headers on the sides, but you also need these headers to connect the LEDs, so seems like the serial pins may be there for free.

Thanks for a great tutorial.

Jim

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: FacebookInstagram
Reply 0
Jim at BSME

Engineering Design Question

Geoff,

Just started playing with my Pro Mini, and added an external LED to pin 13, wired like your room lighting module, anode to +5v and cathode to the pin via a resistor.  Then ran the blink sketch and noticed the external LED was on/off opposite the onboard LED.  I also played with on/off time in the blink sketch and additionally noticed that the LED was on when the pin was LOW and off when the pin was HIGH.

I can resolve this by switching the cathode connection to ground and the anode to the pin, but I was wondering is there a power design reason for doing it the way you did, and/or is it specific to the room lighting application?

Thanks,

Jim

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: FacebookInstagram
Reply 0
Geoff Bunza geoffb

Which way to power a LED

Hi Jim,

Quote:

I was wondering is there a power design reason for doing it the way you did, and/or is it specific to the room lighting application?

If you were one of my students I would have to lead off with "That's an incredibly insightful observation and question!" But, since you're not, I'll just answer the question. My apologies to some readers for the following technical explanation:

1%281%29.jpg 

                                                     DEMO BOARD SCHEMATIC DIAGRAM

Jim, as you noted, the Anode (plus side) of the LEDs in my circuits go to the "RAW" power input to the board, which in the demo case is close to 5.3-5.6 Volts (battery drop from 6 Volts). In the Building animation video, I use a 5 Volt wall wort power adapter to power the whole building, and put the 5 Volt supply directly to the VCC connection on the Arduino Pro-Mini boards. Why? Because the Digital pins (configured as Outputs) of the Pro-Mini can sink and source more than 20ma max each. So they can drive either end of a LED. The red LED on the board connected to Digital Pin 13 is connected to the anode of the red LED (other end goes to a resistor to ground). So whenever Diigital Pin 13 is HIGH the LED will be on. But the source or the current driving the LED is usually from the on-board regulator, through the power connection to the Atmel Processor, through the pin to the LED. By using the same pin to drive the cathode (negative side of the LED), with the plus side of the led connected through a resistor to the off-board 5 Volt power supply, we avoid the power limits placed by the on board regulator and chip power. So the only issue left is using the Digital Output pin to sink the external current through the LED through a transistor switch to ground. This is a slightly better (read less restictive) power advantage for the on-board regulator and the Atmel chip, and when I run some of these off batteries, I want all the advantages I can get! Hence, you have to turn the appropriate Digital Pin LOW to turn on my LEDs.

This is not specific to the room lighting application. In fact, you could take advantage of the sink/source characteristics of the Digital Pins and use one pin to alternately flash two LEDs (say for a crossing signal). Just have the ON/OFF, HIGH/LOW timing of the pin set for equal on and off times, and drive one LED to the Anode and the other to the Cathode, using only one pin. Neat?

With the general technique, you can wind up driving 16, even 18 "room lights" with little problem.

'Hope this helps. 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 0
ILHO

bitmap loading

First I have to say you are amazing !  Thank you for all you provide to other modelers.

Now my question : Are you using modified code ? My bitmap loading goes line by line and yours seems to change the bitmaps all at once.  I have one in a boxcar with Lipo battery running the arduino at 3V.

Thanks again ... i have done animation with arduinos and controlled them with IR and XBees, Your DCC implementation opens up a completely new arena.

Ivan

Ivan Lee Herring

Mountain Valley Western

Reply 0
Geoff Bunza geoffb

@Ivan re: bitmap loading

Hi Ivan,

'Glad to see you're having some fun with this! 

Quote:

Are you using modified code ? My bitmap loading goes line by line and yours seems to change the bitmaps all at once. 

I did not modify the library nor did I use "self modifying code (bad practice, by the way)." The answer is much more simple! If you look carefully at my "room" animation, the background "storeroom" scene never changes. It is literally a still picture. I used a specially selected picture of the figure, cropped it as best I could, and sized both the background picture and the figure to the HO scale scene-- mostly by trial and error, and realizing the screen resolution and it's physical size. Then I superimposed (pasted) the figure onto the background picture, and created a view frame (one picture) for the sequence. Each new frame would move the figure slightly, like the old comic flip pages found in "Cracker Jack" box prizes (I don't know if you are familiar with these, but they were the original idea source for me). At one point, I mirrored the figure to begin reversing its motion to "leave" the scene. I think there were something like 14 pictures (or fames) that make up the total movement. The frames were then displayed one after another-- I think I may have added some variable delays in there too from frame to frame to mix things up.

The reason you don't see the frame "paint" on the display is because most of the picture stays exactly the same-- it appears as if only the figure area is "repainted" from frame to frame.

Ivan, Thanks for sharing your work 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 0
John Herrmann

Drive-in theater

If you can get video to work and/or flashing several picture files you could create a Drive-In Theater, Time Square with all the screens or even Las Vegas Strip with LEDs.

Really cool.

Thanks,

John

Future Model Railroader

 

 

Reply 0
Geoff Bunza geoffb

@John

Hi John,

Quote:

If you can get video to work and/or flashing several picture files you could create a Drive-In Theater, Time Square with all the screens or even Las Vegas Strip with LEDs.

I am looking into a faster library that some say works better and also smaller displays which may load faster. There may actually be hope for these ideas you present in the near future! Have some fun experimenting and modeling!

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 0
tommypelley

You mention a flashing grade

You mention a flashing grade crossing project. How would you attach a trigger so that the crossing doesn't flash at inappropriate times.
Reply 0
Geoff Bunza geoffb

@tommy pelley

Hi Tommy,

Quote:

You mention a flashing grade crossing project. How would you attach a trigger so that the crossing doesn't flash at inappropriate times.

The grade crossing project can be found here: http://model-railroad-hobbyist.com/node/20176

The sensors I used are simple infrared proximity sensors that detect when a car/loco is in front of them. There is no direct physical contact. The "inappropriate" triggering is handled in the Arduino Pro Mini controller. It looks for a loco or car arriving in from one direction and waits until the sensor at the other end is completely clear for a short period. It will remember which direction was triggered first too-- a bit more sophisticated than older track switch contacts.

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 0
nicolasg

I LOVE your use of the GLCD.

I LOVE your use of the GLCD.

Reply 0
Geoff Bunza geoffb

GLCD.

Hi Nicolas,

Quote:

I LOVE your use of the GLCD.

Thanks! It came out pretty good.

Since you liked this animation, keep an eye out for my next Blog posting-- likely this weekend. See how you like that one! 

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 0
trainmaster247

WOW

Do you know where I can buy some of this stuff and are your codes avaliable to the public I am still quite a beginner to coding if possible e-mail me some of them at curramck000@gmail.com THANKS

23%20(2).JPG 

Reply 0
Peter Levos

Awesome

This piece just made my day, the functionality is bloody awesome!  Can't wait to try it for myself.   

Reply 0
Geoff Bunza geoffb

@trainmaster247

Hi trainmaster247,

If you read the article the code for the room lighting was listed. Here it is again

#define numleds  16                                                       

byte ledpins [ ] =  { 0,2,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 ;

}

All my code (sketches) are available for download. You can find more including construction details, in my MRH articles (for which you can use the MRH search function) and in my Blog entries and comments, which you can find here:

http://model-railroad-hobbyist.com/blog/geoff-bunza

and here:

http://home.comcast.net/~gbglacier/

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 0
Geoff Bunza geoffb

@Peter

Thanks Peter!

You made my day too!

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 0
Joe Baldwin

Curious

Hi Geoff,

Curious as to how you mounted the LED's in the building to keep from having bleed through. Assume you made some kind of egg crate interior walls?

So many interesting projects.

Thanks again, 

Joe Baldwin

 

Joe Baldwin

Northern Colorado 

http://www.joe-daddy.com

Reply 0
Reply