MPU6050, BeagleBoard, KiCad, PCB and Stuff


Hi,

As mentioned in my earlier post, I am moving towards interfacing MPU6050 with BeagleBoard. MPU6050 operates at 3v3 and BeagleBoard at 1v8. The I2C buses too use on the same voltage levels. The MPU6050 has an internal pull up resistor. For those who still do not get the issue, here it is explained in simple words:

I2C is bidirectional. It has 2 lines, namely SDA and SCL. Master and slave communicate on both the lines. But in the present scenario, the operating voltages are different. When IMU wants to send a high, it gives 3v3 on the SDA line. For Beagleboard to register that as a high bit, it should be in the range of 1.5v – 2.3v. Well, that is not happening here. You may say that I could use a resistor and create the required drop. Awesome. But here is the issue:

Now when the BBxM wants to send a high bit to the IMU, BB will give 1v8 on SDA line. IMU may not register that as a high, since IMU can register voltages only around 3v3 as high. So, wont work. We will have to design a small circuitry which can amplify the voltage from 1v8 to 3v3.

Constraints:

  •  On the same line, 1v8 should be read as 3v3 on the other end, 3v3 from one side should be read as 1v8 on the other end, and 0v too should be read as 0v on both sides.
  • Available supply voltages : 1v8 and 5v.

I came up with a small circuitry to do exactly the above, using a bunch of transistors and resistors and diodes. However, the circuit was never stable and gave irregular output. After cracking my head enough on this, I decided to finally give up the bread board design and move to a more stable solution.

Enter TI’s IC: TCA9406.

This is a bidirectional voltage level translator! Yippe! Solves major issues. But it is available only in SMD flavour. So I decided to design the PCB based on this IC.

I searched around and found that KiCad is one of the easiest tools around to begin with for PCB designing. It is available on Linux, Windows and Mac. Frankly speaking, I had not done much of this earlier. But I found a couple of good tutorials online. Basically KiCad has the following parts:

  • EESchema – Schematic Editor. It can be used to create your schematics. Very easy to use.
  • CvPCB – Used to make Netlists.
  • Pcbnew – Used to create PCBs.
  • Gerber Viewer – It allows you to see Gerber files.
  • Well, the other two options can  be ignored for now. The logo one and PCB Calculator.

Okay, a quick note: All these are sequential. There is no point going to the Pcbnew without going through the schematic editor or netlist, unless of course you already have them.

EEschema – Has a host of components. To add a part, press ‘a’. However, if you do not find your desired part, you can always create one from the Library Editor. Creating components was never so easy. Put in the desired pins, draw a box, and voilà its done. You do not need to worry about the pin placement on the IC, the size for now. That can be handled later. Once you have all your desired components in place, you can connect them and you are ready for the next steps. If you are unclear about how to design a schematic, I suggest you take a look at this video (Tip: Its a bit too long, but you can download and skip most of the introduction parts). If you would like to know how to add your own part in KiCad’s EESchema, you can take a look here (Explained step by step).

After you are done with making a basic schematic, for something like this:

My schematic for the above mentioned issue.

My schematic for the above mentioned issue.

Now, you will have to annotate the circuit. Annotation basically means, to add names to every part you are using. Say if you are using an IC, it is generally named as U1, U2, etc. So annotation is important. There is a button in the toolbar which does the same for you. Once your schematic has been annotated, you can now test your schematic. Note that this will just test the connections. It wont simulate the circuit for you. Also if you are using any standard ICs, it will check for the standard connections for those ICs too, like Gnd, VCC etc. There is a button right next to Annotation to do Electrical Rules Check. Test ERC and clear all the errors. Standard step to correct the errors is to redraw the particular connection.

Once you are through with ERC, you can generate your netlist. Save it in your working directory and generate a BOM (Bill of Materials). You see how cool KiCad is, it allows you to do everything from one toolbar alone. Now you need to run Cvpcb. Basically, this is one of the most important parts of designing a PCB. In this step, you will be assigning space for the components on the board. Also you will be routing the connections. Basically deciding on how the components will be connected.

