Introduction: Project 2: How to Reverse Engineering
Hello fellow Hobbyist,
A good friend of mine had put together several components along with a Raspberry Pi in order to decode RS232 protocol to TTL. The end result was thrown all in a box that contained 3 main components: a power converter to power the Pi, a dual channel relay that ensures power is not wasted by controlling when the communication has to happen, and a RS232 to TTL module converter. The task at hand is to create a better solution that combines all the hardwares into one PCB. The end result will have less elements laying around -> less cables -> vibration proof design. This means that the task at hand is a hardware reverse engineering task. The following steps should help solve tasks of these nature.
Step 1: Identify the Components
You will need to google based on either of the following:
- Using the name printed on the board itself.
- Using the function of the device.
- Using the main component in the board itself: look for the beefy chips -> get their names -> google their application.
- Google image any key words found and scroll down until you find the device or any lead to another search.
Long story short, I have found all the three devices and went ahead and ordered them on ebay:
- MAX3232 TO TTL: https://www.ebay.ca/itm/MAX3232-RS232-to-TTL-Serial-Port-Converter-Module-DB9-Connector-MAX232/262241627343?epid=25013268400&hash=item3d0ed1accf:g:FSgAAOSw7Vpa8roe
- 5V Dual Channels Relay : https://www.ebay.ca/itm/5V-Dual-2-Channels-Relay-Module-With-optocoupler-For-PIC-AVR-DSP-ARM-Arduino/263347137695?hash=item3d50b66c9f:g:DlUAAOSwIVhaG-gf
- DC-DC buck converter: https://www.ebay.ca/itm/DC-DC-Buck-Step-Down-Converter-6V-80V-24V-36V-48V-72V-to-5V-9V-12V-Power-Suppply/122398869642?hash=item1c7f8a888a:g:3vkAAOSwuxFYyQyb
Step 2: Time to Get Some Circuit Schematics
When searching for circuit schematics it is important to keep in mind the main function of each board.
Once the circuit diagrams are found, go to digikey (or mouser, or anything you’re going to order the elements from) and see if the main chip is available as you will be ordering it later.
All other elements should be available is most electronic websites (diodes, caps, inductors, resistors…) Sometimes, you might have a problem find those in the right size or package (through hole, surface mount, …)
In case this matters in later stages of the design, please search keeping those details in mind.
So I ended up with the following datasheets:
- MAX3232 TO TTL: https://www.sunrom.com/p/rs232-ttl-module-max3232
- 5V Dual Channels Relay : http://wiki.sunfounder.cc/index.php?title=2_Chann...
- DC-DC buck converter: http://www.xlsemi.com/datasheet/xl4015%20datashee...
As mentioned before I went ahead and started searching for the components used on Digikey websites, I was able to find all of them except for one component regarding the DC-DC buck converter, more specifically I was not able to find XLSEMI XL4015 buck converter (found on LCSC tho !) To avoid having to order from two different websites and therefore pay the shipping twice, I have decided to bypass the converter at hand and go for another design that uses components found on Digikey. So I ended up following this schematic:
New Buck converter: http://www.ti.com/lit/ds/symlink/lm2576hv.pdf
By making sure that the current and voltage are enough to power the Pi, I have finally identified all the elements that will be used in my main PCB.
Step 3: Keep the Big Picture in Mind
This step is really important, as it sets the tone for the overall design. My task is to reduce the number of wires laying around inside the box as this last is exposed to an environment with high vibrations. In tackling this problem, I had to separate the power lines (powering the Pi) from signal lines used for the decoding and the communication between devices. With information in mind, we will combine everything into one PCB. The final product will have one ribbon cable, and one micro-usb cable to establish the connection with the Pi. The ribbon cable will contain all the signals between the two devices, while the micro-usb cable will provide the 5V ,1 A power needed to turn on the Pi. With this in mind, I went ahead and rearranged the GPIO pins used in the Pi in order to have all the signals close to each other as show in the picture. Obviously, in order to do so, you will need to change GPIO pins to other GPIO pins, while changing Gnd with other Gnd and power with other power pins using the general pin out of the Raspberry Pi. These changes shall be recorded as they will be needed later to update the firmware running on the Pi.
Step 4: EasyEDA: Schematics
In this step, you will need to get yourself familiar with the simplest cad tool out there. EasyEDA ! as the name indicates, learning how to use this development website tool should be straightforward. I am attaching the link to the website itself along with other good references to get you ahead quickly:
Introduction videos (by GreatScott): https://www.youtube.com/watch?v=SpKK6o4ffts
Quick tutorial made by the website developers themselves: https://docs.easyeda.com/en/FAQ/Editor/index.html
Step 5: Select the Components Needed
In this step you have to select whether you want to use through hole or surface mount components based on the dimension of the board, your soldering equipment, and your soldering skills! I have decided to go surface mount for all the components if possible with few exceptions where the SMD version is not available, say the relays for example.
Next you will need to fix the package size for all the caps, resistors, diodes, etc... In my case, I have decided to settle on 1206 for most common components.
Here again there many online tutorials regarding surface mount soldering techniques. I particularly relied on Dave Jone’s tutorial on this subject (linked below), feel free to watch the other two soldering tutorials:
EEVblog #186 – Soldering Tutorial Part 3 – Surface Mount
I know the video is long, but the dude talks about other interesting stuff while teaching you how to solder. Obviously, he has more experience than most of hobbyist out there, like you and me, so it should be fine.
Step 6: Draw Schematics for the Missing Components
EasyEDA has a vast majority of the components I was planning to order except for one device. This being said, it shouldn’t be a problem, as this software allows you to add your drawings to the online library.
I needed to add “D-SUB 15 female connector ” (digikey: https://www.digikey.ca/product-detail/en/amphenol-fci/D15S33E4GV00LF/609-1498-ND/1001812)
By checking the datasheets of the device in the link, you will be able to replicate the geometrical features of the component. That should include spacings, dimensions as well as direction of the device. If you are lucky enough, sometimes the manufacturers include the PCB drawings as well for you to simply copy and paste it manually onto easyeda.
Step 7: Design Your PCB Layout
In placing the different components into the board, you will need to make sure to reduce the connecting traces length. The longer these last are, the more exposed are you signal lines to impedance and noise interferences. With this golden rule in mind, I went ahead and place all my components as shown in the video.
Step 8: Crunch the Numbers in
In this step you will need to determine the right trace width to be used in order to connect different elements. Easyeda’s trace thickness is standardized to 1oz (your cheap option). This means, you simply need to have a rough estimate of the current flowing in each of the traces. Based on the application at hand, I decided to fix 30mil for most of my power traces ( to hold a max of 1 A) and 10~15 mil for the signal traces (to hold a max of 100 mm A).
You can use some online trace calculator like this one to get those numbers.
Online Trace Calculator :https://www.4pcb.com/trace-width-calculator.html
Step 9: Wire It Up
Once the race thickness for different lines is fixed, it is time to do the wiring of all the components. If you have placed your components according to the general PCB design rules (linked below), you should be able to do the wiring easily. At the end after adding the copper coating, you will end up with a completed PCB ready to be ordered. For that, I recommend using the partner website to easyeda, JLCPCB (linked below), when ordering you don’t need to make any changes to the standard ordering options. Also if you are soldering more than one board, I recommend ordering the stencil sheet that goes along with your uploaded gerber file. Doing so will allow you save a lot of time during the soldering process.
Step 10: Time for Some Serious Soldering
Since I am soldering only one component for the sake of testing my design, I carried the soldering manually to enhance my skills in that area. The final product will look like the picture attached.
Step 11: Do the Final Checks
In this final step, you will need to do basic continuity test of your important traces such as the power lines. This should help you avoid damaging anything connect with your board (in my case: The raspberry Pi). And just like that, using reverse engineering I was able to create a vibration proof device.
As always, thanks for following my stories with engineering. Feel free to like, share, or comment any of my posts.
Until next time,