Interfacing optical encoders from embroidery machine with arduino

In my neighbor, there are a lot of embroidery machines from China. These machines got optical encoders to stop machine if any inconsistency came in moving of threads. But all those encoders are connected via a large setup. I wanted to interface these encoders with arduino. On this board, 3 Pins from left are connected to IC and Last 6 are connected to + of all 6 optoswitches. The IC on circuit board is CD14538BE.

Please help me out... I have an application that is based on continuation of threads, so I'm really wishing to do something using this. Plz help me out. Thank You.

The chip is a dual Monostable Multivibrator: http://www.ti.com/lit/ds/symlink/cd14538b.pdf It generates a fixed width pulse from an input pulse edge.

The 6 inputs are going to the LED's of the optical interrupters. I don't know why they are driven separately. Somehow the 6 phototransistors in the interrupters are connected to the output pins, possibly through the MM.

The chip is a dual Monostable Multivibrator: http://www.ti.com/lit/ds/symlink/cd14538b.pdf It generates a fixed width pulse from an input pulse edge.

The 6 inputs are going to the LED's of the optical interrupters. I don't know why they are driven separately. Somehow the 6 phototransistors in the interrupters are connected to the output pins, possibly through the MM.

Thanks to your reply Sir. I was thinking those 6 inputs to be 6 outputs, possibly because there run six threads independently. Its assembly is like- to all six opto-interrupters each, connected an encoder wheel which is connected to another wheel through a shaft. This wheel moves when thread runs along its boundary. If any breakage comes to any of the six thread, the machine stops. Now I wanna know how do i connect this board to arduino, so that i can write mmy own code to work with this.

Well it doesn't look easy. I would say that the way this is wired up is that all the detectors are wired in parallel so if one detector is unblocked it will show a low on the detector. Now in order to sense exactly what one has been unblocked the emitters are cycled one at a time. That is emitter one is activated and the detector output is checked. Then if that shows blocked that emitter is turned off and the next one is activated. This continues until you activate an emitter that the detector sees as unblocked. Then you know what thread has broken. This arrangement has the advantage of only having to monitor one detector line normally if you put all the emitters on. The 6 emitters should be connected to 6 arduino outputs, Check if there is a series resistor on the board otherwise put a 220R in line with these. Then trace the detector outputs to the connector and use that to connect to an arduino input.

Well it doesn’t look easy. I would say that the way this is wired up is that all the detectors are wired in parallel so if one detector is unblocked it will show a low on the detector.

Yes, one and only one detector is used at a time.

Now in order to sense exactly what one has been unblocked the emitters are cycled one at a time. That is emitter one is activated and the detector output is checked. Then if that shows blocked that emitter is turned off and the next one is activated. This continues until you activate an emitter that the detector sees as unblocked. Then you know what thread has broken.

You mean that a cycle initiates to check which interrupter is blocked and turn it off until it finds an unblocked one. But the machine runs until an interrupter is unblocked, that is I think if machine sees all interrupters to be blocked, it shuts down. Still am having a question, that all six interrupters got encoder wheels, and at a time it is possible that all wheels set up in a way that detector detects light from emitter. More simply, I mean to say that, this works if and only if the wheel moves. Because a stopped wheel could still e in a position to let the detector detect light from emitter.

This arrangement has the advantage of only having to monitor one detector line normally if you put all the emitters on.

The 6 emitters should be connected to 6 arduino outputs, Check if there is a series resistor on the board otherwise put a 220R in line with these.

Yes a series resistor is there, but do you mean i need six different arduinos to connect 6 emitters. And by the way, what do u mean by arduino outputs?? I’m not getting this. Do u mean to define 6 pins as output(out of 0 to 13 digital pins).

Then trace the detector outputs to the connector and use that to connect to an arduino input

Please simplify this, I’m not able to understand what is the connector here.

Also, please tell how to provide power to this arrangement. There are three pins (other than those going to emitters) one of which is connected to the CX1 of IC and other is to the VDD, and third one is connected to Q2 bar. Do i have to provide 5+V to VDD??

that all six interrupters got encoder wheels,

You never mentioned encoder wheels before, this changes everything! What are they like? What we are trying to do here is second guess the intentions of the engineers who designed it, previously I was only thinking about a blocked / unblocked sensor but if there are encoding wheels then it is likely that these are not just simple opto slot detectors. It could be that they are incremental encoders like you find in computer mice.

I am not sure where you got the C & E markings from on your initial diagram. It is possible that this is wrong and that would make the other lines (the ones going to your connector) from the detector part not the emitter part.

So I think you will have to be a bit more precise in what is actually happening. It would be good to see what sort of signal is actually being produced by this unit when it is in operation. Can you measure them on a scope and see what signals they have.

I mean to say that, this works if and only if the wheel moves.

Is this ALL wheels move? If so over what time period. That is what that chip could be about. It is a retriggerable monostable acting as a missing pulse detector. Movement could reset the monostable, if no movement is detected in a certain time then the monostable times out and produces a falling edge, then that edge triggers the other monostable in the package which fires an interrupt to stop the machine.

These other questions may or may not be relevant now I know about encoder wheels.:-

Yes a series resistor is there,

Where? we are talking about one resistor per opto slot, is it on another board?

And by the way, what do u mean by arduino outputs??

Do u mean to define 6 pins as output(out of 0 to 13 digital pins).

Yes but never use pins 0 or 1 because they are used by the serial port.

I'm not able to understand what is the connector here.

The 12 pin header on your board.

