High-Speed Actuation Sensing

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
I'm new to electronics design and I'm trying to learn how to design a particular circuit. The functionality I'm looking for is perhaps best described as a "latching" action from component B in response to quick off-on actuation of a simple switch, the primary function of which is a simple toggle to component A.

To clarify, let me put it another way:

I have a simple SPST switch that controls component A. Sometimes when A is active, I want B to be active also. B will never be active unless A is also active.

I would like to control B's state with the same switch as A, but I want B's response to the switch to be based on a particular type of actuation: B should turn on when the user turns A off then back on quickly. We could say that this quick flip "latches" B to A.

Continuing with both A and B on, the user can unlatch B from A by again flipping the switch off then back on quickly. When doing so, the initial "off" turns both A and B off, and the following quick "on" brings back only A.

I have been doing some reading and have come up with what I'm sure is quite a hodge-podge of ideas. The main elements are:
  • Switch
  • Timer (555 or ?)
  • Comparison component (AND logic)
  • Flip-flop
  • Second comparison component (same AND logic)
  • Relay

Here is a diagram:


My questions are multitude, but we'll probably all be happier if we start out basic, as I'm sure there are plenty of things to be said just about the above. Right now, since this is my first post at this forum, I'd like to hear what others think about this approach, specifically the logic and whatnot.

Also, since we'll be crossing bridges, I should mention: Troll if you must, but please have something constructive nestled in the vitriol.

I should also add, I'm down to read and learn. That's actually what I want. So feel free to drop helpful links and other explanations.
 

Yaakov

Joined Jan 27, 2019
1,612
Welcome to AAC.

I must tell you frankly that your abstract version of your problem limits the ability to help you. While your simplified set case may seem to be a way of making things easier for people seeking to help you, ironically it makes it harder and more frustrating.

It would help a great deal if you described what you are actually trying to do. Then people could provide sensible and effective advice without the inevitable "well, what I really want to do is X" when they advice doesn't match your needs. It's frustrating to the helpful folks and a waste of time.

Additionally, this seems to be a very good application for a small MCU, like a Pic. Have you considered that?
 

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
I have. I considered using Arduino, as I'm unfamiliar with the Pic.

I would like to do whatever I need to do in order to make it easier to approach my information. Let me be more specific in regard to what I'm attempting: I want to be able to turn on and off a set of auxuliary lights on my motorcycle by using the highbeam switch.

I should also explain that using the Arduino would be a secondary choice to me for two reasons. One, I'm interested in avoiding the processing unit simply on the principle that the bike currently doesn't have one (old technology), and the idea of keeping it conceptually consistent (just components, no data processing as such) has its appeal. The other reason is that I'm interested in learning about how to construct this type of thing from analog components, simply for the experience of doing so.
 
Last edited by a moderator:

Yaakov

Joined Jan 27, 2019
1,612
I have. I considered using Arduino, as I'm unfamiliar with the Pic.

I would like to do whatever I need to do in order to make it easier to approach my information. Let me be more specific in regard to what I'm attempting: I want to be able to turn on and off a set of auxuliary lights on my motorcycle by using the highbeam switch.
Ah, now that will get you some good help. An Arduino is overkill for this problem. There are many people here very conversant in the smaller MCUs, and they will be able to help. Using a processor will give you far more flexibility than discrete logic.

I am sure that someone will pop up to help pretty quickly. It's a good project, and a fairly straightforward one.
 

Yaakov

Joined Jan 27, 2019
1,612
I should also explain that using the Arduino would be a secondary choice to me for two reasons. One, I'm interested in avoiding the processing unit simply on the principle that the bike currently doesn't have one (old technology), and the idea of keeping it conceptually consistent (just components, no data processing as such) has its appeal. The other reason is that I'm interested in learning about how to construct this type of thing from analog components, simply for the experience of doing so.
This is OK, but really the older bike doesn't have any ICs on it at all. Things like the Pic I have in mind are only 8-pin devices, they look just like the 555 but can do much more, and you will need discrete components to interface it anyway. It's a nice idea to use "analog" components, but not sensible, really.

As the Sabbath approaches, I have to go offline, but I feel confident many people will offer help no matter what you choose to do.

Good luck, I will check back.
 

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
Thank you for the warm welcome, Yaakov.

As you mention, I'm new to the forum. Along with this I've already run into one bit of "newbie friction:" I can't upate the pic in my post above because editing time has passed. Also, updating the image where I have it stored doesn't seem to do the trick. So I'm posting a better version, one that includes both A and B as well as, you know, ground :):

 
Last edited:

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
As I drew this I realized that the flip-flop requires its own table with itself as both an input and output. Then a second table is required to explain the rest of the circuit in response to the flip-flop and the highbeam switch. I believe these are correct, but feel free to point out mistakes/improvements.

