It's got to be that easy! It has to be! - Page 1
Forum section: electronics / beginners

author: shaneman20
author_rank: Contributor
timestamp: April 01, 2015, 11:33:10 pm
content: Hello guys!My name's Shane. Long story short: I like trains.So, I've got this new truck that I've been wanting to install all the necessary hardware to blow a few train horns that I've been collecting for a couple years now along with a bell that I received from an oldhead engineer.So, what I've been doing is setting up the air system in a way that is similar to the modern day passenger locomotives on Amtrak (better known as GE P42DCs) with a two-stage (three-position) horn button and a regular push-button bell.Now, how it works on the locomotive: you push the bell button, the bell comes on. You push it again, it turns off. Simple? Well, hold on a minute. When you push the horn button, the bell comes on along with the horn and stays on until you push the bell button to shut the bell off.So, what I've figured out so far on my own with just basic knowledge on electronics (had to take a class in college for audio engineering) and not able to find any schematics of how this is laid out in the locomotive whatsoever, I've come to the conclusion that the horn/bell relation is most likely on a latched relay setup. Just an educated guess, but it seems to be correct so far. The problem that I'm having is figuring out how to set up the bell button alone and for it to work with the horn button since I need the ability to shut the bell off after the desired length of time.For simplicity-sake, I'd like to keep the setup relay-based, but if I have to get a little complex, then so be it. Like I said in the title, it's got to be that easy. They've been doing this since the 90s. Not to say micro-processors couldn't do it, but it seems like it's a simple setup.I will say in my GE C40-8W operation manual, it talks about the horn and bell being interlocked with each other. And just to give you the simple tl;dr version of this: I need a way to wire up two buttons with one acting as an on/off and the other as an on only but the other turning it off.Can anyone help shed a little light on the subject as best as possible? Please and thank you!

author: kolonelkadat
author_rank: Regular Contributor
timestamp: April 02, 2015, 02:38:47 am
content: Im not sure I fully understand your situation, but there are a dozen or so ways to make a push on - push off switching circuit. All of them are fairly simple.dave did a video on one method uses a mosfet and some resistors and capacitorshttp://www.eevblog.com/2012/03/30/eevblog-262-worlds-simplest-soft-latching-power-switch-circuit/if you dont want to use a mosfet, you can get some love from some nand gates and some resistors and capacitors.this site has lots of different methods.http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/electronic-circuits/push-button-switch-turn-on/latching-toggle-power-switchif you arent into buying a logic gate ic, you can always make your own logic gates using diodes or transistorshttp://hyperphysics.phy-astr.gsu.edu/hbase/electronic/diodgate.htmlI know this probably doesnt perfectly answer your question, but it should give you some design ideas.

author: shaneman20
author_rank: Contributor
timestamp: April 03, 2015, 02:03:43 am
content: Quote from: kolonelkadat on April 02, 2015, 02:38:47 amThe second link gave me most of the ideas that I could understand.Now, it's just being able to incorporate a hard latching system into the soft latching on/off setup because, as I said, button A will be on/off, but button B will be on only, but button A will shut off what button B started. Making a little sense yet or are you still a little lost with what I'm looking for?

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 03, 2015, 02:40:07 am
content: If I understand how the buttons are supposed to operate then something like the attached might work. I didn't show the relay that would drive the horn but you likely already know how to do that part.The leftmost relay is just a simple SPDT signal relay (for example.) All it does is route a signal to either the Set# or Reset# signal of a dual coil latching relay (for example.) For the latching relay I linked to the Reset# pin is A1 in the datasheet, Set# is A2 and the pin connected to +12V is A3 in the datasheet.The two diodes allow either the horn switch or the bell switch (when the bell is off) to turn the bell on. The bell switch will toggle the bell on or off. It does this by energizing (or not) the coil in the first relay which changes where the signal (the button press) gets routed to.Honestly, I've never played with latching relays so the circuit may or may not work.

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 03, 2015, 01:05:02 pm
content: Now that I think about it a little more, that circuit won't work. (Can anyone spot the problem?)Here's one thatmight. It uses a flip-flop and two regular normally-open relays.I haven't had a chance to play around with this circuit much in the simulator so... caveat emptor.

author: babysitter
author_rank: Frequent Contributor
timestamp: April 03, 2015, 07:27:56 pm
content: Used to do a lot of relay logic when younger, let me think but it is well possible. Also, I like horns and have some Zoellner ship and rail horns - which was just a byproduct of collecting air raid sirens

