Pre-populated footprint?

Hi,

I’ve created a WS2812b ring with 12 LEDs. I did the fairly intricate graphic in inkscape and imported it into the footprint editor. Really, this isn’t an actual part … it’s just a footprint.

(btw … no fixation on the number 12 or WS2812b … same question would apply to other configurations.)

It occurs to me that this ring will ‘Almost always’ be populated with 12 WS2812b LEDs (and while I’m not convinced they are necessary, the datasheet also calls for a separate capacitor for each LED.) This this is 24 parts that someone would need to add every time they use this ring, and worse, they’d also need to rotate each part to match the ring. So, I’m just wondering if there is some way of combining the footprint and the parts, into a new footprint, so that someone could simply drop the whole ring, pre-populated, into their project, in such a manner that KiCad would understand all the separate parts.

Anyone have any thoughts on this?

That’s the hard bit, so the merge answer is no.

However, you can do a script that places parts relatively easily, and that would be given a radius and ref-range, or list.

Below is an example that works from a list, and does XYRS.
You would replace the XYR with a spoke/radial calculation & probably do not need S

import sys
from pcbnew import *
pcb = GetBoard()
RefNm   = ['C1','C2','C3','C4','C5','C6','C7','C8','C9','C10','D1','D2',
'J1','Q1','R1','R2','R5','R6','R7','U1','U2','U3','U4','U5','U6','U7','X1','Y1']
RefX    = [ 1150, 500, 1950, 700, 700, 1950, 400, 2100, 2100, 1150, 3535, 3465,
 1575, 3100, 2050, 2050, 400, 3675, 3675, 1400, 1400, 2050, 2050, 750, 750, 650, 2600, 400]
RefY    = [-1000,-1000,-1550,-1700,-1350,-900,-1550,-400,-1800,-1650,-1565,-565,
-375,-1200,-550,-1200,-1700,-925,-1275,-800,-1450,-800,-1450,-1600,-1250,-800,-600,-1400]
RefOri  = [ 180, 180, 180, 180, 180, 180, 180, 0, 0, 180, 45, 315,
 0, 90, 0, 0, 0, 255, 105, 0, 0, 0, 0, 0, 0, 0, 0, 90]
RefSide = [True,True,True,True,True,True,True,False,False,True,False,False,
True,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]

print('Start Place XYRS')
for Idx,Rn in enumerate(RefNm):
  nPart = pcb.FindModuleByReference(Rn)
  nPart.SetPosition(wxPoint(FromMils(RefX[Idx]), FromMils(RefY[Idx])))  # Update XY
  nPart.SetOrientationDegrees (RefOri[Idx])                             # Update Rot
  if RefSide[Idx]!= nPart.IsFlipped():                                  # Current Side <> Reqd Side ? then flip
        nPart.Flip (nPart.GetPosition())
print('Finished Place XYRS, Press F11 to refresh display')
1 Like

I don’t get it… why would one drop a 12-LED block into anything?

@PCB_Wiz 's approach to take the footprints and rearrange them in the layout via some script is the way to go for this.