The Idea…
We transformed our downtown marketplace into a ghost town for Halloween. The idea that the empty building faces already made it look like a ghost town played right into it…
But we needed more than those same tired buildings I cast so many years ago. Something more than three storefront apartment buildings. Something big. Something Grand. Hello Grand Hotel!
But that still wasn’t enough. Those foundation blocks with their corner cutouts have been patiently waiting for some attention too. Hello Corner Drugstore!
All of these additions came together in the few weeks before Halloween. Most of the groundwork began in September, but filing our taxes stole time away from our goals. And we had many goals.
Glow in the dark ghosts. Lightning bolts striking the Grand Hotel sign which would then remain eerily lit. “Uncanny eyes” gazing about in the hotel’s elevator houses atop the towers on either end. Even a drive in theater playing horror movies!
The Result…
Alas, those were not to be, but there’s always next year. We are more than pleased with what we accomplished though! The customized lighting effects stole the show. They were the show!
Eerie “ectoplasmic” colors fading in and out. Bright blues coupled with flashes of lightning give the impression of dramatic and destructive electrical explosions. Surging waves of blood red, as if the building is breathing.
Here’s a look before we even had the Corner Drugstore finished!
The History…
It all started with the desire for better lighting inside our passenger car “fleet”.
All but a handful of these passenger cars are Bachmann, the style with two light bulbs inside and a 9V battery box beneath to power them. They really couldn’t be seen until dark and the battery usually only lasts a few hours until it’s dead anyway. Not real impressive…
I used 5050 LED strips for everything, starting with lighting under our patio train station platform… All 16 feet of it! These were pre canned light strips, complete with remote control and power supply. I even dug in an underground feed right to the corner of the platform dedicated to powering it.
The next step was to fit shorter segments of those strips inside a passenger car. This had a number of drawbacks. First, while small, the Arduino controller still didn’t fit inside the existing battery box. The Lithium battery is slightly larger than that. I designed and 3D printed one large enough to replace the existing battery box.
Fast forward to now. Many iterations of the design later, I switched to using 2812 individually addressable LED strips, for a number of reasons. What’s the difference? The power supply for one. The 2812 strips run on 5V, the 5050 strips require 12V. Not a showstopper, but it does require extra parts to boost the 5V supply I already have to 12V.
The biggest difference between the two types is the ability to address each LED on the strip individually with the 2812 style. While the 5050 version allowed me to mimic the effects of the pre canned units, I wanted to be able to have them individually flicker, even scroll in marquee fashion!
The Effects…
I started with the easy effects, jump, fade, flash, blink. I added the ability to individually address each “pixel”. Then I added the flicker. It can be adjusted to be as slow and subtle as a kerosene lamp to as fast as an arc welder, with a flickering candle flame somewhere in between.
The problem is all the effects are global in nature. That is to say, they affect ALL the LEDs at once. Only the “per pixel” selection allows for changing each pixel’s color independently from one another and the ability to scroll them (marquee).
I spent a good bit of time to marry the two versions together… The issue I have to solve is the all or one addressing, or rather, pixel addressing and grouping. In a nutshell, we have baggage cars (no lighting whatsoever), combination cars (baggage and passenger sections), full passenger cars, and what I’ll call a parlor car (with an additional lit herald on the back railing).
How to handle all these different situations in ONE implementation? The hardware was identical, with 24 LEDs for each. The only exception is an extra 3 LEDs for the herald. The software is as generic as well. Each car has its own configuration that describes its unique situation.
If I haven’t mentioned it before, all these “gadgets” use a web browser interface for control. The embedded Arduino controller has built in WiFi. It operates as an access point that will allow other devices to connect to it as well as connecting to an existing WiFi access point as a client.
All of this allows the Arduino to act as a web server, serving up the control interface web page, available to any device on the network! Smart phone, tablet, laptop, you name it. If it has a web browser, you can control it!
I’ll add a video capture of the interface in action soon…
The old version only accounted for baggage and passenger sections of the combination car. The herald lighting wasn’t even addressed. It’s a step by step approach. First the LED and group addressing. The next is modifying the effects selection for each group and pixel.
In the process, I had to “wedge” the new additions into the existing status reporting mechanism. I pretty much gutted the entire per pixel reporting mechanism and refactored it to better fit into the group addressing scheme. Needless to say, the per pixel addressing functionality was the last to come back online.
Without getting into too much detail, there are two sides of the coin we’re talking about here. The client side and the server side. The client side is the browser client, consisting of HTML web pages, CSS for styling, and javascript for the nuts and bolts programming “smarts” behind the button pushes and handling the web socket interface to the web server.
The web server is the Arduino side, serving up the control interface pages and taking the appropriate actions when commanded. If this is all Greek to you, that’s alright. It’s a lot of programming jargon if you’re not interested.
If you are interested and would like to know more, leave a comment and I’ll be happy to answer any questions you may have. If there’s enough interest, I can add more detailed posts that describe how this all works.
The Ghost Town…
I had to further adapt the passenger lighting controller to become the ghost town controllers, starting with the Grand Hotel. But that’s not the only thing we needed. It would help if we actually had a Grand Hotel! For that, I cobbled together a number of 3D print designs I’d been working on to improve the casting process in the form of custom molds.
After many iterations, I finally managed to match the brick pattern sheets I used to cast the original storefront apartment buildings. In fact, I came up the the positive version before converting it to the negative impression suitable for use as a casting mold.
With a few changes here and there, I can print the various pieces of a building, one floor at a time. In essence, I’m converting a concrete block into a building using a 3D printed skin, one 5″ x 8″ section at a time. The sections are then joined together similar to styrene models, using a different liquid cement (chloroform), together with brick strips that mimic columns and headers.
If you’re a model railroader in smaller scales, you’ll recognize the approach is similar to Design Preservation Models modular kits. They supply a set of walls, window, door, and other detail castings, and the assembly instructions. All you need is glue and paint.
The resulting “skin” then slides over the block, after painting of course! It’s obvious the window frames and glazing are missing, but that’s what prompted us to make it a ghost town in the first place! The original buildings had both window frames and glazing in addition to a ground floor store front at first, slowly demolished by continued collisions with the pups.
I start by assembling floor sections together into a single three story wall then comparing it to the block. My first attempt fell short… Literally. Had I butted the brick header strips together with the sections to be joined instead of overlapped on top of them, it would have been just about the correct height.
The Grand Hotel…
Armed with this information, I began to madly 3D print wall after wall. I already had a few walls that I had previously printed, attempting to recreate the existing storefront apartments. My first attempt left too large an opening for the windows. The next attempt matched the window openings very closely, but added an extra brick to the width.
Great for ¼” thick castings… For a 0.072″ plastic brick sheet, not so much. The great thing about thin plastic sheet is how easy it is to cut with a good pair of scissors! Not Kindergarten scissors and construction paper easy, but easy enough to trim half a brick off either end without much bruising…
This is a seat of the pants operation here. It doesn’t need to look perfect and it doesn’t need to last, it only has to resemble a big hotel from a distance at dusk. If you look closely, you’ll see there are no doors anywhere on the ground floor. Kind of like Hotel California, “You can check out any time you want, but you can never leave”, assuming you could get inside in the first place!
In any case, I soon exhaust the entire replacement spool of yellow filament. I screwed up getting the hub to fit inside when I first got it and it’s been hanging there ever since. The fear was a tangle in the line will cause a knot and jam the printer extruder. The result? A failed print at the very least. A flying spaghetti monster if not caught in time.
I was lucky this time though. I was present for most if not all the printing. Each section takes about three to four hours to print, so I continue to update my Arduino code while printing continues in the background behind me. Not only did I exhaust that entire replacement spool, I went through another regular spool as well, plus part of a second!
I had to wait on the second regular spool to get here too! The hotel is complete except for a few sections, so at least the side that shows looks like the Grand Hotel.
The Corner Drugstore…
The Corner Drugstore was meant to be printed from a spool of brick red colored filament I ordered especially for it. There’s something to be said for sticking with the known quality of a brand of filament. Apparently, I chose poorly… I tried three times to get a print just to stick to the bed before I finally gave up and threw it off to the side.
I loaded up my usual brand of filament in the bright red variety and had nothing but perfect prints one after another. This building is different than the others in that the corner entrance wall and doors will be at a 45° angle to the side walls. With barely enough time left to print the side walls themselves, I didn’t take the time to design the entrance and the 45° column pieces.
I did design a different set of window walls though. Two large windows per section for the bottom floor, as if there is restaurant seating, and four small windows for the middle floor sections suggesting a mezzanine. The upper floor sections are the standard three window apartment style windows.
I even added a set of alley side carriage doors with a small office door beside them. It went together quickly, but not quickly enough. I was still adding those finishing touches Halloween night! I ran out of time to cut the aluminum extrusions to size for the LED strip to fit inside.
Not even the original storefront apartment buildings had them, just the Grand Hotel, and even then those were cobbled together and barely fit inside the blocks. I needed something to diffuse the bright spot source of the LEDs. Even with the diffuser covers snapped in the extrusions over the LED strips, they can still be seen and it’s obvious they’re LEDs.
The only “pictures” I have are actual video recordings of it, and even then it’s just the incomplete skin. At least it’s painted brick red and has the lighting effects installed! It was a rush job to say the least. I was lucky to get as much done as I did. Here’s what the end product looked like. Hope you enjoy it as much as we did!
Most of the work remaining on it and the rest of downtown will wait until the new Main Street design is finished. The idea is to pour a thin concrete “sidewalk” that will serve as Main Street and the side streets, including curbs, sidewalks, and a firm, level foundation for all the buildings. But that’s another project for another time…
The Code…
The code has evolved over time, based on the success of previous additions from various projects. It all started with the WiFiTrainController Arduino sketch Nick put together a few years back to control his Lionel trains. Between his inspiration and my renewed immersion into embedded systems control at work, there’s a strong motivation to return to my “gadgetronics” days of the past.
After a number of iterations of modifications, and many failed attempts at getting reliable readings from Hall effect current sensors, I finally stumbled across the resolution to the problem. Unfortunately it meant going in an entirely different direction. That resulted in more iterations and improvements, and some refactoring along the way.
All that work on the block and motor controllers paid solid dividends going forward. The expanded web socket interface was far beyond the original single character command approach. Adding new commands is as easy as adding the command keyword to a map of handlers and pairing it with a new command handler to take the appropriate action on the server side.
This scaled nicely when I began working on the passenger car lighting projects, the direct ancestors of these building lighting effects projects for Halloween. First it was my “Glow In The Day” clocks, 3D printed in glow in the dark filament, then illuminated with UV LEDs to glow in the daytime. Now it’s the downtown ghost town.
Actually, it’s three separate projects, one for the Grand Hotel, one for the original Storefront Apartments, and one for the Corner Drugstore. The code for all three is basically the same except for the number of LEDs controlled and the user interface pages themselves.
In more detail, the projects consist of an Arduino sketch (written in C) and the data files. The NodeMCU 12E controllers are ESP8266 based and contain 4MBytes of flash memory. This can be divided between the two parts, in 1MByte increments.
The program sketch is compiled into an executable binary that is uploaded to the first part of flash memory. The data files are stored using the SPI Flash File System (SPIFFS). It’s a flat file system, but provides hierarchical storage via the file name itself. This is where the web pages, CSS, and javascript files are stored that are served to the web browser.
Here’s a video example of how we select and control the lighting effects we used for the ghost town. As you can see, there’s even enough room in the flash memory for a couple of smaller image files.
The Finish…
I used a dedicated power bank (20,000mAh) each for the Grand Hotel, Storefront Apartments, and Corner Drugstore. Each had its own dedicated Arduino controller as well. I was able to connect to each controller with my phone and the office PC to control them! The only thing I wasn’t able to pull off was the passenger car effects.
I thought I could spend a couple hours and get something whipped in to shape and working, but it was not to be. In fact, it took more than another week to get things the way I wanted them to work. But that’s software. If you wait until it’s perfect you’ll never have anything to ship!
As an experiment, I left the effects running all night long. They were still going in the morning! The power banks were fully charged Halloween night, with somewhere between 25% and 50% of the 20,00omAh charge remaining. I was also quite aggressive with the LED levels for a more dramatic effect. More conservative selections would last even longer.
By comparison, the passenger cars have only a tenth of that power (2,000mAh), and with more subdued lighting levels they are still running in the morning as well. I can get anywhere from 8 to 12 hours from them on a single four hour charge.
Stayed tuned for more updates on the passenger cars and the Barkyard too!