Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Scratchbuilding an Animated Water Tower

6716 views
7 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    June 2009
  • From: QLD, Australia
  • 1,111 posts
Scratchbuilding an Animated Water Tower
Posted by tbdanny on Tuesday, May 29, 2018 11:53 PM

Part 1: Basic Structure

All steam railroads need water towers, and the BVLC is no exception.  I'd planned to have one water tower on each side of the layout, given that they depict different ends of the same line.  With that in mind, I scatchbuilt and animated both of them.

I started by cutting two Pringles cans to length, to form the tank.  I wanted to make the roof removable, so I used the top half of each can.

The boards around the outside were made from coffee stirrers, cut to length and stained with my usual stain.  This is a mix of water and black acrylic paint.  When dry, it gives the effect of weathered wood.  I also built two wood platforms for the tanks to rest on, out of basswood stained the same way.  At this point, I realised I'd made a bit of a mistake.  Most of the prototype photos I'd collected for inspiration didn't have a wooden platform.  Instead, these tanks seemed to be mounted directly on wood frames.  As such, I decided to modify my design.

I started by cutting two circles out of thick cardboard.  I'd cut the coffee stirrers slightly longer than the Pringles cans, and these cardboard discs fit just inside them.  After cutting a hole in the middle of each disc, I glued them in place with the plain side down.  The bottom ends of the coffee stirrers were then sanded down evenly.

Using basswood, I constructed frames under the tanks, based off what I saw in the prototype photos.  Two of the support beams were extended out beyond the sides of the tanks.  These will be supporting the boards that hold up the spout and pulley later on.

Once that had dried, I added the legs.  I used a small length of wire drilled into the end of the wood to reinforce the joins.  I wanted to make the towers removable, in case the servos need to be replaced in future.

On the Camp D side, the water tower is going on level ground, however on the Camp A side it was mounted on a hillside.  As such, I designed and 3D printed two sets of concrete 'feet' for the towers.  The ones on the Camp A side have their base angled at about 14 degrees to match the hillside.  The others are flat.  I had them done in Shapeways 'white processed versatile' plastic.  This plastic has a rather grainy finish, which can be smoothed with the application of liquid putty.  In this case, however, I wanted a coarse finish.  Once painted grey, the feet had a finish similar to concrete.

I glued the feet in place.  Each leg had to be cut to a different length in order to get the tower to sit level.  With the body sorted out, I then turned my attention to the spout mechanism, which I'll be covering in part 2.

The Location: Forests of the Pacific Northwest, Oregon
The Year: 1948
The Scale: On30
The Blog: http://bvlcorr.tumblr.com

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Wednesday, May 30, 2018 1:15 AM

Looks good! This will be an interesting thread to follow.

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    September 2003
  • 10,582 posts
Posted by mlehman on Friday, June 1, 2018 2:51 AM

I agree with Dave, looks great and your documentatin encourages others to give it a try.

Mike Lehman

Urbana, IL

  • Member since
    June 2009
  • From: QLD, Australia
  • 1,111 posts
Posted by tbdanny on Sunday, June 3, 2018 2:34 AM

Part 2: Spout and Mechanism

In this post, I'll be covering how I built the mechanism for these water towers and some of the detailing.  Each step was done on both water tower models at the same time.

My design called for a servo to be installed inside the tank itself, which would raise and lower the spout via a thread attached to it.  To allow the thread to move smoothly, the first thing I had to do was construct a pulley for it.  I had some N scale wheelsets handy, so I used the wheels from those.  They were taken off the axle and drilled out to fit over a brass rod, then glued face-to-face.  This rod would then fit within some brass tubing that allowed it to rotate freely.

While these were drying, I added the cross-bracing to the water tower legs.  This was formed from 1mm copper wire.  I drilled holes into the wood legs at the correct angle, then passed the wire through.  Once the wires were in place, I soldered them together where they crossed over and filed it to shape.  I've tried using glue on copper wire before, and that's never really worked for me.

My next step was to put in the counterweight and support for the pulley.  I decided to model it as though it were an enclosed counterweight, as I couldn't figure out a way to make the counterweight move with the spout.  Also, this helped to disguise the fact that the thread was going into the tank itself, rather than being attached to a counterweight.  To prevent the thread wearing down the wood and cardboard, I added a small section of brass tube.  This runs into the tank itself.

