Timing coil pulse to TTL "strobe" - Page 1
Forum section: electronics / projects

author: ChristofferB
author_rank: Frequent Contributor
timestamp: May 15, 2016, 06:41:32 pm
content: Hey! I'm on the quest of creating/modding/buying a paper tape punch/reader system, and I've run into some trouble with the punch:The timing is purely electromechanical. There's a "ready" signal and 8 punch solenoid lines I need interfaced.So whenever the "ready" is triggered, the combination of bits is sent to the punch. (physically, it's when the punches are all the way up).Driving the punches with some ULN2003's are no problem, the issue is the "ready"It's literally just a big coil, and then there's a blade on the motor shaft that passes by it, inducing a small pulse.So how could one go about getting a square TTL pulse from that?I don't even think "timing coil" is the appropriate term..

author: georges80
author_rank: Frequent Contributor
timestamp: May 15, 2016, 06:54:07 pm
content: Like an inductive pickup style output.Just google for inductive pickup circuit etc. Some r's and c's and an opamp etc will do the trick.First step is to characterise the actual signal with a scope to get an idea what you need to do to it to get it to a nice digital pulse.There's also dedicated inductive pickup IC's that have all the circuitry inside.cheers,george.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 15, 2016, 09:19:28 pm
content: Yeah, probably a comparator is all you need. Make sure to filter the signal well, and use hysteresis, so you aren't getting fake pulses from contact switching or motor-brush noise!Tim

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 29, 2016, 05:49:53 pm
content: Hi, and sorry for replying to my own, very old post, but since a new topic would be identical, I thought it better.It's the same issue: I'm sitting with a lever, rotating on a shaft passing by a coil, making a pulse per revolution.The pulses are approx 1,1V pp, and approx. 0,2ms apart. something like attached. (voltage in red, period in green).My initial approach was to have a 5,1V zener to gnd, letting the signal pass through a 1n4148, then have an RC net to gnd, and a buffer.(see attachment 2)This circuit yields NO output at all, and I suspect the voltage drop over the diode drowns out the relatively weak signal.What could be done differently? Let the first stage be a transistor to buffer the signal, THEN diode and RC net?Thanks in advance, this one's really bugging me.

author: Zero999
author_rank: Super Contributor
timestamp: August 29, 2016, 06:19:32 pm
content: Quote from: ChristofferB on August 29, 2016, 05:49:53 pmIf the pulses are 1.1V peak to peak and are symmetrical, it means the peak voltage is only 0.55V and it takes around that voltage to even slightly turn on a BJT, so it's not surprising it didn't work.If you changed it to a common emitter amplifier, rather than a emitter follower and applied the pulses directly to the base, it might work.Try this. A diode is used to add about 400mV on to whatever the input voltage is before the transistor. It's inverting though. If you want non-inverting, then add another transistor.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 29, 2016, 06:53:20 pm
content: Thanks, I'll try that! The inversion is fine, as I'm planning to use a inverting schmitt trigger on the other side.

author: Ian.M
author_rank: Super Contributor
timestamp: August 29, 2016, 07:10:33 pm
content: Amplify and invert it, differentiate it and use a comparator to pick off the +ve spike from differentiating the rapidly falling part of the waveform. If there is a wide variation in shaft speed, you'll need some sort of AGC to avoid the output pulse shifting relative to the shaft angle.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 29, 2016, 07:48:32 pm
content: Okay, so after the proposed amplifier stage, I've added an op amp comparator and a 74121 for pulse stretching. (74123 pictured, cad package didn't have the '121). Would that be usable? RC time constant would be said to 0,05 ms or something like that. The aforementioned time between pulses is when the motor has spun right up, so if there's any variation, the pulses will be further apart, never closer than the 0,2ms. See attached schematic for what I gather from your ideas.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 29, 2016, 07:56:14 pm
content: D'oh, forgot a transistor inverter before the comparator.

