KiCAD – PCB Layout

One of many new features that was not available in Target 3001 is display of signal names on tracks and pads. I selected the wrong footprint for SWD, but as it is the same size as a 1.27 pitch header I did not think it matter before I noticed that it count the pin differently – wherever this bug is in schematics or selected footprint can be discussed. What is important is that KiCAD allow me to see it.

Another feature is the capability to drag entire sections of lines to make room for a new one- The level of semi-automation on KiCAD is really impressive. I am actually routing manually, but the automation allows me to move earlier content to make space and suggest alternative routes from where I am with such an ease that PCB routing is done in a fraction of the time I needed with Target 3001 – and I considered Target 3001 to be easy to work with.

This is still a 2-layer layout for now as I am learning KiCAD properly the only way it can be done – by using it and gaining experience. But, I have not used the backside much at all do to the routers capability to find or make paths. It will obviously take a few weeks before I truly master KiCAD and I will not spam this blog with details – I think most of you get the picture by now – KiCAD was something I should had started on years ago! That said – getting started with KiCAD is a bit heavy so you must set your mind and start digging in watching videos and try and fail. KiCAD has to be learned the hard way, but it is worth it.

As for suggestions on how to improve KiCAD – don’t worry, I have plenty. The first I would start with is to merge the two screens that (1) allow you to watch footprint and (2) allow you to select footprint because the first let you see the footprint while the second don’t – luckily I van have both open at the same time because it’s a bit hard not seeing the footprint you select. But, again – you don’t want to hear about how I had to do this earlier + yes it’s a button to open a 3rd window where you can see the selected footprint 🙂

Looking at the backside pic above I notice how little I have used the backside – which is good since we are on 2-layer, but I also notice that I still have to learn how to deal with drill holes yet. One thing at the time.

The last think I wanted to show you is the semi-auto router. As you select two points on the PCB KiCAD will attempt to autoroute that lane. In this case I was more impressed that it actually found a path – I will not be using this one, but many times I do and end up routing much more single layer than before. I can now draw part of the lane manually by clicking on connection points and the auto-router will take it from there. And you can always use the drag function to optimize path afterwards as well. This is a big time-saver compared to how my previous tool worked. I assume it exist a full auto-router as well, but I have not tried that one yet.

Thanks for reading my early morning ranting…

Ordering new PCB’s

It is soon 1.jan.2020 and Norwegian import rules changes, meaning I basically get MVA and a 20.-USD handling fee on every package unless I get the foreign company to declare MVA. It will be a pain and take some time before this happens. Ordering parts from Asia will be close to impossible unless you order big quantities. It feels like my country are reverting back to the stone age…

2-Screens in use w/KiCAD

This is a screen-shot of my two screens. I have PCB router on left and schematics on right. As I work on PCB the schematics will show the associated part – neat little detail. KiCAD is actually multiple applications so its perfect to take full advantage of multiple screens as you work. I have routed 60% of the new board in about an hour – most times just playing around – KiCAD is so quick to route that it is amazing. The auto-router is also good at finding track options allowing me to stay as much as possible on the same layer + it’s a real pleasure to use via’s.

KiCAD 3D Model

This shows and early draft of rev 1.4 on KiCAD using their normal 3D model. KiCAD have a more realistic version that is a bit slower to draw, but for all poractical purposes it does the job. Accurate details is IMO not important here, the objective is to verify as much of the mechanics as possible. KiCAD enables export of images directly, but I ended up using my old trick of taking a screenschot and use Paint 3D.

What I am really happy with here is the PCB layout. Some things are a bit new and different yet, but the more I learn KiCAD the more I like it. on some features I seems to have less manual control than before, but all in all – setting this up was more about learning KiCAD than work.

As you can see I lack 3D model on 3 footprints + I have the wrong footprint on the crystal – I have yet to learn how to create my own 3D models and footprints. But, I am happy to see that the libraries contains far more + you get libraries from various sources. And yes I know – I am using straight headers rather than angled headers because I did not find angled headers 3 rows deep. I am not even sure if I actually used the correct tool for drill holes as what you see is a gigantic “via”, but I will get there thanks to hundreds of videos assisting me.

One of the tools I really appreciated is the measurement tools and aids on making correct dimensions – that was not existing in Target 3001.

Operating KiCAD feels like doing Schematics, PCB and 3D in one integrated tool. I know it is different tools, but once set up the next step is only a button away. It is a few manual steps between schematics and PCB to give you full control and I must admit I like having schematic symbols separated from footprints giving me options to replace footprint with a minimum of changes.

