Tag Archives: FreeCAD

Experimenting PCB rendering using KiCad, FreeCAD and Blender

via WyoLum Blog


I’ve been putting off using Blender since over 5 years, being intimidated by the complex UI and workflow, until this month when I mustered courage to go through Andrew Price’s Doughnut tutorials. My aim was to learn how to do photo-realistic renders of KiCad boards.

Within a week of dipping my feet in the shallow end, I made these few renders.

Blender render #1
Blender render #2
Blender render #3
Blender render #4
Blender render #5

I started off with the Open Hardware Summit 2020 badge (which I had a bit role in designing). KiCad’s in-built ray-tracer does a decent job, but there is no way to adjust lighting, background and other parameters. This is what it looks like in KiCad.

Normal 3D view from KiCad
Ray traced render from KiCad – bottom side

This is the bottom of the PCB, so the “floor” is not visible, and the overall render looks darker than expected. 

Ray traced render from KiCad – top side

As a comparison, here’s what the top view looks like. You can see shadows on the floor. There are multiple light sources (multiple shadows), and the scene looks washed out due to excess light.

Unfortunately, KiCad raytrace option does not allow us to set lighting, floor and other scene parameters, hence Blender. So my next step was to export VRML and STEP file models from KiCad.

The STEP export from KiCad is useful in MCAD for designing enclosures and such, but it doesn’t have copper and silk layers, and no material textures too. So it isn’t much use for realistic renders.

STEP import in FreeCAD
VRML import in FreeCAD

One important difference between the raytrace render as seen in KiCad v/s the exported VRML is the “MASK” layer. Look at the “W” in the OSHW logo and the “quiic” logo. In the KiCad design, there’s a mask opening over these elements so that the underlying Copper/Gold is visible in KiCad 3D. In the VRML export, this mask window gets covered over. So the VRML export from KiCad is not a faithful representation of the board.

I ran another test by using KiCad StepUp Tools workbench in FreeCAD to import the Board with parts and Copper + Silk layers. Once again, the result was the same – the mask openings do not show up as in the pic below.

KSU Tools import in FreeCAD with Copper and Silk

At this moment, I not sure how to resolve this – so anyone have suggestions, please comment away.

Anyway, next step was to move to Blender and try getting better renders. Here’s what the KiCad VRML import looks like in Blender.

VRML import in Blender

According to @maui in this thread on the KiCad forum, from Blender ver 2.8 onward, the WRL/X3D importer has been changed causing the lack of color/texture import.

Opening the KiCad VRML file in Meshlab produces expected results.

VRML import in Meshlab

A workaround to this that I stumbled upon is to use the online 3D file format converter at CADexchanger and convert the KiCad VRML file to Collada DAE format. Importing the DAE format in Blender results in glorious color renders.

COLLADA DAE import in Blender

And now we can fine tune the colors, roughness (shininess), subsurface (internal reflectance / translucency ?) for the PCB fibreglass material (PCB edge), mask, copper, silk, adjust the lighting, change the background etc.

So the workflow looks good now, and it’s possible to get nice renders using Blender. At the moment, render quality is only hampered by my very limited knowledge of Blender (about 2 weeks old) – so more experienced Blender power users will be able to do much better.

Also, FreeCAD ver 0.19 Render workbench has a Blender option now, with Cycles rendering, but I haven’t yet got around to figuring out how to use it.

Render workbench in FreeCAD 0.19 with Blender/Cycles

The one issue which needs to be resolved is the inaccurate “mask” layer export from KiCad and I’m hoping anyone with more insight on this can tell us how to get it right.

Next up, i’m going to try making the initial footprint models more realistic by adding device information on the packages and such.

In Part 2 of this blog post, we’ll look at the Blender workflow needed to get :
– Colors for the various PCB elements – fibreglass body, solder mask, copper, silk legend
– Adjusting light and camera (although there are a lot more better, detailed tutorials on this that you can find)
– Background planes and effects.

KiCon 2019, Chicago

via WyoLum Blog

The seed for my long overdue tour of the US was planted when I realised that my son – and “Minion-at-Large” at WyoLum, Hearsh’s Graduation at the University of Pittsburgh and KiCon 2019 were happening practically on the same weekend. Thus were set in motion the gears that culminated on my current Whirlwind tour of the US. I was looking forward to both events with equal anticipation. First step was to take a couple of small hops halfway across the world.

One small hop, then a large one !

At WyoLum, we have been using KiCad since 2010, when it was still quite rough around the edges, but suited us better than other existing EDA even with all of its shortcomings. Since then, I’ve been consistently using KiCad for all of our hardware projects. And I love conducting workshops and boot camps to help people get started with KiCad. Over the years, at many locations in India and the US, I’ve conducted quick 2 hour introductions, as well as long, 2 ½ day intensive boot camps. This summer trip, I planned to do more of the same wherever possible. But I wasn’t sure what I could talk about, or do a workshop on, at a KiCad conference attended by novices, power users, developers and everyone in between.

Alongside of KiCad, we have also been using FreeCAD since several years. FreeCAD is an open source, parametric 3D modelling software similar to AutoCAD, Solidworks and Fusion360. It’s an amazing tool to develop models for 3D printing, Laser cutting or CNC engraving. We have been using it to create models of electronic components for use with KiCad, and also for designing enclosures for our projects.