author: David Hess
author_rank: Super Contributor
timestamp: August 30, 2016, 04:48:15 am
content: If the output level is high enough, then capacitively coupling it to the clock, set, or reset of a flip-flop or bistable latch may be enough; a low edge rate will requiring using the clock input assuming it has a schmitt trigger input but that is not a problem. The flip-flop or latch is then reset at the end of the operation producing monstable operation.If the level is low, then an amplifier or comparator is used before the flip-flop or latch.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 30, 2016, 05:50:16 am
content: Differentiate..? Why would you do that? You're adding more noise to an already spiky signal.Integrate it instead!Indeed, the wave looks to be some sort of magnet-passing-a-coil, or something physically similar anyway, where the voltage is the derivative of the action. So take the integral, and get a square* pulse just like that!*Probably not square, because the rising and falling edges depend on geometry and proximity. And because an integrator is a linear element, the output will be proportional to the height (and duration) of the input pulse, not digital. In any case, you have a better chance of detecting thresholds by using a comparator.Tim

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 30, 2016, 10:22:44 am
content: So you'd add an integrating stage before the comparator? Yeah, that might help. I'll try that.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 30, 2016, 02:35:02 pm
content: Quote from: Hero999 on August 29, 2016, 06:19:32 pmI just mashed this together on some veroboard, with an inverter stage after. It needs no further formatting! it gives nice crisp 0-5V pulses of a uniform lenght! I can always stretch the pulses if a microcontroller can't pick them up, but it's in the low khz scale, so that shouldn't be a problem. Thanks again!Now the last issue is to drive the punch solenoids -17V as low and 0V as high from TTL.. Just found out using a ULN2003 can't be done, what with the negative voltages.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 30, 2016, 03:18:16 pm
content: I think the ttl->punch could be worked out as simply as attached here. a ttl HI would pull the voltage low, to -17V, a ttl LO would have the signal "pull up" to gnd.

author: Zero999
author_rank: Super Contributor
timestamp: August 30, 2016, 03:26:18 pm
content: Quote from: ChristofferB on August 30, 2016, 03:18:16 pmThat will only work if the TTL's ground is at -17V. If the TTL ground is at 0V, then the transistor will just turn on and the output will be continuously -17V

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 30, 2016, 03:36:25 pm
content: Aww yeah, missed that... oops. How else could it be achieved, then?Maybe a relay? I mean, it's not going super-fast but I'm not sure it'd work. and the noise...

author: ChristofferB
author_rank: Frequent Contributor
timestamp: August 30, 2016, 04:21:26 pm
content: Std. dip 5v relays are too slow. They have switching/bounce times in the same order as the punch times, it seems. Probably better using a transistor solution, I just can't get my head around it.

author: Ian.M
author_rank: Super Contributor
timestamp: August 30, 2016, 04:22:10 pm
content: When you've got crazy level shifting requirements, the 'nuclear' option is to use an optocoupler. However in this case a simple PNP in common base will do it.R2 sets Q1 base current exactly as if the TTL ground was the -17V rail and Q1 was driven direct as in your previous circuit. Neglecting its base current, what goes into Q2 emitter comes out of its collector. R1 handles up to 50uA leakage in Q2 to prevent unwanted turnon of Q1.N.B It relies on the TTL Vol being less than Q2 Vbe. If not, (i.e you are driving it from something that barely meets the TTL Vil threshold of 0.8V), either add a pulldown on the emitter or a series silicon diode.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 14, 2016, 08:25:03 pm
content: Hey, terribly sorry to update an ancient thread yet again, but I'm SO CLOSE now.. and lost. again.I've built the circuit as proposed by Ian M., and it succeeds in dragging the voltage to -17V when 5V TTL is applied, but it can only pull up to around -6.5V when 0VTTL is applied. What on earth could be wrong and/or done to remedy that?I guess a tighter pullup than 10K would work, but that's pretty much just brute-forcing it, as I see it, Q1 must still be driven, where it should be off.Thanks in advance.

author: Zero999
author_rank: Super Contributor
timestamp: September 14, 2016, 10:06:23 pm
content: What load are you trying to drive? How much current does it use?

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 14, 2016, 10:13:46 pm
content: It's supposed to drive a solenoid labeled 250 mA, 36 ohm, connected from output to -17V but since afforementioned schematic has a pullup, I just went without further load at this test.

author: MK14
author_rank: Super Contributor
timestamp: September 14, 2016, 10:46:24 pm
content: Quote from: ChristofferB on September 14, 2016, 08:25:03 pmIs there any voltage across R1, when "off" (0V TTL) ?If there is anything like or near a diode drop, then I would wonder if any back emf's produced by the solenoid(s), have damaged your transistor(s), potentially making them leaky.If that is your problem, then you will have to come up with something, much better protected, against the inductive spikes of the solenoid(s).I've not been following this thread, so could be talking complete nonsense.EDIT: similarly, Q1 could have gone leaky. If that is the case, R1 won't necessarily show any voltage, but there are other ways of testing for that eventuality.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 14, 2016, 10:54:47 pm
content: I've never hooked the circuit up to the solenoids, I'm still at the "getting the driver to work" stage.I'm not very experienced in higher power stuff, or analog stuff for that matter, so if I seem a bit lost, it's because I am.I'm thinking about putting some big 5W current limiting resistors before each solenoid, and then maybe a diode across each as well.Right now I'd be happy if I could get my driver to go -17V (off) to 0v (on) with a low impedance load.