Also, please tell how to provide power to this arrangement

Wire up +5V and ground to the correct pins on the header. You have identified the +5V as being at the end and connecting to the +ve of the IC but you need to trace the ground.

EDIT I see you have sent me a PM, at the moment these do not work and so I can't read it or reply to it.

You never mentioned encoder wheels before, this changes everything!

I assumed you've gone through the whole thread...in third post I've mentioned about encoder wheels. Anyways, know you know it.

I am not sure where you got the C & E markings from on your initial diagram. It is possible that this is wrong and that would make the other lines (the ones going to your connector) from the detector part not the emitter part.

May be but I've checked these marks on a couple of parts, all bearing the same, with(diode symbol) on optoswtich marked between - and +.

Can you measure them on a scope and see what signals they have.

Please explain how to do this.

Yes a series resistor is there, Where? we are talking about one resistor per opto slot, is it on another board?

No actually there's a resistor of 62ohm 5%tolerence(blue,red,black,gold) which is connected to - and E of all optoswitches, where all - are connected together and all E are connected together. And an another resistor of 1100ohm 1% tolerence (black,black,red,brown) connected one side to C of optoswitch and another side to a capacitor rated 16V 47uF. Now the two pins of the three are connected to this capacitor( 3 pins from header which are connected to IC). Also, The pin which is connected to Vdd of IC is the same connected to the capacitor and the resistor.

Do u mean to define 6 pins as output(out of 0 to 13 digital pins). Yes but never use pins 0 or 1 because they are used by the serial port.

Okay, I'll remember to leave tx and rx.

Wire up +5V and ground to the correct pins on the header.You have identified the +5V as being at the end and connecting to the +ve of the IC but you need to trace the ground.

No, I haven't identified anything, just guessed as optoswitches need +5V. I'm still supposing to give +5V to first pin, which is connected to Vdd of IC, but how to trace the ground???? please help me.

Last, but not the least, your help is really appreciable. Am becoming a fan of you. Thanx a lot.

in third post I've mentioned about encoder wheels.

So you did, missed that sorry.

Please explain how to do this.

You need an oscilloscope, this measure the signal levels and gives a graph of how the signals vary over time. I assume you haven't got one, this makes thing hard because in electronics this instrument is your eyes. Have you got any test equipment? The simplest multi meter will cost less than $10.

there's a resistor of 62ohm 5%tolerence(blue,red,black,gold) which is connected to - and E of all optoswitches, where all - are connected together and all E are connected together.

No not that, you need a resistor to limit the current through the LED emitters of the opto switch, I can't see any on those two photos. By the way have you flipped one over because it does not look like a board underside from the same board. You have traced the second connector wrong, I think the ground goes on pin 1 on your board and the power goes on pin 1. When it is connected to your machine you need to measure what these voltages are.

but how to trace the ground?

You follow it either visually or electrically using the continuity or resistance measurement of the multi meter from a known ground point. A good point is pin 8 of the IC because we know that is ground.

So having identified pin 1 and 2 as being the power and ground and pins 7 to 12 as going to the anodes of the LEDs that only leaves pins 3 to 6 to find out about. Then we can start to think about how to connect it to your arduino.

You need an oscilloscope, this measure the signal levels and gives a graph of how the signals vary over time. I assume you haven't got one

Yeah, seriously I haven't got one. Damn, its too costly.

By the way have you flipped one over because it does not look like a board underside from the same board

Yes, I have flipped it.

You have traced the second connector wrong

The second connector is connected to one leg of the capacitor C1(47uF) and simultaneously it is also connected to Cx1 of IC, while going through one leg of another capacitor C2(104).

I think the ground goes on pin 1 on your board and the power goes on pin 1.

This is confusing, Power and ground on same pin, but how?

So having identified pin 1 and 2 as being the power and ground and pins 7 to 12 as going to the anodes of the LEDs that only leaves pins 3 to 6 to find out about.

Pins 4,5 and 6 are spared on this board. So only pin 3 is to be now identified.

If you wish, i can post more clear pics of it, like some more close-ups. Also, to get everything more clear, I can remove all components from the board itself. Please let me know. Thanx again for your help.

I think the ground goes on pin 1 on your board and the power goes on pin 1.

Sorry typo, I did go on to say:-

So having identified pin 1 and 2 as being the power and ground

Well it looks to me like the first three connectors have something attached to them.

Yes, I have flipped it.

That makes it hard to follow because it is not like you would see it in real life.

The second connector is connected to one leg of the capacitor C1(47uF) and simultaneously it is also connected to Cx1 of IC, while going through one leg of another capacitor C2(104)

Well that nails it as a power connector, use your multimeter and see if it is connected to pin 8 of the IC, I thing it is through traces on the top.

OK, now i have found out the solution to the problem. There are nine working pins on the header. Last six pins connected each to the + of each optoswitch. The first three pins are as follows: +ve(5v), GND and a common signal. Other three pins are of no use. There exist encoder wheels between each optoswitch, which is connected to another wheel through a small shaft. The wheel moves when there is a thread attached to it runs. As soon as the thread breaks, the wheel stops moving and ultimately the machine stops. This happens because whenever the encoder wheel moves, the current flowing from + of that optoswitch to the signal pin is very weak and in an alternating form(I checked it via led which is very dim and flicks till the wheel moves). As soon as wheel stops, the current from + to signal pin becomes HIGH. So there must be some algorithm that reads and stops the machine. But this information is sufficient for me. Thanks to all who've helped me in this thread and forum.