Wireless train controller - Page 1
Forum section: electronics / projects

author: TarHeelTom
author_rank: Newbie
timestamp: November 02, 2014, 09:05:12 pm
content: This will probably be a long thread. Bought a 1/8 scale gasoline powered locomotive. About a 10 hp engine and a hydrostatic drive. Here's a few old pictures. Need to find some newer pics and post them also.http://tomwade.me/tw/trains/dash9/Here's also a short video of our railroad.The orange engine is operationally similar to mine.Currently controlling this engine with a single DPDT center off (spring loaded) toggle switch mounted in a small project box, with a single small cable leading to the locomotive. One problem is that as the engine gets nearer completion, there will be more and more switches, and a bigger and bigger box and a large connector connecting the box to the engine. My friends engine uses a 36 pin connector. That cable is also hard to find and expensive.I want to use a smaller cordless box, with still the same toggle switch, one or two push buttons, a small LCD display, and an eStop button.The hydrostatic drive has a single control arm which gives you full forward in one direction, and full reverse in the other direction. This is driven with a long linear actuator. Although you can worry it into the "center off" position, there really is no "neutral" position. So to stop, you have to move the actuator toward the "neutral" position and hunt for the stopping point. Sounds easy, but the eStop first needs to discover in which direction the locomotive is moving.So, for starters, I need to discover direction of motion, then rate of motion (speed), then start moving the actuator, and monitor the speed until the train is stopped.There is easy access to one sprocket. Thought I'd mount several small magnets, or reflectors, to the sprocket, then use a Hall effect transistor or photocell to count the number of events. That will give me speed. Thought perhaps two hall effects side by side would give me a direction signal. One or the other of the two sensors will trigger first. I have no idea what kind of circuitry could be used to tell me which HES "fired" first. So that's my first call for help. But I'm sure it won't be the last.Tom

author: nctnico
author_rank: Super Contributor
timestamp: November 02, 2014, 09:46:50 pm
content: First of all I'd make the eStop interrupt the ignition and close the fuel valve.To know the position of the lever I'd mount an analog encoder (=highly reliable potmeter) to it so you get an exact reading of the position of the lever. Setting the level to a certain position is then a matter of a simple servo control loop.I still don't see why you would need so many connections. Maybe eloborate on that first.

author: ajb
author_rank: Super Contributor
timestamp: November 02, 2014, 10:17:16 pm
content: Quote from: nctnico on November 02, 2014, 09:46:50 pmSeconded, and the E-Stop should be configured so the the physical switch must be closed to operate the locomotive.'E-Stop' and 'cordless' is not an easy combination to achieve. If the size/price of the connector and cable is a concern, you could put one MCU in the locomotive and one in the control box and use cheap Cat 5 cable to carry a duplex RS-485 connection between them on two pairs, an interlock loop for the E-stop on the third pair, and even a moderate amount of power to run the control box on the fourth pair.

author: TarHeelTom
author_rank: Newbie
timestamp: November 02, 2014, 10:34:19 pm
content: Don't want to shut the engine down, just stop the train. I *THINK*, but haven't confirmed this, that shutting the engine down would stop the pump in the hydrostat, with unknown consequences. I think that shutting the engine down would immediately lock the hydrostat, thereby locking the wheels on the loco. Would for sure result in spilling passengers all over the place, and most likely derail the train. I have called this eStop, because I'll use a small eStop switch, but this will be for more than just emergency stops.The operational problem here is that the linear actuator which moves the bellcrank on the hydrostat moves very rapidly. If I had my druthers (but I don't) I'd have bought a slower actuator. But I've never seen any options in the catalogs for actuators of different speeds. And the actuators were included with the engine, so I'm stuck with them, at least financially. If one is sitting in the station and just holds the toggle switch forward, the train will leave the station with a very big lurch, which would NOT encourage the passengers to come back. Same thing with stopping. One changes the speed of the train by doing repetitive small bumps on the toggle switch, asking for very small speed increases at a time.When it's time to stop, one bumps the toggle switch to the rear a little at a time. One problem is that there is no easy way of knowing when you have reached the "neutral" point on the bellcrank. Several guys have put in linkages with multiple micro switches to indicate which direction the bellcrank is pointing, and when neutral is reached. All of these tend to be finicky, especially as the rotational travel on the bellcrank is only about 20°, and the linkage is a bit long and the microswitches are somewhat remote from the bellcrank itself.Hence, I want to use a pulse width modulator to generate pulses so that the engineer can just push the toggle and just hold it, more or less. And using a "speedometer" to measure speed and direction of rotation would more reliably (I think) let a computer find the neutral position.Why so many conductors? There are three linear actuators, and one needs to feed them in either polarity to make them go in either direction. Most guys are using multiple relays to accomplish this.The headlight needs to operate in either dim or bright, depending on direction of travel. Air brake controller for the train, operate the compressor, and operate the air release. Parking brake for the locomotive. Bell. Horn. And several different lighting circuits.I plan to move the existing ignition switch and starter control to the rear of the engine and hard mount it there. The ignition switch seems to only ground the ignition coil, and results in a big load. Could possibly put a big relay on it, but probably won't. Also need a battery cutoff switch, which will also be mounted on the locomotive.Tom