author: MK14
author_rank: Super Contributor
timestamp: September 14, 2016, 10:58:44 pm
content: Quote from: ChristofferB on September 14, 2016, 10:54:47 pm6.5 volts, is suspiciously close to the "zener" or avalanche voltage of the emitter base junction. I wonder if you have mis-wired it somewhere ?I.e. The transistor EBC connections are a bit wrong or something ?I.e. The emitter/base junction gives around 7V, if connected up wrong. I.e. a 7 volt zener like effect.

author: Ian.M
author_rank: Super Contributor
timestamp: September 14, 2016, 10:59:51 pm
content: If you need a really beefy pullup, try this:It may need an anti-parallel Schottky diode across the solonoid coil though the back-emf is clamped via D1 and the forward biassed b-c junction of Q3.If you are only driving a simple solenoid, take my original circuit, use a 60V Vceo min. transistor, leave out R3 and wire the solenoid in place of it, putting a 33R resistor in series with a 1N4002, cathode +ve, across the solenoid coil, to slug the back-emf without increasing the dropout time significantly.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 14, 2016, 11:49:36 pm
content: See that's the issue. The solenoids are supposed to have a common -17, and then the driver on the other side..It is just a solenoid that's supposed to inhibit a mechanical pin from firing, by dragging it sideways. Might try simplifying your original circuit as proposed. I have built an x8 board of that circuit on protoboard, would be nice to re-use.MK14: Actually, the voltage is closer to -7V. The 2n2222's I'm using are some old ITT2222A's, and I recall there are two pinout variants of the 2222... Might try flipping one just in case.Again, thanks!

author: Zero999
author_rank: Super Contributor
timestamp: September 15, 2016, 10:38:34 pm
content: Yes, this is looking pretty complicated.You can definitely get rid of a transistor.

author: StillTrying
author_rank: Super Contributor
timestamp: September 16, 2016, 12:39:02 am
content: It might be possible to do this with 1 transistor rather than 18, - as long as that one is a Darlington.I don't know if the phase is the right way up.

author: Zero999
author_rank: Super Contributor
timestamp: September 16, 2016, 07:55:39 am
content: Quote from: StillTrying on September 16, 2016, 12:39:02 amYes, that will work, for the output stage but it will need another transistor to convert the 0.55V signal to 5V TTL. It also relies on the 17V rail being, pretty close to 17V, which may not be a problem.As multiple channels are required, I'd suggest using the LM339 to get 0 to 5V from the 0.55V signals, a common base PNP transistor to level shift it to the negative rail and the SN754410 to drive the solenoids. I'll post a schematic later.

author: Zero999
author_rank: Super Contributor
timestamp: September 16, 2016, 07:44:02 pm
content: It's simpler than I thought: the LM339 & SN754410 will give you four channels. R1 & R2 give the reference voltage from 5V and don't need to be repeated for the other channels: connect the LM339's +inputs to all Vref.Note: The SN754410 is not specified to with Vcc1 = 17V but it should work. If it causes any problems, then add a 5V regulator between 0V and -17V and connect it to pins 1, 9 & 16 and R3.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 17, 2016, 08:56:34 pm
content: Wow, that's a lot of hints! the SN754410 solution looks interesting!I've attached the schematic for the original driver circuit from the manual.-Another thing: The only thing in this punch that uses the -17V rail is these solenoids, and they're arranged like I've attached below.Couldn't I just let the common terminal be gnd and run them on +17V on each channel? It'd have the same voltage difference, and the same phase, as far as i can tell, and it'd be much much easier to level shift!

author: Zero999
author_rank: Super Contributor
timestamp: September 17, 2016, 09:56:49 pm
content: Quote from: ChristofferB on September 17, 2016, 08:56:34 pmYes, that would work. In fact it would be easier to just switch the negative line with a transistor. The ULN2803 contains eight Darlington transistors, plus back-EMF protection diodes. You'll still need another circuit to translate the 0.55V to a high enough voltage to switch the transistors though. The LM339 circuit I posted would do that.http://www.ti.com/lit/ds/symlink/uln2803a.pdf

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 17, 2016, 10:07:11 pm
content: I'm sorry, that all sounds good, but where does the 0.55V come from?the coils are supposed to be triggered by std. TTL logic.But yeah, if you go 0 to+17, I'd planned to just use ULN2003's. or similar.

