The project details will expand as we progress, however, for now these diagrams outlay the main project design as it currently stands;
Custom coffee table with a DCC train track, automation, LEDs and a web interface
The project details will expand as we progress, however, for now these diagrams outlay the main project design as it currently stands;
Woodworking should be in my blood, my Dad was an "old school" joiner to trade, I have inherited a lot of tools and have been using them a lot in this project, learning to use them has been a combination of childhood memories, from all those summer school holiday's with Dad as Day Care was not a thing in them days, and Googling best practices. Master Carpenter I am most definitely not, but an enthusiastic amateur with a garage full of old tools, a hackers spirit and a very limited budget. I like them odds!
Having the main Diorama part of the project 95% completed the focus for me is the Coffee Table Woodworking. Jack is working on the electronics and the plan is to get a day or two together to complete the electronics installation.
The acrylic sides and rails needed fitted, the top rails that will have a RGB LED strip lighting on the underside inner, the top of this rail will support the hinge and gas strut for the hinged top.
We realised access to the track in the tunnel for fixing derailments and for track cleaning was going to be required, a hinged access hatch was needed for each end, the opening top will give access to the rest of the layout.
The Top will have the tempered glass inlaid flush to the top surface in the centre of the top.
I think about that phrase a lot when I'm putting together circuits. Sometimes it works, sometimes I get carried away with the fun of building. However, (un)fortunately, I'm not onsite with the table so the best I can do is plan ahead and with that in mind I put together the rats nest below as attempt to plan out all of the inter-connectivity that we'll have on the table.
It was modelled in Fritzing *GASP!*. I know, but despite fritzings uselessness for pcbs and schematics, it does print a pretty picture and it had 90% of the device images that matched what we're actually doing on the table.
Hopefully design and reality can meet somewhere in the middle;
Finally got to do this log, apologies for the gap. a lot has happened, we have learned so much and loved every minute of it. This is a brief summary of events of the past 5 months (that long... really!) I have to say that it has been well worth it, a rethink and redesign has really paid off, but first a recap.
The wiring was embedded in the foam board, this would prove to be the wrong approach, wiring was run back to the control boards that we test fitted inside the hill, this also proved to be the wrong move but ignorance is bliss and we pushed on to get to a point of testing functionality.
I downloaded a set of n-scale roads and printed them out, I then built up the road layout hiding the embedded wiring below the roads, I added the building that were complete and we were able to test run for Xmas day.
We learned a great deal from our test run, the proof of concept was really successful, the lighting looked awesome and the project "cool" potential was huge. The main lessons learned were we could not cut corners, we need to do this justice, we decided to remove any time restraints we had given ourselves and having mercilessly explored layout modelling on YouTube, we developed a new plan.
Lessons learned so far
1. Embedding wiring is not advisable, the conventional way is to drop the wires straight through the board to underneath the layout, allowing easy maintenance or fault finding.
2. Like point 1 the control boards need to be fitted on the underside of the layout for the same reasons, the original idea was to have a drawer in the bottom of the table and we attempted to contain the wiring and controllers in the foam core and inside hidden the hill, this proved impractical and woefully inadequate as the electronics list expanded.
3. We attempted to use an old kitchen table to make the coffee table, it quickly became apparent that we needed to build our own frame, the cost to adapt the kitchen table was comparable with buying the wood, we could then design and build exactly what we needed.
The new plan was to build the frame, mount the foam core to a plywood base, we could then run the wiring through and fit controller boards and power supply on the underside. This allowed us to develop the look of the hill and it was decided to expand the scenery into the void in the centre.
YouTube influences - Mel the Terrain Tutor - Luke APS - Luke Towan
We then soaked up modelling information and learned the following
1. How to make Mod Podge for terrain modelling from egg boxes and plaster.
2. How to make a static grass applicator from a bug zapper.
3. How to make trees with wire and coloured saw dust.
4. How to make a hot wire foam cutter.
5. How to make water with resin.
6. How to use Das air dry clay for structures.
7. How to make bushes with aquarium plants.
8. How to make waterfalls
Nearly 6 months from the test run we have allowed our artistic side free rein and the table project is back on track (shameful pun I know)
We are really happy with the terrain and rebuild so far, we are now at the stage of finalising the electronics and completing the woodworking.
So it's been a long time since I last posted in December. We had a successful first run of the table before it failed spectacularly and we lost the ability to light up the leds. Since then the electronics have stalled but the work on the layout has been amazing. It's truely a work of art and looks amazing. I'm hoping we find the time to get some proper details put up because the amount of work in the artistic side of the layout is shocking.
Now that the majority of the paint,gravel, clay, paper, and everything else has been put down we've been able to build a complete picture of the final numbers for the electronics.
|Single Colour LEDs||69|
|Car Series LEDs||10|
This also includes 1 Raspberry Pi, a Teensy LC as well as a strip of 5v RGB LED Strip Lighting. I need to get onsite to setup the voltage control for some of the leds as we're using a PC ATX power supply to get 12v and 5v and I need to PWM the 12v for the Car LEDs. The Cars come premade with a set of 4 leds in series with a current limiting resistor. Because the LEDs are in series we need a higher (12v) voltage to cover the voltage drop of the 4 leds.
Some pics of under the table;
Light at the end of the tunnel
OK! loads of progress to update on, it's been a while since I have had a chance to do this entry on the terrain.
The tunnel grouting turned out OK, I have learned a lot about terrain building from Mel the Terrain Tutor, he has a great resource on YouTube and I encourage anyone wanting to find out more to visit his channel https://www.youtube.com/channel/UCx_aro8CTHw7ZD5H661hC6Q
He has some brilliant ideas and hacks about making your own materials and well explained tutorials on landscaping that I have borrowed from heavily as you will see from the next few log entries.
But first to catch up, the tunnel was just begging for some lights and at that point I wired it for led's, the intention was to have white light but I didn't notice until I had them in position and was able to test them that I realised they were blue.
I printed a full size track layout using AnyRail v6.16 DRail Modelspoor Software (Trial Version), a resource that has proven really useful when planning a model railway.
The full size track layout was a useful guide for checking the tunnel for clearances.
What the Flock!
It was time to get on the internet and get some materials for the next stage, this is where I quickly realised how expensive the materials for model making were, I bought some small items (literally!) to get the feel for the scale and experiment with.
This is when Mel The Terrain Tutor came in, and I began creating my own flock and foliage using sawdust, fish tank sand, and a sponge.
I looked at making a static grass applicator but did't have the time or budget to make one never mind buy one, so I went for the super budget version and a balloon rubbed on my jumper, I experimented with PVA glue on a plastic tray, I put blobs of PVA on the tray and chucked some static grass at it, then waved my static charged balloon over it, looks OK and will do for now, cheap and cheerful.
I gathered up the sawdust from the table saw and used acrylic paint to colour it, left it to dry for a couple of days then sieved it into 3 different sizes.
I took some fine light sand out of my aquarium and after mixing it with acrylic paint I aggressively dried it on top of the wood-burner.
I then shredded a sponge with my drill and wire brush and once again coloured with acrylic paint, then air drying for a few days.
Garden earth and leaves collected from the garden baked and sieve graded into 3 sizes completed the terrain material creation.
The grout rock tunnel structure was painted brown then the LED's soldered and sunk into the tunnel roof, later after rigging up a 3v tester from two AA batteries I realised that the LED's were blue, can live with it as it was the only long nose LED's I had, plus they were soldered and embedded in place at this point. These were linked together by the -ve terminal and each with a tail back to the control box area in the tunnel hill centre.
Having being gifted a kitchen table I test fitted the terrain and measured the overall height. I had to cut the corners of the board base to accommodate the leg brackets of the table.
Stairway to Heaven!
My attention turned to the buildings that we want for the layout, a Station is a must, once again I printed, cut out and assembled the building using scalescene kits. These are pretty detailed and take a lot of time and patience to build, but really satisfying to complete, the stairs and roof trusses on the station look awesome, there is a good chance a casual admirer would not notice, but a nice touch if you take the time to try to see through the windows. More buildings to follow.
The station was mounted on a bit of plasterboard that happened to be the right thickness for the platform, having finally bought the extra track needed.
The next stage is to run all the wires for LED's, Servo's and track bus back to the control box area ready for fitting the hardware.
Now that the electronics hardware has been confirmed, I've been able to update the code bases to better reflect the hardware we'll use. You can see my code on github
The main changes on the Arduino/Teensy side have been to support the i2c PWM boards, as well as the Neopixel RGB strip. Instead of stripping out and re-writing from scratch I took the classes I had made for the placeholder hardware and added support for the new additional hardware. This means that my local test piece still works but I can easily change the code over to the new hardware once I get it up and running.
On the Django/Webserver side of things I was adding support for the Servos which will be used to control the track point switching. The buttons have been added and I've included an image of the track layout to make it clearer what areas the servos affect. I'd like to add a further layer to the interface that indicates what position the track switch points are in and how the servos effect this. It's a work in progress.
Further backend work was also done so now the Django database is updated when commands are sent to the Arduino Effects Manager. This means when we refresh the page it should show the current positon of all of the connected hardware. A future development will be to add feedback from the Arduino Effects Manager so that the database is fully reflective of the hardware. Currently we're working on the assumption that the database and physical hardware currently match up which might not be the case at first start.
The project has been quiet on Hackaday but we've been working away on finalising the electronic elements. We've been working to build the layout, settle on the scenery and, most importantly for electronics, settling on the number of LEDs required. We're estimating around 60 single LEDs across the whole table for lighting effects. This includes Street Lighting, Cars and individual LEDs inside the housing. Once that was settled, I went shopping;
17th of December is our wiring date. It's the day I'll be onsite with the build and we'll be putting all of the electronics together. The planning stages have been fun but I can't wait to get hands on.
Having recently tiled the bathroom I had some grout left over, it occurred to me while tiling that this could be used to make scenery for the train table. I sourced some cut offs of wall insulation foam by chance at my local tile DIY shop - shout out to Solway Tile, cost me £1.00 for insulation and £3.89 for the grout, 70% used on the bathroom the rest used for project.
We wanted a tunnel with lighting options and with the sides being visible via the perspex sides, using the foam and a knife I measured up the curve of the track from the full scale plan and cut the foam roughly to the right shape, I then carved the foam with the knife, cutting out chunks to look like rock face.
I constructed the tunnel by joining the pieces of insulation together with cocktail sticks and wood glue, I used chop sticks to keep the foam in line with the base. I then mixed up the grout and added some brown paint (£1.99 The Range) just to take the whiteness off. I painted the grout on to the foam with an old brush and assembled the tunnel structure. The chop sticks allow me to leave the upper section free to remove for further construction.
As the grout was drying I realised that the centre section of the hill that forms the tunnel would be a great place to hide some electronics and if I can make it accessible from the top somehow, it would be ideal for top down maintenance or expansion.
Kind of winging it at this stage with the terrain, adapting as we push forward with the build, the rough terrain idea is for a rolling Hill with tunnels in half the layout and which levels out to a small village with a station and engine shed. We really need an idea of electronics requirements at this point (position and number of LED's, points servos, signalling and sensors) , both for the electronics design and the modelling .
Using Smart Models printable building kits, I have created a few test buildings for the project, one early attempt was used for testing with the LED lighting, these paper-craft buildings in N Scale are really small to work with and a few things learned on early builds were that cutting out with a craft knife has to be precise, straight cuts on the line are vital (had to get a pair of reading glasses from the pound shop) Also glue gets everywhere (maybe just me) accurate gluing with minimum glue is required. Tweezers, magnifier and toothpicks are handy tools to have around.
Oh yeah bought some sheep from China too.
Needless to say I have got better at paper-craft and planning on doing a small village scene, but first the track layout is next on the list. First of all the dimensions are somewhat dictated by the glass top which is 1100 mm by 600 mm. We used a trial version of layout planning software AnyRail to come up with a layout that is simple but has enough interest with two trains running simultaneously. This turns out to be more of a challenge than meets the eye if we want to automate the running with manual override capabilities.
We have some track in the workshop but not enough for what we have planned, we will need to hit amazon or eBay at some point but for now we have printed out a full scale plan of the track layout allowing us to consider the table construction and the scenery construction.
The model train world has moved far forward from the old-school days of analogue current motor control. It's now possible to have multiple trains on a track with sound effects, lights, and motors, and control these trains with ease. DCC (Digital Command Control) is the cool new way to do this. It's a command protocol on the rail lines that allows for addressing and commanding of individual trains on a shared "network" of rail line. DCC can be thought of as quite similar to an i2c or rs482 communications bus but also supplying power at the same time as data. We're planning to use, likely 3, N-scale locomotives for our train layout that all have DCC decoders built into them. To interface to the DCC decoders on the trains we're using the Sprog 3 Command Station.
The Sprog 3 is a simple USB based DCC controller that allows for both programming and running of devices on a DCC rail network. It's a really small packaged device and it works on a simple serial command interface. Traditionally it's connected to a PC or Raspberry Pi running JMRI which is a super powerful program that handles reprogramming of devices, track layouts and automation and a tonne of other stuff; it's actually over powered for what we're looking to do and I'm excited for the opportunity to create my own interface for working with the Sprog. To be fair, another reason we're using this controller is it was repurposed from a previous project so essentially for this project it was free.
DCC Command Protocol
So when it came to working with the Sprog I had a little bit of a harder time than expected. The documentation for the Sprog is reasonable. It has a command list for "rolling roads" and other testing features but these setups tend to be for reprogramming purposes. When it comes to actually running a full working track layout you need the sprog in it's command mode instead.
I needed a way to get a better look at what the command structure should be for the Sprog. I struggled to find anything under "Dcc command list" on google due to an open source "Dcc controller" project that actually led me astray. In frustration I tried a different tactic; I setup JMRI and after a lot of jigger-pokery I managed to get it up and running with my lovely little DCC decoder tester.
The decoder tester is basically a deconstructed train on a pcb. It has lights, a motor and speaker and with a decoder plugged in it reacts exactly like a train. Using JMRI (which reaffirmed my opinion that it's overly complex) I was able to monitor the packets that JMRI was sending to the Sprog based on my inputs to the JMRI "throttle" control. This made it clear that the Sprog works on a packet format similar to;
< O -Train Address- -Data 1- -Data2- -CheckSum- >
Now I could have simply gone through the process of testing every button press and speed value, creating a look up table of commands and using that to jerry-rig the control I wanted, but obviously it was much better to understand the packet and decode it to allow me to create commands on the fly. I did a couple of easy checks to start out; Speed, Forward, Backward, Stop slow and hard emergency stop. Interestingly these commands were all encoded in one packet. I thought that possibly there would be a separate command for direction and then speed but this didn't turn out to be the case.
Clearly I needed some documentation to move forward. I contacted the owner of the Sprog site and he replied pointing out that the sprog accepts "standard NMRA DCC commands". That led me down the rabbit hole of eventually finding the NMRA spec sheet for DCC commands. Reading through the document we can see that the DCC commands are based on a packet layout as discovered and use the individual bits in a byte to differentiate the different commands and control. Another point made to me in the email was that JMRI repeatedly sends the same commands over and over again. This makes sense...Read more »