As for PCB routing – You have to remember that I started my carrier as Electronic Engineer back in 1978 using pen and paper to make schematics and PCB layout. Actually using a CAD tool is like putting someone used to a horse carry into a formula 1 car. Target 3001 impressed me, but getting used to KiCAD is like dropping into the cockpit of a jet-fighter. It’s semi- automatic routing is very impressive in terms of how fast you route. And just for the record – I have used Target 3001 for 4 years and KiCAD for 1 week. I still like Target 3001, but it is no match for KiCAD once you take the time needed to learn it’s user interface. And to remind you all – KiCAD is free, open source. It is C/C++ code with wxWidgets.

KiCAD vs Target 3001 – 2nd Impression

1 – Schematics – KiCAD is most definitly a step up. It is much, much faster to work with once you get used to the somewhat weird user interface.

2 – PCB Layout – It is hard to say. I see huge advantages in the life-cycle of interactions between PCB/Schematics as I apply changes.

3 – 3D – Both gets the job done. KiCAD have a special mode making 3D model look realistic, but so far I must admit that I preffer Target 2001 on this.

Will be interesting to see how these impressions change as I get to learn KiCAD more – so far it is ok – weird, but ok.

I am mainly a Windows user/developer so my expectations to user interface is standarized through years of Windows usage. Target 3001 fall into that category. People who have grown up with Linux is not used to this and tend to re-invent the wheel by doing things differently – KiCAD falls into this category. It takes a bit of time to get used to because it don’t follow standards we are used to. Once you get the shortcuts into your fingers they actually are quite convenient.

Making a LED Lamp

I am a bit handicapped as my Lamp with a magnifier broke. I was using that all the time, but having seen how badly designed that it I decided to rebuild both of my lamps to be LED lamps.

What I will do is to buy a 130VAC to 12VDC adapter in a shop (or use an old one laying around) that is CE aproved – and this is very important in Norway. I am allowed to deal with 12V, but if I deal with 230VAC and start a fire my insurance might kick back on me.

This project is straight forward – Use an adapter to get 12V and make a PCB that is a circle fitting inside the lamp with LEDS designed so they accept 12V – in reality that is 3 leds with a resistor in series.

The next step I am considering is to use an ESP32 and a few Half H-Bridges to dim different parts of the lamp to control light, but for now I will just make a dumb, analogue design on vero boards to get my lamp working again.

Getting on with KiCAD

The graphical user interface on KiCAD is different than most applications. On KiCAD you get little feedback that you have selected something. Editing on PCB is quite “normal” – you select a component and click to move it. Doing the same on schematics are different, you select by using area and the component stick to cursor until you click again.

This is just one example of how KiCAD interface is a bit different than what you would expect from a standard Windows application. And this takes a bit of time to learn.

Comparing to Target 3001 it is a few things that are automated in Target and manual in KiCAD, but the rest is quite cool if you take the time to master the tools.

Target 3001 have multiple sheets with global labels, but KiCAD have a hierarchical sheet system. I basically use the first sheet for sub-sheet for every module in the system. But, here comes the main advantage – they are actual modules. KiCAD support local tags that can be used as interface if you re-use the component. This is a big advantage – I am about to redraw 32xServo/IO and can basically have one schematics referenced 32 times.

Integration between Schematics, PCB design and 3D View is close to fully integrated. It is separate applications, but you don’t notice that so much. What was most alien is that in KiCAD you draw schematics, afterwards you allocate footprints – so in other words you can easily change footprint without touching schematics. In Target 3001 symbol, footprint and 3D was always connected – it’s pros and cons on both – you just need to get used to the tool in front of you.

All in all I am quite impressed with KiCAD so far. Yes it takes a bit of time to learn, but many of the differences leads to more advanced tools that will help productivity. Using KiCAD without a community and dozens of videos would however have been very difficult.

Moving lines on schematics or PCB seems to be little automated, but it might be that I have not learned it properly yet. If I should compare Target 3001 and KiCAD I would state that Target 3001 is much easier to learn and master than any other tool I have tested so far. I do however feel that KiCAD will be better and faster to work with once you take the time to master it – and this is what matters because we are only newbies for a short time.

And lets not forget the most important feature in KiCAD – it is free. If I should continue with Target 3001 I would need to pay 1000.- USD for a fraction of what I got in KiCAD – which I can guarantee you is not an option. I have a friend using Cadence priced to something like 10,000.- USD per license and he brags about it a lot. But, I also remember a time then Embedded IDE’s JTAG’s and compilers costed thousands of dollars – I still pay license on Visual Studio at work, but even that is free for open source these days.

Burning lamp