author: Zero999
author_rank: Super Contributor
timestamp: September 17, 2016, 10:45:26 pm
content: Quote from: ChristofferB on September 17, 2016, 10:07:11 pmWell you said:Quote from: ChristofferB on August 29, 2016, 05:49:53 pmAnd the peak voltage of 1.1V is 0.55V, which won't be enough to turn on an ordinary BJT, let alone a Darlington transistor.The AM26C32 could be used to convert the tiny voltage voltage to a TTL level to drive the Darlington array.http://www.ti.com/lit/ds/symlink/am26c32.pdf

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 17, 2016, 11:03:02 pm
content: Quote from: Hero999 on September 17, 2016, 10:45:26 pmOh, now I get it. That was a different pulse, a timing signal made by the punch. That was solved. the signal driving the solenoids is just standard TTL from a microcomputer/microcontroller/8255 or something. Guess I should have made it clearer that this problem was two-parted.That looks great, your schematic, I think I'll go with that solution! much simpler. Thanks a bunch! - Could I use ULN2003's instead of 2803's? I have a million of those lying around, you see.

author: Zero999
author_rank: Super Contributor
timestamp: September 17, 2016, 11:18:14 pm
content: Quote from: ChristofferB on September 17, 2016, 11:03:02 pmOf course the ULN2003 could be used. I only suggested the 2803 because it has eight channels. You can drive the Darlington array directly from the MCU.The AM26C32 could be used for the other part of the circuit, to convert the 0.55V signal to TTL, if you need more than one channel.

author: Ian.M
author_rank: Super Contributor
timestamp: September 17, 2016, 11:48:38 pm
content: Is the assumption the solenoids are electrically reversible valid? Plain solenoids would be, but if they are magnetically biassed, you'd need to maintain the same polarity.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 17, 2016, 11:54:28 pm
content: Quote from: Ian.M on September 17, 2016, 11:48:38 pmIan: I have no idea, but I'm not changing polarity, by doing this, as far as I can tell. I've tested this with a very simple setup, actually. putting +17V over all coils, the other way around, and that gives some lovely blondes of FF-punched tape!So that's the plan, then. Yeah, the AM26C32 definately sounds like an interesting part to keep in mind for future stuff!I've attached what I've reached now, i think. It might be beneficial to add an octal latch triggered by a pulse stretched ready signal, to ensure the solenoids don't do stuff while it punches, don't really know how it would handle that...I think the first device for getting stuff printed will just be an EPROM with the address hooked to a counter triggered by the ready signal. Can't imagine anything simpler.Thanks again for all your help!

