1960s Garage Scene Diorama Completed
Introduction
This page describes the electronics used on a small diorama that represents a country garage and petrol station. It is set in the late 1960s. The completed diorama can be seen in the following composite image:

The shop and the garage workshop are lit with LEDs. Close up shots of the shop and workshop with the lights switched on are shown below:

The lighting and arc welder simulation can be seen in the following video.
There is also a simulation of an arc welder at the rear of a car in the garage workshop.
Each light and the arc welder simulation can be switched on and off separately using touch switches that are located under the left hand side of the diorama. There is a master, mechanical, on / off switch located next to the touch switches. Power comes from a 9V PP3 battery that is mounted underneath the diorama.
The design and build process was iterative. The first attempt went horribly wrong, and is described in the next section. Because some of the errors in could not be reversed, the final design was more complex than it could have been.
Initial design and mistakes
The original plan was for the lighting LEDs in the shop and workshop to be switched using NPN transistors as low side switches:

Similarly the arc welder LED would also be switched using an NPN transistor:

Now, this design requires that the LED cathodes to be connected to the relevant transistors. Unfortunately, I commoned the lighting LED cathodes. That connection was burried under the scenery, so the error couldn't be corrected. I didn't notice this error until after I'd created a circuit board containing all the LEDs' current limiting resistors. That board only had one zero volt (GND) input, so now the arc welding LED's cathode would also be commoned with the others. Given that nothing could be done about the lighting LEDs, it was decided not to change the circuit board with the current limiting resistors.
This decision meant that low side NPN transistor switches couldn't be used. Therefore the design was changed to use high side PNP transistors, switching the LED anodes. Each LED switch would be similar to the following:

By the time I'd realised that I needed to use PNP transistors I had already modified the TP223 touch switches to toggle high when activated. This caused another problem. PNP transistors switch on when no current flows through the base. The problem was therefore that LEDs were switched on before the touch switch was pressed and off after it was pressed! So, I needed to invert the output of each touch switch before connecting it the the PNP transistor bases. It is possible to configure the TP223 to start high and toggle low, which would have avoided the need for the inverters, but that's not what I did! Adding the inverter results in the following circuit (inverter shaded grey):

Having explained some of the complexities caused by incorrect assumptions when wiring the LEDs, I'm hoping that explains the complexity of the final circuit design, which is described in the next section.
Final circuit design
The overall design is broken down into three parts:
- The power supply
- The shop and garage lighting
- The arc welder simulation
Power supply
In order to make the diorama self contained it was decided to operate it using a battery. Because I had several 9V PP3 batteries in stock it made sense to use those. Since much of the componentry requires 5V, a voltage regulator was used to convert the 9V supply into 5V. A mechanical on/off switch was used to switch on the power and a LED was used as a power on indicator.
The following circuit was used:

The power on LED, D2, is coupled across the 9V supply, with a 68kΩ current limiting resistor. Such a high value resistor was used because I wanted the LED to be dim enough so that its light would not bleed out from under the baseboard when viewing the diorama in the dark with its lights on.
Diode D1 was used to protect the circuit in case the battery was connected with polarity reversed. This is unlikely since the battery is connected by a standard PP3 clip that can't be connected the wrong way round, but there's nothing wrong with belt and braces!
The capacitors are within the range of values specified by the L7805CV voltage regulator's data sheet.
Lighting circuit
As noted above, the garage shop and workshop were each lit with a single LED. Cold white 3mm LEDs were used, with a forward voltage of 2.8V. Each LED could be switched on and off using touch switches.
Given the problems indentified earlier, the signal from the TP223 touch switch has to be inverted before passing on to a PNP transistor base in order to switch the LEDs on and off. The following cicuit diagram shows the circuit used to switch and drive one LED, so that two copies of this circuit are required. The circuit is very similar to the example circuit presented in the previous section, except that a trim pot is also included to enable the brightness of the LEDs to be adjusted. The final design is as follows:

The touch switch is a TP223 module. This module has been modified to latch on and off with each touch, starting low, going high on the first touch then toggling back low on the second touch and so on. This is achieved by shorting out the solder pads labelled B on the circuit board. (See this instructables article for more information). This was the choice that came back to bite me (see above)!
The output of the touch switch signal pin is first inverted using the inverter comprising R1, R2 and NPN tranistor Q1. The inverted signal is connected to the base of LED switching PNP transistor Q3, via R3. The LED's current is limited by resistor R4 and is dimmed as necessary by variable resistor R5.
Arc welder simulation
The arc welder simulation was created by flashing a LED in a pseudo random fashion that is reminiscent of a real arc welder. The LED was hidden under the rear of a jacked up model car. Once again a cold white 3mm LEDs with a forward voltage of 2.8V was used. The simulation was toggled on and off using a touch switch.
My first attempt at a simulation circuit was based on a design I found online that used Schmitt triggers wired as oscilators. The design used a higher voltage version of Schmitt triggers than I had in stock. My attempts to recreate the circuit using 5V triggers failed miserably.
Instead I decided to use a microcontroller to generate the required arc welder flashes. The software was developed and tested on an Arduino Nano, but since the C program was so simple I switched to an Attiny85 microcontroller. The microcontroller starts the sequence when power is applied and stops when power is disconnected. There are pauses of random length between each sequence of flashes. The program can be found in the cahamo/diorama-3 repository on GitHub. The main source code is in src/main.cpp.
The following circuit was developed to both switch the Attiny85 on and off and use a signal from the Attiny85 to flash an LED.

