Getting a custom board outline from an .svg file into KiCad

I recently stumbled upon a problem which I thought could be easily solved when I wanted to do design a PCB with an unusual board outline (e.g. a star-shaped board).

Since I am not such a great artist when it comes to painting or drawing, I downloaded an .svg file of the shape from Wikipedia and I thought it could be easily imported in KiCad. But this is apparently not possible using a direct approach (at least not up to version 4.0.3 at this time of writing). KiCad only supports .dxf files as of now. So you must first convert from .svg to .dxf.

After some searching on the internet and some frustrating experiences later (e.g. the shape dimensions were extremly off after importing), the following workflow seems to do the job:

  1. Open the .svg file in Inkscape and adjust the shape to your needs. That means cropping and more important scaling it to the size of the board outline. Use real dimensions like “mm” and not “px”. Set the dimensions in the document settings.
  2. Convert the object to a path (Inkscape: Path -> Object to path). I don’t know if this is really necessary in all cases.
  3. Save a copy of the file using the .eps file format (Encapsulated PostScript). Use the default settings.
  4. Get the nice little tool pstoedit.
  5. Convert the .eps file to a .dxf file using the following command line: pstoedit -dt -f "dxf:-polyaslines -mm" shape.eps shape.dxf where shape.eps is the source file from step 3.
  6. Finally you can import the newly generated shape.dxf file in KiCad’s Pcbnew.

This approach does not only apply to the board outline, but you can also use this technique to import shapes for example to the silkscreen. Just select the desired target layer in KiCad.

I hope someone finds this helpful, at least I think you can do a lot of cool things with custom shapes. 😉 Maybe some time later this post will become obsolete when KiCad eventually gets support of native .svg imports.



Quick hack: Add native (user) USB to ST’s Nucleo boards

I recently bought myself one of ST’s cheap Nucleo development boards with an STM32F072RB controller on it to quickly start developing one of my projects. The microcontroller has native USB support even without an external clock which makes it quite attractive.

The downside is that this board does not come with a USB connector that can be used by the controller itself. The USB connector on it is already used by ST’s own programmer (ST-Link). You could of course rewire the port to the microcontroller directly – but then you would lose the connection to the ST-Link and had to connect an external programmer.

So I came up with another solution: I just glued a straight (180°) THT mini USB connector to the bottom side of the board and wired the USB-D- pin to PA11 and USB-D+ pin to PA12. Luckily both pins are not already used on the board and are easily accessible since they are routed to pin headers. USB GND (and shield) must also be connected to GND. You can see the little hack in the following picture. The same hack can probably be done with all Nucleo boards that provide a controller with USB support. Maybe someone finds this useful. 😉

Glued mini USB connector to bottom side of Nucleo board and wired the data lines to the microcontroller port pins. Fits well. ;-)
Glued mini USB connector to bottom side of Nucleo board and wired the data lines to the microcontroller port pins. Fits well. 😉

Happy hacking,


Electronics Project: Active Load

Project: Active load with microcontroller – Part 6: Validation and conclusion

This is a follow-up post to my previous project page Part 5 (PC software).

This is the last post concerning this project. I have done some tests with the final hardware and software. Furthermore I have written a small conclusion to this project.

Transient response

An interesting test is the transient response on a sudden change of the setpoint current. In this case I stepped the setpoint current from 2 A to 0 A. The following picture shows the voltage across the shunt. You can see a voltage drop of 200 mV (corresponding to 2 A) within a time span of around 20 ms. The time could be reduced by decreasing C18 and C21 in the schematic. The latter one should be adjusted carefully because a too small capacitor may destabilise the control loop.

Step response from 2 A down to 0, measured across 0.1 Ohm shunt.
Step response from 2 A down to 0, measured across 0.1 Ohm shunt.







Electronics Project: Active Load Software development

Project: Active load with microcontroller – Part 5: PC software

This is a follow-up post to my previous project page Part 4 (Firmware).

One way to interface with the active load device is to use a terminal program and query the state of the device or send commands to it manually. But this is of course very cumbersome and not very user-friendly. That’s why I have written a program called Active Load Tool in C# for Windows.

The setpoint current can be changed and all relevant pieces of information can be monitored. Furthermore the tool allows to calibrate the device and plot oscilloscope-like graphs visualising current, voltage, power and temperature.

Actually I have separated the program into two different projects: ActiveLoadProtocol and ActiveLoadTool. The former one is a class library which capsulates the interface between application and device, while the latter one depends on this library to present a GUI to the user. The class library can easily be used in own projects, for example to automate and log test runs.

You can find the source code of the software (project written with Visual Studio 2015) in my GitHub repository.

Some screenshots
Electronics Project: Active Load STM32

Project: Active load with microcontroller – Part 4: Firmware

This is a follow-up post to my previous project page Part 3 (Schematic, layout and pictures).

At this point the hardware development is finished and fortunately nothing blew up as I had plugged in a voltage source for the first time. 😉 But of course there is no functionality yet. The load sinks (nearly) no current which is a good sign because all port pins of the microcontroller are in a high impedance state while there is no firmware on it. That means the setpoint current and also the actual current of the current control loop are (nearly) zero (the opamp input “sees” ground). This is considered a safe state as nothing bad can happen in this case: no functionality – but also no potential to destroy something.

