This is a small story about how I found the mysterious culprit that was hindering with one of my experiments and baffled me for two whole days.
The story goes like this : I was trying to setup a serial communication bridge to test the GUI software I was making for the Mini CNC Plotter. The software is being developed on Processing. I have finished designing the basic algorithms for implementing the communication protocol between the control software and the Arduino Nano which I am using as the control end MCU of my plotter. Before I can test the protocol on my actual plotter hardware, I wanted to test whether the communication protocol, and thus my algorithms work properly because I didn’t want to mess with hardware with my shifty code. So to do that, I grabbed a CP2102 breakout board and an another Nano to make a serial COM port bridge. I could simply connect the control software to the plotter’s Nano and try testing it. But then I wouldn’t be able to understand what exactly happening under the hood. I wouldn’t be able to know if either the control software or Arduino screw up something. It could be misinterpreting or missing commands, dead loops etc. So I wanted to know what they would be doing regardless of the fact that I am writing the code. The idea was to interface the CP2102 to Nano using the Software Serial library for Arduino and use the Nano’s USB serial COM port as normal. This way, I can open two serial terminals on my system to emulate the control software and the plotter and see how they respond to each commands in real-time.
If you didn’t understand what I’ve just said, just ignore it because that’s not what we are concerned about here. It’s only a preface.
I was using a breadboard to make the bridge. I had to first make an RMC (Relimate Connector) equivalent in order to connect the RX and TX of the CP2102 to the breadboard. I used a 4 x 6 (holes) piece of a dot matrix PCB to solder a 4 pin male breakaway header pin in a really smart way to make the breadboard connector. I could’ve directly inserted the wires to the breadboard, but hey this is seri(al)ous stuff; I don’t want loose contacts. Even if I wanted to, the RMC came with the breakout board had multi-strand wires like any other RMC cables. If you don’t know, multi-strand wires and breadboards don’t go well together.
This is the connector I made. Smart and perfect isn’t it ? It may look perfect, but it is the center of our concern. I connected the CP2102 to Nano via pins 5 and 6 and wrote the code (using Software Serial) to send and receive commands between them. Then I fired up the serial terminals (Bray’s) and started sending commands. But counter to all my expectations nothing really did happen. I was first like, “ow there must be something wrong with my code”. So I tried modifying my code again and again trying to make it work except it didn’t work. Luckily I had a spare breakout board. So I swapped the boards thinking there could be some issue with the board I was using and viola! It worked. So I assumed the problem was with the breakout board. But at some point later the second board stopped working for no reason. I double checked the connections, they were all right. So I sat in front of my work table trying to figure out what’s wrong with my setup. It was midnight by then. So I had to start the debugging again today.
I tried to use all my knowledge, all my experience, everything I’ve ever taught to pinpoint the problem but in vain. I was really frustrated at that point. Then something came to my mind as an intuition. I checked the connector I just soldered, and then a past experience hit me in the prefrontal cortex (you may know it as a “light bulb”). I recalled a situation where one of the two ATmega328 minimal boards I made for my final year B.Sc project didn’t work due to a mysterious problem. The problem was that the solder residue on the board was acting like a low value capacitance and attenuating the clock signal generated by the crystal oscillator on board. I solved it by washing the boards with paint thinner (I didn’t have IPA solution then, and still don’t). It removed the solder residue and made an end to the headache I was having then.
Similar to that, the solder residue on the PCB of the connector I just made was behaving like a capacitor and was attenuating the serial data signals (I was using 9600 baud rate then). That was the reason why both the serial converter modules failed to work and I was not receiving any signals. I removed the residue and the modules worked just fine.
The perplexity of this problem is that you can not find it with ordinary troubleshooting methods. For example I tried using a multimeter to check for shorts though I was 100% sure there weren’t any. If you check for shorts using the continuity option in the multimeter, it wouldn’t show anything, because there will be no physical shorts you to find. The stray capacitance will only affect the high frequency signals not the DC signals.
You may say that it was my ignorance that caused this trouble by not cleaning the PCB after soldering. But this just happened. It literally baffled me to death for two days which I should’ve been spending to finish the plotter project. I hope I’ll never forget this again ever in my life [sighs]