Showing posts with label railmotor. Show all posts
Showing posts with label railmotor. Show all posts

Friday, November 06, 2015

Creating an MP3 sound sytem

Introduction

As part of my ongoing investigations into sound systems, I thought I would have a go at 'modifying' a self contained USB MP3 player to provide a sound system for my Ford(ish) Railmotor.

 It turned out to be a relatively straightforward conversion requiring very few additional components - a voltage regulator to provide the power and the sound files which were mostly downloaded from the internet.

Pros
  • Relatively cheap - mine cost about £5.00 a couple of years ago. I notice there are several variants of this still available on eBay for around £6.50. I paid for some of my sound files (around $10), but it could have been done with free sound files or my own recordings
  • Comes complete with micro SD slot, amplifier, loudspeaker, battery and case (even includes a built-in FM radio)
  • Loud enough to be heard across the garden
  • Easily adaptable
  • Plays 'real' sound files to produce quite high quality sound
  • Plays very long sound files (a 1Gb SD card could hold around 18 hours of sound effects)
  • You can make and play your own tailor-made sound effects
Cons
  • There is about a pause of about 1 second when switching between tracks
  • Requires a little bit of time and effort to make the modifications to the player and the edit your own sound files
  • Not much else, really
I control my player remotely from my Deltang Tx22 transmitter through a Deltang Rx61b receiver, though any receiver which provides outputs from the direction switch (Channel 3) could be used.

Dismantling the MP3 Player

 At first, I couldn't see how the gadget fitted together, but after reading an article by Mike Jeffries in the December 2014 edition of the Garden Rail magazine in which he dismantled a similar sound system, I realised it wasn't too difficult.

The base was prised off with a small flat-bladed screwdriver.

It was held in place by some sort of silicone based glue which was still quite gummy, but with some gentle persuasion it became detached. At the same time the plug for the speaker disconnected itself from the socket.

The wires to the battery were snipped off. I wanted to be able to remember which wire was attached where as there was nothing printed on the circuit board indicating how the battery should be connected.

The two screws holding the circuit board to the base were removed.

The lithium-ion battery was glued to the underside of the speaker and needed a fair bit of leverage to become free .......

In the end, I sliced the plastic sleeve and removed the battery from it as I was anxious not to damage the battery case.

 The speaker grille was prised away from the case, bringing the speaker with it. Again, this was held in place with silicone-based adhesive.


Connecting the circuit board to the receiver

 The switches which enable the user to move forwards and backwards through the MP3 files on the card were held in place on the circuit board with a large blob of hot-glue.

This needed to be very carefully cut away to avoid damaging the board or the delicate contacts on the back of the switches. 

 Scrutiny of the board revealed that the left hand contacts (viewed from the back) on the switches were connected to ground (ie the negative side of the battery), so leads were carefully soldered to the contacts on the right of the 'next' and 'previous' switches using the thinnest wire I could lay my hands-on.

To check that these wires would act as triggers to move forwards and back through the tracks on the SD card, the board was wired up to the speaker and a 4.5v battery. The ends of the flying leads were then touched on to the negative terminal of the battery and, reassuringly, the player moved back and forth through the tracks.

Powering the MP3 player

 The MP3 player runs off 5v and as the loco is powered by a 12v battery I needed to find a way of powering it. As there is plenty of space in the railbus I could easily have added another 4.5v or 5v battery pack and linked the negative leads of the two battery packs to ensure the 0v logic signals would still work. However, I like to keep things simple when it comes to recharging and so decided it would be easier to make a voltage regulator circuit using an LM7805 voltage regulator. There is plenty of guidance on the internet for making this circuit - eg http://www.learningaboutelectronics.com/Articles/How-to-connect-a-voltage-regulator-in-a-circuit.

Mine was mounted on a small piece of stripboard and covered with some clear heatshrink sleeving as the mounting plate of the regulator is 'live'.

I decided not to clamp the regulator to a heatsink, even though the regulator did run quite hot when I wired everything up and turned the sound up to full power. To reduce the current draw I replaced the 4 ohm speaker which was supplied with the MP3 player with a small 8 ohm speaker. The voltage regulator still gets quite warm but now not alarmingly so.

