ringing in signal - Page 1
Forum section: electronics / projects

author: n4te
author_rank: Regular Contributor
timestamp: September 04, 2023, 06:58:31 pm
content: EDIT: Itturned outthe problem was the base on the optocoupler should not be left floating!I have this:I know this is not ideal and if doing it over I'd use a proper transmission line setup. I will go that route if I must, but for now I'm playing with this 1) to salvage it if possible, and 2) for the experience to improve my understanding.I'm sending a signal at 400 baud, so 2.5ms between transitions. Most often it works perfectly, between pins 11 and 12:Once in a while it looks like this:When this happens, there are about 1-6 dips and they are ~0.7ms apart. In all these tests, the "long wire" is about 14" of ethernet.This doesn't seem to be EMI, as the signal is stable except after a low to high transition, and even then it only happens once in a while.Another pic of the anomaly:What could be the cause? Is it reflections in the 14" cable? Why does it only happen sometimes?Starting from the source, here's between pins 1 and 2:Nice and clean. Between pins 4 and 5:Some noise, I wonder if this is the problem already?Next, how might I ignore this noise? Yes, use a proper transmission line!I may still do that. Scrapping everything would be a lot of work and cost. Scrapping only the receiver is less than 1/10th the effort and even less cost.0.7ms = ~1.4kHz. I could use an RC filter < 1.4kHz and > 400Hz. Maybe 800Hz or so? Is that likely to clean up the signal enough to make receiving reliable? I know questions like that are not really unanswerable. Maybe instead: Is an RC filter the right approach to condition the signal so the dips don't interfere with decoding?

author: wasedadoc
author_rank: Super Contributor
timestamp: September 04, 2023, 07:11:41 pm
content: That is not ringing. Nor is it noise on the wires. Those negative going glitches are clearly at regular intervals. The problem most likely is the input signal to the first optocoupler. Hang the second channel of your scope on there to prove it.

author: fourfathom
author_rank: Super Contributor
timestamp: September 04, 2023, 07:22:39 pm
content: And it is definitely not due to reflections on a 14-inch twisted-pair wire. Those would be very roughly 3ns apart.

author: jkostb
author_rank: Regular Contributor
timestamp: September 04, 2023, 07:24:48 pm
content: Have you tried to reduce R2? Reducing R2 would result in faster pullup of signal and possible solve your problem

author: n4te
author_rank: Regular Contributor
timestamp: September 04, 2023, 07:30:21 pm
content: Quote from: wasedadoc on September 04, 2023, 07:11:41 pmThat was this pic, between pins 1 and 2:http://n4te.com/x/8111-L7ZC.jpgIt's nice and clean!Quote from: jkostb on September 04, 2023, 07:24:48 pmI can give that a try, thanks!

author: StillTrying
author_rank: Super Contributor
timestamp: September 04, 2023, 07:36:39 pm
content: Is it using the MCU's internal weak pull-up, which looks too weak.It could be software turning the weak pull-up off for a few us.

author: AndersJ
author_rank: Frequent Contributor
timestamp: September 04, 2023, 07:38:43 pm
content: Is the unconnected V01.6 picking up something?Perhaps better to not float it.

author: n4te
author_rank: Regular Contributor
timestamp: September 04, 2023, 08:14:54 pm
content: Quote from: AndersJ on September 04, 2023, 07:38:43 pmVO1.6 is the NPN phototransistor base (opto isIL2-X009T). I've read leaving it unconnected is best, else it might interfere with the sensitivity. Grounding it through a resistor would be hard, as it's down in a hole next to a connector.Quote from: StillTrying on September 04, 2023, 07:36:39 pmThe input pin is indeed using the internal pullup, which seems to be 45kOhm (ESP32-WROOM-32E). This seems promising, cheers! I'll give it try right now.

author: CaptDon
author_rank: Super Contributor
timestamp: September 04, 2023, 08:18:59 pm
content: Don't leave that base floating!!! Connect the base pin to the emitter pin with something between 100K to 470K ohms.

author: n4te
author_rank: Regular Contributor
timestamp: September 04, 2023, 08:37:22 pm
content: I've hacked on a 4.7K pullup on the input pin:The signal does seem better! I can't tell if it happens less often. It seems like the same anomaly is there but less:Quote from: CaptDon on September 04, 2023, 08:18:59 pmOK, trying that will take some doing, but I'll give it a go.

author: StillTrying
author_rank: Super Contributor
timestamp: September 04, 2023, 08:42:30 pm
content: It's a software problem, a glitch when something (re)configures that port.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 04, 2023, 08:44:06 pm
content: Looks like EFT, though rather slow (~kHz repeat rate), and no evidence of it elsewhere on the trace.Note that RF noise causes charge injection in bipolar devices, so any common mode noise in the circuit can cause activation like this. It's not clear if this is the problem.Tim

author: n4te
author_rank: Regular Contributor
timestamp: September 04, 2023, 09:30:00 pm
content: Quote from: StillTrying on September 04, 2023, 08:42:30 pmI've done such dumb things before (yesterday in fact) but it shouldn't be the case this time. I configure the GPIOs once at start and then never again.I rigged a 220kOhm resistor between the base (pin 6) and emitter (pin 4, SGND) and the problem has gone away! It was happening maybe once in every 8 tries. I must have tried 60+ times and didn't get a single anomaly. Sooo, I guess that solves it! Thanks everyone for your input and to AndersJ and CaptDon who nailed it!It's annoying there's no version of the IL2-X009T optocoupler without the base, and that the datasheet doesn't bother to mention what should be done with the base. I could use something else, like LTV-816S, as I do for other things. I can't remember why I started using the IL2/ILD2/ILQ2 optocouplers over LTV-816S/826S/846S. EDIT: Ah it's because IL2-X009T has 100% min CTR while LTV-816S has 50%.Unfortunately the fix is on the transmitter side. I need a resistor between these pins:I don't think I can do that cleanly. Maybe it really is time to redo all my beautiful boards and use RS-485.Ah well, I learned a thing!

author: StillTrying
author_rank: Super Contributor
timestamp: September 04, 2023, 09:51:15 pm
content: Not far off from what T3sl4co1l said then, but on that base.It must have been bad luck that you never saw it on the wire, which would have given a clue that it was coming from the TX.I've always left the base floating.

author: n4te
author_rank: Regular Contributor
timestamp: September 05, 2023, 01:05:15 am
content: Maybe these give you a chuckle...Not the best of times, but it's something. Sadly my attempt on the most important boards was a melty failure:

author: ledtester
author_rank: Super Contributor
timestamp: September 05, 2023, 01:11:58 am
content: Maybe use a through-hole resistor.

author: n4te
author_rank: Regular Contributor
timestamp: September 05, 2023, 01:15:22 am
content: True, soldering that might be a little easier, but not by much. My things were so pretty.