Momentary Output From Latching Input? 555 Timer?

Started by chrisaxeman, February 09, 2023, 07:49:45 PM

Previous topic - Next topic

chrisaxeman

Hi Everyone,

Is there a preferred way to generate a pulsed signal for a momentary relay contact closure, from a latching switch input?

I need to send an output pulse, when the input switch is latched on, then alternatively another output pulse when input switch is latched open.

Thanks in advance. It's a work-around for a PIC-controlled Framus amp.

Cheers

Chris.
I have no idea what I'm doing,but I like the way it sounds!

Rob Strand

#1
You can use an NE555 wired as a monostable.

If the switch is latched closed and you only want activity on the closing edge the
you also need a pulse shaping network feeding NE555 trigger input.

https://electronics.stackexchange.com/questions/180716/555-timer-one-shot-trigger


When used with an NE555 the effective pulse width of the trigger is 0.41 * R2*C1 and
it needs to be shorter than the NE555 output pulse, which is 1.1*Rt*Ct.

You might consider raising the value of R2.

If you only want a simple pulse into the micro you can actually use a circuit like
R1, C1 R2, D1 to form a pulse directly into the micro.
You need to power the circuit from the same supply as the micro.  For some
micro's it might wise to put a protection resistor between D1 and the micro pin.
With the micro, the effective pulse width won't quite be 0.41*R2*C1.
The 555 will hide the switch bounce but the straight RC circuit might need
some careful tweaking of the RC time constant.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

chrisaxeman

Thanks Rob.

I'll try to work through what you are describing.

I wish I knew how to reprogram the PIC.

It is hard for me to describe why I need the workaround. The same PIC handles MIDI for the amp's functions, as well as mechanical switching input via 1/4" jacks. The three channels are fine, as they are assigned a unique CC# each.

The problem is the dual master's 1&2 are on the same CC target, that toggles on any value, not a latched one (say CC level 0 for master 1, 127 for master 2, is what I would like). The setup with the dual masters is more conducive to a Workstation MIDI track that can sequence the Master CC toggle value at the right time, whenever.

Problem with using the amp with a normal guitar-player style MIDI controller, is on any MIDI preset stream, that CC gets detected by the amp and toggles the master level. Even if you don't want it to.

An example could be a footcontroller preset where I'm on Clean+Master2 for the amp, even if I switch to a preset with Lead+Master2 for a solo, the amp's PIC just detects a value for the master to toggle and reverts back to Master 1.

If the master level was a latched CC value, that wouldn't happen.

I've tried combining MIDI for just the channels and mechanical for Master 1 and 2. It's still unreliable though more consistent.

Cheers.

Chris.


I have no idea what I'm doing,but I like the way it sounds!

FiveseveN

Quote from: chrisaxeman on February 09, 2023, 09:27:31 PM
I wish I knew how to reprogram the PIC.
Could you swap it for something you do have experience with? Or if not swap, maybe insert another uC before as a "MIDI filter" to give you the behavior you're looking for?
Quote from: R.G. on July 31, 2018, 10:34:30 PMDoes the circuit sound better when oriented to magnetic north under a pyramid?

anotherjim

Do you know what the DC voltage is normally on this PIC pin? What else is connected to it?
The contact you want to send the pulse with needs a connection to the same ground as the PIC. If not you will need a spare contact on the relay that can be connected to the pic ground.

Assuming the PIC pin is normally pulled high and no other parts interfere...
Rob's showing a principle for a negative pulse (normally high pin input)  and it will smartly pulse a low level to the PIC pin on contact closure. C1 will charge up and PIC input will return to a high state. When the contact opens - nothing happens except D1 and R1+R2 will discharge the voltage stored on C1, effectively rearming the circuit for the next contact closure. The PIC input remains high.
So, I think that will only work one way, and you want another pulse when the contact opens?

So far, my only idea is if it was a changeover double throw contact, it can be used to create the pulse each time it changes state.


Rob Strand

I don't exactly understand what the requirements are.

It is possible to trigger of both edges if that's what is required.   The textbook way is an XOR gate with an RC network,


Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

anotherjim

I think it just needs to provide a toggle function every time the relay changes state.
However, I think there is a risk the toggle could get out of step without also having some means of proving which state the channel selection is in. If the PIC operates electronic or relay switching between amp channels, there is a chance of using this.

chrisaxeman

Quote from: anotherjim on February 10, 2023, 07:29:29 AM
I think it just needs to provide a toggle function every time the relay changes state.
However, I think there is a risk the toggle could get out of step without also having some means of proving which state the channel selection is in. If the PIC operates electronic or relay switching between amp channels, there is a chance of using this.


Hi anotherjim.

Your description is pretty close. A pulse to momentarily close a relay contact when the input switch is latched closed, another pulse to the relay to be sent when the switch is latched open. The said relay is to be controlled external of the amp.

The reason I'm asking for a latched input is annunciation characteristics of the equipment that is to be controlling that relay.

I tried a combination of MIDI to do the channel switching, mixed with a mechanical contact (MIDI controlled Axess Electronics piece) to switch the masters. On rig power up, I just needed to synchronize the status of the master volume with whatever the associated instant access switch status was on my footcontroller. 9/10, that setup works fine. But the combination of the mechanical input (though MIDI triggered) and MIDI signals racing (same PIC I/O) might be why the Master 1/2 will unintendedly toggle.

If the code was written in the PIC that Master 1 was CC level 0, and Master 2 was 127, or alternatively, Master 1 and 2 had their own CC#, this would be easy. MIDI all day long.

I have some other ideas to try out, but I don't want to modify the amp itself at this point.

Cheers

Chris.
I have no idea what I'm doing,but I like the way it sounds!