Electronics Project: Active Load

Project: Active load with microcontroller – Part 3: Schematic, layout and pictures

This is a follow-up post to my previous project page Part 2 (Hardware design details).

In this post I briefly present the full schematic and PCB layout of this project. As a proof that I actually built this device, there are also some pictures included at the end of the post. 😉

Full schematic and PCB layout

The schematic and layout has been drawn with KiCad 4. The full schematic is attached below (as PNG image, PDF and KiCad’s native format). The layout is not depicted in this post, it should be opened with KiCad directly for clarity.

Active Load v1 schematic
Active Load v1 schematic

Active Load v1 schematic (PDF version)

ActiveLoad v1 KiCad files (including PCB layout)

You can also find the latest version of the schematic and the PCB in my GitHub repository.

Pictures of the finished device

Read further on as I describe the firmware part of the project in part 4.

Electronics Project: Active Load

Project: Active load with microcontroller – Part 2: Hardware design details

This is a follow-up post to my previous project page Part 1 (Requirements).

In the last part I laid out the requirements and specifications of my active load without going too much into detail. This is about to change while I write about the different implementation details.

The main task of the active load is – of course – to dissipate power. This can be done by any device which has resistance. The simplest load is just a resistor but the problem is that a resistor usually has a fixed resistance which makes no sense in an active load. So we need a device which can dissipate (a lot of) power and has a controllable resistance. This can be done with a power transistor or in this particular case with a power FET. The idea is to control the gate-source voltage in order to influence the drain-source resistance. The device under test is just connected to drain and source.

Electronics Project: Active Load

Project: Active load with microcontroller – Part 1: Requirements

This time I would like to write about a project of mine: A (simple) active load with support from a microcontroller.

There are times when you need a dummy load to test and validate some equipment or part of a schematic, e.g. a power supply. In the past I just used some power resistors as a load but this solution is very inflexible. Often you don’t have the right resistors at hand or you must switch resistors when you want to change the simulated load.

It would be nice to have a simple and cheap active load which solves the above problems. My design approach relies on the great Re:load 2 project by Arachnid Labs. I added a STM32 microcontroller with USB support and LCD to my own design. This way I can use my active load as a standalone device which shows me all important pieces of information on the display. Or I can connect a computer via USB to the device and let the PC control and monitor the simulated load.

Here are the requirements:

  • Power supply from around 3.3V to 40V
  • Should be powered by device under test
  • Alternative power supply via USB
  • Maximum dissipated power: Around 12W permanently at room temperature
  • Maximum current: 3A
  • Robust (protected from overvoltage, overcurrent and overtemperature conditions)
  • Device under test should be connected via banana plugs or screw terminals
  • A PC should be able to monitor the actual current and control the desired current via USB
  • Small display to monitor actual and setpoint current
  • Rotary encoder to change setpoint current
  • Small (5×10 cm)
  • Measure temperature at heatsink

Read further on as I write about the hardware design details in part 2.


Howto: Hand solder an MSOP IC with exposed pad

I recently had to solder a special MSOP IC with an exposed pad to a PCB. The device was a LT8610 which is a 2.5A synchronous step-down regulator. The exposed pad is needed to lower the thermal resistance and it is internally connected to ground. That’s why you should really solder the exposed pad to the PCB.

It is important to notice that these kind of IC packages do not lie flat on the PCB when they are not soldered yet. The IC stands on its pins and the exposed pad has no contact to the pad on the PCB.

I decided to solder the IC using a cheap hot air soldering station, a flux pen and regular tin-lead solder. These steps worked quite well in my situation:

  1. Apply (a lot of) solder to the thermal pad on the PCB. Don’t touch the other pads yet. The objective is to apply just enough solder so that the remaining pins of the IC lose contact to the pads on the PCB. That means that the IC only lies with its exposed pad on the thermal pad of the PCB.
  2. Use flux pen on the PCB and the IC.
  3. Place the IC on the PCB as exactly as possible. The flux helps by glueing the IC to the PCB a little bit.
  4. Set the hot air soldering station to ~240 °C.
  5. Apply hot air around the IC for at least a minute. Don’t point the nozzle to just one location. Use circular motions while heating.
  6. Set the hot air soldering station to ~350 °C.
  7. Apply hot air to the IC and around it until the solder on the thermal pad under the IC pulls the IC flat onto the PCB. Then continue for another couple of seconds.
  8. Lower temperature again and continue heating the PCB for a couple of seconds.
  9. You are basically done. Solder the remaining pins with a soldering iron as usual.

This should to the trick, at least it worked for me. By using this method you avoid overheating the IC or the PCB because you notice the moment when the solder melts again and pulls down the IC (capillary action). I believe that this method could also be used with QFN or DFN packages. In this case (instead of step 1) you should probably make sure that all pads on the PCB contain roughly the same amount of solder before applying hot air.

Happy soldering! 😉


Connecting an external RAM to a microcontroller the easy way through pin swapping

In some applications you need greater amounts of RAM. Microcontrollers like the STM32 only have around 20 to some hundred kilobytes of internal RAM. So what do you do if your application needs require some megabytes of RAM, for example in high speed data acquisition systems?