Once this was in place, I added the boards to support the pulley.  These had holes drilled out to accommodate the brass tube that would hold the pulley.

While waiting for this to dry, I started working on the servos.  They needed to be mounted high in the tank, so I cut supports for them out of plywood.  I used the mounting screws that came with them to hold them in place.

Once the support boards were dry, I added some detailing around the counterweight.  To represent a cover plate over the brass tubing, some strip styrene was used.  I added two NBW castings to it, drilled a hole for the tubing and painted it with the 'faded red' I use for weathering.  When it was dry, I glued it over the brass tubing and painted the tubing the same colour.  I also weathered it at this point, as I wouldn't be able to do so after the pulley was in place.

With that finished, I installed the pulley.  I painte the brass tubing before installing it, and pushed it through from each side.  Before gluing it in place, I turned the pulley by hand to ensure it moved freely.

Now that the pulley was in place, the next thing was to install the spout.  In order to allow it to move, I filed it flat at the end and glued a length of brass tubing over it.  This was just wide enough to fit over 0.8mm copper wire.  To provide the support, I used the same wire in the same tubing.  The support tubing was glued into the wood, then the wire passed through it and the spout tube.  The wire was then glued in place at each end.  When it was dry, I checked each spout and found that they moved freely.

This isn't the first time I've tried to animate a water tower.  Back when I was in HOn3, I took a D&RGW water tower kit and tried to animate it in a similar fashion.  However, it didn't work, for two main reasons.  The first was that the spout casting was plastic, and the second was that I used fishing line to control it.  The fishing line had been coiled up, and didn't uncoil properly.  With the spout being plastic, it didn't have enough weight to pull the fishing line down.

As such, I made sure to use a whitemetal casting for these water towers, as well as thread instead of fishing line.

Each servo came with several attachments, to allow various connections.  My plan was for an 'arm' to come off the servo, which would be attached to the string.  It would be in a horizontal position for the spout being lowered.  To raise the spout, it would rotate downwards through 90 degrees, pulling the thread with it.

I cut some square brass tubing to length, then filed down the servo attachment and glued the tubing over it.

Once they'd dried, I drilled a hole 3mm in from each end.  These were to accommodate the brass screw to which the thread would be attached.  I then attached the arms to the servos.

Before installing them, I tested them with an Arduino and my computer, to determine how they behaved and how I would need to program them.  I discovered that due to the way I'd oriented the servos, they had to start at an angle of 0 and increase the angle to move the arm down.

With the servos sorted, I turned my attention back to the water towers.  The spout castings included the pipes they attach to.  I cut these to length and painted them, then glued them in place between the first two support beams.

I then glued the servo mounts in place, making sure to leave the hole in the floor clear.  I then attached thread to the spouts, and ran it through the brass tubing into the tank.  It was cut so that there was no slack with the spout in the 'down' position.

With this in place, I tested the mechanism again, with my computer and an Arduino.  I found that having the arm go down 90 degrees was too far, and that 75 degrees was enough to raise the spout to a suitable 'up' position.

That's it for part 2.  In my next post, I'll cover the final detailing, as well as the Arduino code that makes the animation work.

Tags: scratchbuild

The Location: Forests of the Pacific Northwest, Oregon
The Year: 1948
The Scale: On30
The Blog: http://bvlcorr.tumblr.com

  • Member since
    July 2006
  • From: Bradford, Ontario
  • 15,797 posts
Posted by hon30critter on Sunday, June 3, 2018 8:20 PM

Great tutorial!

Dave

I'm just a dude with a bad back having a lot of fun with model trains, and finally building a layout!

  • Member since
    November 2007
  • From: California
  • 2,388 posts
Posted by HO-Velo on Monday, June 4, 2018 8:21 PM

Your skill, creativity and techniques cross over into all scales, I contiune to admire your work and echo Dave's sentiments, great tutorial!

Thanks & regards, Peter 

  • Member since
    June 2009
  • From: QLD, Australia
  • 1,111 posts
Posted by tbdanny on Saturday, June 16, 2018 12:20 AM

Part 3: Detailing and Animation