In these tables:
  • S.A = the highbeam switch
  • 5.55 = the output of the timer
  • T= the Toggle
  • A & B = the two devices.
  • The red cells highlight changes in the toggle.
Toggle table is on the left. Final outputs table on the right.

 

Analog Ground

Joined Apr 24, 2019
396
I propose looking at this as a state machine problem. The truth tables are starting to get at it. However, organizing the problem into present states and next states might be best (a state table). It is entirely possible to do this design with old school electro-mechanical relays which would be appropriate for a motorcycle. Particularly if it is vintage!
 

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
Doing this with relays is an interesting idea, but I need you to help me see what you mean a little more. For example, how could the timer be emulated via electro-mechanical relay(s)? Or the flip-flop?
 

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
Is this what you have in mind when you say a state table? I've highlighted the "quick switch back on" states in red. These are the states where the switch has been turned back ON while the timer, being triggered by a recent turn-off from the switch, was still on. When this occurs, the Toggle (or "latch") changes its value:

 
Last edited:

Analog Ground

Joined Apr 24, 2019
396
Your table is really good work and is circling around the idea of state machine design. I made an error when suggesting a state table right off. Here is a link which will goes back one step in the process to a state diagram. I suggest starting there at a minimum. This is a way of defining the problem which is also a good way to communicate to others. One step back from there is a free flowing timing diagram. Probably not needed here. The state table falls out from the diagram. Make sure to include all possible "transitions" in the diagram. Many problems arise due to incompletely specified machines. Don't worry about the number of states. Let the simplification process shown in the article reduce it down.

https://www.allaboutcircuits.com/textbook/digital/chpt-11/finite-state-machines/

Your problem starts to diverge in Step 5. Here you have to decide on the technology you want to use. This could be mechanical relays, discrete logic like flip-flops, programmable logic (e.g. FPGA) or even a micro-controller. Your problem in it's simplest form does not have a clock. So, when selecting the technology, you also decide on whether you will make a "synchronous" or "asynchronous" state machine. The first uses a clock to keep everything ship shape and the later has no clock. A design with mechanical relays would be an asynchronous state machine.

Why do I mention relays? All the other technologies get complicated really fast. A power supply is needed. Then, a driver for the light. Maybe a circuit board. Your initial diagram shows a mix. There is a relay and some "logic". Elevators used to be controlled with state machines made out of nothing but mechanical relays. One thing lost along the way is the ability to use relays to perform logic. This technology is kind of fun actually. Different.

OK. I ramble. The next question is "What about the timer?". This can be a "time delay relay" but these are a bit expensive. I would look for a prepackaged solution which runs on 12 volts (or whatever your battery voltage, 6V?) and takes a mechanical switch input. Perhaps something from a maker site? Under the covers, it is probably a 555 timer anyway.

I will try to find a link on Asynchronous machines and relays. You can start with the state diagram and state table.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
Seems a natural for an ATTINY85 8 pin DIP and Visual Programming tool.
versus writing C.

There are visual methods for coding -

http://www.carobot.cc/how-to/ardublock/ Ardublock

http://www.mblock.cc/software-1/mblock/mblock3/

https://forum.allaboutcircuits.com/threads/visual-programming.157949/#post-1370887



Videos on both on youtube.

You would need an Arduino board to program the ATTINY85. So looking at < $5
in overall costs to do the development.

No matter what approach you use electrical environment on bikes and cars ugly -

http://www.ti.com/lit/an/snva681a/snva681a.pdf



Regards, Dana.
 

mvas

Joined Jun 19, 2017
537
An idea ...
What if you used a Toggle Input / Self-Latching Bi-Stable 12 Volt Relay?
And configure your 555 Timer to 500 milliseconds but then
Connect the 555 Timer "TRIGGER" Pin to the Headlamp / Switch connection.
Connect the 555 Timer "OUTPUT" Pin to the Relay Input Pin.

When you TAP the headlamp switch ...
a) The headlamp will pull the TRIGGER Input Pin LOW.
b) The output of the 555 Timer will immediately change from Low-to-High = Input to Relay to TOGGLE the Load On/OFF
c) 500 milliseconds later, the 555 Timer will lower the Output Pin and prepare for another TOGGLE

The 500 millisecond delay will "debounce" the Headlamp Switch, to prevent multiple TOGGLES from a single TAP.
 

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
Thank you all for the responses and links so far. The variety of responses is exactly what I was looking for. I will look all of this over. Also, I'll make the state diagram you requested, @Analog Ground.

No matter what approach you use electrical environment on bikes and cars ugly -

http://www.ti.com/lit/an/snva681a/snva681a.pdf
@danadak, are you saying here that I need to account for special considerations for automotive systems because of the low consistency of the power coming from them? Can you give me some ideas about what these considerations might entail?
 
Last edited by a moderator:

AnalogKid