author: shaneman20
author_rank: Contributor
timestamp: April 05, 2015, 11:50:46 am
content: Quote from: TerminalJack505 on April 03, 2015, 01:05:02 pmLooking at this just a little more in-depth, I noticed you had the horn on a relay and as the output, which really, all I would need for the bell is the signal from the horn switch. The horn switch itself is actually a double NO switch. If you push the button half-way down, one of the switches closes giving you a modulated (or partially open sound on the horn), and pressed all the way down is obviously wide open on the horn. So, really, for that to work, I just planned to wire the contact block straight to the solenoids. All I would necessarily need is the signal from the switch saying, "I have been closed; do your job," and this would trigger the bell to come on. That's kind of why I thought maybe a latching relay would work for that, but shutting it off from the bell button would be the fun part.

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 05, 2015, 05:50:51 pm
content: I missed the fact that the horn switch has two-positions from your original post. You will likely be able to use just the signal from the first position to trigger the bell since, from the sounds of it, the switch will always go through the first position when sounding the horn.If you're dead-set on using a latching relay then you might be able to make the first circuit I posted work by putting a large capacitor in series with the bell switch. (See attached.) This way just a pulse of current will flow when the bell button is pressed. The problem with the circuit as I drew it originally is that if you hold the button down too long then the bell will toggle on/off continuously. Obviously, you want the bell to toggle just once each time the button is pressed. The series capacitor should prevent that.I played around with the second circuit that I posted (that one that uses a flip-flop) on the breadboard. I used LEDs instead of relays and horns and bells.I made some changes. (See attached.) I'm still showing the horn being driven by a relay but you can change that like you mentioned.The circuitdoeswork. It isn't perfect, however.The problem is that the 4013 flip-flop doesn't like slow clock signals. The bell switch, as you can see from the circuit, is driving the clock signal. The problem with switches is that they 'bounce'. All of that circuitry around the switch is meant to prevent switch bounce but it also slows down the rise time and fall time of the signal. So the values of the switch debounce components had to be tuned to make the 4013's clock input happy.A better solution is to put a Schmitt trigger between the switch debounce circuitry and the clock input. Another solution is to use a 74HC74 instead of a 4013. The 74HC74 has a Schmitt trigger built-in to the clock input. The 74HC74 is a 5 volt (max) part, however, so you'd have to accommodate for that. Also, the Set and Reset signals are active-low, whereas they are active-high on the 4013.

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 07, 2015, 12:59:30 am
content: I found a solution to the problem in my circuit with the flip-flop--the problem regarding the 4013's dislike of slow rise times on the clock pin. (It doesn't seem to have problems with slow fall times.) I found the solution while browsing through Google images for 4013 schematics.The solution is D5 in the new schematic. This diode allows the capacitor (C1) to charge much faster by bypassing R8. So the rise time of the clock signal when the bell button is pressed is much faster (< 500 ns.) The cap has to discharge through R8 and R1 so debouncing is still taken care of.The circuit works like a charm now. I've attached the circuit in case you don't find a way to implement a solution with a latching relay.

author: shaneman20
author_rank: Contributor
timestamp: April 07, 2015, 01:09:07 am
content: I think I'm digging the latching relay setup more than anything. It's pretty simple. However, I'm intrigued about this setup. But I guess where I'm thrown off is how the circuit will react if I pressed the horn button down. I'm assuming that I could do quick bursts on the horn if I pressed the button a thousand times and there would still be no problem to what's happening. Again, I just have a basic understanding of electronics and my brain trying to understand what this schematic is telling me looks a lot like this.I guess what would be nice to know is if I did press the horn button like that, would it be okay and not react sluggishly?

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 07, 2015, 01:27:23 am
content: The debounce circuitry on the horn button will add about 1 millisecond of delay so it shouldn't be noticeable. I didn't notice any delay on the breadboard using LEDs. Debouncing that particular signal isn't as critical as the bell button so you could make the capacitor (C3) smaller to reduce the delay.You should be able to press the horn button to your heart's content and it shouldn't hurt anything. When you hit the horn button and the bell is off then the bell will be turned on. If you hit the horn button and the bell isonthen the bell will stay on and there won't be any interruption or glitch in its power.

author: shaneman20
author_rank: Contributor
timestamp: April 07, 2015, 10:42:11 pm
content: Alrighty then.Well, I can't seem to find a D Flip-flop on google. So, my question is, at least for parts, what would you suggest? Are there any good sites to go to now with Radioshack closing now?

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 08, 2015, 12:27:10 am
content: From what you understand of the circuit, do you think it will work? That is, are the assumptions I made correct?It is a 12V system.The horn switch goes high when pressed.The horn switch is open when released.The bell switch goes high when pressed.The bell switch is open when released.The horn is activated by a +12V signal.The bell can be wired as shown.If any of these assumptions are incorrect then there will likely need to be some changes made.I also don't want to dissuade you from trying the latched-relay solution. I'd like to have someone else's opinion on it, however.So far as which components to use, we can figure that out once we know the circuit will work.Some of the sites for buying components are: digikey.com, mouser.com, newark.com and ebay.com.

author: shaneman20
author_rank: Contributor
timestamp: April 08, 2015, 12:43:09 am
content: Well, I was trying to keep options open.If the schematic in which you have drawn can do this, then I will be happy.

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 08, 2015, 01:37:51 am
content: It should. It's actually pretty simple. There are just the two inputs: horn switch and bell switch and two outputs: horn enable and bell enable.The real trick now is interfacing it to your equipment.

