Skip to main content

Oh no!    You've opened a can of worms.  Replace the rechargeable battery with a BCR?  Where have I heard this before?

 

The problem is the voltage drops linearly with time with a supercap whereas a charged battery holds its voltage.  Perhaps specific to this proposed implementation but with a Class-D audio amp as on the 82 cent amplifier module, the volume is directly proportional to the available voltage so a supercap drop of, say, 1V from 5V to 4V during the dropout would correspond to a 2dB drop in volume...not significant but a drop nonetheless.  The MTH system doesn't exhibit this because the rapidly decaying voltage from the supercap goes thru a voltage step-up regulator to maintain the voltage to the audio amp.  I suppose such a voltage regulator could be added, along with something to manage supercap charging other than a resistor. 

 

If using the included battery, the idea would be to run the entire rolling-stock electronics including the audio-amp at the battery voltage...so when there's a voltage dropout the battery's "chemistry" acts as the voltage management system with no additional parts.  Of course I may be over-thinking this but I'd like to keep all this under $5 (arbitrary).

 

So many ideas, so little time! 

 

There's a foolproof method for detecting IR or optical inputs called correlation. Easy to explain, not so easy to implement. By modulating the output let's say at 10 kHz then the required input must have the same 10 kHz modulation. All other inputs will be rejected. I built a couple circuits quite a few years ago and they're still going strong.

Boy, we're splitting hairs.  It's actually a microcontroller if you want to get technical.  A microcomputer has only the CPU on the chip, not the memory and I/O.  The microcontroller, OTOH, has a CPU, in addition with a fixed amount of RAM, ROM and other peripherals all embedded on a single chip.  Microchip knows what it's called...

Why Buy PIC® Microcontrollers (MCUs)?

Frankly, this falls under the category of TMI, I doubt anyone was confused about what the conversation was about.

 

Last edited by gunrunnerjohn

For about $2 free shipping on eBay you can get a modulated IR transmitter-receiver module.  In this case it pulses the IR LED at 38 kHz, and there's a detector IC 'tuned' to listen for these 38 kHz IR pulses.  No software, PIC, uP, uC, underwear, or whatever required.

 

http://www.ebay.com/itm/381028...e=STRK%3AMEBIDX%3AIT

 

$_57

 

Azatrax, which makes off-the-shelf IR signaling accessories for model RR uses this method too.  I don't know if they implemented it using dedicated IC chips, a few lines of code, or with a mouse running on a wheel...

 

Attachments

Images (1)
  • $_57

Hi Stan,

 

You caught my attention with the above module. I checked it out on ebay and couldn't understand anything their broken English was trying to explain. If the emitter & sensor can be removed, this would seem to be a better approach for making a train-crossing detector that's not affected by ambient light. Have you managed to decode their instructions and if so, can it be used as I mentioned above?

 

Ken

Originally Posted by ken's trains:
Have you managed to decode their instructions and if so, can it be used as I mentioned above?

Well, if you go back to page 1 of this thread you will see that GRJ's first comment was to use modulated IR.  I have played with this module.  The transmitter or IR LED is pulsed using an oscillator circuit which you have to manually adjust to 38 kHz.  You don't need any fancy equipment to do this as you just adjust the trimpots to the mid-point of where you get the best sensitivity.

 

Yes, you can remove transmitter (LED) and receiver (tuned detector IC) from the board; the receiver is that black blob in the upper right of board.  The receiver is actually a very-high-gain sensitive circuit so if more than a few inches from the board you need to install a small resistor and capacitor right at the IC at the end of the 3-wires going to it.  Pennies in parts and no big deal but something you should do.

 

The interesting thing is you can drive multiple LEDs from a single oscillator.  So most of the board is consumed by that 38 kHz oscillator-pulsing circuit (actually the ubiquitous 555 timer IC chip).  In other words, if you want to go this route, what I'd suggest is you buy a 555 oscillator module (about $2 free shipping on eBay) and use it to drive all your IR LED transmitters.  Then just buy the tuned IR detector IC which have 3-connections (+5V, Ground, output).  Of course there are hookup details to get the polarity right and such if this is how you want to go.

 

Keep in mind than many/most off-the-shelf IR track sensor detector systems do NOT use modulated IR.  Yes, you read stories about guys having issues with sunshine or room lighting affecting the IR sensors but with some thought in placement, shielding /shading of the components, you can generally work around the issue.

Originally Posted by stan2004:
Originally Posted by nvocc5:

How would wire this up to the IR trackside with  oscillator module  and the MP3 player. Could you provide a scheme so I could follow, thanks! 

It will take a few weeks to get it but I am working on it!  I'm still working on some arcane technical issues but so far so good. 

Here's what I've come up with for a low-cost MP3 player that can be connected with the crossing-flasher module.  This is definitely reserved for the DIY enthusiast.  If you don't want to mess with eBay, components, soldering, wiring, etc. just buy an off-the-shelf crossing-gate sensor/light/sound system.

 