Joined Aug 1, 2013
8,449
The description in post #1 sounds like something I worked out years ago to add to 4-tube fluorescent light pans to turn them into 2+2 - two come on when you first flip the switch, and two more come on if you then bounce the switch rapidly.

If load B is controlled by a relay, what are the relay coil requirements? Voltage / Current / Wattage?

The A off time controls everything. If the switch is off longer than a decision level, the circuit resets to B-off no matter what the previous B state. What is the maximum switch-off time you want to be interpreted as a toggle command?

Also, do you want a circuit, or do you want to develop the circuit yourself?

And just to be clear -- if A is on and you bounce the switch to turn on B, A goes off and on quickly, with B coming on when A returns. Also, if A and B are on and you bounce the switch, A goes off and on quickly, while B goes off with A and stays off. yes/no ?

ak
 
Last edited:

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
@AnalogKid, yes, you have it right.

And just to be clear -- if A is on and you bounce the switch to turn on B, A goes off and on quickly, with B coming on when A returns. Also, if A and B are on and you bounce the switch, A goes off and on quickly, while B goes off with A and stays off. yes/no ?

From the "A on alone" position, I should be able to bounce the switch to bring B on, then bounce it again to turn B off. A and B are always off when the switch is off, including during the bounce.

Also, do you want a circuit, or do you want to develop the circuit yourself?

I don't mind if you post a circuit. I'm curious about what you did for the timer etc. It sounds like your circuit worked slightly differently than the one I'm trying for, with the "decision level" (in my case, notated above as the 555 output) acting to turn off the B circuit in response to an OFF input with no bounce back up. With mine I'm envisioning a "latch" so A + B can go off and on together until I unlatch them with a bounce. This is because I anticipate riding on dark roads and wanting extra light. If this is the case, I would want to dip the brights + aux for oncoming traffic, then bring 'em back up again, with the auxiliaries reactivating if they were previously active.

If load B is controlled by a relay, what are the relay coil requirements? Voltage / Current / Wattage?
When you say "relay coil requirements," I'm assuming you're talking about the trigger. To answer your question: I don't know yet. If I were to go with the diagram in my first post, I'd have some questions about how I can use the 12v system to power all of this, and which components I could use for the logic gates (nomenclature correct?) as well as the flip-flop ("latch"). If I have to step down the 12v to get this to work, then the relay's trigger input would need to match I believe. Regardless, it would be passing the 12v (or 13.7 or whatever) across its switch. Does that help?

Also, nice name! A Signals reference if I'm not mistaken?
 

Thread Starter

oKCfGYhmJQi

Joined May 3, 2019
60
An idea ...
What if you used a Toggle Input / Self-Latching Bi-Stable 12 Volt Relay?
And configure your 555 Timer to 500 milliseconds but then
Connect the 555 Timer "TRIGGER" Pin to the Headlamp / Switch connection.
Connect the 555 Timer "OUTPUT" Pin to the Relay Input Pin.

When you TAP the headlamp switch ...
a) The headlamp will pull the TRIGGER Input Pin LOW.
b) The output of the 555 Timer will immediately change from Low-to-High = Input to Relay to TOGGLE the Load On/OFF
c) 500 milliseconds later, the 555 Timer will lower the Output Pin and prepare for another TOGGLE

The 500 millisecond delay will "debounce" the Headlamp Switch, to prevent multiple TOGGLES from a single TAP.
@mvas Forgive me if I'm not understanding your suggestion correctly/completely, but you seem to describe a functionality where every time I turn the headlamp switch, the toggle relay would switch its setting.

Let's say I start off with A (as you say "headlamp" and I say "highbeam" = same same) ON, then turn it off. The 555 is set to 2 seconds. I wait 5 seconds then turn back on. I believe B (aux lights) would come on as well, since the relay would have been toggled. Please correct me if I'm misunderstanding.

While I do question whether you sorted it out 100%, if I may venture to say so, I think you've brought up a possible solution to a key question I have. My question is, "What component can I use for the flip-flop latch?" Your answer is this locking relay. If we keep the logic gate (a component which I also don't yet know how to source) between the 555 output and your relay, then the relay would be triggered only when the 555 output was high and the switch was turned on. Is this what you meant…?

Can you tell me more about the relay you have in mind? Can you send me a link?
 

AnalogKid

Joined Aug 1, 2013
8,449
I would want to dip the brights + aux for oncoming traffic, then bring 'em back up again, with the auxiliaries reactivating if they were previously active.
That is a change from my previous circuit. Hmmm ...
When you say "relay coil requirements," I'm assuming you're talking about the trigger.
No, I'm talking about the relay. Your schematic shows a relay controlling load B, and the circuit driving the relay coil. How much current does the relay coil need?

Also, the logic can be CMOS devices, which run on 12 V directly. No need for a 5 V regulator.
Also, nice name! A Signals reference if I'm not mistaken?
Yup.

ak
 
Top