Japanese Tram Coffee Table Layout

This coffee table is made of layered bamboo-composite wood treated with Danish oil, and below the oval glass top is a small N-scale layout that runs a Japanese tram around two levels. The layout is powered by a single 18650 Lithium-Ion battery, and has solar panels to harvest power to charge the battery.

There is a small meter that reports on the state of charge of the battery, and additionally "twitches" the needle to indicate charge or discharging. The meter is described here on the University Research Commons.

The layout activates automatically, in response to movement in light levels, or every 90 minutes if the room is light and there is plenty of energy in the battery. The tram then runs around the layout for about half a minute. There is enough charge in a single 18650 2.5Ah cell to run about 300 trips or idle for a month.

There is a three-colour signal at the station that signals train activity or error codes. The signal is the main consumer of power when the tram is inactive. It dims in low light, or if the battery approaches 20% charge. When too flat to run safely, the signal flashes red. There is an emergency charging micro-USB socket on the underside that permits rapid charging of the battery (usually required in winter months).

All the track and the tram came from a robot-translated Japanese model railway web site, "HOBBY SEARCH" (http://www.1999.co.jp). The track is especially tight, using 100mm and 140mm radii Tomix sections. The tram is a Toden Type 8000 (Tokyo Class 8000 Tram) (Route No.22/for Shinbashi/#8054). The electronics is a custom-designed SEPIC converter based on a PIC16F1825 that also handles the signals and logistics. Trees and some (Z-scale) tunnel portals are home made. The other tunnel portals are also from Japan. Grass, rocks, tree materials are Woodland Scenics. All the background photographs are scenes of Japan from various web sites. People are home-painted Preiser models.

The tabletop is slightly less than 575mm by 450mm, and the whole table is 490mm high. The table body is 96mm deep.

The photographs below give some idea of how the chassis of the layout was made. There are 6 levels each using 16mm-thick bamboo composite wood.

If necesary, the bottom can be removed to give access to the conduits carrying signals. These pictures show the mid section and base plate disassembled. The small metal clip visible on the base plate is the USB charger PCB, courtesy http://www.aliexpress.com.

Here is the finished product with the glass removed to give a clearer view.

Some views from within:

The table firmware works as follows.
On boot, the signal cycles slowly red-yellow-green four times if there is a link in place of the photovoltaic sensor input, but only twice otherwise, to signify entering automatic mode. Then there are a series of fast flashes of all three signal lights at once, and the number of flashes signals the number of times that the battery has been cycled. (Manual mode is not used on this layout, but is on others such as the Z-box layout.)

After boot, the signal goes RED for 2 seconds and the tram is accelerated. Then the signal goes YELLOW. The speed is regulated to a level set by a pot on the main PCB. This continues until the IR sensor at the station sees the (reflective) underside of the tram. At this point the tram slows to a halt. The signal remains at yellow until a timeout period elapses, at which point it turns GREEN. This is the "idle" condition.

When the light level on the panel changes in one direction for about 400ms the tram is triggered to do a run. The signal turns RED, the tram is accelerated, and 15 seconds later the signal goes YELLOW. When the tram returns to the station it halts, and after the timeout the signal goes green. The light-level run sensor is designed not to respond to quick fluctuations in light, such as tree brances blowing in the wind, but it is sensitive to a hand being passed over the sensor slowly.

The tran will also periodically do runs "automatically". These occur more frequently the more charged is the battery, as a kind of power management. During an automatically triggered run, the signal stays RED for only 2 seconds, so it is possible to tell if light triggered a run: the signal goes YELLOW before the tram enters the first tunnel on automatic, but usually it only just turns YELLOW as the train emerges on the lower level for a normal, light-triggered run.

If the tram fails to get back to the station in 25 seconds it is considered "lost" and the signal flashes YELLOW-RED slowly. A trigger restores power for up to another 25 seconds in order to try and "recover" the tram. This way it usually finds its way home in the end.

There is a "hidden" extension to the timeout, a period beween the signal turning green and the tram becoming willing to start a run. Up to 25 seconds, this period is proportional to the number of runs undertaken, so it is possible to sense how many times the tram has run over a period. The delay is 100ms per run, modulo 256. The number is stored in NV RAM, so it continues past reboots, as does the number of battery cycles.

In low light ("night") the signal flickers perceptibly (37% duty cycle at 30Hz). In this state autoruns are disabled, and manual runs may require a bright light instead of a shadow. After a period of about 40 minutes inactive, the system goes to sleep, extinguishing the signal to save power, until the light level returns (usually the "next day"). Signal operation is the greatest consumer of energy when the tram is not running.

The IR sensor that searches for the tram has a sensitivity pot, also inside the case. To access the electronics, remove the glass top and the three screws holding the three rubber resting points for the glass top. Carefully lift the top to the side. The battery, battery management system, solar panels, and the battery charge meter electronics are all attached to the lid. A 3-core cable connects to the run electronics inside. Shoud the IR sensor or signal electronics ever need to be reached, the base plate must be removed using underside screws. A 6-core cable links to the signal and IR LED and phototransistor. The cable is colour-coded red, yellow and green for the signal LED anodes, blue for ground, brown for the phototransistor and orange for the IR LED anode.

There is a commercial battery management system that prevents oversharge, undercharge, and overcurrent hazard to the lithium cell. This is on a PCB about 3mm by 20mm mounted on the battery negative strap. Three other PCBs hold the meter electronics, the IR sensor electronics, and the controller.

In the event of low power, the tram will refuse to run, and the signal will flash RED slowly. Charge with USB to recover. If the battery becomes very close to flat, the BMS shuts everything down. Charging should initiate a reboot.

| Home (up 3 levels) | Documents Index (up 2 levels) | Railway Index (up 1 level) |