Our Halloween Ghost Town - Building Lighting Controller
We had grand ideas for the "Downtown Marketplace", as we call it, but the passage of time has not been kind. Like the Barkyard itself, it's had many incarnations over time. Our original plan included "company houses" behind downtown, but they occupied too much of the puppy playground. After a number of yelping collisions with those concrete blocks, we decided to downsize downtown. This increased the play area by half the size of the lower loop.
Distracted by yet another six month stretch of home renovation, among other diversions, what was left of downtown fell into ruin. Main street, once brand new, was now crumbling beneath our feet. The 3D printed windows and showcases, ravaged by the harsh sun, had long since fallen out of the storefront apartment castings. Ann made the observation that it looks like a ghost town and we should make it look haunted for Halloween.
Challenge accepted! Fresh off the success of the Next Generation Passenger Car Lighting improvements, it's time to expand the Lighting Controller's capabilities to include grouping of the LEDs and Lightning effects. Organizing LEDs into "groups" is necessary to control each floor of the building, and each room on that floor, independently. An added bonus is the work to create LED groups can be retrofitted to the Passenger Car Lighting for the combination car.
Our initial hard coded approach was far from perfect, but provided proof of concept. Eventually it will be configuration file driven, but to meet the Halloween deadline, that has to be deferred. A common "global" group emerged, i.e. all LEDs, which all behave the same. As other groups are added, e.g. "left tower" or "lower floor", the concern becomes how to control and minimize the interaction between the group effects. Do we disallow all effects but the currently active group? Do we assign group priorities? Or some other method?
Each group had hard coded controls, repeating the common global set of controls as necessary for each newly defined group. The per pixel definitions seem the oddball at this point. How do we handle per pixel effects? That called for a redesign, replacing the once global effects with an effect defined per group. Now we have to track what effect is active for each group as it's selected. A default of "none", or no effect, is assigned to the "global" group at startup. Anything selected from that point on adds a new entry for that group, or updates the currently selected effect for that group.
This was a major change in the way the controller treated everything globally. The main Arduino sketch is cluttered with all the global effects code. It's time to move the effects handling to their own files, eventually to become the effects library. THe idea is to decouple the two. The main sketch, which defines each group as a range of pixels, has to know how to assign effects to the group. The effects library has to be able to passing LED values to each in the group as it updates them based on the selected effect.
This approach allows decoupling those two parts, with a suitably defined interface between them. This way, the main sketch doesn't need to know how to implement the effects, just which effect it wants to assign to which group. In the same fashion, the effects library doesn't need to know how to set the LED values, just what function to call to set them. So as the new approach unfolded, so did the mystery of how to solve the interaction between the different groups and effects assigned to them. Don't worry about it.
It's the pursuit of the Lightning effect that raises the question of how to avoid the interaction between the different groups and effects assigned to them. While experimenting, setting a group to Lightning while a different effect was enabled globally really helped guide that determination. Say the global effect was a slow color fade, the effect can continue cycle through the colors, interrupted periodically by brief flashes of lightning! Not only is it impressive, it's exactly what we need for a Poltergeist effect!
More experimentation produced even more spooky and unexpected combinations. Create an "ectoplasmic green" background, overlay that with a slow flickering, then overwhelmed by lightning flashes. It looks like something out of Ghost Busters! Perfect! Next start with a bright bluish color like that of electrical arcing. Speed up the lightning to appear like a quickly flashing arc, and we have a believeable electrical disturbance. Now start with a reddish background. Overlay with flickering, the rate set to act like flames. Add an occasional flash to make it appear as if the building's on fire.
Now let's add another dimension to the story. While all this software development was shaping the lighting controller, we were designing 3D printed "skins" for the downtown buildings. The original storefront apartment buildings already had their cast faces, but everything else was just bare concrete blocks. The first step was to create a model of those face castings electronically. From there, it became a matter of how to assemble the various sections into walls, and those walls into buildings.
The Grand Hotel slowly emerged, taking shape one 5" x 8" section at a time, each taking more than three hours to print. It takes days of printing and more than two of the one kilogram spools of PLA filament just to print the skin for the Grand Hotel. That's nearly four and a half pounds of plastic! The "Corner Drugstore" takes nearly another spool of plastic and it's questionable whether there's enough time left before Halloween to finish it.
This all came together Halloween night. We had lighting controllers configured, installed, and operating in the other buildings while hurriedly finishing up the Corner Drugstore as it was getting dark. We were hoping to retrofit the lighting controller improvements to the passenger cars, but ran out of time! Regardless, the Ghost Town display is impressive! We are entirely entertained by the display and can't wait until next year to add even more of the features we didn't have time to finish this year.
          We're able to leverage the work done for the passenger cars, retrofitting the Passenger Car Lighting controller with all the improvements made for the building controllers. 
          We also added the hardware for the heralds on those cars so equipped, but that's a future installment. Follow the Halloween Ghost Town build in more detail on our Barkyard 
          Blog! 
          See More...      
        
          We leveraged the work done for the passenger cars, retrofitting the Passenger Car Lighting controller with all the improvements made for the building controllers. We 
          also added the hardware for the heralds on those cars so equipped, but let feature creep interfere with adding the Christmas light effect in time for Christmas. A day 
          late... as they say. The effect was "perfected" on Christmas day! 
          See More...      
        
          We invite you to enjoy our Halloween Ghost Town on the Barkyard YouTube channel if you're so inclined. We go into much more detail than we could possibly fit on a 
          web page. Even our Barkyard Blog posts can't capture all the details the videos do. 
          View Now...