Browse Source

add ps2 pcb

master
Schoenberger, Philipp 6 years ago
parent
commit
dc011d0706
  1. 13
      3d/lib/antenna.scad
  2. 6
      3d/lib/cube.scad
  3. 19
      3d/lib/cylinder.scad
  4. 375
      3d/remote.scad
  5. 32
      3d/stick.scad

13
3d/lib/antenna.scad

@ -6,6 +6,7 @@ module antenna() {
d2=[12.8, 12.8, 12.8, 12.8, 5.85, 5.3, 5.85, 5.85,]; d2=[12.8, 12.8, 12.8, 12.8, 5.85, 5.3, 5.85, 5.85,];
h= [180.8, 172, 154, 81, 44, 12, 10.60, 0, ]; h= [180.8, 172, 154, 81, 44, 12, 10.60, 0, ];
color("darkgray")
difference() difference()
{ {
translate([0, 0, -h[0]]) { translate([0, 0, -h[0]]) {
@ -21,15 +22,17 @@ module antenna() {
} }
} }
module sma_connector_male() {
d=[2, 3.2, 9.1, 8, 9.1, 6.15, ];
fn=[0, 0, 6, 0, 6, 0 , ];
h= [20.5, 16.45, 13.1, 10.75, 8.75, 7.1 , 0];
module sma_connector_male(thickness=0) {
d=[2, 3.2, 9.1, 6.15, 8, 9.1, 6.15, ];
fn=[0, 0, 6, 0, 0, 6, 0 , ];
h= [20.5, 16.45, 13.1, 10.75, 10.75-thickness, 8.75-thickness, 7.1-thickness , 0];
l=len(h)-1;
//translate([0, 0, -h[0]]) //translate([0, 0, -h[0]])
color("gold")
{ {
difference() { difference() {
for (i=[0:len(h)-1]) {
for (i=[0:l]) {
translate([0, 0, h[i+1]]) { translate([0, 0, h[i+1]]) {
if(fn[i] == 0) if(fn[i] == 0)
cylinder(d=d[i], h=h[i]-h[i+1]); cylinder(d=d[i], h=h[i]-h[i+1]);

6
3d/lib/cube.scad

@ -35,9 +35,9 @@ module aligned_rounded_cube(size, r=5, rounding=[1,1,1], aligned=[1,1,0])
}else if( rounding == [0,1,1] ) { }else if( rounding == [0,1,1] ) {
//cylinder rounding x/z //cylinder rounding x/z
minkowski() { minkowski() {
translate([ 0,-r,0])
cube([size[0] - 2*r, size[1] - 2*eps, size[2]- 2*r]);
rotate([90,0]) {
translate([-r,0,0])
cube([size[0] - 2*eps , size[1] - 2*r, size[2]- 2*r]);
rotate([0,90]) {
cylinder(r=r,h=eps); cylinder(r=r,h=eps);
} }
} }

19
3d/lib/cylinder.scad

@ -1,14 +1,27 @@
module cylinder_flange_sphere($fn=32,r1=10, r2=15, h=5) module cylinder_flange_sphere($fn=32,r1=10, r2=15, h=5)
{ {
diff=abs(r1-r2); diff=abs(r1-r2);
h_off= (r1 < r2 ) ? 0 : h/2;
h_off= (r1 < r2 ) ? 0 : diff;
difference() {
difference()
{
cylinder($fn=$fn, r=max(r2,r1),h=h); cylinder($fn=$fn, r=max(r2,r1),h=h);
scale([1,1,h/diff]) scale([1,1,h/diff])
rotate_extrude() rotate_extrude()
translate([diff+min(r2,r1),h_off]) translate([diff+min(r2,r1),h_off])
rotate([0,0,0]) rotate([0,0,0])
circle($fn=$fn,r=diff);
circle($fn=$fn*diff,r=diff);
} }
} }
cylinder_flange_sphere($fn=32,r1=4, r2=17.5, h=7);
color([0.5,0.1,0,0.2]) %cylinder(r=17.5,h=20);
translate([0,0,-4]) color([0.0,0.1,0.4,0.2]) %cylinder(r=4,h=25);
translate([40,0])
{
cylinder_flange_sphere($fn=32,r1=17.5, r2=4, h=7);
color([0.5,0.1,0,0.2]) %cylinder(r=17.5,h=20);
translate([0,0,-4]) color([0.0,0.1,0.4,0.2]) %cylinder(r=4,h=25);
}

375
3d/remote.scad

@ -7,135 +7,48 @@ use <lib/LCD_1602_I2C.scad>;
use <lib/PCB.scad>; use <lib/PCB.scad>;
use <lib/Arduino_nano.scad>; use <lib/Arduino_nano.scad>;
show_switch=1;
show_lcd=1;
show_sticks=1;
show_stm32=1;
show_antenna=1;
show_cc2500=1;
show_switch =1;
show_lcd =1;
show_sticks =1;
show_stm32 =1;
show_antenna =1;
show_cc2500 =1;
show_battery_charger=1; show_battery_charger=1;
show_joysticks =1;
show_joysticks_pcb =1;
show_top =1;
show_bottom =1;
name="phschoen"; name="phschoen";
text_pos=[[-10,-18,0], [10,-18,0], [-55,49,0], [-25,49,0], [0,40,0], [25,49,0], [55,49,0] ];
top_text=["on", "armed", "some", "thing", "needs", "to be", "configur"];
bot_text=["off", "disarmed", "", "", "", "", "" ];
text_pos=[[-8.5,-15,0], [8.5,-15,0], [-54,45,0], [-20,45,0], [0,40,0], [20,45,0], [54,45,0] ];
top_text=["on", "armed", "mode", "beeper", "failsave", "led", "turtle"];
bot_text=["off", "disarmed", "", "", "", "", "" ];
pos_cc2500=[0,10,-3]; pos_cc2500=[0,10,-3];
pos_stm32=[48,-15,-1];
pos_antenna=[0,70,-15];
pos_lcd=[0,-44,-10];
pos_stm32=[40.5,-10,-3];
pos_antenna=[0,75.20,-15];
pos_lcd=[0,-40,-10];
pos_batery_charger=[-48,-15,-5]; pos_batery_charger=[-48,-15,-5];
eps=0.1; eps=0.1;
$fn=32; $fn=32;
module lcd_1602() {
pcb=[80,36,1.6];
metal_case=[71.2, 24.2, 6.5];
case_lcd_cut=[64.5, 14.5, 6.5+2*eps];
// metal case
difference() {
translate([0,0,pcb[2]])
aligned_cube(metal_case,[1,1,0]);
translate([0,0,pcb[2]])
aligned_cube(case-2,[1,1,0]);
// glas cut
translate([0,0,pcb[2]-eps])
aligned_cube(case_lcd_cut,[1,1,0]);
}
// glas cut
color("blue")
translate([0,0,0])
aligned_cube(case_lcd_cut,[1,1,0]);
// pcb
color("green")
aligned_cube(pcb,[1,1,0]);
}
module remote() {
// animate sticks
if($t < 0.25)
sticks($t*4,0);
else if($t < 0.5)
sticks(1,($t-0.25)*4);
else if($t < 0.75)
sticks(1-($t-0.5)*4,1);
else
sticks(0,1-($t-0.75)*4);
module ps2_pad() {
// pcb
difference()
{
pcb=[26, 34, 1.6];
color([0.2, 0.2, 0.2]) {
aligned_cube(pcb,[0,0,0]);
}
// mounting holes
r=3.4/2;
color([0.8, 0.8, 0.8])
for (i = [
[ 1.4+r, 3.3+r, -0.1], // bot left
[pcb[0]-(1.4+r), 3.3+r, -0.1], // bot right
[pcb[0]-(1.4+r), pcb[1]-(1.6+r), -0.1], // top right
[ (1.4+r), pcb[1]-(1.6+r), -0.1], // top left
]) {
translate(i)
cylinder($fn=16, r=r, h=0.2 + pcb[2]);
}
}
// pins
{
}
}
//ps2_pad();
//pin_angled();
module pin_angled(pins=4, angled=true) {
w=0.65;
pin_angled=[w, 7-w, w];
pin_vertical=[w, w, 7.2-w];
plastic=[2.16,12.6];
color([0.8,0.8,0.8]) {
// vertical pin part
translate([0,0,0])
aligned_cube(pin_vertical, [1,0,0]);
// angled pin part
translate([0,w,7.2])
aligned_cube(pin_angled, [1,0,2]);
difference() {
d=1.5;
translate([0,d/2,7.2-d/2])
rotate([0,90,0])
translate([0,0,-w/2])
cylinder($fn=32,d=d, h=w);
translate([0,w+d/2,7.2-d/2-w])
rotate([0,90,0])
translate([0,0,-w/2-eps])
cylinder($fn=32,d=d, h=w+2*eps);
}
}
}
module remote() {
if (show_sticks) {
if($t < 0.25)
sticks($t*4,0);
else if($t < 0.5)
sticks(1,($t-0.25)*4);
else if($t < 0.75)
sticks(1-($t-0.5)*4,1);
else
sticks(0,1-($t-0.75)*4);
}
if(show_stm32) { if(show_stm32) {
translate(pos_stm32) { translate(pos_stm32) {
rotate([0,180,180]) rotate([0,180,180])
@ -144,9 +57,9 @@ module remote() {
} }
if(show_antenna) { if(show_antenna) {
translate(pos_antenna) {
rotate([90,0,0])
color("darkgray")
translate(pos_antenna)
rotate([90,0,0]) {
sma_connector_male(3.5);
antenna(); antenna();
} }
} }
@ -176,20 +89,29 @@ module remote() {
battery_charger(); battery_charger();
} }
top_case();
//bottom_case();
if(show_top)
top_case();
if(show_bottom)
bottom_case();
} }
module sticks(l1,l2) module sticks(l1,l2)
{ {
max_angle=30; max_angle=30;
color("orange")
for(i=[1,-1]) { for(i=[1,-1]) {
translate([40*i,20,-10]) { translate([40*i,20,-10]) {
rotate([max_angle*(l1*2-1),max_angle*(l2*2-1),0])
translate([0,0,8]) {
stick(h=20);
if (show_sticks) {
color("orange")
rotate([max_angle*(l1*2-1),max_angle*(l2*2-1),0])
translate([0,0,7]) {
stick(h=20);
}
}
if (show_joysticks_pcb) {
translate([0,0,-8]) {
ps2_joystick(l1,l2);
}
} }
} }
} }
@ -201,24 +123,15 @@ module top_case() {
color([0.5,0.8,0,0.8]) color([0.5,0.8,0,0.8])
union() { union() {
hull() { hull() {
remote_top_plate_1=[150,110,1];
remote_top_plate_2=[140,120,thick];
remote_top_plate_3=[100,135,thick];
remote_top_plate_1=[140,110,1];
remote_top_plate_2=[130,110,thick];
remote_top_plate_3=[100,125,thick];
aligned_rounded_cube(remote_top_plate_1,2,[1,1,0],[1,1,0]); aligned_rounded_cube(remote_top_plate_1,2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_2,2,[1,1,0],[1,1,0]); aligned_rounded_cube(remote_top_plate_2,2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_3,2,[1,1,0],[1,1,0]); aligned_rounded_cube(remote_top_plate_3,2,[1,1,0],[1,1,0]);
} }
{
for(i=[0:1:len(text_pos)-1]) {
translate(text_pos[i])
button_with_text(thick=thick+2*eps,
text_size=4,
top_text=top_text[i],
bottom_text=bot_text[i]);
}
}
// lcd screw holder // lcd screw holder
translate([pos_lcd[0],pos_lcd[1]-1.2,0]) translate([pos_lcd[0],pos_lcd[1]-1.2,0])
translate([-40.6,-20.25,0]) translate([-40.6,-20.25,0])
@ -259,7 +172,7 @@ module top_case() {
translate([x*(pcb_size[0]/2-10), translate([x*(pcb_size[0]/2-10),
y*(pcb_size[1]/2), y*(pcb_size[1]/2),
0.2]){ 0.2]){
aligned_cube([5,6.25,pcb_size[2]-0.5],[1,1,0]);
aligned_cube([5,6.25,pcb_size[2]-pos_stm32[2]],[1,1,0]);
} }
translate([x*(pcb_size[0]/2-10), translate([x*(pcb_size[0]/2-10),
y*(pcb_size[1]/2+1.625), y*(pcb_size[1]/2+1.625),
@ -308,7 +221,7 @@ module top_case() {
} }
//lcdcutout //lcdcutout
translate([0,-45,-eps]) {
translate([pos_lcd[0],pos_lcd[1],-eps]) {
color("green") { color("green") {
aligned_rounded_cube(size=[64,14,5+2*eps], r=2, rounding=[1,1,0]); aligned_rounded_cube(size=[64,14,5+2*eps], r=2, rounding=[1,1,0]);
hull() { hull() {
@ -323,7 +236,7 @@ module top_case() {
// stick cutouts // stick cutouts
color("orange") color("orange")
for(i=[1,-1]) { for(i=[1,-1]) {
w=36;
w=32;
r=14; r=14;
translate([40*i,20,-eps]) { translate([40*i,20,-eps]) {
//aligned_rounded_cube(size=[w,w,thick+2*eps], r=2, rounding=[1,1,0]); //aligned_rounded_cube(size=[w,w,thick+2*eps], r=2, rounding=[1,1,0]);
@ -346,17 +259,17 @@ module top_case() {
} }
// buttons cutouts and naming // buttons cutouts and naming
translate([0,0,-eps]) { translate([0,0,-eps]) {
translate([0,61,0])
translate([0,26,0])
text_engave(thick, text_size=5, text_=name); text_engave(thick, text_size=5, text_=name);
translate([0,-61,0])
translate([0,pos_lcd[1]-15,0])
text_engave(thick, text_size=5, text_="toolbox v1"); text_engave(thick, text_size=5, text_="toolbox v1");
// buttons // buttons
for(i=[0:1:len(text_pos)-1]) { for(i=[0:1:len(text_pos)-1]) {
translate(text_pos[i]) translate(text_pos[i])
button_with_text(thick=thick+2*eps, button_with_text(thick=thick+2*eps,
text_size=4,
text_size=4.2,
top_text=top_text[i], top_text=top_text[i],
bottom_text=bot_text[i]); bottom_text=bot_text[i]);
} }
@ -368,10 +281,9 @@ module top_case() {
module button_with_text(thick=4,text_size=5, top_text="on",bottom_text="off") module button_with_text(thick=4,text_size=5, top_text="on",bottom_text="off")
{ {
dist_text=10.5; dist_text=10.5;
cylinder(d=5.8, h=thick+2*eps);
cylinder(d=5.8, h=5*thick+2*eps, center=true);
//
color("gray") color("gray")
translate([0,0,thick-1]) translate([0,0,thick-1])
union() { union() {
@ -406,29 +318,88 @@ module text_engave(thick, text_size, text_)
module bottom_case() { module bottom_case() {
h=25;
h=20;
wall=3*2; wall=3*2;
remote_top_plate_1=[150,110,h];
remote_top_plate_2=[140,120,h];
remote_top_plate_3=[100,135,h];
remote_top_plate_1=[140,110,h];
remote_top_plate_2=[130,110,h];
remote_top_plate_3=[100,125,h];
translate([0,0,-h]) translate([0,0,-h])
color([1,1,1,0.1])
difference() { difference() {
//body itself
hull() {
aligned_rounded_cube(remote_top_plate_1,2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_2,2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_3,2,[1,1,0],[1,1,0]);
color([1,1,1,0.8])
union() {
//body itself
hull() {
aligned_rounded_cube(remote_top_plate_1,2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_2,2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_3,2,[1,1,0],[1,1,0]);
translate([0,0,-5]) {
aligned_rounded_cube(remote_top_plate_3,2,[1,1,0],[1,1,0]);
}
}
for(i=[1,-1]) {
hull() {
union() {
translate([i*(remote_top_plate_1[1]/2)-i*0,0,-14]) {
aligned_rounded_cube([remote_top_plate_3[2],100,20],6 );
}
}
translate([i*remote_top_plate_1[1]/2-i*5,0,0]) {
aligned_rounded_cube([remote_top_plate_3[2]+20,110,0.1],6,[1,1,0]);
}
}
}
} }
s=[wall,wall,0];
// inner cutout
color([0.8,0.8,0.8,0.8])
translate([0,0,3]) translate([0,0,3])
hull() { hull() {
aligned_rounded_cube(remote_top_plate_1-[wall,wall,0],2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_2-[wall,wall,0],2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_3-[wall,wall,0],2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_1 - s,2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_2 - s,2,[1,1,0],[1,1,0]);
aligned_rounded_cube(remote_top_plate_3 - s,2,[1,1,0],[1,1,0]);
translate([0,0,-5]) {
aligned_rounded_cube(remote_top_plate_3 - s,2,[1,1,0],[1,1,0]);
}
} }
// left and right holder
color([0.7,0.7,0.7,0.8])
translate([0,0,wall/2])
for(i=[1,-1]) {
hull() {
union() {
translate([i*remote_top_plate_1[1]/2-i*0,0,-14]) {
aligned_rounded_cube([remote_top_plate_3[2],100,20],6 );
}
}
translate([i*remote_top_plate_1[1]/2-i*5,0,0]) {
aligned_rounded_cube([remote_top_plate_3[2]+20,110,0.1],6,[1,1,0]);
}
}
}
translate([0,0,h]) // undo moveing
{
// sma connector cutout
color("gold") {
translate(pos_antenna)
rotate([90,0,0]) {
translate([0,0,10]) // inner sma offset
cylinder(d=6.5,h=10, center=true);
}
}
// usb connector cutout
pcb_size=[52.3, 22.6, 1.6];
color("red")
{
translate(pos_stm32)
translate([pcb_size[0]/2, 0,-2-5]) // undo moveing
aligned_rounded_cube([10,12,8], 3, [0,1,1]);
}
}
} }
@ -681,5 +652,95 @@ module battery_charger() {
rotate([0,0,-90]) rotate([0,0,-90])
usb_micro(); usb_micro();
}
module ps2_joystick(l1,l2)
{
pcb_size=[26.15, 34.15, 1.6];
eps=0.1;
max_angle=30;
// joystick module
/* color("silver") */
/* translate([0,8.75]) */
// jostick module iself
color("silver")
translate(pcb_size/2)
translate([-4.1,-9,0]) {
aligned_cube([16,16, 12.5], [2,2,0]);
translate([-8,-8,3.5])
rotate([max_angle*(l1*2-1),max_angle*(l2*2-1),0])
translate([0,0,9])
cylinder(d=4, h=7);
}
// potties
color("darkgray")
translate(pcb_size/2)
translate([-0.5,-12.4,0]) {
aligned_cube([3.8, 9.52, 12], [2,2,0]);
}
color("darkgray")
translate(pcb_size/2)
translate([-7.35,-25,0]) {
aligned_cube([9.52, 3.8,12], [2,2,0]);
}
/* color("silver") { */
/* rotate([90,0]) */
/* import("ps2_analog.stl"); */
/* } */
difference()
{
pin_x=[2,1,0,-1,-2];
pin_names=["GND", "+5V", "VRX", "VRY", "SW"];
union()
{
// pcb
color("lightblue")
aligned_rounded_cube(pcb_size, r=1, rounding=[1,1,0]);
//pinpads
for(i=[0:len(pin_x)-1]) {
translate([pin_x[i]*(2), pcb_size[1]/2-4.5,-eps]) {
color("silver")
cylinder(d=1.5,h=pcb_size[2]+2*eps);
color("black")
translate([0,-1,pcb_size[2]])
linear_extrude(height = 2*eps)
rotate([0,0,-90])
text(
halign="left",
valign="center",
$fn=$fn,
size=1,
font="Linux Libertine O",
pin_names[i]
);
}
}
}
// pins
for(i=[0:len(pin_x)-1]) {
translate([pin_x[i]*(2), pcb_size[1]/2-4.5,-2*eps]) {
cylinder(d=1,h=pcb_size[2]+4*eps);
}
}
// screwholes near pin
for(x=[1,-1]) {
translate([x*(pcb_size[0]/2-2.7), pcb_size[1]/2-4.5,-eps])
cylinder(d=2.9,h=pcb_size[2]+2*eps);
}
// screwholes other side
for(x=[1,-1]) {
translate([x*(pcb_size[0]/2-2.7), 2.9-pcb_size[1]/2,-eps])
cylinder(d=2.9,h=pcb_size[2]+2*eps);
}
}
} }
remote(); remote();

32
3d/stick.scad

@ -2,24 +2,29 @@
// throttle has different mounting slot at the bottom then the roll stick // throttle has different mounting slot at the bottom then the roll stick
// throttle has a metal stick and roll has a ps2 plastic shaft // throttle has a metal stick and roll has a ps2 plastic shaft
use <lib/cube.scad> use <lib/cube.scad>
use <lib/cylinder.scad>
// draw itself // draw itself
stick(); stick();
module stick(h=25)
module stick(h=25-10)
{ {
$fn=32; $fn=32;
translate([0,0,15]) {
translate([0,0,15-3]) {
cylinder(d=5,h=h); cylinder(d=5,h=h);
translate([0,0,h]) translate([0,0,h])
// top nob to grab // top nob to grab
gabber_part(); gabber_part();
} }
// stick holder with cutout // stick holder with cutout
stick_mount();
translate([0,0,0]) {
stick_mount();
}
// dust protector // dust protector
protector_cone();
translate([0,0,-3]) {
protector_cone(thickness=1.25);
}
} }
module gabber_part() { module gabber_part() {
@ -70,9 +75,9 @@ module stick_mount(is_ps2_shaft=1) {
difference() { difference() {
color([1,0,1]) { color([1,0,1]) {
if ( is_ps2_shaft ) { if ( is_ps2_shaft ) {
cylinder(d=6.75,h=15);
cylinder(d=6.75,h=10);
} else { } else {
cylinder(d=6,h=15);
cylinder(d=6,h=10);
} }
} }
translate([0,0,-eps]) translate([0,0,-eps])
@ -88,17 +93,22 @@ module stick_mount(is_ps2_shaft=1) {
} }
} }
} }
module protector_cone() {
module protector_cone(thickness) {
//dust protector //dust protector
difference() { difference() {
union() { union() {
sphere(d=30); sphere(d=30);
translate([0,0,12])
cylinder(d2=3,d1=17.5,h=7);
translate([0,0,12.1])
//cylinder(d2=3,d1=17.5,h=7);
cylinder_flange_sphere($fn=32,r2=4/2, r1=17.5/2, h=20);
} }
// cut lower half
translate([-15,-15,-30]) translate([-15,-15,-30])
cube([30,30,30]);
sphere(d=26);
cube([30,30,30]);
// cut innerpart so its a shell
sphere(d=30-2*thickness);
} }
} }

Loading…
Cancel
Save