With the mechanism built, I put the final details on the water towers.

The bands were made out of cardboard from a cereal box, painted with the same faded red that I'd used for the brass tubing into the tank.  For the metal plates over the pulleys, I used styrene with NBW castings.  I also painted the cross bracing between the legs and added some NBW castings over the holes I'd drilled to install the wires.

I wanted to have the roof removable, in case the servos need to be replaced in future.  In order to accomplish this, I 3D printed a 'lid' for each water tower.  Internally, they match the diameter of the Pringles can lid.  To get a 'tarpaper' like texture on them, I built up layers of masking tape.  Each piece of tape was cut to match the angle of the roof section.

Once the tape was in place, I used narrower tape to form the seams between the sections.  At the top, I applied some body putty to provide a smooth peak.  Once this had dried, I sanded it into shape.

Before installing the water tower on the layout, I hooked it up to an Arduino, wired up identically to how it would be installed on the layout.  After testing the code I'd written, I made a couple of tweaks.  The final code is as per below:


 

#include <Servo.h>
#include <OneButton.h>

//Below variables are for the Water Tower servo controller
const int startAngle = 75; //Initial angle for the servo motor
const int endAngle = 0; //Ending angle for servo - where it stops in the raised position
const int servoDelay = 15; //Delay (in ms) between servo steps
const int servoOutPin = 10; //Output pin for servo control
OneButton contButton(17, 1); //OneButton object for servo control - this is pin A3 being used as digital.
const int servoLEDPin = 11; //Output pin for indicator LED
Servo towerServo; //Servo object for the water tower

void setup() {
  //Initialise stuff for water tower servo
  towerServo.attach(servoOutPin);
  contButton.attachClick(towerAnimate);//attach the Single Click function to this event
  pinMode (servoLEDPin, OUTPUT);
  towerServo.write(startAngle);
}

void servoLower (int startPosn, int endPosn, int servoPause){
  /*Takes the desired starting and ending positions as arguments.  E.g. 0
  for start and 45 or whatever the closing angle is for end.
  This has the effect of raising the spout - it lowers the servo arm.*/
  for (int pos = startPosn; pos <= endPosn; pos += 1){
    towerServo.write(pos);
    delay(servoPause);
  }
}

void servoRaise (int startPosn, int endPosn, int servoPause){
  /*Takes the desired starting and ending positions as arguments.  E.g. 45
  for start and 0 for end.
  This has the effect of lowering the spout - it raises the servo arm.*/
  for (int pos = startPosn; pos >= endPosn; pos -= 1){
    towerServo.write(pos);
    delay(servoPause);
  }
}

void towerAnimate(){
  digitalWrite(servoLEDPin, HIGH);
  /*System assumes that the water tower starts with the spout in the 'up' position - i.e. with the
  servo down.  So servo will need to be raised, paused, then lowered.*/
  servoRaise(startAngle, endAngle, servoDelay);
  delay(5500);
  servoLower(endAngle, startAngle, servoDelay);
  digitalWrite(servoLEDPin, LOW);
}

void loop(){
//This acts as a 'listener', to determine what is being input and calling the appropriate subroutine
  contButton.tick();
}


 

This is part of a larger sketch, which runs my automation controller Arduino on the Camp A side of the layout.  Only the parts relevant to the water tower animation have been included above.  Starting from the top, I've included two code libraries, the Servo library and the OneButton library.  The former defines functions to control a servo motor.  The latter, which can be downloaded here (https://www.arduinolibraries.info/libraries/one-button), is designed to help with using buttons.  Instead of having to handle things like the 'debouncing' of buttons, setting the input pin, activating the built-in resistor, etc in code, this library takes care of it all.  It can also detect single presses, double-presses and when the button is held down, which allows you to use the one button for multiple functions.

(Debouncing refers to filtering out the multiple open/closed signals generated by a single press of a button.)

Next up, I defined the various values and objects that will be used by the code.  I prefer to define these in a single place, then use the names in the code.  This means that if these values need to be tweaked, it only needs to be done in the one place, and it ensures that none of the uses of that value is missed.  I've also defined them as constants, rather than variables (as per the 'const' keyword).  This saves memory space in the Arduino, and also prevents them from being accidentally changed.

