Newer
Older
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
TSSOP_pad_dx = 0.120
pad_TSSOP = cube(-TSSOP_pad_width/2.0,TSSOP_pad_width/2.0,-TSSOP_pad_height/2.0,TSSOP_pad_height/2.0,0,0)
class TRC102(part):
#
# RFM TRC102 ISM transceiver
#
def __init__(self,value=''):
self.value = value
self.pad = [point(0,0,0)]
self.labels = []
#
# pin 1: SDI
#
self.shape = translate(pad_TSSOP,-TSSOP_pad_dx,3.5*TSSOP_pad_dy,0)
self.pad.append(point(-TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'1 SDI'))
#
# pin 2: SCK
#
self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
self.pad.append(point(-TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SCK'))
#
# pin 3: nCS
#
self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
self.pad.append(point(-TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'nCS'))
#
# pin 4: SDO
#
self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
self.pad.append(point(-TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'SDO'))
#
# pin 5: IRQ
#
self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
self.pad.append(point(-TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'IRQ'))
#
# pin 6: DATA/nFSEL
#
self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
self.pad.append(point(-TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'DATA'))
#
# pin 7: CR
#
self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
self.pad.append(point(-TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CR'))
#
# pin 8: CLKOUT
#
self.shape = add(self.shape,translate(pad_TSSOP,-TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
self.pad.append(point(-TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'CLKOUT'))
#
# pin 9: Xtal/Ref
#
self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
self.pad.append(point(TSSOP_pad_dx,-3.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'Xtal'))
#
# pin 10: RESET
#
self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
self.pad.append(point(TSSOP_pad_dx,-2.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RESET'))
#
# pin 11: GND
#
self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
self.pad.append(point(TSSOP_pad_dx,-1.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'GND'))
#
# pin 12: RF_P
#
self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
self.pad.append(point(TSSOP_pad_dx,-0.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RF_P'))
#
# pin 13: RF_N
#
self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
self.pad.append(point(TSSOP_pad_dx,0.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RF_N'))
#
# pin 14: VDD
#
self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
self.pad.append(point(TSSOP_pad_dx,1.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'VDD'))
#
# pin 15: RSSIA
#
self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
self.pad.append(point(TSSOP_pad_dx,2.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'RSSIA'))
#
# pin 16: nINT/DDET
#
self.shape = add(self.shape,translate(pad_TSSOP,TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
self.pad.append(point(TSSOP_pad_dx,3.5*TSSOP_pad_dy,0))
self.labels.append(self.text(self.pad[-1].x,self.pad[-1].y,self.pad[-1].z,'nINT'))
class CBA(part):
#
# CBA logo
#
def __init__(self,r=.02):
self.value = ''
self.pad = [point(0,0,0)]
self.labels = []
d = 3*r
self.shape = cylinder(0,0,0,0,r)
self.shape = add(self.shape,translate(cylinder(0,0,0,0,r),-d,d,0))
self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),-d,0,0))
self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),-d,-d,0))
self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),0,-d,0))
self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),d,-d,0))
self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),d,0,0))
self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),d,d,0))
self.shape = add(self.shape,translate(cube(-r,r,-r,r,0,0),0,d,0))
class fab(part):
def __init__(self,r=.05):
self.value = ''
self.pad = [point(0,0,0)]
self.labels = []
d = 1.8*r
l = 3.5*r
h = r/2.
self.shape = rectangle(-d,d,-d,d)
self.shape = subtract(self.shape,circle(0,0,r))
self.shape = subtract(self.shape,rectangle(-l,0,-h,h))
self.shape = add(self.shape,rectangle(d,l,-h,h))
self.shape = add(self.shape,circle(l,0,r))
self.shape = add(self.shape,circle(-l,0,r))
#
# define board
#
width = 1.02 # board width
height = .87 # board height
x = 1 # x origin
y = 1 # y origin
zt = 0 # top z
zb = -0.06 # bottom z
w = .015 # wire width
rv = 0.016 # via size
rp = 0.03 # pad size
mask = .004 # solder mask size
pcb = PCB(x,y,width,height,mask)
IC1 = ATtiny44_SOICN('IC1\nt44')
pcb = IC1.add(pcb,x+.49,y+.56)
VIC1 = via(zb,zt,rv,rp)
pcb = VIC1.add(pcb,IC1.pad[14].x+.08,IC1.pad[14].y+.02)
pcb = wire(pcb,w,
VIC1.pad[1],
IC1.pad[14])
point(IC1.pad[7].x,J1.y+.02),
point(IC1.pad[7].x+.04,J1.y-.02),
point(J1.pad[4].x,J1.y-.02),
VJ12 = via(zb,zt,rv,rp)
pcb = VJ12.add(pcb,J1.pad[2].x+.075,J1.pad[2].y)
VJ16 = via(zb,zt,rv,rp)
pcb = VJ16.add(pcb,J1.pad[6].x-.075,J1.pad[6].y)
VJ16.pad[1],
J1.pad[6])
pcb = wire(pcb,w,
VJ16.pad[2],
VIC1.pad[2])
J2 = header_FTDI('J2 FTDI')
pcb = J2.add(pcb,x+width-.22,IC1.y-.0,angle=0)
point(IC1.pad[13].x+.105,IC1.pad[13].y),
point(IC1.pad[13].x+.105,J2.pad[4].y),
point(IC1.pad[12].x+.07,IC1.pad[12].y),
point(IC1.pad[12].x+.07,J2.pad[5].y+.04),
point(IC1.pad[12].x+.11,J2.pad[5].y),
VJ2 = via(zb,zt,rv,rp)
pcb = VJ2.add(pcb,J2.pad[3].x+.1,J2.pad[3].y)
pcb = wire(pcb,w,
VJ2.pad[1],
J2.pad[3])
pcb = wire(pcb,w,
VJ12.pad[2],
VJ2.pad[2])
pcb = XTAL1.add(pcb,IC1.pad[4].x-.2,IC1.pad[13].y+.003,angle=-90)
point(XTAL1.x+.12,IC1.pad[2].y),
point(XTAL1.x+.12,XTAL1.pad[1].y),
XTAL1.pad[1])
pcb = wire(pcb,w,
IC1.pad[3],
XTAL1.pad[3])
VXTAL = via(zb,zt,rv,rp)
pcb = VXTAL.add(pcb,XTAL1.x-.12,XTAL1.y)
pcb = wire(pcb,w,
XTAL1.pad[2],
VXTAL.pad[1])
pcb = wire(pcb,w,
VJ16.pad[2],
VXTAL.pad[2])
pcb = wire(pcb,w,
R1.pad[1],
IC1.pad[1])
pcb = wire(pcb,w,
R1.pad[2],
point(J1.pad[5].x,R1.y),
J1.pad[5])
VR1 = via(zb,zt,rv,rp)
pcb = VR1.add(pcb,R1.pad[1].x-.08,R1.y)
pcb = wire(pcb,w,
VR1.pad[1],
C1.pad[2],
VIC1.pad[1])
VC1 = via(zb,zt,rv,rp)
pcb = VC1.add(pcb,C1.pad[1].x-.025,C1.y-.06)
VC1.pad[1],
C1.pad[1])
pcb = wire(pcb,w,
VR1.pad[2],
point(VC1.x,VR1.y,zb),
VC1.pad[2])
#
# select output
#
outputs = {}
if (output == "top, labels, and exterior"):
outputs["function"] = add(add(color(Tan,pcb.board),pcb.labels),
color(White,pcb.exterior))
outputs["layers"] = [zt]
elif (output == "top, bottom, labels, and exterior"):
outputs["function"] = add(add(color(Tan,pcb.board),pcb.labels),
color(White,pcb.exterior))
outputs["layers"] = [zb,zt]
elif (output == "top, bottom, labels, holes, and exterior"):
outputs["function"] = add(add(color(Tan,
subtract(pcb.board,pcb.holes)),pcb.labels),
color(White,pcb.exterior))
outputs["layers"] = [zb,zt]
elif (output == "top traces"):
outputs["function"] = color(White,pcb.board)
outputs["layers"] = [zt]
elif (output == "top traces and exterior"):
outputs["function"] = color(White,add(pcb.board,pcb.exterior))
outputs["layers"] = [zt]
elif (output == "bottom traces reversed"):
outputs["function"] = color(White,
reflect_x(pcb.board,2*x+width))
outputs["layers"] = [zb]
elif (output == "bottom traces reversed and exterior"):
outputs["function"] = color(White,
reflect_x(add(pcb.board,pcb.exterior),2*x+width))
outputs["layers"] = [zb]
elif (output == "interior"):
outputs["function"] = color(White,pcb.interior)
elif (output == "exterior"):
outputs["function"] = color(White,pcb.exterior)
outputs["function"] = color(White,
subtract(add(pcb.exterior,pcb.interior),pcb.holes))
outputs["layers"] = [zb]
elif (output == "holes and interior"):
outputs["function"] = color(White,
subtract(pcb.interior,pcb.holes))
outputs["layers"] = [zb]
elif (output == "solder mask"):
outputs["function"] = color(White,pcb.mask)
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
else:
print("oops -- don't recognize output")
#
# set limits and parameters
#
border = 0.05
outputs["xmin"] = x-border # min x to render
outputs["xmax"] = x+width+border # max x to render
outputs["ymin"] = y-border # min y to render
outputs["ymax"] = y+height+border # max y to render
outputs["mm_per_unit"] = 25.4 # use inch units
outputs["type"] = "RGB" # use RGB color
#
# send output
#
json.dump(outputs,sys.stdout)