author: nctnico
author_rank: Super Contributor
timestamp: November 02, 2014, 11:21:51 pm
content: I'd definitely removed the microswitches and use good potmeters to have feedback on the position of the linear actuators. Doesn't need to break the bank but makes life so much easier. Like others suggested: sending messages over an RS485 link (UART) is a good solution to reduce the number of wires. Maybe go for CAN. CAN might be harder to get going at first but the bonus is that the adressing and message format is solved mostly in hardware.I'd certainly test what happens if the engine shuts down. After all the engine could stall or malfunction.For the rest: I'm sorry but it sounds like an insurance nightmare. Better get this really right (safety first) or don't work on it at all.

author: TarHeelTom
author_rank: Newbie
timestamp: November 03, 2014, 12:04:16 am
content: Quote from: nctnico on November 02, 2014, 11:21:51 pmOddly enough, these actuators come with pots installed. First thing the builder did was to remove the pots. (He was a mechanical engineer).After working on this rr for more than ten years, I don't ever remember an engine stalling, and only remember one work train which just ran out of gas.A RS485 link would reduce the number of wires, but a wireless link reduces the number of wires, and possibly the cost, even more. I've found a pair of 2.5 GHz transceivers for under $4. Thought I use an arduino board and a 2 x 8 or 2 x 16 line LCD display in the remote to generate a code sequence for each command and send it to the loco, which would echo most commands back, plus provide a continuous speed readout. Would need either a big relay shield or a breadboard with lots of relays to make things happen.One nice benefit of using the HES and magnets is that's technology that I'm already using in other places. Almost every aspect of finding the speed and operating all the lights, bells, etc is stuff I'm already comfortable doing. The one thing I'm missing at the moment (at least in my mind) is the ability to determine the direction of travel.And insurance is a concern. No club such as ours has ever had a claim, but one club had a derailment, with absolutely no injuries, but some bystander picked up his cell phone and called 911. Our rates went up ten fold overnight, and have gone up more since then.But this is my locomotive, and I'm the one who has to do the work. Radio control is not a hard problem. Across the street from us in the park is an old military airfield where they fly RC aircraft almost year round. And right beside that is a off road track where they race RC cars. So how do I determine which HES fired first?Tom

author: TarHeelTom
author_rank: Newbie
timestamp: November 03, 2014, 05:04:34 am
content: So how would one work the linkage between a pot and a linear actuator?Tom

author: nctnico
author_rank: Super Contributor
timestamp: November 03, 2014, 09:14:34 am
content: Isn't there a pivot point for the levers? That would be an ideal spot to connect a potmeter with a flexible link.

author: TarHeelTom
author_rank: Newbie
timestamp: November 03, 2014, 10:41:48 pm
content: Quote from: nctnico on November 03, 2014, 09:14:34 amThere IS a pivot point. But I'm not able to picture in my mind how to do this. Can someone suggest a particular potmeter that might work. Or a picture of something related?At the moment, I just stumbled onto the TLE4966L, which appears to be ideal.Tom