Working with electronics you accept that it is a small risk of fire and take pre-cautions. But are we really prepared for what can go wrong? The issue is that everything around us contains more electronics and things that can take fire these days. Yesterday my lamp bought on Clas Olson took fire. Nothing bad happened, but the light tube took fire and wrecked the lamp. Changing light tube nothing happens, so this lamp is wrecked. Pictures below:

Obviously the fire started in the light tube itself, burned some of the heat resistant plastic and heated up quite a bit. I have never seen this happen before.

I was in the livingroom as it happened and came back to a dead lamp – no drama, but if something else had caught fire my house would have burned down. I am stunned to see that it is something inside the light tube that caught fire – probably the start device – I don’t know the proper name, but these types of lamps have a small “starter” that in this case seems to be inside the light tube itself.

The lamp is very nice for electronics work because it has a magnifier in the middle, so I have to replace this – or should I just upgrade it to a led lamp?

KiKad First Contact

I decided to make Rev 1.4 of the 32xServoIO using KiKad. One of many reasons for leaving Target 3001 and using KiKad is that I want to show more schematics out here. That has been difficult with Target 3001. The main reason is however cost – I use a free version of Target 3001 with some age and lack support for 4 layers etc. I will give you a summary of the experience once I know KiKad better.

One thing that can be said about KiKad is that it is much, much heavier to get started with than Target 3001. Things are different for sure – hopefully to the better once I get to know KiKad more.

What you see above is the bare minimum for ticking a STM32F405RG. In fact you can even drop the crystal if you don’t use USB.

And first point to KiKad – I actually can copy schematics out here now! I could before as well, but with some difficulty.

32xServo/IO Hat

These two 3D models show my old and new 32xIO. It’s a layout difference, but except for that they are mostly identical. The old board have the DIP selecting CS Pin for SPI, while the new dropped that.

Revison 1.1

Revision 1.3

The challenge with these 32xServo ports are that I do not have 32 PWM signals in HW. In theory STM32F405 do have 32 x PWM signals, but you can’t route them all at the same time. At most I get 28 signals if I switch everything else off – which I can’t.

The idea was to use a timer interrupt to bit-bang some of the pins to compensate, but to do that we need to actually use the MCU a bit. The classic RF pulse is 500uS to 1500 uS, so we need something like 50Khz interrupt or preferable 100Khz interrupt to process with some accuracy. I would have preferred using PWM signals only, but that is not possible. Also, we do actually have a powerfully M4 ticking at 168Mhz to support this, so we have plenty of juice – we can do this. The test is to put signals on a Servo and watch their behavior as they hold selected positions. I tried that with SW on a ESP32 and noticed “twitching” – small movements before I switched to HW PWM channels.

The way it is routed on 2.3 means I have:

  • 32 x GPIO channels since all are GPIO.
  • 17 x 5V compatible GPIO channels
  • 15 x ADC channels
  • 22 x Hardware PWM Channels.
  • 1 x SPI port for backbone bus
  • 1 x CAN port
  • 1 x USB port
  • 1 x User Led

I do however notice that I can optimize this a bit:

  1. I have used PC1 which is ADC capable for Status Led, while I have PC13,14 and 15 that are GPIO only available. This gives me one extra ADC channel, meaning I get all 16 ADC channels on IO.
  2. PC13, PC14 and PC15 can be used for Led’s giving me 3 user leds.
  3. PB12 and PB13 can be used on CAN2 releasing PB9 and PB8 from CAN1. That gives me 2 extra PWM/GPIO channels replacing 2 x GPIO only channels. CAN2 is Slave only thought, but I think I can accept that.
  4. If I ditch SPI1_MOSI and accept that this board only can be used as Half-Duplex Slave will free a PWM capable pin. I have to think about this one.
  5. In addition I need to add resistor options on SPI as well as the new SWD connector.
  6. Replace 2.54 pitch jumper with a 1.27 pitch.
  7. Move + Power lane away from ground plane looks doable to get a better ground plane.
  8. Move USB connector to right side closer to PSU.
  9. I also need to evaluate capacitance on the power connector.
  10. That leaves one change – I need different PSU on the 16 first versus the 16 last. Or more correctly. I think the solution here is to add an option to select between 3.3V/5V or Servo PSU on the 16 ADC capable channels.

I guess I can as well just start re-wiring this PCB from scratch due to the number of pin changes. But, I think this will be worth it + it is not that much work once I set my mind to do it. It is actually far more work making SW, but again – the changes will only affect the “wire” function and capability list. Done right Rev 1.4 should have:

  • 16 ADC/GPIO w/Mixed HW/SW PWM to left
  • 16 GPIO w/ HW PWM to right