Tailoring the receiver output pads on the receiver

 The receiver installed in my railbus is an Rx61b (v603) as it was installed a couple of years ago. The programming information for this older version of the Rx is still there in detail on the Deltang website and so I could see from the chart for the Rx61b-22-v603, that pads 4 and 5 provide 3.3v outputs in response to Channel 3 (the direction switch on Deltang transmitters).

Item

Setting Details
P1 output

Servo
Bind button (Ch5)

Slow-motion servo for coupling
Press bind button to open coupling
Release bind button to close coupling

P2 output

Front Light
(auto)

Led needs current limiting resistor

P3 output

Rear Light
(auto)

Led needs current limiting resistor

P4 output On/Off
Direction switch (Ch3)

Item being switched needs current limiting resistor
Switch right for ON (center/left OFF)

P5 output On/Off
Direction switch (Ch3)

Item being switched needs current limiting resistor
Switch left for ON (center/right OFF)

P6 output On/Off
Bind button (Ch5)

Item being switched needs current limiting resistor
ON while button pressed, OFF when released (momentary)

P7 output On/Off
Bind button (Ch5)

Item being switched needs current limiting resistor
Toggle ON/OFF each time button is pressed (latching)

P8 output IR4

Battery voltage telemetry
Infrared led needs current limiting resistor

I was already using Pads 2 and 3 for direction lighting and Pad 4 to turn on and off the interior lighting, and so I needed to find another way of turning the lighting on and off. Normally, I would use the bind button (Ch 5) for the loco whistle or horn but decided I could manage without the horn if I included it in the sound files for the engine sound (see below). I therefore soldered wires to Pads 4, 5 and 7. The outputs from pads 4 and 5 could be used to move back and forward through the tracks on the SD card (provided I inverted the outputs from 3.3v to 0v) and the output from Pad 7 could be used (without modification) to operate the interior lighting.

To invert the outputs from Pads 4 and 5, I made up a couple of transistor inverter circuits with a 2N3904 transistor and a couple of resistors (See How I trigger soundcards with a Deltang receiver.)

The two transistors, together with the four resistors, were mounted on a small piece of Veroboard as I found that the legs of the transistors were a little fragile.
The output leads were connected to the push button leads on the MP3 player and the inputs connected to pads 4 and 5 on the receiver.

All that was needed now was to find or create the sound files needed for the railbus.

Creating the sound files

After some experimentation, I decided I could simulate all the situations needed for the railbus with five sound files:
  1. 20 minutes of silence
  2. Engine start and idle (for 20 minutes)
  3. Horn, gear grind and acceleration through the gears to running speed ( for 20 mins)
  4. Decelerate, brake squeal and idle (for 20 mins)
  5. Engine shut down
I decided to include 20 minutes of silence as there will be times when the railbus is stationary before I get around to turning it off manually. Also, I didn't have a spare switch or channel on my Tx22 transmitter which I could use to switch the MP3 player on and off remotely.

From 'silence', I could then advance to the 'engine start and idle file' using the direction switch. When ready, I could then advance to 'the acceleration and running file'. The distance between my stations is such that I would never need to run the bus for more than ten minutes and so a leeway of 20 minutes running sound would be fine. The bus tends to run at a fairly consistent, slowish, speed and so there seemed little need to vary the speed of the running sound by a great deal. Approaching stations, I could then advance to 'the decelerate, brake and idle file' and leave the railbus on idle for as long as necessary. Using the direction switch I could therefore either move to the next 'engine stop file' which would automatically advance round to the first 'silence' file when it stopped playing, or I could move back to the previous file and go through the acceleration and running sequence again.

For more information on how I created the sound files see How I used Audacity to create sound files for my Ford(ish) railmotor.

The Railmotor in action

Once everything had been wired-up and tested, the speaker was put into a small sound chamber made from some 2mm thick larch veneer. This, together with the circuit board was mounted in the roof of the railbus power car (suitably insulated from accidental contact with the lighting bus bars).

Of course, after all this work, the railbus required some extensive testing.