Ok. eventually this will be the output:

Looks great no?

Looks great no?

 

Well, if you have used all standard components in your schematic, you can skip this part. Now, if you can not find the footprint of the components you need, then you might as well have to create one. To create a footprint for any component, you need to have the datasheet. The datasheet generally has the specifications mentioned. To create footprint for your component, you need to open module editor and create a new component. For TCA9406, I placed the boundaries first and then added the pads. Note that these placements have to be exact. If you are creating a component which is SMD, then you need to choose SMD pads. Generally they will be shown red in color. If you are using a through hole component, then you need to choose the pads accordingly. Note that you need to know the pitch of the component before you start making the footprint. Pitch is basically the distance between two adjacent pins on the component. Also one of the most important things is the units. You need to decide in what units will you be working. Either it will be mil (milli- inches) or mm. I chose to work in mm, since the datasheet contained measurements in mm. You can select the grid spacing as mil or mm from the left menu. Please note that you can also choose to change the selected snap grid spacing. Choose one according to your component size. Once you create the component, you need to save it in your library. For Linux users it is usually in /usr/share/kicad/ . Or however, you may decide to save it in the working directory folder and add this folder in your library preferences.

Once this is done, we need to go back to Cvpcb. Here we will be assigning footprints to the components we are using in our design. Standard components can be automatically chosen, however for the special components, we again need to add them to the library to get access to them. Once cvpcb is done, save it. Now let’s go back to pcbnew. Here, there is an option to read netlist. Read the netlist, check for any errors, solve if there are any and get the components on board. Once you have the components on board, you need to decide the size of your pcb. Choose PCB Edges from the drop down menu, it is generally yellow in color. From the right side menu, choose “Add graphic line or polygon”. Once done, draw the pcb of the desired size. Once this is over, spread all the components all over in the yellow box. Once you have done that, you might want to use an autoroute feature. Basically this will route all possible connections. To enable autorouting, click on autoroute feature, right-click on the board, and select autoroute. It will ask you what kind of PCB are we looking for. You need to know whether you will be manufacturing a single layer PCB / double layer PCB. Also you need to decide the tracks on the front side and on the bottom side. If you are  using a single layer PCB, you can choose all the tracks to be on the backside. However, if you are choosing a double layer PCB, then tracks on the front from SMD components and back from the through hole components should work well.

Once you have autorouted, there might be some connections which could not be done. You can do them manually by using the shortcut ‘x’. Note that if you are using multiple layers pcb, it might be a good idea to use Vias ( shortcut – v ). Once you are done with routing, perform a design rules check. This step is important. If it returns without any errors, you are good to go. However, if there are any errors, try googling and resolving them. Next, it is always a good idea to add a Ground plane if you are using a double layer PCB. To add a ground plane, select back side from the top drop down box, select “highlight net” option, click on any ground lines, draw a big rectangle along the border of the PCB, “add filled zones” option from the right tool bar, and choose “fill zones”. Once you are done, you will get something like the above PCB.

Now you need to do a couple of steps to get the Gerber and Drill hole files. To generate Gerber files, choose Plot option. Once chosen, select all the options you need, and choose a folder where you want to dump your Gerber files. Once done, click plot and generate drill files. Similar steps for drill files. You can now check your generated Gerber files via Kicad, or you could upload your zip files to say oshpark. It allows you to check how your pcb has turned out. You can decide on various parameters, say track width and drill hole sizes etc.

Few tips: If you are making the footprint of your own connectors, pad dia 1.6mm , hole size 1.05mm . Use pin array for standard bread board spacing. Use SIL connectors only if you want the ones which are smaller than your bread board holes.

Pardon me, this post was written in haste.

Advertisements

2 comments

  1. the Texas Instruments TXS and TXB is another nice series of voltage level translators. We use them a lot. Another reliable , discrete solution is ti use N-channel FET’s instead of Transistors.

    1. Yeah, I did go through some more TI components. N Channel FETs were also an option, but somehow didnt end up using them.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: