HantuBlauLOL Posted December 29, 2014 Share Posted December 29, 2014 (edited) Recently I got this idea, after seeing the price of Kato's sound box.. But I have very little knowledge about electronics, so I'm going to ask here. Here is how it would works: The voltage input from a DC controller controls the engine pitch sound, and track sensors controls the volume (close: Bigger sound, far: Quieter sound). The sound file would be .mp3 or whatever that can be imported from a windows based computer. An Arduino perhaps? Thanks! Edited December 29, 2014 by HantuBlauLOL Link to comment
kvp Posted December 29, 2014 Share Posted December 29, 2014 This is pretty much how any Tomix sound equipped cab works. They also measure the backemf from the locomotive motor, so sound calculation can use the actual speed of the locomotive and not an estimate from the track voltage. This is also how most DCC sound decoders work. A larger arduino should be capable of doing this. There is an audio playback library available too. You can also mix various sounds (tunnel and bridge noise, brake and compressor sounds) into the output, depending on the state of the locomotive and various keys pressed. (brake sound on fast deceleration, compressor sound after braking, door open and close sounds at platforms) Besides the arduino, you would also need an sd card reader and an audio output/amplifier shield and an interface board for the track sensors and any buttons you wish to use. ps: The Tomix threadle type track sensors work by pulling down the two side wires to the middle ground based on track voltage polarity. You should pull up the two side wires up to 5V with 10k ohm resistors and connect the middle to ground, so they can be sensed on the arduino like simple buttons. They can be daisy chained too, since they have an open collector output. 1 Link to comment
HantuBlauLOL Posted December 30, 2014 Author Share Posted December 30, 2014 I dont think using back emf would be useful in DC as the motor speed isn't constant, but the voltage is.. I have no experience on arduino, I don't want to buy the complex one first.. Does arduino uno capable of doing this? Personally I'd like to use LDR sensors, as they are simple and small. Proximity sensors are bigger and unprototypical.. Link to comment
kvp Posted December 30, 2014 Share Posted December 30, 2014 Backemf depends on the speed of the motor and measured during the tristate phase of chopped pwm drive. This is the drive method of dcc decoders and most tomix analog throttles. Threadle sensors are prototypical, just not very common since the introduction of track circuits. The interface of an optoisolated occupancy detector is exactly the same. Link to comment
HantuBlauLOL Posted December 30, 2014 Author Share Posted December 30, 2014 Could you provide the circuit diagram? I have no idea on how pwm and backemf works.. Also which arduino should I use? Link to comment
kvp Posted December 30, 2014 Share Posted December 30, 2014 For pulse width modulation, you only need a H bridge motor driver chip. Set the direction input, brake input (to brake off) and pulse the enable input with a square wave between 0 and 99 percent. During the off period, when the driver is not powering the motor you can measure the voltage. It would take quite a bit of time to draw a full circuit, but any bidirectional DC motor driver shield should work, so you don't have to design one yourself. For measurement, a bipolar voltage measurement shield with a +/-12V range should be ok (or +/-20V if you are using 12V for PWM, just to be safe). The voltage measured on the motor terminals (on the rails) when the driver chip is disabled should be proportional to its speed. For a more simple circuit and software, you can skip the backemf feedback and just generate the pwm signal for the motor driver, so you can get good results with only a H bridge chip. For audio playback i would suggest a combined dac/audio amplifier shield. Link to comment
HantuBlauLOL Posted January 1, 2015 Author Share Posted January 1, 2015 Motor driver = recitifier? Also I just discovered that backemf is a voltage after being applied to the motor, am I right? Link to comment
kvp Posted January 1, 2015 Share Posted January 1, 2015 (edited) Motor driver = recitifier? No. The motor driver is a transistor H bridge circuit containing 4 transistors, some diodes and all support circuits needed to control them. The idea of a single chip version is that transistor level digital signals and higher voltage power for the motor goes in and controlled current comes out. You control the speed of the motor by turning on and off some of the drive transistors very fast with a digital circuit and the motor's momentum smoothes out these pulses into a specific speed. Backemf: This is the voltage you can measure on the terminals of a spinning motor once you disconnect the drive voltage. The motor essentially turns into a generator and the unloaded voltage is proportional to the speed of spinning, so can be used to indirectly measure the speed of the motor. Essentially a H bridge is about 40% of a simple DCC digital decoder. The other main component is the microcontroller which is a single chip computer that can be programmed and controls everything. Building a circuit like i described is actually as complex as designing and building a sound equipped DCC decoder (you just don't have to make it small, because it would be under the layout, not in a locomotive). So imho if you don't really have at least a basic level in electric engineering you might be better off buying the off the shelf systems. They cost so much because it takes several hundred engineering work hours to design them. For single items, component costs are very low compared to the design and programming costs. So, i'm sorry for making it sound too simple. The small automation unit i've built took around a total of 16 hours to build (over a few days between family visits), with around 1 hour to find the materials and tools (tracks, circuits, trains, wall adapter, chips, proto board, soldering station) scattered around the house, 9 hours to design the circuit to use the available parts only, 5 to solder it together (i'm slow) and 1 hour to write the program. Suprisingly it worked on the first try, so no testing and bugfixing was required apart from watching it go without a hickup for 15 minutes. This would cost around 600 usd in engineering and technician wages in the US. Doing it at home for fun is free of course. Now a dcc decoder with sound playback functionality (or an external sound box as in the title) is a slightly bigger task, around 300 hours (38 work days), so around 11000 usd, and still without parts and assembly costs and without a custom box to put it into. The chinese version in an off the shelf plastic box would be somewhat cheaper of course, but the design time is still the same. ps: My suggestion is if you really want to build one is to read up on Arduino-s, the use of dc motor control shields and available off the shelf versions and the use and availability of sound playback shields. Then you can just get them and connect everything up and write a program to control them. This part will require some knowledge of embedded software engineering, but thanks to the friendly environment of the arduino platform, not more than what an average person with some kind of higher degree could learn in a few weeks. Then after around one or two months (if you work on it an avergage of 8 hours every day) you will have something that works the same way as the Kato sound box, so you only have to find sound files for it to work and could also be mass produced. I'm pretty sure some talented people could do it faster, but i've calculated with my own speed. Edited January 1, 2015 by kvp Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now