LGB-trains, Arduino and PWM
I have a garden railroad. I use LGB material. It's all analogue. I'm an analogue guy. That's why they call me The Old Man, Dinosaur or The Fossile at our Makerspace. Any way, I am working with a model dragline with DC motors, which are PWM driven by an Arduino. Works fine. My model locomotives are no different. It's a DC motor that drives it. PWM makes a motor turn real slow, making it ideal for slow moving locomotives in a yard, shuffeling cars. So the idea arose to have a certain amount of track and program an Arduino to control it. I coupled the Arduino setup for the dragline to a locomotive and yes, it works too. The only disadvantage is the sound and possibility to control the speed. A steamlocomotive producing a skreeking sound is not that elegant and max speed is slow. Bill did a topic on modifying the PWM pulse on the Arduino, maybe that might help with the sound and smoothening the PWM-wave.
I have a sound modul in my locomotive. It works on 12v DC, starting making sound at 7 v or so. PWM is a kind of AC. Is it possible to rectify it so I can use it to supply the soundmodule with "a regular" DC voltage?
Any suggestions on this item anyone?
PWM is a kind of AC. Is it possible to rectify it so I can use it to supply the soundmodule with "a regular" DC voltage?
PWM is already DC so there's no need to rectify it. But it is possible to filter it back into a nice smooth dc if what you are driving (like a sound module) doesn't actually need the PWM. You'll just need filter capacitors at the input of the sound module.
A steamlocomotive producing a skreeking sound is not that elegant and max speed is slow. Bill did a topic on modifying the PWM pulse on the Arduino, maybe that might help with the sound and smoothening the PWM-wave.
Yes, you can try using different frequencies for the PWM. PWM is pulse WIDTH modulation. So the modulation is being done via the timing of a pulse width. But the frequency you use is unrelated to pulse width. So you can try using different frequencies to reduce unwanted sounds. A lot of code uses a PWM frequency of 50 or 60 hertz which is compatible with many servo motors. But since you are driving PM motors there's no need to stick to those frequencies. So you can experiment in the code using different PWM frequencies. That should be in the code where you first setup the PWM parameters. Just try some different frequencies and see if the sound changes.
I've been reading all of your responses with much interest. As a want-a-be train enthusiast I have thought many times about how the old model electric trains could be improved but I never considered the challenges that come with an outdoor environment.
This suggestion may be model train heresy but here goes. Considering that one of the more costly challenges (both initial cost and maintenance) seems to be the track. I was wondering if using something inexpensive yet durable like concrete, pave stones or stepping stones as the base. For aesthetics, track could be painted or stenciled on to the bed. The painted rail lines could then be utilized by a line following camera/software and an engine that's self powered and steerable. This would require some significant modification to the engine by exchanging the steal wheels to something like rubber and the creation of a steering mechanism as well as remote control. The line following, speed control, robotic steering and remote control all seem to be in the wheelhouse of this group.