toggle mode with button (without micro-controller)

Hi,
I am thinking for a long time on how to design a logic that has one digital input and one digital output.
Whenever the input goes low to high ("rising-edge") the output should change its value, regardless of the "high time" of the input.

for example:
-simple button (not switch) that every click toggle led on/off.
-RF receiver and transmitter. tx will send high signal for unknown time and rx will change state only at rising edge.

in: 0 0 0 0 1 0 0 0
out:0 0 0 0 1 1 1 1

in: 0 0 0 0 1 1 1 0
out:0 0 0 0 1 1 1 1

in: 0 0 1 0 1 0 0 0
out:1 1 0 0 1 1 1 1

example code: (just for understanding)
while(true)
if(in == HIGH){
out = !out;
while(in == HIGH);
}

I have two ideas I'm not sure about:
-TFF (trigger flip flop), connect line in to CLK and '1' to T. each CLK rising edge, Q will change
-T latch (short J and K to T, on JK latch)
-RC debounce circuit

I don't want to use mcu. only electrical components. digital circuit of 5V.

I would really appreciate your help from you experience.

Use an edge triggered D-Type flip flop and connect the D input to the Q bar output.

Now the serious problem here is that you refer to a "simple button (not switch)". What you probably do not realise is that a pushbutton - or switch - is not "simple".

Switch contacts - unless very specially designed (such as mercury-wetted switches) - "bounce", so that your flip-flop will faithfully respond to every bounce and end up in the same state as before if there happen to be an even number of contact closures overall.

So I am not sure whether this relates to your dog watering bowl project, but while your actual question has been answered, this almost certainly represents an "XY Problem".

Grumpy_Mike:
Use an edge triggered D-Type flip flop and connect the D input to the Q bar output.

Thanks, but my question is what do you think about this solution and not how to implement it.

Paul__B:
Now the serious problem here is that you refer to a "simple button (not switch)". What you probably do not realise is that a pushbutton - or switch - is not "simple".

Switch contacts - unless very specially designed (such as mercury-wetted switches) - "bounce", so that your flip-flop will faithfully respond to every bounce and end up in the same state as before if there happen to be an even number of contact closures overall.

So I am not sure whether this relates to your dog watering bowl project, but while your actual question has been answered, this almost certainly represents an "XY Problem".

LOL ;D
No it's not about the watering project, so I'll explain:

I bought one of this (link) online.
Here is a tutorial on how it works (link).

I want the tx to sit by my bed, and whenever I click a button the tx sends HIGH signal to the rx that switches the lights on/off. The rx of course is somewhere inside the wall, connected to relay.
The thing is I want to click once in order to toggle the lights, and not to keep pressing the button for the whole day.

Thanks, but my question is what do you think about this solution and not how to implement it.

Ok my answer is “not a lot”.

Given what you want to do with it what makes you think that would work or is in anyway a solution?

Grumpy_Mike:
Ok my answer is “not a lot”.

Given what you want to do with it what makes you think that would work or is in anyway a solution?

Basically I thought about making the same circuit as in the tutorial. (button connected to RF tx, rx connected to some logic that is connected to relay and to the wall switch).

The logic is what I am not sure of. It suppose to power the relay when I turn on the light with a single click until the next time I click the button.

So I thought it must be something with flip flops, for example T type.

In TFF every time the clock goes HIGH while the input is HIGH, the output changes. So I suppose that if I'll connect the rx output directly to TFF's clock than it would solve my problem.

OK, the problem is not with the flip flop. A "T" type (not available as such) or "J-K" or "D" as Mike pointed out, are all pretty much one and the same thing and the latter two readily available as ICs (usually more than one per package).

The problem is as I explained, with your button. The transmitter and receiver you cited will most likely be quite capable of reliably conveying the contact bounce which I described, making the operation rather unreliable.

On the other hand, a MCU such as the ATtiny range can be programmed to perform the denounce operation perfectly as well as the toggle (and other functions such as turning the light off after a certain time). That is why people now do use them instead of the basic logic ICs.

For the application you describe, such reliability probably does not matter however.

Hi,

Lots of hits..

Tom...

Paul__B:
The problem is as I explained, with your button. The transmitter and receiver you cited will most likely be quite capable of reliably conveying the contact bounce which I described, making the operation rather unreliable.

So what do you think about using two debouncing circuits (like this), one for the button near the tx and one for the rx received signal?

TomGeorge:
Hi,

Looks awesome! thank you very much!

So what do you think about using two debouncing circuits (like this), one for the button near the TX and one for the RX received signal?

Pretty much useless!

OK, you have caught my attention. I watched the video after I realised something obvious and I was (perhaps not surprisingly) right!

The video points out that - despite all his useless mucking about with his form of "de-bouncing" - the radio link is in itself, completely unreliable. If you simply use it to toggle a flip-flop, you will have your night light or room light randomly switching on - and off - all through the day and night!

And of course the reason is that as with my own experiments back in the 1960s, the oh-so-simple receiver here is a superregenerative circuit. In the absence of anything but a very strong signal, it produces a continuous stream of noise, and noise means that part of the time, the output will be HIGH, and part of the time it will be LOW. It is not possible to resolve this either by using delay ("de-bounce") or level sensing circuits because from time to time it will be HIGH for quite a long time, and part of the time it will be very HIGH even without a signal from the transmitter.

And in addition, the superregenerative receiver exhibits "capture" on any signal within a wide frequency range, not just the specific 433.92 MHz of the SAW resonator in the transmitter, but any other frequency in the 432 MHz ISM/ Amateur Radio band.

These communication pairs are (or were) commonly used in car and garage door remote controls such as on my own garage - so you may ask if they are so unreliable, how are they at all useful?

Well guess what? By using microcontrollers (or ASICs) - the very thing you keep on fantasising that you do not want to use.

They are used by requiring a MCU-generated code to be sent repeatedly by the transmitter, and the MCU-based receiver responds only when it detects the code with complete accuracy and no error at least once.

And yes, there are remote control transmitter and receive pairs available on eBay (I have at least one such in a container here somewhere ...) which incorporate these functions - including the toggle. Lacking the necessary design skills, you are advised to get one for your project.

(OK, so that one does not appear to have the toggle. This one does for a dollar extra! And it controls two lights or whatever.)

OK paul, thank you very much.
Lucky I have ordered 2 nanos online, just because it was cheap

Good reason. I have ordered quite a few, even though I really have not used many - yet. But I have lots of (serious) uses for them.

I never buy just one of anything when buying parts. I always get at least one more than I need.

Well, regarding the superregen pairs, I ordered five - because they were individually cheaper that way (especially now that Australia has legislated on GST from all overseas imports) even though I may only ever play with one just for the reminiscence ...