author: shaneman20
author_rank: Contributor
timestamp: April 08, 2015, 09:15:55 pm
content: Quote from: TerminalJack505 on April 08, 2015, 01:37:51 amShouldn't be too difficult. Now, the problem is any of the 4013s I searched for are all duals. So, I guess now what I need to find is one that is single and try to interpret where the wires need to go because some show different letters for input/output.For example:http://www.farnell.com/datasheets/1727525.pdf

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 09, 2015, 12:15:57 am
content: I would just use a dual and wire all of the inputs of the unused flip-flop to ground and leave the outputs unconnected.

author: shaneman20
author_rank: Contributor
timestamp: April 09, 2015, 12:21:49 am
content: Quote from: TerminalJack505 on April 09, 2015, 12:15:57 amOh. Okay. I see that now after I looked at a CD4013B. I was starting to get confused because there's no output, but I understand it after looking at how it is on the PDF of the CD4013B.Now, with the horn relay side, I think I asked this (of course, I could be wrong), but would I necessarily need that whole relay? I mean, I think I could get away with doing the resistors and capacitor as is and have it go straight to the solenoids, but I wonder if the capacitor would be a problem. So, that's why I'm asking. I'm always reminded of the painting on the wall: "The only stupid question you can ask is the one you don't ask."

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 09, 2015, 12:48:11 am
content: You should be able to wire the horn up as shown. The capacitor will help filter-out noise as well as absorb voltage transients but you might be able to get by without it.

author: shaneman20
author_rank: Contributor
timestamp: April 09, 2015, 12:53:03 am
content: Quote from: TerminalJack505 on April 09, 2015, 12:48:11 amNow I just have to figure out in my head where that resister has to go. I'm wondering if coming back from the solenoid is where it needs to be or if it has to be before that.

author: shaneman20
author_rank: Contributor
timestamp: April 10, 2015, 12:08:22 am
content: I think I figured it out. Wondering if a terminal would be good for the power and ground.And considering this is coming from the battery of a truck, is there any way to protect the circuit from frying due to amperage, or will this even be an issue?

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 10, 2015, 01:27:35 am
content: Quote from: shaneman20 on April 10, 2015, 12:08:22 amThe automotive environment is one of the harshest environments for an electronic circuit so, yes, you'll likely want some protection.In this particular case, however, you probably want to keep it pretty simple. Otherwise, the circuit protection could wind-up being more expensive then the circuit it's protecting: the 4013--a fifty cent IC.I'd probably just use a diode for reverse voltage protection and a Zener diode and capacitor for protection against transients on the power.The clock input, as shown in the last schematic, already has adequate protection.The 4013's Set pin, connected to the horn switch, however, only has the chip's ESD diodes to protect it. If you use the horn switch circuit I posted asTrain Horn and Bell Mk IIband put the solenoid on the other side of the emitter follower (T3) then the Set input should be adequately protected. Don't forget to put a diode across the solenoid.

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 12, 2015, 12:23:28 am
content: Here's a schematic that shows some protection. It should be pretty bullet-proof and protect the circuit from all of the conditions an automotive circuit can experience.Load dumps. Z2 handles this. Use a 27V automotive TVS specifically meant for load dump protection24V jump starts. R6 and Z1 handle this. Z1 is just a 15V Zener diode.Reverse battery. D1 and Z2 handle this.ESD transients on the inputs. Primarily handled by R4/R8, C3/C1, D3/D1 and the IC's ESD diodes.Ignition system transients. Handled by Z2, Z1, C4 & C5.D3/D1 and R9/R10 are primary meant to protect the IC from any charge on the C3/C1 caps at power-down but they'll work to prevent ESD also. You can also put diodes from D3/D1's anode to ground for additional protection against negative-going ESD transients. (The IC will already have these built-in, however.)

author: shaneman20
author_rank: Contributor
timestamp: April 12, 2015, 11:09:27 am
content: And this does make sense. Well, alright then. The horn/bell situation has been figured out at least for me. I will try to update this thread as I start to build it and if there would be any questions pertaining to the circuit and how I'm doing with it that would come up, I'd just bring it back here.Now, just out of curiosity, could I even use the power from the battery as it's show on this schematic to do a relay to start the compressor? The compressor will be taking pretty much all the load. The specs say 180 amps at max load, but I'm not taking it that far. However, on the manufacturer's website, they state 150 amps @ 100psi, and without having an ammeter (and a hefty one at that), there's really no way of knowing what the actual load will be until I get everything set up and find a decent ammeter to handle the load.

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 12, 2015, 04:18:04 pm
content: 180 Amps!I hope that's a typo and you actually meant to say 18A.If it is 180A then you want to make sure your alternator can actually produce that much current. Not many can.

author: shaneman20
author_rank: Contributor
timestamp: April 12, 2015, 11:53:51 pm
content: Quote from: TerminalJack505 on April 12, 2015, 04:18:04 pmThat's why I'm planning to look into it. It won't be for very long as far as the compressor being on. Relatively short.I'll show you the specs on the manufacturer's website.http://aircompressors.oasismfg.com/item/air-compressors/xd4000-continuous-duty-air-compressors/item-1052The biggest thing is having an alternator that can keep up with charging the battery. That's the kicker. GM offers a 220A alternator, but I have to talk to the service guys first before I go about it and also have them piece together an auxiliary battery harness. Not sure what either will cost me, but it all just depends.