Following the same way we did with the MPU6050 article, we now have to design the component HMC5883L, which is a digital compass. Again, instead of drawing the part, you can use SparkFun’s library. Even if you use the component from the library, you can always practice and learn.

The complete list of this series:

First steps for designing your own component

First of all, open the datasheet here. Go to section “Mounting Considerations”. There you find how the component is, and where is located each pin. The datasheet gives you how should be the PCB. All we need to do is to design the footprint according to this drawing.

Open EAGLE, on the main window, left panel, open your library folder. If you configured correctly the library on the first tutorial or you did the second tutorial, you should have a folder! Now select your name on the library panel and go to “File”, then “New” and finally click on “Library”. Before anything, save your file. Go to “File”, “Save as”, and save the file as HMC5883L inside your library folder. Great, let’s begin.

Click on the “Package” button and a window will appear. On “New” box, write the package name. This is the name of package size, i.e. for the HMC5883L that should be 16 pin LPCC, or LPCC16. Select “Yes” to create new package with that name. Before drawing the part, go to the “View” menu, then “Grid” and change your units for millimeters, place the “Size” to 1 mm and “Alt” to 0.5mm.

Designing the package

Click on the “Wire” button from the toolbar, select tDocu from the layers menu and draw a rectangle. After that, click on the button and change the properties from the geometric figure to fit on the package size defined by 3mm x 3mm. Then you can draw another rectangle defined by 2.1mm x 2.1mm. This tDocu layer won’t be printed on the PCB, however it helps you when designing the part. If you have any doubt about how to draw the piece, consult the datasheet dimensions. For example, the larger rectangle will have origin on the coordinate: (0,0), then go to (3, 0) to (3,3) and finally (0,3) to (0,0). The second rectangle will have origins at:

  • P1 = (0.45 , 0.45);
  • P2 = (2.55 , 0.45);
  • P3 = (2.55 , 2.55);
  • P4 = (0.45 , 0.45).

Your drawing should look like the following image:

Now draw the pads. Click on the SMD pad button . Insert one pad anywhere on the screen. Click on the information button again and change its proprieties, like the place and size of it. Put it on the coordinate P1 = (0.25 , 2.25) with size 0.5 x 0.3 mm. Now copy that pad with the copy tool . Place all the other 15 terminals around, right clicking it to rotate, when placing the pads on the sides. After that, just position each one on the correct place. It will look like this image.

Now use information button to change the location of the four lines from the inner rectangle from tDocu layer to tPlace layer. Now you can change the display of the layer tDocu to be easier to see. Go to “View” menu, then “Layer Settings”. Double left click on the tDocu layer (it’s one of the last layers from the menu) and put some yellow color there. Apply.

Click on the name tool and change the pin names for 1 to 16. Beware to put the pin 1 on the upper left pin, and that the pin 16 is on its right side (top view – looking through). After all this, you can draw a circle so you can know where is located the pin number 1 when placing the components. Use the tPlace layer. At last, select the text button and write “>Name” and “>Value” over the tNames and tValues layers, respectively. OK, your package is ready! Save and get out!

Editing the symbols of the component

Now go back to the device creation window. You might need to open your new library file again, and click on the “Device” button. Write it on the “New” dialog box HMC5883L. Save the file as HMC5883L. Now this part is easier. The compass has 16 pins, but only 11 pins are used on the schematic. Click on the wire tool and select the Symbols layer. Draw a box of any size you want. After that, select the pin button and place all 16 pins. Remember that you can change the pin size on the top menu, as the image shows. Also, remember to right click when placing the pins if you want to change the side that the pin is. By right-clicking you can rotate it.

After putting the pins, you can name them! Select the name tool once more and name the pins according to the datasheet. Now select the text tool and write “>Name” to the Name layer and “>Value” to the Value layer. Simple as that. There you go! Your schematic should be ready like the image below.


Connect pin and pad

Save again your work and you are ready to connect the pins and pads. You can do that by clicking on device the button. Name it HMC5883L, and create it. First of all, on the new window, click on “Prefix” button (down there) and write a big and capital “U”. Now “OK”. Select the “Add” button and put your new HMC5883L you just created. Above the “Prefix”, click on the “New” button and select your LPCC16 package. After all this work, you will see an exclamation mark near the package name. Select the “Connect” button and associate each pin to a pad. Of course, as this compass has unused pads, some of them won’t be assigned to any pin. There’s no problem on that. However, if this was the opposite, a pin without a pad, you would have problems. The final step is to add a description to your device. Save it and we are done! Cool!


Now we are able to compare our own design with the standard SparkFun library. Putting both components side by side we will see small differences. Our part follows exactly as described on the datasheet.

Where to go from here

  • Designing The Parts III (Or Downloading) – BMP180;
  • Designing The Parts IV (Or Downloading) – PCF8563;
  • Designing The Parts V (Or Downloading) – AT24C64;
  • Schematic I – The Arduino Pro Mini;
  • Schematic II – The Sensors;
  • Schematic III – Other Modules;
  • Board Designing;
  • Generating Files.

3 thoughts on “Designing The Parts II – HMC5883L

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s