Hi Mehemetkose
An optical sensor may not work unless you keep it perfectly clean, also if the thread goes slack even for a second it will trip and stop the machine unfortunately sometimes the thread knots and stays tight and the machine will keep going.
One method is to contact a supplier of coin micro switches like this one. Shape the end so it is held closed by the thread.
Put it just (after) the thread tensioner on the sewing head or near by.
http://www.happcontrols.com/amusement/pinball/95417000.htmHowever it is not ideal if the thread knots it will stay on as above
I can guarantee the next option works. I used on for many years. But you will have to get a technician to make one up for you. I am no longer Quilting.
Get a cheap shaft Encoder (it must have ball bearings.)
This one is OK S1-500-236-I-B-D
http://usdigital.com/products/encoders/incremental/rotary/shaft/s1/Mount it on your machine head (before) the thread tensioner.
Put a small 20mm pulley on the shaft, and wrap the thread once around the pulley and then through the normal thread tensioner you already have on the sewing head. It will not effect the tension. (That is why a ball bearing type is better)
The technician will have to design a circuit that will cut the power as soon as the little wheel on the encoder stops rotating for more than say 2 seconds. That can be adjustable. However it must not work for say 5 seconds after the machine starts. So he will be building 2 timers that work one after the other. I remember the man that did mine used a couple of 555 timers and a relay. The parts cost is around 100USD. Maybe there is a tech in this forum that wants to give it a try, and do it for “Mates Rates” Labour.
I guess this will not be that cheap in the end. However it works every time. If the thread stops moving (tangled or not) it will stop.
Often at the same time the thread breaks the needle brakes causing the blunt end of the stub that is left to punch holes as it merrily wrecks the work piece. I guess that is your main reason for concern.
Cheers
John Mac