I'm considering ways in which I could overcome the 1 second pause when I change tracks. It might be possible to program a Picaxe micro controller to trigger some sound on another soundboard for a second or so to mask the silence (eg a horn, a backfire or even a chunk of miscellaneous engine sound).

I am quite happy to live with the hiccup in the sound for now - after all, I run my railway mostly for my own pleasure and am mostly the only audience for my operational sessions. When I make videos (such as the one of the test run above), I can quite easily shoot the video to avoid the pauses or them edit out.


How I used Audacity to create sound files for my Ford(ish) railbus

Introduction

Having just modified a cheap USB MP3 Player to enable a Deltang receiver to trigger movement from file to file (see How I modified an MP3 Player to provide sound for my railbus), I needed to create some appropriate sound files to use with it.

I decided that I needed five sound files:
  1. 20 min of silence (when the railbus was stationary with no engine running)
  2. Engine start-up and idle (for 20 minutes)
  3. Horn, gears and acceleration through the gears before running sound (for 20 mins)
  4. Deceleration, brake squeal and idle (for 20 mins)
  5. Engine stop
I figured that I could move forward and back through these files using the direction switch on my Deltang Tx22 transmitter to cover all eventualities under which the railbus might operate.

Locating suitable sound files

The internet is a wonderful place. I searched for appropriate sound files of antiquated Ford motor vehicles which I could use. Initially, I searched for Model T Ford sounds as I had previously used some of these to dub sounds on to a video of the railbus in action (see A Day in the Life of Peckforton Station).

 These sounds had been suitable for lineside shots, with the railbus moving towards and away from the camera, but I needed engine sounds which were more constant.

Eventually, I managed to track down the sound of a Model A Ford on the StockMusic.com website. For a modest sum (just under $10), I was equipped with the sound of a car running past, the car starting, idling and stopping, and the sound of a car horn.

I was now ready to start editing in Audacity, which is a free open-source sound editing program available from SourceForge. To demonstrate the editing processes involved in producing the sound files, I'll show you how I produced the most complicated one - the third file with the horn, gear change and acceleration to running speed.

The first step was to start up Audacity and then open the downloaded file containing the idling engine sound. The engine start and engine stop sections of the file were highlighted and then deleted, leaving just the sound of the idling engine.

Part of the engine sound was highlighted and then Adjustable fade ... was selected from the Effects menu

 The opening volume was set to 100% and the closing volume was set to 200%. You may need to experiment with these values to suit the sound file you are working with.

 Once the rising effect of the volume was checked, the same section was highlighted once more and the Sliding Time Scale/Pitch Shift tool was selected from the Effects menu.

 The initial tempo change was set to 0 and the final tempo change was set to 200%. Again this final value was determined by experimentation. After some checking I decided the pitch needed to be changed as well to give a rising pitch to the engine as it increased in speed. The final pitch shift was set to 100%.

 The effect was tested to check the settings sounded satisfactory.

 The edited section of sound was highlighted, copied and pasted into the sound track and another section of the original idling sound was edited to give a slightly different and shorter section of rising sound, which was copied and pasted again to give the effect of working through four gears.

I decided the sound would be enhanced with the addition of the gearbox whining in the background. I tracked down the video of a vintage bus on the internet and extracted the sound using another piece of free software - Any Video Converter.

Once a suitable section of whining gearbox was found it was imported into the Audacity .......

.... where it opened as a new track

The short section of whine was copied and pasted a few times....

 The section of whine sound before the rising engine sound was highlighted and then, using the Amplify tool from the Effects menu, its volume was reduced to zero (there would be no gearbox whine while the railbus is stationary).

A section about twice as long as the rising engine sound was highlighted and amplified, rising from 0 to 400% using the Adjustable fade tool from the Effects menu (again some experimentation was necessary to find the most appropriate value).

The tempo and pitch of the same section was edited with the Sliding Time Scale/Pitch Shift tool from the Effects menu. The tempo was changed from 0 to 200, and the pitch from 0 to 100%.

The effect was applied again and copied and pasted to match the other sections of the engine sound track.