I'll try to itemize specific tasks and comments as I go along.

 

1. The player comes apart by popping off the pink-colored panel.  I did end up removing the included battery.  The player has 5-button control with 2 buttons for volume up and down.  It remembers the volume you set it at so you would do this one time.  The audio amp module has fixed volume.  There are eBay modules that have a volume adjustment pot/control that are about $1.50 (instead of 82 cents) if you think you will need to frequently fiddle with the volume.  I think for a crossing-gate accessory you could just set the volume accordingly one time using the buttons on the player.

 

ogr mp3 player backside

2. The player sends the left and right audio signals to the audio amp from a standard 1/8"/3.5mm plug.  It's important to note that only the L and R wires are connected.  You do NOT use the common wire.   Of course if you're only needing mono sound as probably the case for crossing gate dinging, you could choose to just run the L wire between the modules.  As shown I actually used the plug for prototyping/testing flexibility but to save space you could solder wires for the L and/or R wires between the two modules.

 

ogr mp3 player and audio amp

 

 3. For the player, a mini-USB normally applies +5V DC power.  I opted to solder 2 wires red/black as shown to save space.  The player was also modified by adding a 1 uF capacitor (16V or higher, 50V is a common value) as shown.  If you use a polarized electrolytic cap, place the + and - sides of the cap as indicated.  Or use a non-polarized ceramic cap if that's all you have.  Place the player's on/off slide switch as shown.  When the player is playing an MP3 file there is a red LED on the upper right that flashes (see video below).

 

ogr mp3 player wiring

 

4. The audio amp is also modified by adding a 1 uF capacitor.  If using a polarized cap mind the + and - as shown.  I used connectors for ease of prototyping/testing but they do add space.  The module also takes +5V DC.  The +5V red/black wires from both modules are combined.  And when +5V is applied, the MP3 file stored on the microSD card starts playing (see video below).  The audio amp can drive a 4 or 8 ohm (or higher) speaker; there's an 8 ohm speaker shown which will generate plenty of volume for an accessory.  The best thing you can do for sound is put a chamber/baffle around the speaker as shown. I think this was the plastic cap from laundry detergent.  A sealed enclosure has dramatic effect on improving volume and bass.  No connection is needed to the R input or output if not used.

 

ogr mp3 amp wiring

 

And here it is in action.  In this case I'm not using the IR detector relay from before but just a 5V DC power module.  The point is this sound module can stand-alone.  You apply 5V DC and off it goes, you remove 5V and it stops.  When you apply power again it starts at the beginning of the MP3 file.

 

The previously shown LED crossing flasher module also starts operating when 5V DC is applied).  I assume it's obvious that to integrate the lights and sound, you apply 5V DC switched from the IR detector relay circuit to both light and sound circuits.

 

I also attached the MP3 file that I used for this demo.  I don't remember where I got it  but if was a free download off the web.  I edited it (cut-and-paste many times) to make it run for about 90 seconds not paying much attention to sampling rate, bit rate, etc.  Note that it's about 1 MByte which is nothing for a microSD card.  For this player, it will repeat a single MP3 file if that's all that's on the card.  You may hear a short gap.  If this is an issue, then just store a 10 minute version or whatever the longest you think the gates will run for.  As mentioned, when you power it up the next time, it starts at the beginning of the MP3 file.

 

Attachments

Images (4)
  • ogr mp3 amp wiring
  • ogr mp3 player and audio amp
  • ogr mp3 player backside
  • ogr mp3 player wiring
Videos (1)
ogr mp3 player crossing gate
Audio (1)

I have been watching all this and that looks just great. I have some MTH crossing gates that make no sound, this would be perfect for them.

 

Also, thanks to both of you (stan2004 & gunrunnerjohn) for doing all these projects (not just this one, but all of them that you guys do around here). Then you take the time to post it all for us and put it into pictures and language we (the much less knowledgeable folks) can understand and use. You two have collaborated on some really neat projects like this, I follow them all. Whether I understand them or not, something is always learned. Please keep it up, I for one really do appreciate it all.

 

 

I believe all the IR detector circuits I've shown end up tripping a $1 eBay relay module.  So the basic idea is the trigger closes the relay and the relay applies 5V DC to the MP3 sound circuit.

 

Here's a cut-and-paste of various photos which should explain it.  I believe you have those LM2596 eBay AC-to-DC power modules.  You could use one of those modules to supply the 5V DC.  Then the relay switches 5V to the MP3 sound circuit and to the LED flasher circuit which both require 5V DC.  The LED flasher starts flashing when 5V DC is applied.  The MP3 player starts playing whatever .MP3 file is stored on the microSD card when 5V DC is applied.

 

ir detector with lights and sound

Attachments

Images (1)
  • ir detector with lights and sound
Last edited by stan2004

Hi Stan

 

Quick question in regards to the MP player. You have use one with out the speaker and one with the speaker which one do think work best in this application?

 

Another quick question the MP player without the speaker. To supply it with a speaker  what size and ohm range would you suggest?

