I am trying to come up with a light sensor which better suits my needs, it comes on early as light rises, and goes off early as light falls. However, this post is not really interested in that particular end goal.
Now at first sight it seemed like I needed some combinator logic which expressed hysteresis https://en.wikipedia.org/wiki/Hysteresis.
An idealised hysteresis loop as commonly desired in digital electronics would be a Schmidt trigger https://en.wikipedia.org/wiki/Hysteresi ... c_circuits , https://en.wikipedia.org/wiki/Schmitt_trigger.
Note that in order to move from '-M' > '+M' you need to cross the higher input threshold of '+T', and to move back from '+M' > '-M' you then need to cross the lower threshold of '-T'. - this is actually the reverse of what I needed.
I need: that in order to move from '-M' > '+M' you only need to cross the lower input threshold of '-T', and to move back from '+M' > '-M' you then only need to cross the higher threshold of '+T'. This seems to be a far more uncommon shape for a hysteresis loop both in engineering applications and in the natural physical world. However, one example of where it is expressed is in the behaviour of rubber bands as they extend and shrink as you load and unload them. The name of this shape of loop is apparently (/) Elastic hysteresis. https://en.wikipedia.org/wiki/Hysteresi ... hysteresis.
I came up with some combinatoric logic which achieves this: can anyone simplify or reduce this? (I'm sure someone can)
There is a blue print of my combinator logic below. It has input 'A' (scalar), and output 'H' (boolean 0/1). You can use the slider on the constant combinator for A. In reality it has four thresholds A<=9, A>=10, A<=40000, A>=40001.When A<=9 the logic is latched into a rising mode (R=1). Now when A rises to A>=10 the H = 1 this produces may pass through and the circuit latches 'H=1'.
When A<=40001 the logic is reset into a falling mode (R=0). Now when A falls to A<=40000 the L = 1 this produces may pass through and the circuit is reset 'H=0'.
Note that when the logic is in rising mode (R=1) A<=40000 is ignored and cannot (yet) reset the latch, and that when the logic is in falling mode (R=0) the A>=10 cannot (yet) set the latch.
(I have a sneaking suspicion that my logic is cheating somehow but I can't quite put my finger on in. Maybe it's just that I'm thinking in 'Real' numbers while working in 'Rational/Integer' numbers?)
Code: Select all
0eNrFmEGOmzAUhu/y1mRkAyGBRaVuRrOY1WyrESLgTC2BQcZEE0UcoPdoL9aT1IY2TAIkNiWZTSKD/Zv3f37P4ANs0ooUnDIBwQFonLMSgm8HKOkbi1J1TewLAgFQQTKwgEWZaiUkpgnhizjPNpRFIudQW0BZQt4hwPWrBYQJKihp1ZrGPmRVtiFcdjjqlFmUpos0ygqpXeSlHJIzNauUWchue/m3lMryuQTP03BDvkc7KmeTXWLK44qKUN5LjuO2lJci7D39jnJRySvdxE2PxRO04qWIlANINbIi4k1EAXyBur3PSKxmKJUkVj9vnBD2MTaaQGBbx4dqmvVrLcf3wrcv2di3wW5tcB7GjPir0hlRTnWiJEpDf9Bza9+JYxbklSgqcwjFXkZQMRFueZ6FlEkNCLZRWpIxCJwk1xFYw6ycPisLbD1VPKqKR5A7k5Dj2yJ/OV38+Azl7x+/ZoYpeGXCcq3L0j3HY53c9kZR62TxuZqrl+SuGXH8GcRRj/jPCcSf5yOO0cT0xVeYOnrQll1s1Uaa1BDqwbIfli0tJGkNqHhm6N1GDN2BvGl5f5ylvL/MWN493fWxMinvnm55H1h1QwtgNWUB2LddAF9PU9+fJfUnox101zfLae9ynfb1Un49ZWe+LyuMbr4zm8M6L9Xn9mN8MeU0M8k3o+N8Ah0XITTPq9PjrIBW+nx0K+gQIbUOzF907o/o9u865ojWowVvIGNcvYzB3cf1PwN0KtoYji1NBeEjZwJX7K+U90vUmt+dDfzXlmBdM7BWm3dzWBF8ONuwYCejaKJeOQj7no2dlVfXfwAeL9zU
For example for a regular Shmitt Trigger type (not elastic) hysteresis loop see Xnight's circuit here: viewtopic.php?t=28899&start=50#p189322
My approach is a rather 'digital' (easier, naive) electronic's type approach , where as XKnight's is almost a 'linear' (far more difficult/clever ) electronics type approach.
Have fun if this type of problem is your thing! Many thanks!