MinneBar 12 – What I learned

I overheard one of the attendees at MinneBar describe it as the Super Bowl of Minnesota’s tech entrepreneurship scene. I feel that was a pretty accurate description for this day long (un)conference. Here are some of what I learned from my favorite sessions:

MinneBarTechLead

My most favorite session of the day was probably “You’re the Tech Lead! Now What?” by Eryn O’Neil. I was very interested in the talk because I have been given tech  lead responsibilities at my job in the past year. She gave crisp and very practical advice. As per her, the three key roles of a Tech Lead is to:

  • Facilitate the developers with anything they might need to continue working without interruption.
  • Advocate for whoever is not in the room (e.g. talk to devs about the management’s concerns and goals & vice versa)
  • Motivate the developers do their best work.

She also made a comment about how Tech Leads are expected to work on a manager’s schedule vs maker’s schedule. It is very true and it has been the most challenging part of my present role. I think I am slowly adapting to the nature of my schedule so that it doesn’t impact my productivity.

Here is her slide deck if you are interested: https://www.slideshare.net/eryno/the-zen-of-tech-leading.

I got an opportunity to interview candidates for couple of positions recently. It made me curious about learning how to hire the right talent. The session “Reality Based Hiring” by Genghis Philip helped in answering that very curiosity. His advice ranging from how to interview the stakeholders to understand what gap is exactly being filled by this position to the very practical advice about how to plan out a screening – case study – interview – reply timeline was very insightful.

There were few other interesting sessions that I attended. Perhaps I will write about them in another post.

Also found this cool illustration in the hallway:

MinneBarIdeation

Looking inside without opening

One of the first steps while hacking any electronics is opening up the case and study the components used in the circuit board. If you are lazy or do want want to risk opening the case for whatever reason, there is a quick way to get a glimpse of the components inside the case, if the object you are hacking is FCC certified. I learned recently that you can get a considerable amount of information from FCC’s database, if you know the ID of the product or manufacturer. To test it out, I checked the remote for my tiny quad-copter for the FCC ID.

Proto-X Quad-copter remote
Proto-X Quad-copter remote

I went to FCC’s ID search form located at http://transition.fcc.gov/oet/ea/fccid/ and searched with the ID I found on the remote. As expected, the records showed up:

FCC Records
FCC Records

And one of the entries was “Internal Photo”. Clicking on it opened up a PDF with pictures of the circuit board inside the case:

Proto- X Remote Interiors
Proto- X Remote Interiors

If you poke around further, you might find some cool information. Have fun!

Altium: How to import board shape from SolidWorks

In many projects the PCB designers don’t have the luxury of defining the size and shape of their PCBs, due to mechanical restrictions. Altium has many features that make it easy to collaborate with the mechanical designers, one of them being the ability to import board shapes from any 3D modelling software. Here is how to import board shape from SolidWorks:

  • Let’s say we have a 3D model of the PCB in SolidWorks like the picture below:
    1_SolidWorks_Model
  • First, we ‘ll have to save this drawing in DXF format, which is recognized by Altium. Click on File->Save As and choose DXF file format. In the options that show up, make sure you choose correct views or entities that you want to export.
    2_SolidWorks_DXF_Options
  • The next window that pops up can be used to remove the entities you might not want to export. If you have only the board outline in your exported file, your job will be easier. Click Save after making any necessary corrections. That’s all you need to do in SolidWorks. Similar approach can be followed in other 3D modelling software. Before you close the file, note down the unit used for measurement in your model. My model is set for inches.
    3_SolidWorks_DXF_Options2
  • Open Altium and create a new PCB. Then, go to File->Import. Select DXF as the file format and open the file you exported in the previous step. If you do not see DXF file format listed, you will have to install the appropriate Importer Plugin (Dxp-> Plug-ins and updates). In the options windows that open, make sure to choose the correct units and click Ok.
    4_Altium_DXF_Options
  • You will see the board outline imported to one of the mechanical layers.
    5_Altium_MechanicalLayer
  • Select the lines and click on Design->Board Shape->Define from selected objects.
    6_Altium_Board_Shape_Define
  • That’s it. You ‘ll have the board shape same as the 3D model.
    7_Altium_Final

    Hope this was helpful!

Quick way to tune Servo/Position PID controller

I recently learnt an easy way to tune a servo loop, which has been working pretty well for me. Here is a summary of the steps:

  • The first step is to have a robust current controller. This can be a properly tuned PID controller, with Sinusoidal Field Oriented, 120-Degree Trapezoidal or any other type of control.
  • Next, you need a simple PD controller for the position loop, which would essentially have these three lines of code:

Error = Reference – Feedback;
Output = Kp*Error + Kd*(Error-OldError);
OldError = Error;

  • Once done with coding, run your controller with Kp and Kd set to zero. Slowly, increase Kd and feel the how the rotor reacts when you try to rotate it by hand. You would see that the rotor seems to resist rotation and feels as if it is immersed in some viscous liquid. Keep increasing Kd till it is sufficiently high, without making the controller go unstable or generate any audible noise.
  • You can then increase Kp as you see fit, depending on how sharp or slow you want the response to be. With the high Kd you set in the previous step, the controller is less likely to go unstable due to high Kp values. That’s it. You ‘ll have a nicely tuned servo loop!

Debug tips:

  • It is really important to have a good current controller before you start implementing the position controller.
  • If the rotor doesn’t rotate smoothly during Kd tuning, double check your encoder alignment, commutation sequence, etc.
  • Make sure you have the correct signs for calculating error and Kd component in your code.
  • Check the order of motor wires.
  • Keep things simple!

Texas Instruments InstaSPIN™ – Mind. Blown.

After unsuccessfully spending days on a STM32 evaluation kit to get their motor control firmware up and running, I was pleasantly surprised by the Three Phase BLDC Motor Kit with DRV8312 and Piccolo MCU from Texas instruments. And I was blown away by their InstaSPIN™-BLDC Solution. I could set up everything and have the motor running in under an hour.

This video by Dave Wilson is the most comprehensive and clear motor controller demo I have ever seen.

The beauty of InstaSPIN is its ability to run almost any motor – it instantly ran the motor that came with the STM32 Evaluation kit, and also ran couple of motors my friend found from a surplus store – there is no change in the code necessary – all you need to do is change the flux threshold value in the GUI.

Another impressive feature is how robust the control system is, even at very low duty cycles. Less than 10% duty cycle without sensors? InstaSPIN does.

PCB trace width, via size, etc. calculation tool

When you layout your PCB, one of the basic decisions to take is the trace width. I have come across various online tools which can be used for calculating trace width, but most of them were either obsolete or unreliable. I recently found a very comprehensive tool for all PCB design calculation needs.

Saturn PCB Design Toolkit
Saturn PCB Design Toolkit [image source: www.saturnpcb.com]
You can download the Saturn PCB Toolkit for free from here. I use the tool mostly for calculating trace widths based on the current handling capability required, impedance characteristics of the trace, via properties, etc. The tool also has various other calculations which may be of use. The website also has an informative help page.

Now you can use your brain for things that are more challenging – like understanding the Duckworth–Lewis method.

Gerber: basics, file name extensions and viewer

Whichever program you use for PCB layout, the final output will be a set of gerber files. Gerbers are just text files with co-ordinate positions and other info, which tell your vendor which parts of the board must have copper (or overlay or solder mask, etc. depending on the layer) and which parts must not. It is always a good idea to talk to your PCB vendor and find out the gerber format (version, units, number format, leading/trailing zeros, etc.) in which they need the files. If you are not able to contact the vendor while generating the gerbers, it usually works if you attach a ReadMe file listing the configuration along with the gerbers.You might also have to generate NC drill files separately.

The file name extension for gerbers varies with PCB software. For Eagle, OrCAD or Protel, refer here. For Altium, here.

It might also help to view gerber files in a third party viewer before sending the files to the vendor. Pentalogix’s ViewMate and gerbv are good viewers that you can download for free.

When work is play, literally – PS3 Sixaxis controlling Altium Designer

I do most of my design work in Altium Designer. I got tired of scrolling with my mouse, so wanted to spice things up. I found a PS3 Sixaxis controller lying around and thought it would make a cool controller.

Altium controlled with PS3 Sixaxis controller
Altium controlled with PS3 Sixaxis controller

I found drivers for the controller developed by MotioninJoy, which are available for free download. They also have a well written wiki and an active support forum. Here is how you bake the bun:

  1. Get the latest stable version of the driver (choose 32 bit or 64 bit carefully) and follow the installation instructions given here.
  2. Connect the controller. I do not have a bluetooth receiver, so I connected using a USB cable (you will need a mini-usb to usb cable).
  3. After making sure that the controller is properly recognized and listed, click on “Profiles”. Select the “Custom” profile and click on “==>Create”.
  4. You ‘ll see a window where you can configure each controller input. See picture below:
    MotioninJoy profile editor
    MotioninJoy profile editor

    Edit the profile to match your usage. I configured one joystick for moving the cursor and another joystick for scrolling. Right buttons for mouse buttons and Esc key and few other buttons as different keystrokes for using keyboard shortcuts in Altium (e.g. P->V for placing a Via).

  5. Once done editing, click on “Enable”. There you go. The coolest controller for laying out PCBs!

This is just one usage example. You can customize the controller profile for any application you use. You can also Import/Export profiles, so that you need not configure it each time.

Imagine inserting a local pattern in Solidworks with press of a single button! Have fun!