Hi guys. Thanks for all suggestions, I was digesting them, then I look into theory why the thing work like they work. And from them I got ideas for different approaches etc... And now I thing I have something usable.
So I was playing around with couple ideas what I got from people and I think I came up with blend of almost all of them in one circuit
. I made it on my workbench and I think it's working quite well. I didn't had any function generator but 50Hz hum noise saved me. It's everywhere
as input I have just floating 0.5m cable around and even when tried to touch compensation reference on my scope (1khz) my body acted like transmitter and I was able to detect it on my input and make nice 1Khz square from it. This design started as differential opamps setup, but then I noticed that mine opamp under this condition was not able to handle AC (negative signal) so then I went different way.
First I have 33k resistor, then 5.1V zener diode and then TVS 37V diode. Then it's going into first stage of opamps. It's configured to make about 4x gain I added this first stage just because my second stage had hysteresis around ground. I wanted to have LOW trigger around ground so I was able to do it, but consequence was very awkward values for resistors and then switching feedback from LOW to HIGH and back went very slowly and the raise/fall was noisy so it wasn't making purpose what I wanted and it triggered multiple times while it was falling etc... So I made first stage amplifier and then second stage could have more reasonable values for hysteresis. I ended up with 520mV for HIGH (divided by 4 it's 130mV in original signal) and 80mV for LOW (20mV in original signal), firstly I had much lower LOW trigger but I had problems with it again, but now I think because the amplified signal had almost perfect 0V while the original signal even on opamps input was able to swing little bit into negative. But now on output of second stage I have almost usable signal, I don't have false triggers but on the output the fall is jiggered and noisy (it's not clear and nice line). So it goes into third stage with different hysteresis setup to be sure the noise wont bounce different levels in MCU while it's falling etc... so third stage is 2.88V for HIGH and 2V for LOW and I thing if I should put 1k or even 680 instead 1.3k feedback resistor to have bigger difference in trigger levels (what you think guys?). And now I think I got TTL compatible output, the HIGH from opamp was 4V instead 5V but it was much cleaner, raises and falls too etc... (the noise was gone, but the raise/fall curve had tendency to wait in middle for a while and then continuing to raise/fall, perhaps because of the feedback switching) Just to be sure I feed it into inverters the first stage of the inverter got me 5V on HIGH instead 4V and the raise/fall is almost straight line (no waiting in the middle), then the output is feed to second stage of inverter and now the fall/raise time is 3x to 10x faster than fist stage (now 70ns fall time and 120ns raise) and the base voltage is constant while on first stage was small swing when it drooped to low. Now it's very nice square and 100% TTL.
All parts used are available, so I made it from everything what I found in junk box, if something is overkill and could be done with cheaper/alternative device then I don't mind to use this ones, just because I have them on hand and if you guys give me OK on this design I will make same as it's on picture, just I will make it on small PCB and add couple thing like jumpers to be able to ignore fist stage and then jumper for 2 alternative second stages, one like on the picture and another one almost the same just with potentiometer so I could make small variations with 2 jumpers and 1 potentiometer. And then I will try it in real condition how it's working. Just I'm curious if there is something wrong and asking just for big troubles. Perhaps I should lower the feedback resistor on 3th stage etc...
Best regards Anton. And again thank all of you for all advices.
PS: Sorry for my scribe I just painted it in photo editor.