Currently, I’m using FreeCAD to design a 3D printed case for a photo booth project we are working on right now, and it seemed like an apt topic to talk about at KiCon 2019 – “Mechanical CAD integration with electrical CAD”. We built our first photo booth in 2013 for the Open Hardware Summit, and an updated version for MAKE: magazine in 2016. The latest version is a huge improvement on the earlier versions – more about it in another blog post – and I’ve spend a lot of time trying to design an enclosure for it. Just like us, I figured everyone else who builds circuit boards will sooner or later require an enclosure, and using KiCad + FreeCAD seems like a killer combo.

While at the conference, I set up our TouchSelfie photo booth, and we managed to get some great snaps. Here’s a LINK to the photo album.

There are two separate use cases where FreeCAD is useful when designing electronics. One is to build 3D models of electronic components, align these models with their KiCad footprints, and embed them within the KiCad project. The other is to design an enclosure around the completed KiCad board which can then be 3D printed, laser cut or machined / injection moulded. In both cases, the basic FreeCAD workflow remains quite similar, and my talk focused on providing a quick walk through of the commonly used workbenches. I also briefly talked about two special workbenches which are very useful – KiCad Step Up Tools and CADquery workbench. The former, in particular, provides very strong integration between KiCad and FreeCAD. Embedded below is the video from my talk at KiCon 2019, and a link for the slides deck.

VIDEO : “Fast 3D Model Creation Using FreeCAD” – Anool Mahidharia (KiCon 2019)

Slide deck, KiCon 2019 (Google Slides)

It’s not easy covering such a lot of ground within under 30 minutes, so I was glad to have a chance to do a longer workshop the next day where I (hopefully) guided a roomful of folks get started with the basics of FreeCAD such as constrained sketches, boolean operations and parametric modeling.

KiCon 2019 has been a great experience for me, and I met a ton of interesting people from all around, and made a lot of new friends. I’m hoping it becomes a recurring event and look forward to the next edition. Videos of the talks are being uploaded on YouTube on the Contextual Electronics channel. Do check them out, give a thumbs up, and share them around.

Anool’s Whirlwind Tour in the Summer of 2019

via WyoLum Blog

Less than a week from now, I’ll travel halfway across the world from Mumbai for a 2 month, Whirlwind Tour of the US east coast. As usual, I’m taking this opportunity to spread some Open Source love the best way I can – by doing workshops at Maker Space’s along the coast.

If you want to get started with PCB design using KiCad, or CAD design using FreeCAD, check out my schedule and sign up for the workshops if I’m passing by your town. Here’s what I’ll be up to during my stay here in 2019.

Hopping along the East Coast !
  • The very next day after arriving in New York city, I’ll do a day-long KiCad boot camp at NYC Resistor.
    • APR 14th, 2019, Sunday, 10:00 am to 6:00 pm
      KiCad Boot Camp – (Open Source PCB Design Software), at NYC Resistor
  • On 17th April, I’ll follow up with a short, introductory session on FreeCAD at NYC Resistor helping hackers get started with the basics of CAD design.
  • On 24th April, while in Pittsburgh, I’ll be hanging out on the Hackaday.io chat channel doing a Hack Chat – talking about KiCad and FreeCAD. The Hackaday Hack Chat is where all the hackers and makers hang out, and is a great place to discuss, ask, learn, show off, or generally spend time talking to others just like you from all around the world.
  • Chicago is hosting KiCon 2019 – the first ever user-centric KiCad conference, and it is shaping up to be a great event. I will be talking, as well as doing a workshop, on using FreeCAD to quickly model components for use with KiCad’s 3D visualizer, and get started on basic mechanical design such as enclosures. The conference is on 26th and 27th April at mHub in Chicago. It’s still not too late to plan attending this amazing con, so grab your tickets and we hope to see you in Chicago.
  • From Chicago, I’ll hop over to WyoLum HQ in Reston, just outside of Washington DC for a week long confab with Justin, Kevin and the rest of the WyoLum gang. We have a lot of catching up to do, with all of the various projects that we are simultaneously working on at present. Some of the current projects we are working on are ClockIoT, WyoStat and Braccioforte.
  • After a short personal trip to Fort Lauderdale, I will be heading up to Orlando, doing another set of KiCad and FreeCAD workshops at the MakerFX Makerspace. I’ll do a super quick KiCad boot camp followed by an introduction to FreeCAD on 11th May.
  • After a quick stay over at Austin, I’ll be back in Pittsburgh and will stay there until the end of May. I’m trying to setup KiCad and FreeCAD workshops in Pittsburgh either at the Pitt MakerSpace or at HackPGH (or probably at both places). Stay tuned for announcements on dates for these events in Pittsburgh.
KiCad EDA – Open Source Software for PCB design
FreeCAD – Open Source Parametric CAD modeller

At WyoLum, we just love sharing our work, and our skills, among the hacker community and spreading some love for the amazing open source tools that we use everyday to get our job done.

If you’ve been waiting for an opportunity to learn KiCad to help design PCB’s or FreeCAD for CAD design, do support our enthusiasm for sharing by signing up for the workshops over the next two months. Looking forward to meeting an amazing bunch of hackers this summer. Drop by and say hi.