After some tweaking and adjustment, the sound of a grating gearbox (found on a free sound effects website - https://www.freesound.org/ ) was then imported and copied and pasted on to a new track to occur at appropriate places alongside the engine and gearbox sounds.

Finally, the sound of the Ford's klaxon horn was imported and added on a track near the start of the recording.

 A similar approach was used to create the other files needed (ie start and idle, decelerate and idle, idle and engine stop). These were exported from Audacity as MP3s and then transferred, one at a time (to ensure they appeared in the correct order) on to the micro SD card.

The SD card was then installed into the MP3 player on the railbus and tested to ensure everything worked as intended.

As you can see, there is a 1 second pause when moving from one track to another. I may look into the possibility of using a recordable sound module triggered by a Picaxe chip to mask this pause, but for now I am happy to live with the pause - my imagination disguises the gap in sound and when making videos of the railbus, I can edit out the pauses.




Saturday, May 09, 2015

Locomotive update

It has now been nearly two years since I started building and converting locomotives to battery power and radio control and in that time, a lot has happened. I feel it is now about time I presented updated and collated information about developments in the motive power on the railway.


Locomotive No. 1 - "Peckforton" - Peckett 0-4-0

This was constructed from a Garden Railway Specialists kit in 2008 (see How I constructed a Peckett loco). Seven years ago, GRS kits were largely made from preformed Plasticard plus whitemetal fittings. The kits have now improved with fewer cast resin parts in place of the plasticard pieces.

The body was mounted on an LGB 0-4-0 Toytrain chassis which, considering it was secondhand when I bought it, served me well until the start of this year. After converting it to battery power (see below) and radio control, I gave it a load test which it handled well, until it ran into an obstacle on the track. This proved too much for the nylon worm wheels which admitted defeat and stripped themselves of teeth. Fortunately, I had a brand new ToyTrain motor block to hand and this was pressed into service.

She is now powered by three 18650 lithium-ion batteries which are housed in the cab (see Converting a track powered loco to battery power). There would have been sufficient room for them in the saddle tank, but opening-up the tank and removing the lead weights which are firmly glued inside would have required a substantial rebuild.

Control is via a Deltang Rx65b combined receiver/controller, which is the latest innovation from the Deltang stable (for more information see An evaluation of Deltang radio control and Getting started with Deltang r/c in the garden).

As Peckforton was my first purpose-built loco for the railway, I am delighted she is now back in service. However, as you can see from the photos, she lacks refinement. I really need to spend some time adding details and I'd like to replace the ToyTrain cylinders and motion with something more prototypical. At present, she does not have a soundcard and, without freeing-up space in the saddle tank, there is very little room left to instal one. However, she runs well and is very responsive to radio control.

I consider her a mixed traffic loco and so hauls passenger and goods trains. In a test run to answer an enquiry on the Garden Rails forum, she ran continuously for five hours and 20 minutes on one charge of the batteries.

Locomotive No. 2 - "Beeston" - Barclay 2-4-0T

This loco was bought secondhand from GRS in 2010 (see Progress Report 26), having been constructed from one of their very early kits (now no longer available). It is based loosely La Moye, a loco which ran on the Jersey Railway and is now preserved in South Africa.

She has an LGB motor block and Walschaerts valve gear presumably from another LGB locomotive (such as the Zillertalbahn U class loco). It was converted from track power to battery radio control in 2014 using a Deltang Rx60 receiver/controller (see Progress Report 51).

Other than a coat of paint and Trimline tape lining, she has not been modified or detailed since she arrived on the line, apart from the addition of some cosmetic buffers. I tend use her mostly for passenger duties. She will happily shunt wagons but as the driving wheels are quite large her crawling speed is less controllable than other locos.



Locomotive No. 3 - "Bickerton" - Hunslet 0-4-0T

I constructed this loco from a GRS resin kit and an LGB ToyTrain 0-4-0 motor block in 2010 (see How I constructed a Hunslet loco from a GRS kit). At present, she is still track-powered and so, as I have now sold off all my DCC gear, she is out of action.

The only place to install the batteries would appear to be inside the saddle tank. This will entail some substantial dismantling and rebuilding as the saddle tank is presently crammed full of lead. However, it will be good to see her back in action on the line.

She is in need of detailing and some light weathering.

Update Sept 2015 - She has now been converted to battery power with three 18650 li-ion batteries and a Deltang Rx65 receiver controller

Locomotive No. 4 - "Bulkeley" - Manning Wardle 0-6-2T

This was my first scratchbuilt steam loco (see How I constructed a Manning Wardle 0-6-2T loco) and joined the line in 2013. She is based on the Southwold Railway No. 4 loco, Wenhaston. I found that the driving wheel sizes of the LGB U-class 0-6-2T locomotive were the correct size, though the wheel spacings are incorrect - the trailing driving wheels being too close to the centre pair. However, as the motor block included Walschaerts valve gear, I decided I could live with the slight inaccuracy.

 She is controlled by a Deltang Rx60 receiver/controller and powered by a 12v li-ion battery which is intended for use in CCTV cameras. These batteries include protection circuits which monitor charging and discharging.

I decided to leave her unlined, as a homage to the Southwold livery which she wore for most of her working life. As my railway is set in 1932, I argue that they bought the loco from the SR when it closed in 1929. I will probably add some finer details at some point in the future, but for now she will happily pull passenger or goods stock.


Locomotive No. 5 - "Tarporley" - Sharp Stewart 2-4-2T

My second scratchbuilt steam loco was somewhat more ambitious as, not only did she have leading and trailing pony trucks, I also had to construct her motion (see How I constructed a Sharp Stewart 2-4-2T loco). She was constructed during 2013 and is based on the second Southwold Railway No. 1 loco, Southwold.



 Motive power comes from a PlayMobil 0-4-0 motor block as I found the wheel sizes and spacing were approximately correct for 16mm:1foot scale. She is powered by a 12v li-ion CCTV camera battery and controlled by a Deltang Rx60 receiver/controller.

Once the loco was finished, I spent a while adding smaller details, such as the oiling pots. She also has works plates which I feel add an extra touch of realism.


Locomotive No. 6 - "Harthill" - Manning Wardle 0-6-0ST

My third scratchbuilt steam loco was completed in 2014 (see How I constructed a Manning Wardle 0-6-0ST loco). She is based on the Manning Wardle locos which ran on the 3'6" gauge railway at Davington. These were shipped to Brazil when the railway closed at the end of World War I. I found this loco to be the most challenging of the three to construct, owing to the saddle tank and making sure there was sufficient space inside the body to accommodate three 18650 lithium-ion batteries. She also has a fair amount of external pipework which proved to be more complicated to construct than it might appear.

 Motive power is provided by a Piko 0-6-0 motor block, which I've found to be a delight. It is extremely smooth running, especially at low speed, and is very responsive to the Deltang Rx65a receiver/controller.

She is in unlined livery and has recently been given appropriately number works plates. She has become the stalwart of the line, handling goods and passenger traffic with alacrity. Out of curiosity, I gave her a haulage test and found she could pull 24 wagons up a 1:40 gradient with ease.



Locomotive No.7 - "Tollemache" - Fowler 0-4-0DM

 This was my first foray into scratchbuilding in 2011 (see How I constructed a Fowler diesel loco). Based on an LGB ToyTrain 0-4-0 motor block, she is based loosely on the early Fowler diesel mechanical locomotives which ran on standard gauge and narrow gauge railways. Whilst I could find photos of standard gauge and 2' narrow gauge locos, I couldn't find an image of a 3' gauge Fowler and so imagined how it might look.

At present, she is still track-powered, but will be the next loco to be converted to battery operation. The flycranks on the layshaft are, at present, somewhat loosely connected to the driving wheels, as I was unable to source flycranks of the correct size and so overcame this by slotting the holes in the connecting rod. When converted, I will improve this aspect and also add some finer detailing.

Locomotive No.8 - "Wynford" - Freelance 0-4-0DM

This was my second venture into battery power and, like my first battery model (see below), has had a long and chequered history. After three failed attempts to construct a reliable mechanism, I eventually found success by inserting a USA Trains motor block into the chassis. This lengthened the wheelbase, but has proved to be a lot more reliable than any of the previous mechanisms.

 The bodywork is from an IP Engineering Jessie kit (now no longer available) which, being constructed principally from steel, provides plenty of inherent weight. As a consequence, I have not had to add any additional weight and yet she will happily haul twenty skips up the 1:40 gradients on my railway. She was originally powered by ten NiMh batteries but these have just been replaced by three 18650 li-ion batteries with a protection board. She is controlled via a Deltang Rx102 receiver feeding into a Brian Jones Mac5 ESC. Because the original mechanisms were so unreliable, I found that trying to control her with a Deltang Rx60 receiver/controller was somewhat erratic. I assume this is because this particular receiver was limited to 1 amp loading and the mechanisms might have been drawing more current (and were probably creating all manner of electromagnetic interference). One day, I will try controlling her with the more recent Deltang Rx65b - which can handle up to 3 amps.

She has a Peter Spoerer DigiSounds narrow gauge diesel sound module (developed by Mktroniks) which, as the name suggests, uses digitised recordings of a real diesel engine, and so sounds rather impressive.

Locomotive No. 9 - "Lolly"- Freelance 'Lollypop' railcar

 Constructed from an IP Engineering kit (see How I constructed a small railcar from an IP Engineering kit),

...... this diminutive railcar was constructed as an experiment to find out how responsive Deltang receivers would be with a low voltage supply - three NiMh Low Self Discharge (LSD) batteries = 3.6v (see Evaluation of Deltang with low voltages). In fact, as Deltang receivers actually step down input voltages to 3v, they will happily manage with these low voltage supplies. This model uses a Deltang Rx60 receiver.

 I added additional detailing (ie planking and bracing) during construction and she has red/white bi-colour LEDs which change colour dependent on direction of travel. She acts as the railway's permanent way vehicle and has a small trailer wagon which is often attached for the workers' tools (see How I constructed a small PW flat wagon).

'Locomotive' No. 10/10a - "Samantha" & "Josephine" - Freelance Ford(ish) railmotors

This was my first major investigation into the feasibility of battery power and radio control and as with No. 8 the railmotors went through various control systems and mechanisms before reaching their present state. They were 'bashed' from two freelance Andel resin coach kits (see How I bashed two Andel coaches into a 'Ford' railmotor) and the power car is now powered by a 12v CCTV li-ion battery, controlled by a Deltang Rx60 receiver/controller and motorised with a MFA Como gearbox motor and bevel gears.

For a while, they were extremely unreliable, becoming derailed when encountering any slight undulation in the track. Eventually, I created a very simple form of compensation on the leading axle of each car and since then have had very few derailments even though they are somewhat top-heavy.

  Both cars have operating directional headlights and internal lighting.

At present they do not have a sound card but I am experimenting with various methods of digitising the sound effects of a Model T Ford starting, stopping and running at speed using a small sound recording board controlled by a Picaxe chip.

Locomotive No. 11 - "Linda" - Freelance 0-4-0DM

This was my first venture into 32mm gauge and was bought for a relatively modest sum on eBay. She has an IP Engineering body on an HGLW chassis. She was originally manually controlled and powered by two AA alkaline non-rechargeable batteries. These were replaced by a single 185650 li-ion battery and a Deltang Rx65b receiver/controller was installed.

The receiver has been programmed to operate in shuttle mode as I decided it would be useful to have her pottering backwards and forwards with a train of Binnie skip wagons while I operated the main railway.

At present, she is more or less in the condition I bought her, but I have added more a little more detailing and given her some light weathering. It is doubtful I will add a sound card as space is limited, however, I am experimenting with a couple of small sound modules which are used in greetings cards to see if something could be squeezed in somewhere.

Locomotive No. 12 - "Emma" - Plate frame Simplex

 Constructed from an IP Engineering kit, at present she is powered by two 14500 li-ion batteries and manually controlled with a Deltang Rx65b receiver controller (see How I constructed a plate frame Simplex from an IP Engineering kit)



She has also been fitted with a small soundboard which has been modified from a cheap (£1.29) module designed to be used in musical greetings cards. While the sound isn't quite hi-fi, it is quite adequate for this little loco.

She is dual gauge - with interchangeable 32mm and 45mm gauge chassis. Both chassis have been fitted with chain drive which makes her quite a powerful little loco for her size