The OneButton and Servo declarations are not constants, but instead create an object in the program code.  In programming terms, an object is a construct which contains various functions and variables to allow it to be used and store data.  The values given in brackets for the OneButton object tell the object which pin it needs to use to receive input from the button, and to activate on initialisation.

Next up, we have the setup() function.  This is one of the two standard Arduino functions, and it is run when the Arduino first has power applied.  As such, it's usually used for code which needs to run on startup.  In this case, the setup function:

  1. Tells the Servo object (towerServo) which pin to use to send the control signal to the servo.
  2. Tells the OneButton object (contButton) which program function to execute when it detects a single button press.
  3. Sets the pin used for the LED to an output.  This is used to light up an indicator LED on the layout fascia, to indicate that the Arduino is responding.
  4. Sets the towerServo to the starting angle.  The system makes the assumption that the servo is starting with its arm in the down position, which has the spout raised.  However, when power is first applied to the servo, it jerks back a couple of degrees.  This line sets it back to the correct starting angle.

With that done, the code is now ready to run.  However, there are three other functions defined before the main part of the program, each of which plays a role in the animation of the water tower.  When it comes to programming, I tend to use a modular approach.  This simplifies debugging, and allows individual sections of the code to be tested before being used in the program as a whole.  In this case, the servoLower and servoRaise functions were copied over from the code I'd written to test the servo in part 2.  These had worked then, so I knew they were proven code.  Both functions work the same way, just in different directions.  Bear in mind that the program defines things in terms of the arm attached to the servo.  When the arm is raised, the spout is lowered and vice-versa.  The arm is raised when the servo angle is 0, and lowered when it's at startAngle, which in this case is 75 degrees.

Both the servoRaise and servoLower functions take three values as arguments; the angle of the servo at the start of the function, the angle at the end of the function, and the delay in milliseconds between each step of the servo.  Each function then goes into a loop which basically adjusts the position of the servo by the current position + or - 1, then pauses for the specified delay, until the end angle is reached.  This is required to provide a smooth animation.  If I were to simply tell the servo to go to the end angle, then it would snap to that position, which would move the spout instantly and possibly damage the mechanism.

Following these, we have the towerAnimate function, which is called when the button is pressed, and does the actual animation.  When called, the very first thing it does is write a HIGH to the LED output pin, which turns on the LED on the layout fascia.  This mainly acts as a trouble indicator.  If the LED comes on but the spout doesn't move, then there's something wrong with the servo or the connections to it.  Following this, it calls the servoRaise function to raise the servo arm and lower the spout.  It then waits for 5.5 seconds, then calls the servoLower function to lower the servo arm and raise the spout back to its original position.  Once all this is done, it writes a LOW to the LED output, turning it off.

There's one final piece of the puzzle needed in order to make this all work.  The loop() function is the other standard Arduino function, and this is the main body of the program.  Following the setup, the loop function will run over and over in a loop, until the Arduino is turned off.  In this case, all that's needed here is to call the tick function of the contButton object.  This checks if the button has been pressed, double-pressed or held down and if so, it calls the associated function.  In this case, that's the towerAnimate function.

Once I'd added the above code to my automation controller sketch and uploaded it to the Arduino, I tested it on my workbench.  I replicated the way it would be wired, with the Ardunio coming off one voltage regulator and the servo off another, with a common ground.  A spare button and LED connected via a breadboard filled the role of the fascia-mounted hardware, which was already in place.  After confirming it worked as expected, I installed it in the layout.

To allow it to be removed for maintenance and servo replacement, I used a small amount of Blu Tack on the base of each leg, to stick it into the concrete feet.  I added a water level indicator, made from a coffee stirrer, thread and some styrene rod.

Here's a video of it in action:

The Location: Forests of the Pacific Northwest, Oregon
The Year: 1948
The Scale: On30
The Blog: http://bvlcorr.tumblr.com

  • Member since
    January 2017
  • From: Southern Florida Gulf Coast
  • 18,255 posts
Posted by SeeYou190 on Saturday, June 16, 2018 12:28 AM

WOW! Great work and well written tutorial!

.

Thank you very much for sharing this interesting (and inspirational) project.

.

-Kevin

.

Living the dream.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!