Kris,

 

The one with speaker is more expensive and harder to dis-assemble.  But it does integrate a mono amplifier and one 4-ohm, 40mm diameter speaker.  Given you have to do a bunch of dis-assembly, wiring, etc. anyway, I am recommending the modular approach buying a separate $1 MP3 module, $1 audio amp, $? speaker.  I think it gives more flexibility.

 

As for speaker choice, for a crossing gate a 1/2 Watt or 1 Watt speaker will be sufficient. A 2" or 50mm sized speaker ought to do the trick.  If you can mount the speaker in a baffle, even a small one, you will be surprised by how much louder and deeper it sounds.  The photo I just posted shows a round speaker mounted in a laundry-detergent cap.  I've used yogurt cups, shaving cream lids, etc.  The speaker impedance can be 4, 8, 16 ohms or whatever.  I'd think 8 ohms is the easiest to find in the hobby/surplus market.  I put $? for the cost of a speaker earlier because it can be all over the map.  You may have a recycled speaker from some broken gadget.

 

As an aside, there's a recent thread on crossing gate sound being annoying.

 

https://ogrforum.com/t...es-fun-or-irritating

 

To each his own of course, but you can buy an eBay amplifier module that has a mechanical/knob volume control. The MP3 players use the up/down button-type volume control which can be inaccessible or inconvenient. This is an example of what I mean by more flexibility using the MP3 player without the built-in speaker.  The amplifier module with volume control knob is only about $1 w/free shipping - search eBay for "PAM8403 volume control"; as you know my direct links to eBay listings get deleted.

 

pam8403 amp with volume knob

Attachments

Images (1)
  • pam8403 amp with volume knob

Dear Stan

 

I finally got all the parts and this the next project on honey do list.  Based on your posting August 2, 2015 8:47 PM how many LED flasher used this circuit? I was also  think of using two crossing gates per IR setup with the LED flashers. Is this too much to ask from IR setup or will it be able to handle it?

ogr%20ebay%20module%20DC%20crossing%20flasher%201

Hi Kris,

I assume by "LED flasher" you mean the above module.  I believe all the circuits I showed use one of those $1 relay modules that trips when the IR circuit detects a passing train.  The relay module switches the 5V DC from the voltage regulator module to the LED flasher.  The relay module can switch Amps of current so that's not a limiting factor.  The voltage regulator module can supply over an Amp of current so that's not a limiting factor either for driving some LED flasher circuits.

 

So it's no problem to hook up two (or more) LED flasher circuits to the relay module.  However, another option is to use one LED flasher circuit to drive more than 1 pair of alternating LEDs.  So pairs of LEDs would flash in tandem.  I don't know if this is prototypical.  Or, since the modules are only about $1-2 then two flashers can come on and their LEDs would alternate/flash independently which might present a more interesting visual effect.

 

That is, I was just at a real crossing gate and noticed that dinging sound was not synchronized to the flashing lights.  So if you are also hooking up the MP3 module for dinging, you could have 3 things that, while activated simultaneously, do something slightly different which can make for a more interesting accessory!

Attachments

Images (1)
  • ogr%20ebay%20module%20DC%20crossing%20flasher%201

Hi Stan

 

I was thinking of using two flashers and two crossing gate and one MP3 player per crossing. I like your idea of using one LED flasher circuit for the two flashers. Once I build the proto type I will make a decision then. I also purchased the volume control AMP for the MP3 player. As GRJ state in an earlier post that it was nice for a while and then start to drive him nuts with sound from the MP3 player. This way I have the option of turning the sound down or off.

Ken, exactly which module did you get?  Does it have 555 or NE555 in its description?  Modules based on the 555 IC chip should have 100 mA of output current capability.

 

But suppose you indeed have a 12V module that only drives 35mA.  Well, since a red LED only needs about 2V at 20mA of drive current, you can stack multiple red LEDs in series.  So, for example, two red LEDs in series would require about 4V and still draw only 20mA.  Three red LEDs in series would required 6V and still draw only 20mA. And so on.  The current limiting resistor value between the module output and the LED(s) would need to be adjusted depending on configuration.

 

In Kris's case the module shown above uses the 555 IC chip so it can easily drive 2 red LEDs in parallel (40 mA).  Or, even with only 5V he could put 2 red LEDs in series and consume only 20mA. 

 

I suggest you draw out a wiring diagram showing how the wires run from module to LEDs.  Having wires running back and forth between gates to implement a series configuration can get awkward depending on your layout and placement of crossing lights. Sincet modules are inexpensive (the module shown above is now $1.33 free shipping - eBay listing # 252087071088) it could simplify assembly to use one module per pair of alternating red LEDs. 

Add Reply

Post

OGR Publishing, Inc., 1310 Eastside Centre Ct, Ste 6, Mountain Home, AR 72653
800-980-OGRR (6477)
CONTACT US
www.ogaugerr.com

×
×
×
×
Link copied to your clipboard.
×
×