author: Ian.M
author_rank: Super Contributor
timestamp: September 18, 2016, 04:27:16 am
content: Unless youv'e rewired the common to each individual solenoid, you *have* reversed their polarity. It used to use a high side OC83 PNP for each solenoid with the common -ve, but it now uses a low side PN in the ULN2003, with the common +ve. However if it works . . . . .Looking at the original schematic, it effectively has 15R in series with each solenoid. If that's more than 20% of their DC coil resistance, you should add it to prevent over-driving them. Also, you'll get crisper turnoff if you can return the ULN2005 diode commons to a higher voltage than the +17V rail feeding the Solenoids. One way to do that would be to stick a beefy Zener in series with that pin, cathode to the +17V rail. It will be carrying the full coil current momentarily at switchoff, so don't use an under-rated one - if you have to, use a power transistor to 'boost' it. Something in the 15-18V range should be about right. If the turnoff is timing critical and the solenoids are high inductance you *MAY* need this refinement. Take a LCR meter and characterise the solenoids then solve for the time for the current to decay by 90% into a single silicon diode Vf opposing it (or 'scope it in action) - if you don't like the answer add the Zeners!

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 18, 2016, 11:31:59 am
content: Surely, the voltage differential will be the same over the coil? - I can't see that having implications beyond maybe inversing the logic (could be handled on the 5V side), but I think I'll wire up a single channel and test on the coil, to be sure. I'm not sure the "47/3" resistor is supposed to mean 15 ohms. I think it might be a 3W 47ohm resistor. I'm unsure, though. The max current of the coil is 250 mA, so calculating the resistor's value should be straightforward.

author: Ian.M
author_rank: Super Contributor
timestamp: September 18, 2016, 12:06:01 pm
content: The original circuit used OC83 Germanium PNP transistors. Look at the direction of conventional current flow indicated by the emitter arrows, its out of the collectors and down to the -17V rail via the solonoid coils (not shown). Now look at your ULN2003 based schematic. With the solonoid common taken to +17V the current direction through each solonoid is opposite, (assuming you haven't rewired the solonoids to reverse each one's connection to the common rail). If they aren't magnetically biassed and don't have an integral anti-parallel diode, no problem - but I wouldn't just assume they'll be OK without checking.The original schematic represents four stages (1-4) i.e. separate channels.The key to figuring out the intended value is the component I.D. R37-48, which is 12 I.Ds. All other part on that schematic have a range of four IDS, e.g. R1-4. So you have one resistor symbol that represents three resistors per channel, and a value given as '47/3' and its only reasonable to suppose they are in parallel, with a value of 15.666R. As there is an extra 330R resistor to 0V, when the transistor is on, the solonoid 'sees' almost exactly a 15R series resistor. If you want to reproduce the original circuit 'pull-in' characteristic and operating current you should fit 15R 1W power resistors there (caution they will run hot).

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 18, 2016, 12:20:31 pm
content: Ahh. I was tired when I made my schematic. I wanted to take the solenoid common to GND, and THAT'S the case I was argruing about. Sorry.You're probably right about the resistors, too. I'll add those in.

author: Ian.M
author_rank: Super Contributor
timestamp: September 18, 2016, 12:34:40 pm
content: If the solonoids are polarised, you'll need a high side driver/switch. UDN2982A might do it, but may not have enough current rating (unless you parallel sections with 27R current sharing resistors, giving you 13.5R in series with the solonoid, which should be pretty close as the Silicon PNP Darlingtons drop a bit more voltage than an OC83!). Otherwise look at 24V rated automotive high side switches, preferably 'dumb' ones.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 18, 2016, 12:46:32 pm
content: I might do that. For now I'll try the uln2003 thing, I think.

author: StillTrying
author_rank: Super Contributor
timestamp: September 18, 2016, 10:02:42 pm
content: Perhaps you could use a small strip of iron to see if the plungers are magnetized.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 19, 2016, 04:31:48 pm
content: I can't really get to the coils, or plungers for that matter. It's all a very complex mechanical design, and everything is hand-adjusted to calibrate for hole-spacing, frequency and such. I reaally don't want to take the mechanical assemblies apart if I can at all help it.I'll see if the design works with reversing on the coils, else, I'll get some UDN2982A's or UDN2981A's, and try that. The last one sounds like the safest bet, actually.

author: Ian.M
author_rank: Super Contributor
timestamp: September 19, 2016, 07:08:20 pm
content: How to tell without disassembly - Pass 200mA constant current from your bench PSU through one coil. Note the voltage. Reverse it and if the voltage is the same and >1V you know there isn't a diode. If there isn't a diode, Jerry-rig the circuit for one solenoid using discretes and whatever level-shifter takes your fancy and see if it punches OK for that bit. Try reversing the solenoid and see if there's any difference.

author: Zero999
author_rank: Super Contributor
timestamp: September 19, 2016, 07:49:49 pm
content: Quote from: Ian.M on September 18, 2016, 12:34:40 pmIf you're going to parallel sections of the '2982A, the you might as well use the SN754410 which can source enough current and is also handy for driving motors.Quote from: ChristofferB on September 17, 2016, 11:54:28 pmIf that circuit works then I doubt the coils are polarised. Test it further if you have any doubts but it should work.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: September 19, 2016, 09:20:22 pm
content: The UDN2982A/2981A should have sufficient drive, I think, rated for 500 mA. The coils are only rated at 250 mA, but I'm getting a couple, then I can always parallel them up.There's also no mention of any diodes in the schematics for the coils, so I don't think there are any. We'll see.

author: Zero999
author_rank: Super Contributor
timestamp: September 20, 2016, 08:35:39 am
content: Quote from: ChristofferB on September 19, 2016, 09:20:22 pmThe UDN2982A & 2981A are no longer made. Look for the MIC2981/2982 which are still in production and are pin compatible.http://ww1.microchip.com/downloads/en/DeviceDoc/mic2981.pdfhttp://www.digikey.co.uk/product-detail/en/microchip-technology/MIC2981-82YN/576-1158-ND/771627