The first part of the circuit from the touch switch through to transistor Q2 is reponsible for toggling power to the Attiny85 on and off. Notice that Q2 is a PNP transistor, so the inverter based around Q1 inverts the signal from the touch switch so that Q2 turns on when the touch switch is latched on. Once again, the invertor could have been avoided if I'd configured the TP223 switch differently. But I didn't so it couldn't!
Transistor Q2 then provides 5V power to the physical pin 8 of the Attiny85, which is the VCC pin. Power is stabilsed by coupling capacitor C1 across the Attiny85's VCC and GND pins.
When switched on the microcontroller program toggles digital output D0 (physical pin 5) high to turn on the LED and low to turn it off. This output is passed through an inverter comprising resistors R4 & R5 and NPN transistor Q3 and from there to PNP transistor Q4 which switches LED D1 on and off. Remember that the decision to use a PNP transistor was forced on me, as explained in the previous section. As with the lighting LEDs, the brightness of the LED is adjustable via a combination of 5kΩ trim pot R8 and 220Ω current limiting resistor R7.
Complete cicuit
Putting all the above modules together we get the complete circuit as pictured below:

Circuit construction
The circuit was split amongst several modules, each of which is explained below.
Battery
A retaining bracket for the required PP3 9V battery was 3D printed in black Bambu basic PLA.
The battery was to be connected to the circuit by means of a PP3 battery clip with attached positive and negative wires.
The battery positive was connected to the switch unit while the battery negative was connected to ground on the power regulator unit. Both boards are described below.
Switch unit
A unit was designed to contain the three touch switches, the mechanical on / off switch and the power on LED. Scew mounts were also included in the desgin. This unit was 3D printed on a Bambu Labs A1 printer using black Bambu basic PLA.
Following testing the LEDs built into the TP223 boards that illuminates when the switch is on was found to be so bright that it spoiled the view of the lit model in the dark. Therefore the on board LEDs were cut away using side cutters.
The power switch was snapped in place. The touch switches each had three short wires soldered to their terminals and has their faces covered in electrical tape; red for the light switches and blue for the arc welder emulation. The wires from the touch switches were fed through the provided holes in the switch units and the switches themselves were glued in place. The power LED was glued into the provided hole.
Wiring was soldered up at the rear of the switch unit as follows:
- The wires leading to the VCC terminals of each touch switch were commoned.
- The wires leading to the GND terminals of each touch switch, and the cathode of the power LED were commoned.
- The positive wire from a PP3 battery connector was soldered to outer terminal of the on / off switch.
- The inner terminal of the on / off switch was soldered via a current limiting resistor to the power LED's anode.
The following image shows two views of the switch unit:

The logical layout of the unit is shown in the following circuit diagram:

Power regulator unit
The power regulator circuit was soldered up on a piece of perfboard. Provision was made to solder in the 9V supply and associated ground by means of pads on one end of the circuit board.
A block of four screw terminals were soldered to the board. Two terminals provided 5V output and the other two terminals providing ground connections.
The functionality provided by the unit is shown in the following diagram:

Two plastic brackets with integral screw holes were designed and 3D printed to be used to mount the circuit board under the diorama. They were glued to the perfboard.
The following photo shows the top side of the final assembly:

Main circuit board
The circuits for the shop and workshop LEDs and the arc welder simulation were all constructed on a single piece of perfboard. The Attiny85 was mounted in a socket that was soldered to the perfboard. The 200Ω current limiting resistors for all three LEDs were mounted on this perfboard, but the trim pots were not.
A block of six screw terminals were provided to accept input to the circuit board. They were:
- Signal inputs from the three touch switches that are high when the switches are toggled on.
- 5V supply from the power regulator unit.
- Ground connection from the power regulator unit.
- One connector was unused.
A further block of four screw terminals that carry power for the LEDs via the LED board. There was one screw terminal for each of the three LED anodes and one common wire connected to all the LED cathodes.
Two plastic mounting brackets, similar to those above were 3D printed and glued to the perfboard.
The following photo shows the top side of the completed circuit board:

LED brightness adjustment board
The final module was used to hold the trim pots used to adjust the brightness of the shop, workshop and arc welder simulation LEDs. The module comprises and piece of perfboard to which the trim pots and some screw terminals are soldered.
A set of four screw terminals are provided to receive inputs for the LEDs from the main circuit board. There is one terminal for each of the three LEDs' anodes and one for the commoned cathodes.
A further set of six screw terminals are provided to connect directly to the LED leads, as follows:
- One connector for each LED anode.
- One connector for the commoned cathodes of the shop and workshop light LEDs.
- One connector for the cathode of the arc welder simulation LED.
- One connecter was unused.
Once again, two plastic mounting brackets were 3D printed and glued to the perfboard.

Final assembly
The completed modules were then screwed to the underside of the baseboard and all the necessary connections were made. Some connections were soldered while other were made using screw terminals.
The final result can be viewed in the following photo.
