diff --git a/global_defs.scad b/global_defs.scad index d9960ba..03a85bc 100644 --- a/global_defs.scad +++ b/global_defs.scad @@ -49,8 +49,14 @@ squeezed_wall = $preview ? 2 * extrusion_width - layer_height * (1 - PI / 4) inf = 1e10; // very big eps = 1/128; // small fudge factor to stop CSG barfing on coincident faces. -$fa = 6; -$fs = extrusion_width / 2; + +fa = is_undef($vitamin_fa) ? 6 : $vitamin_fa; // Used for drawing vitamins, rather than printing. +fs = is_undef($vitamin_fs) ? 0.25 : $vitamin_fs; +fn = 32; + +$fa = $fa == 12 ? 6 : $fa; // Defaults for printing +$fs = $fs == 2 ? extrusion_width / 2 : $fs; + // Some additional named colours silver = [0.75, 0.75, 0.75]; diff --git a/lib.scad b/lib.scad index 594e0fa..f64ee80 100644 --- a/lib.scad +++ b/lib.scad @@ -25,19 +25,20 @@ include include include +include include include include include include include -include include include include include include include +include include include include diff --git a/libtest.png b/libtest.png index 7481dcb..c57d0e5 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/libtest.scad b/libtest.scad index 091cf19..f591b61 100644 --- a/libtest.scad +++ b/libtest.scad @@ -42,6 +42,7 @@ include use +use use use use @@ -65,6 +66,7 @@ use use use use +use use use use @@ -299,6 +301,9 @@ translate([x0, linear_bearings_y]) { translate([x0, steppers_y]) stepper_motors(); +translate([x0 + 400, steppers_y]) + gear_motors(); + translate([x0, sheets_y]) sheets(); @@ -456,10 +461,10 @@ translate([x2, panel_meters_y]) translate([x2, extrusions_y]) extrusions(); -translate([400, transformers_y]) +translate([370, transformers_y]) transformers(); -translate([x4 + 50, transformers_y]) +translate([x4, transformers_y]) no_explode() socket_boxes(); @@ -497,6 +502,9 @@ translate([x4, rails_y + 130]) { translate([x4, cable_strip_y]) cable_strips(); +translate([x4 + 150, cable_strip_y]) + antennas(); + translate([x4, kp_pillow_blocks_y]) kp_pillow_blocks(); diff --git a/readme.md b/readme.md index be3bb6a..d06624c 100644 --- a/readme.md +++ b/readme.md @@ -22,33 +22,34 @@ A list of changes classified as breaking, additions or fixes is maintained in [C - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Vitamins A-H Vitamins I-Q Vitamins R-Z Printed Utilities Core Utilities
7_segments IECs Radials Box Annotation BOM
Axials Inserts Rails Butt_box Bezier Clip
BLDC_motors Jack Ring_terminals Cable_clip Catenary Global
Ball_bearings LDRs Rockers Cable_grommets Core_xy Polyholes
Batteries LED_meters Rod Camera_housing Dogbones Rounded_rectangle
Bearing_blocks LEDs SBR_rails Carriers Fillet Sphere
Belts Leadnuts SK_brackets Corner_block Gears Teardrops
Blowers Light_strips SMDs Door_hinge Hanging_hole
Box_sections Linear_bearings SSRs Door_latch Horiholes
Bulldogs Magnets Screws Drag_chain Layout
Buttons Mains_sockets Sealing_strip Fan_guard Maths
Cable_strips Microswitches Servo_motors Fixing_block Offset
Cameras Microview Shaft_couplings Flat_hinge PCB_utils
Circlips Modules Sheets Foot Quadrant
Components Nuts Spades Handle Round
DIP O_ring Spools Knob Rounded_cylinder
D_connectors Opengrab Springs LED_bezel Rounded_polygon
Displays PCB Stepper_motors PCB_mount Rounded_triangle
Extrusion_brackets PCBs Swiss_clips PSU_shroud Sector
Extrusions PSUs Terminals Pocket_handle Sweep
Fans Panel_meters Toggles Press_fit Thread
Fastons Photo_interrupters Transformers Printed_box Tube
Fuseholder Pillars Tubings Printed_pulleys
Geared_steppers Pillow_blocks Variacs Ribbon_clamp
Green_terminals Pin_headers Veroboard SSR_shroud
Hot_ends Potentiometers Washers Screw_knob
Hygrometer Pulleys Wire Socket_box
Zipties Strap_handle
Antennas Inserts Rails Butt_box Bezier Clip
Axials Jack Ring_terminals Cable_clip Catenary Global
BLDC_motors LDRs Rockers Cable_grommets Core_xy Polyholes
Ball_bearings LED_meters Rod Camera_housing Dogbones Rounded_rectangle
Batteries LEDs SBR_rails Carriers Fillet Sphere
Bearing_blocks Leadnuts SK_brackets Corner_block Gears Teardrops
Belts Light_strips SMDs Door_hinge Hanging_hole
Blowers Linear_bearings SSRs Door_latch Horiholes
Box_sections Magnets Screws Drag_chain Layout
Bulldogs Mains_sockets Sealing_strip Fan_guard Maths
Buttons Microswitches Servo_motors Fixing_block Offset
Cable_strips Microview Shaft_couplings Flat_hinge PCB_utils
Cameras Modules Sheets Foot Quadrant
Circlips Nuts Spades Handle Round
Components O_ring Spools Knob Rounded_cylinder
DIP Opengrab Springs LED_bezel Rounded_polygon
D_connectors PCB Stepper_motors PCB_mount Rounded_triangle
Displays PCBs Swiss_clips PSU_shroud Sector
Extrusion_brackets PSUs Terminals Pocket_handle Sweep
Extrusions Panel_meters Toggles Press_fit Thread
Fans Photo_interrupters Transformers Printed_box Tube
Fastons Pillars Tubings Printed_pulleys
Fuseholder Pillow_blocks Variacs Ribbon_clamp
Gear_motors Pin_headers Veroboard SSR_shroud
Geared_steppers Potentiometers Washers Screw_knob
Green_terminals Pulleys Wire Socket_box
Hot_ends Zipties Strap_handle
Hygrometer
--- @@ -82,6 +83,53 @@ Presence of a decimal point is determined by the number of pins. Its position is ![7_segments](tests/png/7_segments.png) +Top + +--- + +## Antennas +Wifi Antennas + +[vitamins/antennas.scad](vitamins/antennas.scad) Object definitions. + +[vitamins/antenna.scad](vitamins/antenna.scad) Implementation. + +[tests/antennas.scad](tests/antennas.scad) Code for this example. + +### Properties +| Function | Description | +|:--- |:--- | +| `antenna_bot_d(type)` | Diameter at the base | +| `antenna_gap(type)` | Space for left panel, washers and nuts when screwed on fully. | +| `antenna_grip(type)` | Grip d, h, h2 | +| `antenna_hinge(type)` | Hinge post width, z value of the pin, pin diameter, width reduction and slot width | +| `antenna_length(type)` | Total length | +| `antenna_rings(type)` | List of ring z, thickness, depths | +| `antenna_split(type)` | Split point | +| `antenna_straight(type)` | Length of the straight part | +| `antenna_top_d(type)` | Diameter at the top | + +### Functions +| Function | Description | +|:--- |:--- | +| `antenna_hole_r(type)` | Panel hole radius | +| `antenna_nut(type)` | The nut | + +### Modules +| Module | Description | +|:--- |:--- | +| `antenna(type, thickness, angle)` | Draw a WiFi antenna | + +![antennas](tests/png/antennas.png) + +### Vitamins +| Qty | Module call | BOM entry | +| ---:|:--- |:---| +| 1 | `antenna(ESP201_antenna)` | Antenna ESP201 | +| 1 | `nut(ant_nut)` | Nut M6.25 x 1.8mm | +| 1 | `star_washer(ant_washer_washer)` | Washer star M6.4 x 0.6mm | + + Top --- @@ -182,6 +230,8 @@ Also single bearing balls are modelled as just a silver sphere and a BOM entry. | 1 | `ball_bearing(BB6201)` | Ball bearing 6201-2RS 12mm x 32mm x 10mm | | 1 | `ball_bearing(BB624)` | Ball bearing 624-2RS 4mm x 13mm x 5mm | | 1 | `ball_bearing(BB6808)` | Ball bearing 6808-2RS 40mm x 52mm x 7mm | +| 1 | `ball_bearing(BB686)` | Ball bearing 686ZZ 6mm x 13mm x 5mm | +| 1 | `ball_bearing(BB696)` | Ball bearing 696ZZ 6mm x 16mm x 5mm | | 1 | `ball_bearing(BBF623)` | Ball bearing F623-2RS 3mm x 10mm x 4mm | | 1 | `ball_bearing(BBF693)` | Ball bearing F693ZZ 3mm x 8mm x 3mm | | 1 | `ball_bearing(BBF695)` | Ball bearing F695ZZ 5mm x 13mm x 4mm | @@ -189,7 +239,7 @@ Also single bearing balls are modelled as just a silver sphere and a BOM entry. | 1 | `ball_bearing(BBMR83)` | Ball bearing MR83ZZ 3mm x 8mm x 3mm | | 1 | `ball_bearing(BBMR93)` | Ball bearing MR93ZZ 3mm x 9mm x 4mm | | 1 | `ball_bearing(BBSMR95)` | Ball bearing SMR95ZZ 5mm x 9mm x 2.5mm | -| 5 | ` bearing_ball(3)` | Steel ball 3mm | +| 7 | ` bearing_ball(3)` | Steel ball 3mm | Top @@ -571,7 +621,9 @@ Box sections. | Qty | Module call | BOM entry | | ---:|:--- |:---| | 1 | `box_section(AL12x8x1, 100)` | Aluminium rectangular box section 12mm x 8mm x 1mm, length 100mm | -| 1 | `box_section(AL20x20x2, 100)` | Aluminium rectangular box section 20mm x 20mm x 2mm, length 100mm | +| 1 | `box_section(AL20x20x2, 80)` | Aluminium rectangular box section 20mm x 20mm x 2mm, length 80mm | +| 1 | `box_section(AL38p1x25p4x1p6, 60)` | Aluminium rectangular box section 38.1mm x 25.4mm x 1.6mm, length 60mm | +| 1 | `box_section(AL50p8x38p1x3, 40)` | Aluminium rectangular box section 50.8mm x 38.1mm x 3.0mm, length 40mm | | 1 | `box_section(CF10x10x1, 100)` | Carbon fiber rectangular box section 10mm x 10mm x 1mm, length 100mm | @@ -639,6 +691,7 @@ PCB mounted buttons. Can optionally have a coloured cap | `square_button_d(type)` | Button diameter | | `square_button_h(type)` | Height of the button above the PCB | | `square_button_height(type)` | Height of the base | +| `square_button_ra_z(type)` | Height of button centre above the PCB for right_angle version | | `square_button_rivit(type)` | Size of the corner rivets | | `square_button_wall(type)` | Offset of the metal part | | `square_button_width(type)` | Width and depth of the base | @@ -646,7 +699,7 @@ PCB mounted buttons. Can optionally have a coloured cap ### Modules | Module | Description | |:--- |:--- | -| `square_button(type, colour = "yellow")` | Draw square button with specified cap colour if it has a cap | +| `square_button(type, colour = "yellow", right_angle = false)` | Draw square button with specified cap colour if it has a cap | ![buttons](tests/png/buttons.png) @@ -656,6 +709,7 @@ PCB mounted buttons. Can optionally have a coloured cap | 1 | `square_button(button_12mm, "yellow")` | Square button 12mm with yellow cap | | 1 | `square_button(button_4p5mm)` | Square button 4.5mm | | 1 | `square_button(button_6mm)` | Square button 6mm | +| 1 | `square_button(button_6mm_7)` | Square button 6mm | Top @@ -853,6 +907,7 @@ Various electronic components used in hot ends and heated beds. | `fack2spm()` | Draw a FACK2SPM Cat5E RJ45 shielded panel mount coupler | | `fack2spm_hole_positions()` | Place children at the FACK2SPM mounting hole positions | | `fack2spm_holes(h = 0)` | Cut the holes for a FACK2SPM | +| `multiwatt11(part_no, tail = 3)` | Draw a MULTIWATT11 package | | `panel_USBA()` | Draw a panel mount USBA connector | | `panel_USBA_hole_positions()` | Place children at hole positions | | `panel_USBA_holes(h = 100)` | Make holes for USBA connector | @@ -1303,6 +1358,56 @@ Faston receptacles to mate with spade connectors | 1 | `fuseholder(6)` | Fuse holder 20mm | +Top + +--- + +## Gear_motors +DC motors with a gearbox + +[vitamins/gear_motors.scad](vitamins/gear_motors.scad) Object definitions. + +[vitamins/gear_motor.scad](vitamins/gear_motor.scad) Implementation. + +[tests/gear_motors.scad](tests/gear_motors.scad) Code for this example. + +### Properties +| Function | Description | +|:--- |:--- | +| `gm_boss(type)` | Motor boss diameter, corner radius, height and colour | +| `gm_box(type)` | Size, corner radius, colour | +| `gm_holes(type)` | List of hole positions | +| `gm_hub(type)` | Motor hub diameter, height, corner rad | +| `gm_motor(type)` | Motor position, diameter, height, corner rad and colour | +| `gm_motor_boss(type)` | Motor mounting boss on gearbox | +| `gm_screw(type)` | Screw type | +| `gm_screw_boss(type)` | Screw boss diameter and height | +| `gm_screw_depth(type)` | Screw hole depth | +| `gm_shaft(type)` | Shaft diameter, flat width, length, flat length. | +| `gm_shaft_offset(type)` | Offset of shaft from the centre of the gearbox | +| `gm_tags(type)` | Tag size and pitch | + +### Functions +| Function | Description | +|:--- |:--- | +| `gm_box_width(type)` | Gearbox width if rectangular or diameter if round | +| `gm_depth(type)` | Motor total depth | +| `gm_motor_d(type)` | Motor diameter | +| `gm_motor_pos(type)` | Motor position relative to centre of the gearbox | +| `gm_shaft_flat_l(type)` | Length of the shaft flat section | +| `gm_shaft_flat_w(type)` | Shaft width across the flat | +| `gm_shaft_length(type)` | Length of the shaft | +| `gm_shaft_pos(type)` | Shaft position | +| `gm_shaft_r(type)` | Shaft radius | + +### Modules +| Module | Description | +|:--- |:--- | +| `gear_motor(type, alpha = 1)` | Draw specified gear motor, can be partially transparent to see what is behind it | + +![gear_motors](tests/png/gear_motors.png) + + Top --- @@ -1522,6 +1627,7 @@ IEC mains inlets and outlet. | `iec_body_r(type)` | Body corner radius | | `iec_body_w(type)` | Body width | | `iec_body_w2(type)` | Body width at the narrow part | +| `iec_can(type)` | If it has a can then the width, height, thickness and total width of the metal flange | | `iec_depth(type)` | Depth of the body below the flange | | `iec_flange_h(type)` | Flange height | | `iec_flange_r(type)` | Flange corner radius | @@ -1556,14 +1662,15 @@ IEC mains inlets and outlet. | 1 | `iec(IEC_fused_inlet)` | IEC fused inlet JR-101-1F | | 1 | `iec(IEC_fused_inlet2)` | IEC fused inlet old | | 1 | `iec(IEC_inlet)` | IEC inlet | +| 1 | `iec(IEC_yunpen)` | IEC inlet filtered | | 1 | `iec(IEC_inlet_atx)` | IEC inlet for ATX | | 1 | `iec(IEC_outlet)` | IEC outlet RS 811-7193 | | 1 | `iec(IEC_inlet_atx2)` | IEC pressfit inlet for ATX | | 1 | `iec(IEC_320_C14_switched_fused_inlet)` | IEC320 C14 switched fused inlet module | -| 12 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc | +| 14 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc | | 4 | `screw(M3_cs_cap_screw, 10)` | Screw M3 cs cap x 10mm | -| 8 | `screw(M3_cs_cap_screw, 12)` | Screw M3 cs cap x 12mm | -| 12 | `washer(M3_washer)` | Washer M3 x 7mm x 0.5mm | +| 10 | `screw(M3_cs_cap_screw, 12)` | Screw M3 cs cap x 12mm | +| 14 | `washer(M3_washer)` | Washer M3 x 7mm x 0.5mm | Top @@ -1642,6 +1749,7 @@ E.g. a "brown" socket for mains live needs to be displayed as "sienna" to look r | `jack_4mm_shielded_hole_radius()` | Panel hole radius for 4mm shielded jack | | `jack_4mm_shielded_nut_radius()` | Largest diameter of 4mm shielded jack | | `post_4mm_diameter()` | Outer diameter of 4mm binding post | +| `power_jack_radius()` | Power jack socket flange radius | ### Modules | Module | Description | @@ -1651,6 +1759,7 @@ E.g. a "brown" socket for mains live needs to be displayed as "sienna" to look r | `jack_4mm_shielded(colour, thickness, display_colour = false)` | Draw a 4mm shielded jack | | `post_4mm(colour, thickness, display_colour = false)` | Draw a 4mm binding post | | `post_4mm_hole(h = 100, poly = false)` | Drill hole for 4mm binding post | +| `power_jack(thickness)` | Draw a power jack socket with nut positioned for specified panel thickness | ![jack](tests/png/jack.png) @@ -1661,6 +1770,7 @@ E.g. a "brown" socket for mains live needs to be displayed as "sienna" to look r | 1 | `jack_4mm("blue", 3, "royalblue")` | 4mm jack socket blue | | 1 | `jack_4mm_plastic("[0.2, 0.2, 0.2]", 3, [0.2, 0.2, 0.2])` | 4mm plastic jack socket [0.2, 0.2, 0.2] | | 1 | `jack_4mm_shielded("brown", 3, "sienna")` | 4mm shielded jack socket brown | +| 1 | `power_jack()` | Power jack socket | Top @@ -1860,11 +1970,12 @@ Standard domed through hole LEDs. Can specify colour and lead length. | Function | Description | |:--- |:--- | | `led_hole_radius(type)` | Radius of panel hole to accept LED | +| `led_radius(type)` | Radius | ### Modules | Module | Description | |:--- |:--- | -| `led(type, colour = "red", lead = 5)` | Draw specified LED with desired colour and led length | +| `led(type, colour = "red", lead = 5, right_angle = 0)` | Draw specified LED with desired colour and lead length | ![leds](tests/png/leds.png) @@ -2047,6 +2158,7 @@ UK 13A sockets at the moment. | Function | Description | |:--- |:--- | | `mains_socket_corner(type)` | Corner radius | +| `mains_socket_counterbore(type)` | Screw counterbore | | `mains_socket_depth(type)` | Depth at the base | | `mains_socket_height(type)` | Height | | `mains_socket_offset(type)` | Offset of the socket from the centre | @@ -2067,7 +2179,7 @@ UK 13A sockets at the moment. | `mains_socket(type)` | Draw specified 13A socket | | `mains_socket_earth_position(type)` | Position of earth terminal for DiBond panel | | `mains_socket_hole_positions(type)` | Position children at the screw holes | -| `mains_socket_holes(type, h = 0)` | Panel cutout | +| `mains_socket_holes(type, h = 0, earth = true, small = false)` | Panel cutout | ![mains_sockets](tests/png/mains_sockets.png) @@ -2075,6 +2187,7 @@ UK 13A sockets at the moment. | Qty | Module call | BOM entry | | ---:|:--- |:---| | 1 | `mains_socket(Contactum)` | Mains socket 13A | +| 1 | `mains_socket(PMS9143A)` | Mains socket 13A | | 1 | `mains_socket(MKLOGIC)` | Mains socket 13A, switched | @@ -2468,6 +2581,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o ### Functions | Function | Description | |:--- |:--- | +| `pcb(name, desc, size, corner_r = 0, hole_d = 0, land_d = 0, colour = "green", parts_on_bom = false, holes = [], components = [], accessories = [], grid = undef, polygon = undef, screw = undef)` | Constructor | | `pcb_component(type, name, index = 0)` | Return the component specified by name and index | | `pcb_component_position(type, name, index = 0)` | Return x y position of specified component | | `pcb_coord(type, p)` | Convert offsets from the edge to coordinates relative to the centre | @@ -2656,6 +2770,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o ### Functions | Function | Description | |:--- |:--- | +| `pcb(name, desc, size, corner_r = 0, hole_d = 0, land_d = 0, colour = "green", parts_on_bom = false, holes = [], components = [], accessories = [], grid = undef, polygon = undef, screw = undef)` | Constructor | | `pcb_component(type, name, index = 0)` | Return the component specified by name and index | | `pcb_component_position(type, name, index = 0)` | Return x y position of specified component | | `pcb_coord(type, p)` | Convert offsets from the edge to coordinates relative to the centre | @@ -2722,6 +2837,8 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | 1 | `pcb(Duex2)` | Duex2 expansion board - not shown | | 1 | `pcb(Duex5)` | Duex5 expansion board | | 1 | `pcb(ESP-01)` | ESP-01 | +| 1 | `pcb(ESP_12F)` | ESP-12F ESP8266 WiFi module | +| 1 | `pcb(ESP_201)` | ESP-201 ESP8266 WiFi module | | 1 | `pcb(ESP32_DOIT_V1)` | ESP32 DOIT DEV KIT V1 | | 1 | `pcb(EnviroPlus)` | Enviro+ | | 1 | `pcb(ExtruderPCB)` | Extruder connection PCB - not shown | @@ -2758,17 +2875,16 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | 1 | `pcb(RPI_Pico)` | Raspberry Pi Pico | | 1 | `pcb(RPI0)` | Raspberry Pi Zero | | 8 | `screw(M2_cap_screw, 16)` | Screw M2 cap x 16mm | -| 12 | `screw(M2_cap_screw, 20)` | Screw M2 cap x 20mm | -| 2 | `screw(M2p5_cap_screw, 16)` | Screw M2.5 cap x 16mm | +| 8 | `screw(M2_cap_screw, 20)` | Screw M2 cap x 20mm | +| 4 | `screw(M2_cap_screw, 25)` | Screw M2 cap x 25mm | +| 2 | `screw(M2p5_cap_screw, 20)` | Screw M2.5 cap x 20mm | | 8 | `screw(M2p5_cap_screw, 25)` | Screw M2.5 cap x 25mm | -| 4 | `screw(M2p5_cap_screw, 30)` | Screw M2.5 cap x 30mm | -| 8 | `screw(M2p5_cap_screw, 35)` | Screw M2.5 cap x 35mm | -| 4 | `screw(M2p5_dome_screw, 20)` | Screw M2.5 dome x 20mm | +| 12 | `screw(M2p5_cap_screw, 35)` | Screw M2.5 cap x 35mm | +| 4 | `screw(M2p5_dome_screw, 25)` | Screw M2.5 dome x 25mm | | 4 | `screw(M2p5_pan_screw, 20)` | Screw M2.5 pan x 20mm | -| 4 | `screw(M2p5_pan_screw, 25)` | Screw M2.5 pan x 25mm | -| 4 | `screw(M2p5_pan_screw, 30)` | Screw M2.5 pan x 30mm | -| 17 | `screw(M3_cap_screw, 16)` | Screw M3 cap x 16mm | -| 15 | `screw(M3_cap_screw, 20)` | Screw M3 cap x 20mm | +| 8 | `screw(M2p5_pan_screw, 30)` | Screw M2.5 pan x 30mm | +| 19 | `screw(M3_cap_screw, 16)` | Screw M3 cap x 16mm | +| 13 | `screw(M3_cap_screw, 20)` | Screw M3 cap x 20mm | | 11 | `screw(M3_cap_screw, 30)` | Screw M3 cap x 30mm | | 4 | `screw(M4_cap_screw, 20)` | Screw M4 cap x 20mm | | 4 | `screw(M4_cap_screw, 25)` | Screw M4 cap x 25mm | @@ -2777,6 +2893,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | 3 | `terminal_35(2)` | Terminal block 2 way 3.5mm - not shown | | 2 | `green_terminal(gt_2p54, 4)` | Terminal block 4 way 0.1" - not shown | | 1 | | USB A to Mini B lead - not shown | +| 1 | `pcb(tiny_buck)` | Ultra Small 3A buck regulator | | 1 | `pcb(WD2002SJ)` | WD2002SJ Buck Boost DC-DC converter | | 20 | `washer(M2_washer)` | Washer M2 x 5mm x 0.3mm | | 38 | `washer(M2p5_washer)` | Washer M2.5 x 5.9mm x 0.5mm | @@ -2788,27 +2905,27 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | Qty | Filename | | ---:|:--- | | 4 | pcb_spacer20100.stl | -| 4 | pcb_spacer20120.stl | +| 4 | pcb_spacer20130.stl | | 4 | pcb_spacer2070.stl | | 4 | pcb_spacer2080.stl | | 4 | pcb_spacer2090.stl | -| 4 | pcb_spacer25110.stl | -| 4 | pcb_spacer25140.stl | +| 4 | pcb_spacer25120.stl | | 4 | pcb_spacer25150.stl | -| 4 | pcb_spacer25160_2.stl | +| 4 | pcb_spacer25160.stl | | 4 | pcb_spacer25170_2.stl | -| 4 | pcb_spacer25210.stl | +| 4 | pcb_spacer25180_2.stl | | 4 | pcb_spacer25220.stl | | 4 | pcb_spacer25230.stl | -| 2 | pcb_spacer2550.stl | -| 4 | pcb_spacer2590.stl | -| 4 | pcb_spacer30180.stl | +| 4 | pcb_spacer25240.stl | +| 4 | pcb_spacer2580.stl | +| 2 | pcb_spacer2590.stl | | 4 | pcb_spacer30190.stl | -| 3 | pcb_spacer30200.stl | -| 8 | pcb_spacer3050.stl | +| 4 | pcb_spacer30200.stl | +| 3 | pcb_spacer30210.stl | +| 10 | pcb_spacer3050.stl | | 9 | pcb_spacer3060.stl | -| 7 | pcb_spacer3070.stl | -| 8 | pcb_spacer3080.stl | +| 9 | pcb_spacer3070.stl | +| 4 | pcb_spacer3080.stl | | 4 | pcb_spacer40100.stl | | 4 | pcb_spacer4090.stl | @@ -3250,6 +3367,12 @@ Radial components for PCBs. | `rd_disc_lead_d(type)` | Lead diameter and sleeve diameter | | `rd_disc_pitch(type)` | Lead pitch X & Y | | `rd_disc_size(type)` | Diameter, thickness and height | +| `rd_electrolytic_colours(type)` | Colour of jacket and stripe | +| `rd_electrolytic_crimp(type)` | Width and height of crimp | +| `rd_electrolytic_lead_d(type)` | Lead diameter | +| `rd_electrolytic_pitch(type)` | Lead pitch | +| `rd_electrolytic_radius(type)` | Corner radius | +| `rd_electrolytic_size(type)` | Diameter, crimp diameter, height | | `rd_module_colour(type)` | Colour | | `rd_module_kind(type)` | Relay, PSU, etc. | | `rd_module_pin_posns(type)` | list of pin positions | @@ -3269,6 +3392,7 @@ Radial components for PCBs. | Module | Description | |:--- |:--- | | `rd_disc(type, value, pitch = undef, z = 0, tail = 3)` | Draw a radial disc component | +| `rd_electrolytic(type, value, pitch = undef, z = 0, tail = 3)` | Draw a radial electrolytic capcacitor | | `rd_module(type, value)` | Draw a PCB mounted potted module, e.g. PSU or relay | | `rd_transistor(type, value, kind = "Transistor", lead_positions = undef, z = 5, tail = 3)` | Draw a radial lead transistor | | `rd_xtal(type, value, z = 0, pitch = undef, tail = 3)` | Draw a crystal | @@ -3284,8 +3408,10 @@ Radial components for PCBs. | 1 | `rd_xtal(C_002RX, "C_002RX")` | Crystal C_002RX C_002RX | | 1 | `rd_xtal(HC49, "HC49")` | Crystal HC49 HC49 | | 1 | `rd_xtal(HC49_4H, "HC49_4H")` | Crystal HC49_4H HC49_4H | +| 1 | `rd_electrolytic(ECAP8x12, "220uF35V")` | Electolytic capacitor ECAP8x12 220uF35V | +| 1 | `rd_module(LDE10_20B, "12V 900ma")` | PSU LDE10_20B / 12V 900ma | | 1 | `rd_module(VCE03, "12V 250ma")` | PSU VCE03 / 12V 250ma | -| 1 | `pcb(PERF70x50)` | Perfboard 70 x 50mm | +| 2 | `pcb(PERF70x50)` | Perfboard 70 x 50mm | | 1 | `rd_module(HF33F, "012-HSL3F")` | Relay HF33F / 012-HSL3F | | 1 | `rd_transistor(E_LINE, "ZTX853")` | Transistor E_LINE ZTX853 | | 1 | `rd_transistor(TO92, "BC337")` | Transistor TO92 BC337 | @@ -3639,6 +3765,7 @@ For an explanation of `screw_polysink()` see Top @@ -4650,12 +4780,13 @@ Veroboard with mounting holes, track breaks, removed tracks, solder points and c | `vero_no_track(type)` | Missing tracks | | `vero_pitch(type)` | Hole pitch | | `vero_screw(type)` | Mounting screw type | +| `vero_solid_tracks(type)` | List of solid copper tracks (at the edges of some boards) | | `vero_strips(type)` | Number of strips | ### Functions | Function | Description | |:--- |:--- | -| `vero(name, assembly, holes, strips, pitch = 2.54, fr4 = false, screw = M3_cap_screw, mounting_holes = [], breaks = [], no_tracks = [], components = [], joints = [])` | Constructor | +| `vero(name, assembly, holes, strips, pitch = 2.54, fr4 = false, screw = M3_cap_screw, mounting_holes = [], breaks = [], no_tracks = [], components = [], joints = [], solid = [])` | Constructor | | `vero_grid_pos(type, x, y)` | Convert grid position to offset from the centre | | `vero_length(type)` | Length of the board | | `vero_size(type)` | Board size | @@ -4673,6 +4804,7 @@ Veroboard with mounting holes, track breaks, removed tracks, solder points and c | `vero_mounting_holes(type, h = 100)` | Drill mounting holes in a panel | | `veroboard(type)` | Draw specified veroboard with missing tracks and track breaks | | `veroboard_assembly(type, ngb = false)` | Draw the assembly with components | +| `veroboard_base(type, height, thickness, wall = 2, tapped = false)` | Generate STL for a base with PCB spacers | | `veroboard_fastened_assembly(type, height, thickness, flip = false, ngb = false)` | Draw the assembly with components and fasteners in place | | `veroboard_fasteners(type, height, thickness, flip = false)` | Draw the fasteners in place | @@ -4767,7 +4899,7 @@ If a washer is given a child, usually a screw or a nut, then it is placed on its | 1 | `spring_washer(M3p5_washer)` | Washer spring M3.5 x 1mm | | 1 | `spring_washer(M4_washer)` | Washer spring M4 x 1.2mm | | 1 | `spring_washer(M5_washer)` | Washer spring M5 x 1.6mm | -| 1 | `spring_washer(M6_washer)` | Washer spring M6 x 1.6mm | +| 1 | `spring_washer(M6_washer)` | Washer spring M6 x 1.9mm | | 1 | `spring_washer(M8_washer)` | Washer spring M8 x 2mm | | 1 | `star_washer(M2_washer)` | Washer star M2 x 0.3mm | | 1 | `star_washer(M2p5_washer)` | Washer star M2.5 x 0.5mm | @@ -6482,26 +6614,29 @@ UK 13A socket and printed backbox with earth terminal for the panel it is mounte ### Vitamins | Qty | Module call | BOM entry | | ---:|:--- |:---| -| 4 | `insert(F1BM3)` | Heatfit insert M3 x 5.8mm | +| 6 | `insert(F1BM3)` | Heatfit insert M3 x 5.8mm | | 1 | `mains_socket(Contactum)` | Mains socket 13A | +| 1 | `mains_socket(PMS9143A)` | Mains socket 13A | | 1 | `mains_socket(MKLOGIC)` | Mains socket 13A, switched | -| 2 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc | -| 2 | `ring_terminal(M3_ringterm)` | Ring terminal 3mm | -| 4 | `screw(M3_cs_cap_screw, 20)` | Screw M3 cs cap x 20mm | -| 2 | `screw(M3_dome_screw, 10)` | Screw M3 dome x 10mm | -| 4 | `star_washer(M3_washer)` | Washer star M3 x 0.5mm | +| 3 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc | +| 3 | `ring_terminal(M3_ringterm)` | Ring terminal 3mm | +| 6 | `screw(M3_cs_cap_screw, 20)` | Screw M3 cs cap x 20mm | +| 3 | `screw(M3_dome_screw, 10)` | Screw M3 dome x 10mm | +| 6 | `star_washer(M3_washer)` | Washer star M3 x 0.5mm | ### Printed | Qty | Filename | | ---:|:--- | | 1 | socket_box_Contactum.stl | | 1 | socket_box_MKLOGIC.stl | +| 1 | socket_box_PMS9143A.stl | ### Assemblies | Qty | Name | | ---:|:--- | | 1 | socket_box_Contactum_assembly | | 1 | socket_box_MKLOGIC_assembly | +| 1 | socket_box_PMS9143A_assembly | Top @@ -7019,7 +7154,7 @@ Utilities for making PCBs and components |:--- |:--- | | `cylindrical_wrap(r, h = eps)` | Wrap a 2D child extruded to height `h` around a cylinder with radius `r`. | | `solder(ir = 0.3)` | Maybe add solder meniscus if $solder is set | -| `solder_meniscus(ir = 0.3, r)` | Draw a solder meniscus | +| `solder_meniscus(ir = 0.3, r = 1, h = 0.7)` | Draw a solder meniscus | ![pcb_utils](tests/png/pcb_utils.png) @@ -7477,7 +7612,7 @@ leaving a scar on either surface. | `poly_drill(r, h = 100, center = true)` | Make a cylinder for drilling holes suitable for CNC routing if cnc_bit_r is non zero, otherwise a poly_cylinder. | | `poly_ring(or, ir, sides = undef)` | Make a 2D ring adjusted to have the correct internal radius | | `poly_tube(or, ir, h, center = false)` | Make a tube adjusted to have the correct internal radius | -| `slot(r, l, h = 100)` | Make a horizontal slot suitable for CNC routing, set h = 0 for 2D version | +| `slot(r, l, h = 100, center = false)` | Make a horizontal slot suitable for CNC routing, set h = 0 for 2D version | ![polyholes](tests/png/polyholes.png) diff --git a/scripts/options.py b/scripts/options.py index 042835e..cd11138 100644 --- a/scripts/options.py +++ b/scripts/options.py @@ -24,7 +24,11 @@ from colorama import Fore, init def check_options(dir = '.'): global options, options_mtime - options = { "show_threads": str(os.getenv("NOPSCADLIB_SHOW_THREADS")) } + options = { + "show_threads": str(os.getenv("NOPSCADLIB_SHOW_THREADS")), + "vitamin_fa": str(os.getenv("NOPSCADLIB_VITAMIN_FA")), + "vitamin_fs": str(os.getenv("NOPSCADLIB_VITAMIN_FS")) + } options_fname = dir + '/options.json' try: with open(options_fname) as json_file: diff --git a/tests/antennas.scad b/tests/antennas.scad new file mode 100644 index 0000000..7a90b61 --- /dev/null +++ b/tests/antennas.scad @@ -0,0 +1,31 @@ +// +// NopSCADlib Copyright Chris Palmer 2023 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +use <../utils/layout.scad> + +include <../vitamins/antennas.scad> + +module antennas() + layout([for(a = antennas) cos(10) * antenna_length(a) ], 5, true) { + antenna(antennas[$i], 3, 10); + + } + +if($preview) + antennas(); diff --git a/tests/ball_bearings.scad b/tests/ball_bearings.scad index 3abbb52..d486e3f 100644 --- a/tests/ball_bearings.scad +++ b/tests/ball_bearings.scad @@ -22,20 +22,24 @@ use <../utils/layout.scad> include <../vitamins/ball_bearings.scad> -module do_bearings(list) - layout([for(b = list) bb_diameter(b)]) - ball_bearing(list[$i]) - if (bb_width(list[$i]) >= 5) - bearing_ball(3); +module do_bearings(list) { + diameters = [for(b = list) bb_diameter(b)]; + max = max(diameters); + layout(diameters) let(b = list[$i]) + //translate([0, (max - bb_diameter(b)) / 2]) + ball_bearing(list[$i]) + if (bb_width(list[$i]) >= 5) + bearing_ball(3); +} module ball_bearings() { - small_bearings = [for(b = ball_bearings) if(bb_diameter(b) < 12) b]; + small_bearings = [for(b = ball_bearings) if(bb_diameter(b) <= 13) b]; big_bearings = [for(b = ball_bearings) if(!in(small_bearings, b)) b]; translate([0, 0]) do_bearings(big_bearings); - translate([0, -20]) + translate([0, -25]) do_bearings(small_bearings); } diff --git a/tests/box_sections.scad b/tests/box_sections.scad index 8e1ca6e..0bcffb4 100644 --- a/tests/box_sections.scad +++ b/tests/box_sections.scad @@ -22,8 +22,15 @@ use <../utils/layout.scad> include <../vitamins/box_sections.scad> module box_sections() { - layout([for(b = box_sections) box_section_size(b).x], 20) - box_section(box_sections[$i], 100); + woven = [for(b = box_sections) if(box_section_is_woven(b)) b]; + plain = [for(b = box_sections) if(!box_section_is_woven(b)) b]; + layout([for(b = woven) box_section_size(b).x * 0], 10) + box_section(box_sections[$i], 100 - $i * 20); + + translate([50, 0]) + for(i = [0 : len(plain) - 1]) + box_section(plain[i], 100 - i * 20); + } if($preview) diff --git a/tests/components.scad b/tests/components.scad index a6ff451..1cb7068 100644 --- a/tests/components.scad +++ b/tests/components.scad @@ -55,6 +55,10 @@ module components() { translate([0, 130]) al_clad_resistors(); + + translate([80, 10]) + multiwatt11("L6203"); + } if($preview) diff --git a/tests/gear_motors.scad b/tests/gear_motors.scad new file mode 100644 index 0000000..a693aa3 --- /dev/null +++ b/tests/gear_motors.scad @@ -0,0 +1,31 @@ +// +// NopSCADlib Copyright Chris Palmer 2023 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +include <../vitamins/gear_motors.scad> + +use <../utils/layout.scad> + +module gear_motors() + layout([for(g = gear_motors) gm_box(g).x], 10) + gear_motor(gear_motors[$i]); + + + +if($preview) + gear_motors(); diff --git a/tests/jack.scad b/tests/jack.scad index ddc2834..8e7c4b9 100644 --- a/tests/jack.scad +++ b/tests/jack.scad @@ -32,6 +32,9 @@ module jacks() { translate([60, 0]) post_4mm("red",3); + + translate([80, 0]) + power_jack(3); } if($preview) diff --git a/tests/nuts.scad b/tests/nuts.scad index 0db380a..4a3e499 100644 --- a/tests/nuts.scad +++ b/tests/nuts.scad @@ -57,7 +57,8 @@ module nuts() { sliding_t_nut(M6_sliding_t_nut); if(n == M8_nut) - sliding_t_nut(M8_sliding_ball_t_nut); + rotate(90) + sliding_t_nut(M8_sliding_ball_t_nut); } translate([0, 80]) { diff --git a/tests/pcb_utils.scad b/tests/pcb_utils.scad index acbe160..d1b63a3 100644 --- a/tests/pcb_utils.scad +++ b/tests/pcb_utils.scad @@ -33,7 +33,7 @@ module pcb_utils() { color("silver") vflip() - cylinder(d = 0.6, h = 3, $fn = 16); + cylinder(d = 0.6, h = 3, $fs = fs, $fa = fa); color("white") translate_z(h / 2) diff --git a/tests/png/7_segments.png b/tests/png/7_segments.png index 007763b..01777fc 100644 Binary files a/tests/png/7_segments.png and b/tests/png/7_segments.png differ diff --git a/tests/png/annotation.png b/tests/png/annotation.png index c4dea6c..7604a60 100644 Binary files a/tests/png/annotation.png and b/tests/png/annotation.png differ diff --git a/tests/png/antennas.png b/tests/png/antennas.png new file mode 100644 index 0000000..a308546 Binary files /dev/null and b/tests/png/antennas.png differ diff --git a/tests/png/axials.png b/tests/png/axials.png index 9c25aa8..a98239c 100644 Binary files a/tests/png/axials.png and b/tests/png/axials.png differ diff --git a/tests/png/ball_bearings.png b/tests/png/ball_bearings.png index 444febb..8f38e65 100644 Binary files a/tests/png/ball_bearings.png and b/tests/png/ball_bearings.png differ diff --git a/tests/png/batteries.png b/tests/png/batteries.png index c496080..4e53649 100644 Binary files a/tests/png/batteries.png and b/tests/png/batteries.png differ diff --git a/tests/png/belts.png b/tests/png/belts.png index c0fe18c..691892c 100644 Binary files a/tests/png/belts.png and b/tests/png/belts.png differ diff --git a/tests/png/bezier.png b/tests/png/bezier.png index 775a84f..74a754b 100644 Binary files a/tests/png/bezier.png and b/tests/png/bezier.png differ diff --git a/tests/png/blowers.png b/tests/png/blowers.png index 0a69c8f..a2f794a 100644 Binary files a/tests/png/blowers.png and b/tests/png/blowers.png differ diff --git a/tests/png/bom.png b/tests/png/bom.png index 06e009e..442918f 100644 Binary files a/tests/png/bom.png and b/tests/png/bom.png differ diff --git a/tests/png/box_sections.png b/tests/png/box_sections.png index decf235..af11d88 100644 Binary files a/tests/png/box_sections.png and b/tests/png/box_sections.png differ diff --git a/tests/png/bulldogs.png b/tests/png/bulldogs.png index 184b213..c130288 100644 Binary files a/tests/png/bulldogs.png and b/tests/png/bulldogs.png differ diff --git a/tests/png/buttons.png b/tests/png/buttons.png index bd32a94..24bda99 100644 Binary files a/tests/png/buttons.png and b/tests/png/buttons.png differ diff --git a/tests/png/cable_clip.png b/tests/png/cable_clip.png index 2f3b6db..822eb02 100644 Binary files a/tests/png/cable_clip.png and b/tests/png/cable_clip.png differ diff --git a/tests/png/camera_housing.png b/tests/png/camera_housing.png index 76fda6f..1ff0a5c 100644 Binary files a/tests/png/camera_housing.png and b/tests/png/camera_housing.png differ diff --git a/tests/png/cameras.png b/tests/png/cameras.png index eecbe25..5d09457 100644 Binary files a/tests/png/cameras.png and b/tests/png/cameras.png differ diff --git a/tests/png/catenary.png b/tests/png/catenary.png index 7efef20..decb19f 100644 Binary files a/tests/png/catenary.png and b/tests/png/catenary.png differ diff --git a/tests/png/components.png b/tests/png/components.png index 6f73899..552a138 100644 Binary files a/tests/png/components.png and b/tests/png/components.png differ diff --git a/tests/png/core_xy.png b/tests/png/core_xy.png index fcb9efa..58ec32b 100644 Binary files a/tests/png/core_xy.png and b/tests/png/core_xy.png differ diff --git a/tests/png/corner_block.png b/tests/png/corner_block.png index 7f6c71f..79392c8 100644 Binary files a/tests/png/corner_block.png and b/tests/png/corner_block.png differ diff --git a/tests/png/d_connectors.png b/tests/png/d_connectors.png index 0a35014..931ad3d 100644 Binary files a/tests/png/d_connectors.png and b/tests/png/d_connectors.png differ diff --git a/tests/png/displays.png b/tests/png/displays.png index 5c3776a..b3e0200 100644 Binary files a/tests/png/displays.png and b/tests/png/displays.png differ diff --git a/tests/png/door_hinge.png b/tests/png/door_hinge.png index e1269d9..c2be601 100644 Binary files a/tests/png/door_hinge.png and b/tests/png/door_hinge.png differ diff --git a/tests/png/door_latch.png b/tests/png/door_latch.png index 907fb29..f566c86 100644 Binary files a/tests/png/door_latch.png and b/tests/png/door_latch.png differ diff --git a/tests/png/fan_guard.png b/tests/png/fan_guard.png index 4745f36..25f397f 100644 Binary files a/tests/png/fan_guard.png and b/tests/png/fan_guard.png differ diff --git a/tests/png/fixing_block.png b/tests/png/fixing_block.png index 78263cd..abe62d1 100644 Binary files a/tests/png/fixing_block.png and b/tests/png/fixing_block.png differ diff --git a/tests/png/flat_hinge.png b/tests/png/flat_hinge.png index 0ddf6a7..6a6e5b7 100644 Binary files a/tests/png/flat_hinge.png and b/tests/png/flat_hinge.png differ diff --git a/tests/png/foot.png b/tests/png/foot.png index 6191289..a762742 100644 Binary files a/tests/png/foot.png and b/tests/png/foot.png differ diff --git a/tests/png/gear_motors.png b/tests/png/gear_motors.png new file mode 100644 index 0000000..d2853e8 Binary files /dev/null and b/tests/png/gear_motors.png differ diff --git a/tests/png/geared_steppers.png b/tests/png/geared_steppers.png index 05e57d6..4be3fdc 100644 Binary files a/tests/png/geared_steppers.png and b/tests/png/geared_steppers.png differ diff --git a/tests/png/green_terminals.png b/tests/png/green_terminals.png index 9ce55a3..9b71451 100644 Binary files a/tests/png/green_terminals.png and b/tests/png/green_terminals.png differ diff --git a/tests/png/hot_ends.png b/tests/png/hot_ends.png index f141936..928b327 100644 Binary files a/tests/png/hot_ends.png and b/tests/png/hot_ends.png differ diff --git a/tests/png/hygrometer.png b/tests/png/hygrometer.png index f10e551..52695e2 100644 Binary files a/tests/png/hygrometer.png and b/tests/png/hygrometer.png differ diff --git a/tests/png/iecs.png b/tests/png/iecs.png index f240a5e..4619b1a 100644 Binary files a/tests/png/iecs.png and b/tests/png/iecs.png differ diff --git a/tests/png/jack.png b/tests/png/jack.png index 179c898..8d48979 100644 Binary files a/tests/png/jack.png and b/tests/png/jack.png differ diff --git a/tests/png/knob.png b/tests/png/knob.png index 73a0006..1966639 100644 Binary files a/tests/png/knob.png and b/tests/png/knob.png differ diff --git a/tests/png/led_bezel.png b/tests/png/led_bezel.png index 390dcfb..2db3926 100644 Binary files a/tests/png/led_bezel.png and b/tests/png/led_bezel.png differ diff --git a/tests/png/leds.png b/tests/png/leds.png index 9a36310..3647e49 100644 Binary files a/tests/png/leds.png and b/tests/png/leds.png differ diff --git a/tests/png/mains_sockets.png b/tests/png/mains_sockets.png index 889ab1a..3de9800 100644 Binary files a/tests/png/mains_sockets.png and b/tests/png/mains_sockets.png differ diff --git a/tests/png/maths.png b/tests/png/maths.png index d2fd22f..23b0b5a 100644 Binary files a/tests/png/maths.png and b/tests/png/maths.png differ diff --git a/tests/png/microswitches.png b/tests/png/microswitches.png index d6dbfd0..afc1e4f 100644 Binary files a/tests/png/microswitches.png and b/tests/png/microswitches.png differ diff --git a/tests/png/modules.png b/tests/png/modules.png index 788fbc4..7a01193 100644 Binary files a/tests/png/modules.png and b/tests/png/modules.png differ diff --git a/tests/png/nuts.png b/tests/png/nuts.png index b15d3f4..6739055 100644 Binary files a/tests/png/nuts.png and b/tests/png/nuts.png differ diff --git a/tests/png/opengrab.png b/tests/png/opengrab.png index 56ca3dd..4926342 100644 Binary files a/tests/png/opengrab.png and b/tests/png/opengrab.png differ diff --git a/tests/png/pcb.png b/tests/png/pcb.png index 4097be1..c8c6185 100644 Binary files a/tests/png/pcb.png and b/tests/png/pcb.png differ diff --git a/tests/png/pcb_mount.png b/tests/png/pcb_mount.png index 53b0caf..5fc34aa 100644 Binary files a/tests/png/pcb_mount.png and b/tests/png/pcb_mount.png differ diff --git a/tests/png/pcb_utils.png b/tests/png/pcb_utils.png index 88707e8..e28df62 100644 Binary files a/tests/png/pcb_utils.png and b/tests/png/pcb_utils.png differ diff --git a/tests/png/pcbs.png b/tests/png/pcbs.png index 42f4a2e..237da04 100644 Binary files a/tests/png/pcbs.png and b/tests/png/pcbs.png differ diff --git a/tests/png/pillars.png b/tests/png/pillars.png index 3332f0a..675fe63 100644 Binary files a/tests/png/pillars.png and b/tests/png/pillars.png differ diff --git a/tests/png/pillow_blocks.png b/tests/png/pillow_blocks.png index a896086..8639921 100644 Binary files a/tests/png/pillow_blocks.png and b/tests/png/pillow_blocks.png differ diff --git a/tests/png/pin_headers.png b/tests/png/pin_headers.png index 0ab26b0..f8a4e3d 100644 Binary files a/tests/png/pin_headers.png and b/tests/png/pin_headers.png differ diff --git a/tests/png/pocket_handle.png b/tests/png/pocket_handle.png index 90bccbf..bd73e03 100644 Binary files a/tests/png/pocket_handle.png and b/tests/png/pocket_handle.png differ diff --git a/tests/png/potentiometers.png b/tests/png/potentiometers.png index 3ff23b5..fe4bbd4 100644 Binary files a/tests/png/potentiometers.png and b/tests/png/potentiometers.png differ diff --git a/tests/png/printed_box.png b/tests/png/printed_box.png index e513035..5698c86 100644 Binary files a/tests/png/printed_box.png and b/tests/png/printed_box.png differ diff --git a/tests/png/printed_pulleys.png b/tests/png/printed_pulleys.png index 9285bb7..91f5db8 100644 Binary files a/tests/png/printed_pulleys.png and b/tests/png/printed_pulleys.png differ diff --git a/tests/png/psus.png b/tests/png/psus.png index bf3d405..aca4992 100644 Binary files a/tests/png/psus.png and b/tests/png/psus.png differ diff --git a/tests/png/pulleys.png b/tests/png/pulleys.png index 8551585..1417e4a 100644 Binary files a/tests/png/pulleys.png and b/tests/png/pulleys.png differ diff --git a/tests/png/radials.png b/tests/png/radials.png index a6ad0be..2a49ed8 100644 Binary files a/tests/png/radials.png and b/tests/png/radials.png differ diff --git a/tests/png/ribbon_clamp.png b/tests/png/ribbon_clamp.png index fb1c29c..21c17bb 100644 Binary files a/tests/png/ribbon_clamp.png and b/tests/png/ribbon_clamp.png differ diff --git a/tests/png/ring_terminals.png b/tests/png/ring_terminals.png index b7653cf..4b2e09a 100644 Binary files a/tests/png/ring_terminals.png and b/tests/png/ring_terminals.png differ diff --git a/tests/png/rockers.png b/tests/png/rockers.png index e9b7324..bf3bd1f 100644 Binary files a/tests/png/rockers.png and b/tests/png/rockers.png differ diff --git a/tests/png/rounded_cylinder.png b/tests/png/rounded_cylinder.png index 31b9927..70f396d 100644 Binary files a/tests/png/rounded_cylinder.png and b/tests/png/rounded_cylinder.png differ diff --git a/tests/png/screw_knob.png b/tests/png/screw_knob.png index 6799ab0..3c11601 100644 Binary files a/tests/png/screw_knob.png and b/tests/png/screw_knob.png differ diff --git a/tests/png/screws.png b/tests/png/screws.png index a5f01f0..934fb2e 100644 Binary files a/tests/png/screws.png and b/tests/png/screws.png differ diff --git a/tests/png/servo_motors.png b/tests/png/servo_motors.png index 8e78380..64f7176 100644 Binary files a/tests/png/servo_motors.png and b/tests/png/servo_motors.png differ diff --git a/tests/png/smds.png b/tests/png/smds.png index 0249c4a..6b1d9c7 100644 Binary files a/tests/png/smds.png and b/tests/png/smds.png differ diff --git a/tests/png/socket_box.png b/tests/png/socket_box.png index 53d1296..99e017e 100644 Binary files a/tests/png/socket_box.png and b/tests/png/socket_box.png differ diff --git a/tests/png/spools.png b/tests/png/spools.png index 58fbb80..15a3080 100644 Binary files a/tests/png/spools.png and b/tests/png/spools.png differ diff --git a/tests/png/ssrs.png b/tests/png/ssrs.png index 2660769..1b644d3 100644 Binary files a/tests/png/ssrs.png and b/tests/png/ssrs.png differ diff --git a/tests/png/stepper_motors.png b/tests/png/stepper_motors.png index 8851f08..88cc75f 100644 Binary files a/tests/png/stepper_motors.png and b/tests/png/stepper_motors.png differ diff --git a/tests/png/strap_handle.png b/tests/png/strap_handle.png index 837889a..6d0f186 100644 Binary files a/tests/png/strap_handle.png and b/tests/png/strap_handle.png differ diff --git a/tests/png/toggles.png b/tests/png/toggles.png index 7afad9d..53d4e0f 100644 Binary files a/tests/png/toggles.png and b/tests/png/toggles.png differ diff --git a/tests/png/veroboard.png b/tests/png/veroboard.png index d3155af..9bbda4e 100644 Binary files a/tests/png/veroboard.png and b/tests/png/veroboard.png differ diff --git a/tests/png/washers.png b/tests/png/washers.png index edf13d8..17e37b5 100644 Binary files a/tests/png/washers.png and b/tests/png/washers.png differ diff --git a/tests/png/wire.png b/tests/png/wire.png index 901235a..2a5d83d 100644 Binary files a/tests/png/wire.png and b/tests/png/wire.png differ diff --git a/tests/png/zipties.png b/tests/png/zipties.png index db120a3..54fba3f 100644 Binary files a/tests/png/zipties.png and b/tests/png/zipties.png differ diff --git a/tests/radials.scad b/tests/radials.scad index 946c8ed..5d49867 100644 --- a/tests/radials.scad +++ b/tests/radials.scad @@ -22,6 +22,18 @@ include <../vitamins/pcbs.scad> module radials() { pcb = PERF70x50; pcb(pcb); + translate([0, pcb_width(pcb) + inch(0.2)]) { + pcb(pcb); + + pcb_grid(pcb, 10, 12) + rd_module(rd_modules[2], "12V 900ma"); + + for(i = [0: len(rd_electrolytics) - 1]) + pcb_grid(pcb, i * 3, 2) + rotate(-90) + rd_electrolytic(rd_electrolytics[i], "220uF35V", z = 3, pitch = inch(0.2)); + } + $solder = pcb_solder(pcb); for(i = [0 : len(rd_xtals) - 1]) @@ -35,6 +47,7 @@ module radials() { rotate(-90) rd_module(rd_modules[1], "12V 250ma"); + for(i = [0 : len(rd_discs) - 1]) pcb_grid(pcb, 1 + 2.5 * i, 1) { disc = rd_discs[i]; diff --git a/tests/wire.scad b/tests/wire.scad index 1057518..845cf44 100644 --- a/tests/wire.scad +++ b/tests/wire.scad @@ -109,7 +109,7 @@ module wires() { ends = [for(p = positions) [[30, p.x, p.y], [0, p.x, p.y]]]; paths = [for(i = [0 : len(tpaths) - 1]) bezier_join(ends[i], tpaths[i], 1.3, 3)]; - cable(cable, paths, $fn = 32); + cable(cable, paths, $fs = fs, $fa = fa); } } diff --git a/utils/annotation.scad b/utils/annotation.scad index 7e270eb..cf39624 100644 --- a/utils/annotation.scad +++ b/utils/annotation.scad @@ -34,9 +34,10 @@ module arrow(length = 20) { //! Draw an arrow that faces downwards d = length / 20; head_r = 1.5 * d; + $fs = fs; $fa = fa; color("grey") %union() { translate_z(head_r) - cylinder(d = d, h = length - head_r, $fn = 32); + cylinder(d = d, h = length - head_r); cylinder(r1 = 0, r2 = head_r, h = head_r); } diff --git a/utils/core/polyholes.scad b/utils/core/polyholes.scad index 3f27ce2..2a5baac 100644 --- a/utils/core/polyholes.scad +++ b/utils/core/polyholes.scad @@ -110,8 +110,8 @@ module poly_drill(r, h = 100, center = true) //! Make a cylinder for drilling ho // // Horizontal slot // -module slot(r, l, h = 100) //! Make a horizontal slot suitable for CNC routing, set h = 0 for 2D version - extrude_if(h) +module slot(r, l, h = 100, center = false) //! Make a horizontal slot suitable for CNC routing, set h = 0 for 2D version + extrude_if(h, center) hull() { translate([l / 2,0]) drill(r, 0); diff --git a/utils/pcb_utils.scad b/utils/pcb_utils.scad index 1f9fc29..3447696 100644 --- a/utils/pcb_utils.scad +++ b/utils/pcb_utils.scad @@ -22,15 +22,14 @@ // include <../utils/core/core.scad> -module solder_meniscus(ir = 0.3, r) { //! Draw a solder meniscus - h = 0.7; - +module solder_meniscus(ir = 0.3, r = 1, h = 0.7) { //! Draw a solder meniscus + $fn = fn; color("silver") rotate_extrude() difference() { square([r, h]); translate([r + eps, h + eps]) - ellipse(r - ir + eps, h, $fn = 64); + ellipse(r - ir + eps, h); } } diff --git a/utils/rounded_cylinder.scad b/utils/rounded_cylinder.scad index fcf867c..c8c6028 100644 --- a/utils/rounded_cylinder.scad +++ b/utils/rounded_cylinder.scad @@ -33,7 +33,7 @@ module rounded_corner(r, h, r2, ir = 0) { //! 2D version translate([r - r2 - ir, h - r2]) intersection() { - circle4n(r2, $fs = 0.2); + circle4n(r2); square(r2); } diff --git a/vitamins/7_segment.scad b/vitamins/7_segment.scad index 30ad046..192fcb4 100644 --- a/vitamins/7_segment.scad +++ b/vitamins/7_segment.scad @@ -102,7 +102,7 @@ module 7_segment_digit(type, colour = grey(95), pin_length = 6.4) { //! Draw the for(x = [0 : 1 : pins.x - 1], y = [0 : 1 : pins.y - 1]) translate([(x - (pins.x - 1) / 2) * pin_pitch.x, (y - (pins.y - 1) / 2) * pin_pitch.y]) { vflip() - cylinder(d = pin_pitch[2], h = pin_length, $fn = 16); + cylinder(d = pin_pitch[2], h = pin_length, $fn = fn); solder(); } diff --git a/vitamins/antenna.scad b/vitamins/antenna.scad new file mode 100644 index 0000000..991ae05 --- /dev/null +++ b/vitamins/antenna.scad @@ -0,0 +1,229 @@ +// +// NopSCADlib Copyright Chris Palmer 2023 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +// +//! Wifi Antennas +// +include <../core.scad> +use <../utils/tube.scad> +use <../utils/fillet.scad> +use <../utils/thread.scad> + +// +// s d t s s s s p +// c i h o t p p e +// r a i f a r r n +// e m c t r i i n +// w e k n n y +// t n d g g +// e e i v +// r s a d t e +// s i h r +// a k +ant_washer = ["ant_washer", 6.4, 12, 0.6, false, 9.6, 8.6, 1, undef]; + + + + + +// s d t n w t t +// c i h y a r h +// r a i l s a r +// e m c o h p e +// w e k c e d +// t n r d +// e e t e p +// r s h p i +// s k t t +// h c +// h + +ant_nut = ["ant_nut", 6.25, 9.24, 1.8, 1.8, ant_washer, 2, inch(1/36)]; + + + + + +function antenna_length(type) = type[2]; //! Total length +function antenna_top_d(type) = type[3]; //! Diameter at the top +function antenna_bot_d(type) = type[4]; //! Diameter at the base +function antenna_split(type) = type[5]; //! Split point +function antenna_straight(type) = type[6]; //! Length of the straight part +function antenna_hinge(type) = type[7]; //! Hinge post width, z value of the pin, pin diameter, width reduction and slot width +function antenna_grip(type) = type[8]; //! Grip d, h, h2 +function antenna_rings(type) = type[9]; //! List of ring z, thickness, depths +function antenna_gap(type) = type[10]; //! Space for left panel, washers and nuts when screwed on fully. +function antenna_hole_r(type) = 6.4 / 2; //! Panel hole radius +function antenna_nut(type) = ant_nut; //! The nut + +module antenna(type, thickness, angle) //! Draw a WiFi antenna +{ + vitamin(str("antenna(", type[0], "): Antenna ", type[1])); + + split = antenna_split(type); + bot_d = antenna_bot_d(type); + g = antenna_grip(type); + grip_d = g[0]; + grip_h1 = g[1]; + grip_h2 = g[2]; + h = antenna_hinge(type); + hinge_w = h[0]; + pin_z = h[1]; + pin_d = h[2]; + cutout = bot_d - h[3]; + slot_w = h[4]; + w = hinge_w + 0.2; + slot_height = pin_z - split + w / 2; + gap = antenna_gap(type); + translate_z(gap - washer_thickness(ant_washer)) explode(20){ + color(grey(25)) { + translate_z(pin_z) rotate([0, angle, 0]) translate_z(-pin_z) { + difference() { + // Main rod + hull() { + translate_z(split) + cylinder(d = bot_d, h = antenna_straight(type)); + + d = antenna_top_d(type); + translate_z(antenna_length(type) - d / 2) + sphere(d = d); + } + + // Rings + for(r = antenna_rings(type)) + translate_z(r[0]) + tube(or = bot_d / 2, ir = antenna_top_d(type) / 2 - r[2], h = r[1], center = false); + + // Slot for hinge + translate([w / 2, 0, split]) + cube([2 * w, w, 2 * slot_height], center = true); + + // Chamfer top of slot and cut out to avoid knife edge + translate([bot_d / 2, 0, split]) + hull() { + cube([2 * cutout, bot_d, 2 * slot_height], center = true); + + cube([eps, bot_d, 2 * (slot_height + cutout)], center = true); + } + + // Fillet at the bottom + translate([bot_d / 2 - cutout, 0, split]) + rotate([90, 0, 180]) + fillet(r = bot_d / 2 - cutout, h = bot_d, center = true); + + // Hole for hinge pin + translate_z(pin_z) + rotate([90, 0, 0]) + cylinder(d = pin_d, h = bot_d + 1, center = true); + } + // Hinge pins + for(side = [-1, 1]) + hull() { + translate([0, side * (bot_d - pin_d) / 2, pin_z]) + sphere(d = pin_d); + + translate([0, side * slot_w / 2, pin_z]) + rotate([90, 0, 0]) + cylinder(d = pin_d, h = eps); + } + } + // Static part + translate_z(grip_h1) + cylinder(d = bot_d, h = split - grip_h1); + + // Hinge base + translate_z(split) + cube([hinge_w, hinge_w, 2 * (pin_z - w / 2 - split)], center = true); + + // Hinge clevice + cheek_w = (hinge_w - slot_w) / 2; + for(side = [-1, 1]) + translate([0, side * (cheek_w + slot_w) / 2, pin_z]) + hull() { + rotate([90, 0, 0]) + cylinder(d = hinge_w, h = cheek_w, center = true); + + translate_z(split - pin_z) + cube([ hinge_w, cheek_w, eps], center = true); + } + } + // wire + color("Chocolate") + translate_z(split) + cylinder(d = slot_w, h = slot_height, center = false); + + // Grip for thread + rib_d = grip_d - bot_d; + ribs = floor(PI * bot_d / rib_d); + color(grey(15)) { + cylinder(d = bot_d, h = grip_h1); + + for(i = [0 : ribs - 1]) + rotate(i * 360 / ribs) + translate([bot_d / 2, 0, (grip_h1 - grip_h2) / 2]) + cylinder(d = rib_d, h = grip_h2, $fn = 32); + } + } + + color(gold) { + translate_z(thickness) + explode(7, explode_children = true) + //spring_washer(ant_washer) + translate_z(exploded() ? 7 : 0) + nut(ant_nut); + + vflip() + explode(25) + star_washer(ant_washer); + } + + explode(-40) { + color(gold) { + vflip() translate_z(washer_thickness(ant_washer)) { + cylinder(d = 8 / cos(30), $fn = 6, h = 2); + + cylinder(d = 5 / cos(30), $fn = 6, h = 4.5); + + vflip() { + tube(or = 5.3 / 2, ir = 4.6 / 2, h = 11, center = false); + + tube(or = 5 / 2, ir = 4.0 / 2, h = 9, center = false); + + difference() { + tube(or = 1 / 2, ir = 0.6 / 2, h = 8.8, center = false); + + translate_z(8.8) + cube([0.1, 2, 10], center = true); + } + + male_metric_thread(6.25, inch(1/36), 10, center = false, top = -1, bot = -1, solid = false, colour = gold); + } + } + } + color(grey(95)) + translate_z(-washer_thickness(ant_washer)) + tube(or = 5 / 2, ir = 0.5, h = 8.8, center = false); + + color(grey(15)) + vflip() { + cylinder(d = 2.5, h = 9); + + cylinder(d = 1.75, h = 20); + } + } +} diff --git a/vitamins/antennas.scad b/vitamins/antennas.scad new file mode 100644 index 0000000..0616a4f --- /dev/null +++ b/vitamins/antennas.scad @@ -0,0 +1,36 @@ +// +// NopSCADlib Copyright Chris Palmer 2023 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +// +//! Wifi Antennas +// + +// +// d l t b s s h g r g +// e e o o p t i r i a +// s n p t l r n i n p +// c g i a g p g +// t d d t i e s +// h g d h h2 +// h postw pinz pind wr sw z t z +// t +ESP201_antenna = ["ESP201_antenna", "ESP201", 108.5, 7.9, 9.5, 20.6, 20.6, [5.3, 26, 1.7, 8.5, 2], [10, 9, 6.5], [[97.6, 0.7, 0.6], [99, 0.7, 0.6]], 6.45]; + +antennas = [ ESP201_antenna ]; + +use diff --git a/vitamins/axial.scad b/vitamins/axial.scad index caa7e2d..259c05a 100644 --- a/vitamins/axial.scad +++ b/vitamins/axial.scad @@ -28,8 +28,7 @@ module wire_link(d, l, h = 1, tail = 3, sleeve = false) { //! Draw a wire jumper vitamin(str("wire_link(", d, ", ", l, arg(h, 1, "h"), arg(tail, 3, "tail"), arg(sleeve, false, "sleeve"), "): Wire link ", d, "mm x ", l ? str(l / inch(1), "\"") : str(h + tail,"mm"), sleeve ? str(" with ", sleeve[1], " sleeving") : "")); r = d; - $fn = 32; - + $fn = fn; color("silver") if(l) { for(side = [-1, 1]) { @@ -38,16 +37,20 @@ module wire_link(d, l, h = 1, tail = 3, sleeve = false) { //! Draw a wire jumper translate([side * (l / 2 - r), 0, h - r]) rotate([90, 0, side * 90 - 90]) - rotate_extrude(angle = 90) + rotate_extrude(angle = 90, $fn = fn * 2) translate([r, 0]) - circle(d = d); + circle(d = d, $fn = fn); translate([side * l /2, 0]) - solder(ir = d / 2); + if(tail > 1) + solder(ir = d / 2); + else + if(!is_undef($solder)) + translate_z(0.1) + solder_meniscus(ir = d / 2, r = $solder.x, h = h - r - 0.1); } - translate_z(h) - rotate([0, 90, 0]) + rotate([0, -90, 0]) cylinder(d = d, h = l - 2 * r, center = true); } else { @@ -100,11 +103,11 @@ module ax_res(type, value, tol = 5, pitch = 0) { //! Through hole axial resistor body_d = ax_res_diameter(type); length = ax_res_length(type); h = end_d / 2; - $fn = 32; r = 0.3; colours = ["gold", "silver", "black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"]; + $fs = fs; $fa = fa; exp = floor(log(value) + eps); mult = exp - (len(str(value / pow(10, exp - 1))) > 2 ? 2 : 1); digits = str(value / pow(10, mult)); @@ -171,7 +174,7 @@ module ax_diode(type, value, pitch = 0) { //! Through hole axial diode. If `pitc body_r = size.y / 2; length = size.x; r = size.z; - $fn = 32; + $fs = fs; $fa = fa; orientate_axial(length, body_r, pitch, wire_d) { diff --git a/vitamins/ball_bearing.scad b/vitamins/ball_bearing.scad index eb86b0c..4ef8992 100644 --- a/vitamins/ball_bearing.scad +++ b/vitamins/ball_bearing.scad @@ -52,7 +52,7 @@ module ball_bearing(type) { //! Draw a ball bearing fw = bb_flange_width(type); color("silver") { - $fn = 360; + $fa = fa; $fa = fs; rotate_extrude() hull() { @@ -95,5 +95,6 @@ module ball_bearing(type) { //! Draw a ball bearing module bearing_ball(dia) { //! Draw a steel bearing ball vitamin(str(" bearing_ball(", dia, "): Steel ball ", dia, "mm")); + $fa = fa; $fa = fs; color("silver") sphere(d = dia); } diff --git a/vitamins/ball_bearings.scad b/vitamins/ball_bearings.scad index 1179b27..9e1596a 100644 --- a/vitamins/ball_bearings.scad +++ b/vitamins/ball_bearings.scad @@ -18,9 +18,11 @@ // -// name id od w colour or ir fd fw +// name id od w colour or ir fd fw BBSMR95 = ["SMR95", 5, 9, 2.5, "silver", 0.5, 0.7, 0, 0]; // SMR95 ball bearing for FlexDrive extruder BB624 = ["624", 4, 13, 5, "blue", 1.2, 1.2, 0, 0]; // 624 ball bearing for idlers +BB686 = ["686", 6, 13, 5, "silver", 0.9, 0.7, 0, 0]; +BB696 = ["696", 6, 16, 5, "silver", 1.8, 1.3, 0, 0]; BB608 = ["608", 8, 22, 7, "black", 1.4, 2.0, 0, 0]; // 608 bearings for wades BB6200 = ["6200", 10, 30, 9, "black", 2.3, 3.6, 0, 0]; // 6200 bearings for KP pillow blocks BB6201 = ["6201", 12, 32, 10, "black", 2.4, 3.7, 0, 0]; // 6201 bearings for KP pillow blocks @@ -34,6 +36,6 @@ BBF623 = ["F623", 3, 10, 4, "black", 0.6, 0.7, 11.5, 1]; BBF693 = ["F693", 3, 8, 3, "silver", 0.5, 0.7, 9.5, 0.7]; BBF695 = ["F695", 5, 13, 4, "silver", 1.0, 1.0, 15, 1]; -ball_bearings = [BBF693, BBF623, BBF695, BBMR63, BBMR83, BBMR93, BBSMR95, BB624, BB608, BB6200, BB6201, BB6808]; +ball_bearings = [BBF693, BBF623, BBF695, BBMR63, BBMR83, BBMR93, BBSMR95, BB624, BB686, BB696, BB608, BB6200, BB6201, BB6808]; use diff --git a/vitamins/battery.scad b/vitamins/battery.scad index 44bc58a..02d394b 100644 --- a/vitamins/battery.scad +++ b/vitamins/battery.scad @@ -58,6 +58,8 @@ module battery(type) { //! Draw a battery h = 2.65; t = 0.4; + $fa = fa; $fs = fs; + module D() { hull() { translate([-iw1 / 2, h - t - ih1]) diff --git a/vitamins/box_sections.scad b/vitamins/box_sections.scad index 616d435..d586e18 100644 --- a/vitamins/box_sections.scad +++ b/vitamins/box_sections.scad @@ -20,11 +20,12 @@ // // Box sections // -AL12x8x1 = ["AL12x8x1", "Aluminium rectangular box section 12mm x 8mm x 1mm", [12, 8], 1, 0.5, silver, undef]; -AL20x20x2 = ["AL20x20x2", "Aluminium rectangular box section 20mm x 20mm x 2mm", [20, 20], 2, 0.5, silver, undef]; -CF10x10x1 = ["CF10x10x1", "Carbon fiber rectangular box section 10mm x 10mm x 1mm", [10, 10], 1, 0.5, grey(35), grey(20)]; +CF10x10x1 = ["CF10x10x1", "Carbon fiber rectangular box section 10mm x 10mm x 1mm", [10, 10], 1, 0.5, grey(35), grey(20)]; +AL12x8x1 = ["AL12x8x1", "Aluminium rectangular box section 12mm x 8mm x 1mm", [12, 8], 1, 0.5, silver, undef]; +AL20x20x2 = ["AL20x20x2", "Aluminium rectangular box section 20mm x 20mm x 2mm", [20, 20], 2, 0.5, silver, undef]; +AL38p1x25p4x1p6 = ["AL38p1x25p4x1p6","Aluminium rectangular box section 38.1mm x 25.4mm x 1.6mm", [inch(1.5), inch(1)], 1.6, 0.5, silver, undef]; +AL50p8x38p1x3 = ["AL50p8x38p1x3", "Aluminium rectangular box section 50.8mm x 38.1mm x 3.0mm", [inch(2), inch(1.5)], 3.0, 0.5, silver, undef]; - -box_sections = [AL12x8x1, AL20x20x2, CF10x10x1]; +box_sections = [ CF10x10x1, AL12x8x1, AL20x20x2, AL38p1x25p4x1p6, AL50p8x38p1x3 ]; use diff --git a/vitamins/bulldog.scad b/vitamins/bulldog.scad index 0ded476..6a73c4e 100644 --- a/vitamins/bulldog.scad +++ b/vitamins/bulldog.scad @@ -57,6 +57,8 @@ module bulldog(type, open = 4) { //! Draw bulldog clip open by specified amount vitamin(str("bulldog(", type[0], "): Bulldog clip ",length, "mm")); + $fa = fa; $fs = fs; + color("yellow") translate([depth / 2 - thickness - eps, 0]) rotate([90, 0, 0]) diff --git a/vitamins/button.scad b/vitamins/button.scad index b8e9fc0..e8a5279 100644 --- a/vitamins/button.scad +++ b/vitamins/button.scad @@ -29,13 +29,14 @@ function square_button_wall(type) = type[3]; //! Offset of the metal pa function square_button_rivit(type) = type[4]; //! Size of the corner rivets function square_button_d(type) = type[5]; //! Button diameter function square_button_h(type) = type[6]; //! Height of the button above the PCB -function square_button_cap_flange_d(type) = type[7]; //! Diameter of the flange of the cap -function square_button_cap_d(type) = type[8]; //! Diameter of the body of the cap -function square_button_cap_h(type) = type[9]; //! Height of the cap including the stem -function square_button_cap_stem(type) = type[10]; //! Length of the cap stem -function square_button_cap_flange_h(type) = type[11]; //! Height of the cap flange +function square_button_ra_z(type) = type[7]; //! Height of button centre above the PCB for right_angle version +function square_button_cap_flange_d(type) = type[8]; //! Diameter of the flange of the cap +function square_button_cap_d(type) = type[9]; //! Diameter of the body of the cap +function square_button_cap_h(type) = type[10]; //! Height of the cap including the stem +function square_button_cap_stem(type) = type[11]; //! Length of the cap stem +function square_button_cap_flange_h(type) = type[12]; //! Height of the cap flange -module square_button(type, colour = "yellow") { //! Draw square button with specified cap colour if it has a cap +module square_button(type, colour = "yellow", right_angle = false) { //! Draw square button with specified cap colour if it has a cap w = square_button_width(type); flange_d = square_button_cap_flange_d(type); vitamin(str("square_button(", type[0], flange_d ? str(", \"", colour, "\"") : "", "): Square button ", w, "mm", @@ -45,30 +46,39 @@ module square_button(type, colour = "yellow") { //! Draw square button with spec rivit = square_button_rivit(type); pitch = (w/ 2 - wall - rivit * 0.75); stem = square_button_cap_stem(type); + ra_z = square_button_ra_z(type); - color(grey(20)) { - rounded_rectangle([w, w, h - 0.5], r = wall); + $fa = fa; $fs = fs; - for(x = [-1, 1], y = [-1, 1]) - translate([x * pitch, y * pitch]) - cylinder(d = rivit, h = h); + translate(right_angle ? [0, 0, ra_z] : [0, 0]) + rotate([right_angle ? -90 : 0, 0, 0]) { + color(grey(20)) { + rounded_rectangle([w, w, h - 0.5], r = wall); - cylinder(d = square_button_d(type), h = square_button_h(type)); - } + for(x = [-1, 1], y = [-1, 1]) + translate([x * pitch, y * pitch]) + cylinder(d = rivit, h = h); - color("silver") - translate_z(h - 0.5) - rounded_rectangle([w - 2 * wall, w - 2 * wall, 0.2], r = wall, center = true); + d = square_button_d(type); + bh = square_button_h(type) - h + 0.5; + translate_z(h - 0.5) + cylinder(d1 = d, d2 = bh > 1.5 ? d - 0.5 : d, h = bh); + } - if(flange_d) - translate_z(square_button_h(type)) - color(colour) rotate_extrude() { - square([square_button_d(type) / 2, stem]); + color("silver") + translate_z(h - 0.5) + rounded_rectangle([w - 2 * wall, w - 2 * wall, 0.2], r = wall, center = true); - translate([0, stem]) { - square([flange_d / 2, square_button_cap_flange_h(type)]); + if(flange_d) + translate_z(square_button_h(type)) + color(colour) rotate_extrude() { + square([square_button_d(type) / 2, stem]); - rounded_corner(r = square_button_cap_d(type) / 2, h = square_button_cap_h(type) - stem, r2 = 0.5); + translate([0, stem]) { + square([flange_d / 2, square_button_cap_flange_h(type)]); + + rounded_corner(r = square_button_cap_d(type) / 2, h = square_button_cap_h(type) - stem, r2 = 0.5); + } } - } + } } diff --git a/vitamins/buttons.scad b/vitamins/buttons.scad index e4f64ac..198953a 100644 --- a/vitamins/buttons.scad +++ b/vitamins/buttons.scad @@ -18,16 +18,17 @@ // // -// w h w r b b c c c c c -// i e a i u u a a a a a -// d i l v t t p p p p p -// t g l i -// h h t d h f d h s f -// d t h -button_12mm = ["button_12mm", 12, 4.0, 0.8, 1.5, 6.8, 4.3, 12.86, 11.44, 8.15, 2.7, 1.4]; -button_6mm = ["button_6mm", 6, 4.0, 0.2, 1.0, 3.5, 5.0, 0]; -button_4p5mm= ["button_4p5mm", 4.5, 3.1, 0.1, 0.9, 2.4, 4.5, 0]; +// w h w r b b r c c c c c +// i e a i u u a a a a a a +// d i l v t t p p p p p +// t g l i z +// h h t d h f d h s f +// d t h +button_12mm = ["button_12mm", 12, 4.0, 0.8, 1.5, 6.8, 4.3, 7, 12.86, 11.44, 8.15, 2.7, 1.4]; +button_6mm = ["button_6mm", 6, 4.0, 0.2, 1.0, 3.5, 5.0, 4.05, 0]; +button_6mm_7 = ["button_6mm_7", 6, 4.0, 0.2, 1.0, 3.5, 7.0, 4.05, 0]; +button_4p5mm = ["button_4p5mm", 4.5, 3.1, 0.1, 0.9, 2.4, 4.5, 3, 0]; -buttons = [button_4p5mm, button_6mm, button_12mm]; +buttons = [button_4p5mm, button_6mm, button_6mm_7, button_12mm]; use diff --git a/vitamins/circlip.scad b/vitamins/circlip.scad index 0177d6c..f577897 100644 --- a/vitamins/circlip.scad +++ b/vitamins/circlip.scad @@ -21,9 +21,9 @@ //! Circlips aka tapered retaining rings. // include <../utils/core/core.scad> -include <../utils/sector.scad> -include <../utils/round.scad> -include <../utils/maths.scad> +use <../utils/sector.scad> +use <../utils/round.scad> +use <../utils/maths.scad> function circlip_d1(type) = type[1]; //! Nominal OD, i.e. diameter of tube function circlip_d2(type) = type[2]; //! Groove diameter, i.e. OD when installed diff --git a/vitamins/component.scad b/vitamins/component.scad index 87e6bd8..f664238 100644 --- a/vitamins/component.scad +++ b/vitamins/component.scad @@ -29,6 +29,8 @@ include include use <../utils/rounded_cylinder.scad> use <../utils/dogbones.scad> +use <../utils/sweep.scad> +use <../utils/rounded_polygon.scad> function resistor_length(type) = type[2]; //! Body length function resistor_diameter(type) = type[3]; //! Body diameter @@ -45,6 +47,7 @@ module resistor(type) { //! Draw specified type of resistor length = resistor_length(type); dia = resistor_diameter(type); + $fa = fa; $fs = fs; vitamin(str("resistor(", type[0], "): ", type[1])); // // wires @@ -54,9 +57,9 @@ module resistor(type) { //! Draw specified type of resistor for(side= [-1,1]) translate([side * dia / 6, 0, length / 2]) rotate([0, splay_angle * side, 0]) - cylinder(r = resistor_wire_diameter(type) / 2, h = resistor_wire_length(type), center = false, $fn = 16); + cylinder(r = resistor_wire_diameter(type) / 2, h = resistor_wire_length(type), center = false, $fn = fn); else - cylinder(r = resistor_wire_diameter(type) / 2, h = length + 2 * resistor_wire_length(type), center = true, $fn = 16); + cylinder(r = resistor_wire_diameter(type) / 2, h = length + 2 * resistor_wire_length(type), center = true, $fn = fn); // // Sleeving // @@ -66,7 +69,7 @@ module resistor(type) { //! Draw specified type of resistor for(side= [-1, 1]) translate([side * resistor_diameter(type) / 6, 0, length / 2]) { rotate([0, splay_angle * side, 0]) - cylinder(r = resistor_wire_diameter(type) / 2 + 0.1, h = resistor_wire_length(type) - 5, center = false, $fn = 16); } + cylinder(r = resistor_wire_diameter(type) / 2 + 0.1, h = resistor_wire_length(type) - 5, center = false, $fn = fn); } // // Body // @@ -89,6 +92,8 @@ module sleeved_resistor(type, sleeving, bare = 5, heatshrink = false) { //! Draw resistor(type); sleeving_length = resistor_wire_length(type) - bare; + $fa = fa; $fs = fs; + for(side= [-1,1]) if(resistor_radial(type)) { translate([side * resistor_diameter(type) / 6, 0, 0]) @@ -146,6 +151,8 @@ module al_clad_resistor(type, value, leads = true) { //! Draw an aluminium clad body = al_clad_vpitch(type) - 2 * al_clad_clearance(type); + $fa = fa; $fs = fs; + color("silver") { rotate([90, 0, 90]) linear_extrude(length, center = true) @@ -223,6 +230,8 @@ module TO220(description, leads = 3, lead_length = 16) { //! Draw a TO220 packa vitamin(str("TO220(\"", description, "\"", arg(leads, 3, "leads"), "): ", description)); + $fa = fa; $fs = fs; + translate([0, -s.y + TO220_hole_y]) { color("silver") linear_extrude(TO220_thickness()) @@ -275,6 +284,8 @@ module TO247(description, lead_length = 20) { //! Draw a TO247 package, use `de vitamin(str("TO247(\"", description, "\"): ", description)); + $fa = fa; $fs = fs; + module body_shape() difference() { translate([-size.x / 2, 0]) @@ -330,6 +341,102 @@ module TO247(description, lead_length = 20) { //! Draw a TO247 package, use `de children(); } +module multiwatt11(part_no, tail = 3) { //! Draw a MULTIWATT11 package + A = 5; // Body thickness, name from datasheet + B = 2.65; // Lead offset from heatsink face + C = 1.6; // Metal tab thickness + D = 1; // Straight section of leads before bend + E = (0.49 + 0.55) / 2; // Lead thickness + F = (0.88 + 0.95) / 2; // Lead width + G = 1.7; // Lead pitch + H = 20; // Body width + L2 = (17.4 +18.1) / 2; // Height of hole above the PCB + L3 = 17.5; // Height from base to tab + L4 = 10.7; // height of plastic part + L7 = (2.65 + 2.9) / 2; // Distance of hole from the top + M = 4.3; // Back leads from heatsink + M1 = 5.08; // Back leass to front leads + S = (1.9 + 2.6) / 2; // Chamfer + Dia = (3.65 + 3.85) / 2;// Hole diameter + inset = 1; // Metal inset from plastic + draft = 7; // 7 degree body draft angle + leads = 11; // Number of leads + h = L2 + L7; // Total height above PCB + z = h - L3; // Height of base above PCB + dimple_d = 2.7; // Half round dimples in the sides + tab_h = L3 - L4; + tan = tan(draft); + lead_r = E; + rotate([90, 0, 0]) { + color(silver) { + linear_extrude(C) + union() { + translate([-H / 2 + inset, z + inset + 0.2]) + square([H - 2 * inset, L4]); + + difference() { + hull() { + translate([-H / 2, z + L4]) + square([H, tab_h - S]); + + translate([-H / 2 + S, z + L4]) + square([H - 2 * S, tab_h]); + } + translate([0, h - L7]) + circle(d = Dia); + } + } + $fs = fs; + $fa = fa; + M2 = M + M1; + front_path = [for(p = rounded_polygon([ + [-B, z, 0], + [-B - lead_r, z - D, lead_r], + [-M2 + lead_r, h - L7 - L2, -lead_r], + [-M2, h - L7 - L2 - tail, 0], + ])) [0, p.y, -p.x]]; + + back_path = [for(p = rounded_polygon([ + [-B, z, 0], + [-B - lead_r, z - D, lead_r], + [-M + lead_r, h - L7 - L2, -lead_r], + [-M, h - L7 - L2 - tail, 0], + ])) [0, p.y, -p.x]]; + profile = rectangle_points(F, E); + for(i = [0 : leads - 1]) + translate([(i - (leads - 1) / 2) * G, 0, -E / 2]) + sweep((i % 2) ? back_path : front_path, profile); + } + + color("dimgrey") + difference() { + s = B * tan; + s2 = (A - B) * tan; + hull() { + translate([-H / 2 - C * tan, z + s, eps]) + cube([H + 2 * C * tan, L4 - s, eps]); + + translate([-H / 2, z, B]) + cube([H, eps, eps]); + + translate([-H / 2 + s2, z + s2, A - eps]) + cube([H - 2 * s2, L4 - (A - C) * tan, eps]); + } + for(side = [-1,1]) + translate([side * (H / 2 + s2), z + 4.5, C - eps]) + cylinder(d = dimple_d, h = A - C + 2 * eps); + } + + color("white") + translate([0, z + L4 / 2, A]) + linear_extrude(eps) + resize([H * 0.7, 0], auto = true) + text(part_no, halign = "center", valign = "center"); + + + } +} + panel_USBA_pitch = 30; module panel_USBA_hole_positions() //! Place children at hole positions @@ -377,6 +484,8 @@ module panel_USBA() { //! Draw a panel mount USBA connector tongue_w = 10; tongue_t = 1.3; + $fa = fa; $fs = fs; + vflip() { color("dimgrey") { linear_extrude(thickness) @@ -491,6 +600,8 @@ module thermal_cutout(type) { //! Draw specified thermal cutout bl = tc_body_length(type); spade = spade6p4; + $fa = fa; $fs = fs; + color("silver") { linear_extrude(tc_thickness(type)) difference() { @@ -550,6 +661,8 @@ module fack2spm() { //! Draw a FACK2SPM Cat5E RJ45 shielded panel mount coupler tab1 = [4, 3]; tab2 = [6.3, 1.6]; + $fa = fa; $fs = fs; + module socket() translate([0, y_offset]) square([socket.x, socket.y], center = true); diff --git a/vitamins/d_connector.scad b/vitamins/d_connector.scad index e4771df..fa29ca8 100644 --- a/vitamins/d_connector.scad +++ b/vitamins/d_connector.scad @@ -86,6 +86,7 @@ module d_plug_D(length, width, rad) { //! D plug D shape module d_plug(type, socket = false, pcb = false, idc = false) { //! Draw specified D plug, which can be IDC, PCB or plain solder bucket hole_r = 3.05 / 2; dwall = 0.5; + $fa = fa; $fs = fs; flange_length = d_flange_length(type); d_length = d_lengths(type)[socket ? 1 : 0]; @@ -157,6 +158,7 @@ module d_plug(type, socket = false, pcb = false, idc = false) { //! Draw specifi // Pins // color("gold") { + $fn = fn; if(!socket) translate_z(-0.5) pin_positions() @@ -172,11 +174,11 @@ module d_plug(type, socket = false, pcb = false, idc = false) { //! Draw specifi rotate([0, 180, 0]) { linear_extrude(back_height + 1 + 4.5) pin_positions() - circle(r = 0.75 / 2, $fn = 12); + circle(r = 0.75 / 2); linear_extrude(back_height + 1 + 1) pin_positions() - circle(r = 0.75, $fn = 12); + circle(r = 0.75); } if(!pcb && !idc) diff --git a/vitamins/dip.scad b/vitamins/dip.scad index 432c336..e99bc41 100644 --- a/vitamins/dip.scad +++ b/vitamins/dip.scad @@ -92,6 +92,8 @@ module dil_socket(rows, w, pitch = inch(0.1)) { hole = [0.8, 0.5]; pin_l = 3; + $fa = fa; $fs = fs; + color(grey(20)) { linear_extrude(h) difference() { @@ -174,6 +176,8 @@ module pdip(pins, part, socketed, w = inch(0.3), pitch = inch(0.1)) { //! Draw s length = k * pitch + pitch / 2; width = w - pitch / 2; height = 3; + $fa = fa; $fs = fs; + if(socketed) dil_socket(n, w, pitch) dip(n, part, [length, width, height], w, pitch, pdip_pin); diff --git a/vitamins/display.scad b/vitamins/display.scad index cd76f38..f9e381b 100644 --- a/vitamins/display.scad +++ b/vitamins/display.scad @@ -76,6 +76,8 @@ module display(type) { //! Draw specified display aperture = display_aperture(type); ts = display_touch_screen(type); + $fa = fa; $fs = fs; + not_on_bom() { translate_z(display_ts_thickness(type)) { difference() { diff --git a/vitamins/displays.scad b/vitamins/displays.scad index 5c30760..6972a82 100644 --- a/vitamins/displays.scad +++ b/vitamins/displays.scad @@ -17,14 +17,16 @@ // If not, see . // -HDMI5PCB = ["", "", 121.11, 77.93, 1.65, 0, 2.2, 0, "mediumblue", false, [[4.6, 4.9], [4.6, -3.73], [97.69, -3.73], [97.69, 4.9]], - [[ 47.245,-2.5, 90, "usb_uA"], +HDMI5PCB = pcb("", "", [121.11, 77.93, 1.65], hole_d = 2.2, colour = "mediumblue", + holes = [[4.6, 4.9], [4.6, -3.73], [97.69, -3.73], [97.69, 4.9]], + components = [ + [ 47.245,-2.5, 90, "usb_uA"], [-53.14, -4.4, 90, "hdmi"], [ 53.7, 40.6, 0, "chip", 14, 14, 1], [ 59.8, 25.2, 0, "2p54socket", 13, 2, false, 13.71], [ 59.8, 10.12, 0, "2p54header", 13, 2, true], - ], - []]; + ] +); HDMI5 = ["HDMI5", "HDMI display 5\"", 121, 76, 2.85, HDMI5PCB, [0, 0, 1.9], // pcb offst @@ -34,10 +36,15 @@ HDMI5 = ["HDMI5", "HDMI display 5\"", 121, 76, 2.85, HDMI5PCB, [[-2.5, -39], [10.5, -33]], // clearance need for the ts ribbon ]; -LCD1602APCB = ["", "", 80, 36, 1.65, 0, 2.9, 5, "green", false, [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]], - [ [-27.05, - 2.5, 0, "2p54header", 16, 1] - ], - []]; +LCD1602APCB = pcb("", "", [80, 36, 1.65], hole_d = 2.9, land_d = 5, colour = "green", + holes = [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]], + components = [ + [-27.05, - 2.5, 0, "2p54header", 16, 1] + ], + grid = [ + 52.95 - inch(0.75), 36 - 2.5, 16, 1, silver, inch(0.1), inch(0.1), + ] +); LCD1602A = ["LCD1602A", "LCD display 1602A", 71.3, 24.3, 7.0, LCD1602APCB, [0, 0, 0], // pcb offst @@ -47,10 +54,13 @@ LCD1602A = ["LCD1602A", "LCD display 1602A", 71.3, 24.3, 7.0, LCD1602APCB, [], // clearance need for the ts ribbon ]; -LCDS7282BPCB = ["", "", 85, 36, 1.65, 0, 2.56, 0, "green", false, [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]], - [ [3.5, 18, 0, "2p54header", 2, 7] - ], - []]; +LCDS7282BPCB = pcb("", "", [85, 36, 1.65], hole_d = 2.56, colour = "green", + holes = [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]], + components = [ + [3.5, 18, 0, "2p54header", 2, 7] + ], + grid = [3.5 - inch(0.05), 18 - inch(0.3), 2, 7, silver, inch(0.1), inch(0.1)] +); LCDS7282B = ["LCDS7282B", "LCD display S-7282B", 73.6, 28.7, 9.6, LCDS7282BPCB, [-2.5, 0, 0], // pcb offset @@ -60,10 +70,11 @@ LCDS7282B = ["LCDS7282B", "LCD display S-7282B", 73.6, 28.7, 9.6, LCDS7282BPCB, [], // clearance need for the ts ribbon ]; -SSD1963_4p3PCB = ["", "", 120, 74, 1.65, 3, 3, 0, "mediumblue", false, [[3, 3], [-3, 3], [-3, -3], [3, -3]], - [ [2.75 + 1.27, 37, 90, "2p54header", 20, 2] - ], - []]; +SSD1963_4p3PCB = pcb("", "", [120, 74, 1.65], corner_r = 3, hole_d = 3, colour = "mediumblue", + holes = [[3, 3], [-3, 3], [-3, -3], [3, -3]], + components = [ [2.75 + 1.27, 37, 90, "2p54header", 20, 2] ], + grid = [2.75, 37 - inch(0.95), 2, 20, silver, inch(0.1), inch(0.1)] +); SSD1963_4p3 = ["SSD1963_4p3", "LCD display SSD1963 4.3\"", 105.5, 67.2, 3.4, SSD1963_4p3PCB, [0, 0, 0], @@ -73,10 +84,11 @@ SSD1963_4p3 = ["SSD1963_4p3", "LCD display SSD1963 4.3\"", 105.5, 67.2, 3.4, SSD [[0, -34.5], [12, -31.5]], ]; -TFT128x160PCB = ["", "", 56, 35, 1.2, 1, 2.0, 0, "mediumblue", false, [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]], - [ [2, 17.5, 0, "molex_hdr", 8] - ], - []]; +TFT128x160PCB = pcb("", "", [56, 35, 1.2], corner_r = 1, hole_d = 2.0, colour = "mediumblue", + holes = [[-2.5, -2.5], [-2.5, 2.5], [2.5, 2.5], [2.5, -2.5]], + components = [ [2, 17.5, 0, "molex_hdr", 8] ], + grid = [2, 17.5 - inch(0.35), 1, 8, silver, inch(0.1), inch(0.1)] +); TFT128x160 = ["TFT128x160", "LCD TFT ST7735 display 128x160", 46, 34, 2.1, TFT128x160PCB, [0, 0, 0], // pcb offset diff --git a/vitamins/e3d.scad b/vitamins/e3d.scad index 8cf414a..84da38c 100644 --- a/vitamins/e3d.scad +++ b/vitamins/e3d.scad @@ -159,6 +159,8 @@ module e3d_hot_end(type, filament, naked = false, resistor_wire_rotate = [0,0,0] vitamin(str("e3d_hot_end(", type[0], ", ", filament, "): Hot end ", hot_end_part(type), " ", filament, "mm")); + $fa = fa; $fs = fs; + translate_z(inset - insulator_length) color(hot_end_insulator_colour(type)) rotate_extrude() diff --git a/vitamins/faston.scad b/vitamins/faston.scad index 16e5001..259f3c2 100644 --- a/vitamins/faston.scad +++ b/vitamins/faston.scad @@ -60,7 +60,7 @@ module faston(type, closed = false) { //! Draw specified faston ic_p = faston_insul_crimp_p(type); ic_o = faston_insul_crimp_o(type); - $fn = 64; + $fa = fa; $fs = fs; // Receptical module reciptical_shape() for(side = [-1, 1]) mirror([side < 0 ? 1 : 0, 0]) { diff --git a/vitamins/gear_motor.scad b/vitamins/gear_motor.scad new file mode 100644 index 0000000..d9e447b --- /dev/null +++ b/vitamins/gear_motor.scad @@ -0,0 +1,161 @@ +// +// NopSCADlib Copyright Chris Palmer 2023 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// + +// +//! DC motors with a gearbox +// +include <../core.scad> +use <../utils/rounded_cylinder.scad> + +function gm_shaft(type) = type[1]; //! Shaft diameter, flat width, length, flat length. +function gm_boss(type) = type[2]; //! Motor boss diameter, corner radius, height and colour +function gm_shaft_offset(type) = type[3]; //! Offset of shaft from the centre of the gearbox +function gm_box(type) = type[4]; //! Size, corner radius, colour +function gm_screw(type) = type[5]; //! Screw type +function gm_screw_depth(type) = type[6]; //! Screw hole depth +function gm_screw_boss(type) = type[7]; //! Screw boss diameter and height +function gm_motor(type) = type[8]; //! Motor position, diameter, height, corner rad and colour +function gm_hub(type) = type[9]; //! Motor hub diameter, height, corner rad +function gm_motor_boss(type) = type[10]; //! Motor mounting boss on gearbox +function gm_tags(type) = type[11]; //! Tag size and pitch +function gm_holes(type) = type[12]; //! List of hole positions + +function gm_shaft_r(type) = gm_shaft(type).x / 2; //! Shaft radius +function gm_shaft_length(type) = gm_shaft(type).z; //! Length of the shaft +function gm_shaft_flat_w(type) = gm_shaft(type).y; //! Shaft width across the flat +function gm_shaft_flat_l(type) = gm_shaft(type)[3]; //! Length of the shaft flat section +function gm_motor_pos(type) = gm_motor(type)[0]; //! Motor position relative to centre of the gearbox +function gm_motor_d(type) = gm_motor(type)[1]; //! Motor diameter +function gm_depth(type) = gm_screw_boss(type)[1] + gm_box(type).z - gm_motor_pos(type).z + gm_motor(type).z + gm_tags(type).z; //! Motor total depth +function gm_shaft_pos(type) = let(o = gm_shaft_offset(type)) [o.x, o.y, -gm_screw_boss(type)[1] + gm_boss(type).z]; //! Shaft position +function gm_box_width(type) = let(b = gm_box(type)) b.y ? b.y : b.x; //! Gearbox width if rectangular or diameter if round + + +module gm_shaft_shape(type) { + shaft = gm_shaft(type); + r = shaft.x / 2; + difference() { + circle(r); + + translate([-r + shaft.y, -r - 1]) + square([shaft.x, 2 *(r + 1)]); + } +} + +module gm_screw_positions(type, skip = []) { + holes = gm_holes(type); + for(i = [0 : len(holes) - 1]) + if(!in(skip, i)) + translate(holes[i]) + children(); +} + +module gear_motor(type, alpha = 1) { //! Draw specified gear motor, can be partially transparent to see what is behind it + boss = gm_boss(type); + shaft = gm_shaft(type); + box = gm_box(type); + screw = gm_screw(type); + screw_depth = gm_screw_depth(type); + screw_boss = gm_screw_boss(type); + motor = gm_motor(type); + hub = gm_hub(type); + motor_boss = gm_motor_boss(type); + tags = gm_tags(type); + + $fa = fa; $fs = fs; + + module shaft_pos() + translate(gm_shaft_pos(type)) + children(); + + // Shaft + color(silver) { + shaft_pos() { + linear_extrude(shaft.z) + gm_shaft_shape(type); + + cylinder(d = shaft.x, h = shaft.z - shaft[3]); + } + } + // Shaft boss + color(boss[3]) + shaft_pos() + translate_z(-boss.z) + if(boss.y < 0) + hull() { + cylinder(d = boss.x, h = boss.z - boss.y); + + cylinder(r = boss.x / 2 - boss.y, h = boss.z); + } + else + rounded_cylinder(r = boss.x / 2, r2 = boss.y, h = boss.z); + + // Gearbox + color(box[4]) { + render() difference() { + translate_z(-box.z - screw_boss[1]) + union() { + if(box.y) + rounded_top_rectangle(box, box[3], box[3]); + else + rounded_cylinder(r = box.x / 2, h = box.z, r2 = box[3]); + + if(screw_boss.x) + gm_screw_positions(type) + cylinder(d = screw_boss.x, h = box.z + screw_boss[1]); + } + + gm_screw_positions(type) + cylinder(r = screw_radius(screw), h = screw_depth * 2, center = true); + } + if(motor_boss) + translate(motor[0] - [0, 0, box.z]) + rounded_cylinder(r = motor_boss.x / 2, h = motor_boss[1], r2 = motor_boss[2]); + } + // Motor + color(motor[4], alpha) + translate(motor[0] - [0, 0, motor.z + box.z]) { + rounded_cylinder(r = motor[1] / 2, h = motor.z, r2 = motor[3]); + + vflip() + rounded_cylinder(r = hub.x / 2, h = hub[1], r2 = hub[2]); + + } + + // Tags + color(brass) + for(side = [-1, 1]) + translate(motor[0] + [side * tags[3] / 2, 0, -box.z -motor.z]) + rotate([90, 0, 90]) + linear_extrude(tags.x, center = true) + difference() { + hull() { + square([tags.y, eps], center = true); + + translate([0, -tags.z + tags.y / 2]) + circle(d = tags.y); + } + r = tags.y / 4; + hull() + for(y = [-tags.z + 2 * r, - tags.z / 2]) + translate([0, y]) + circle(r); + } + +} diff --git a/vitamins/gear_motors.scad b/vitamins/gear_motors.scad new file mode 100644 index 0000000..2ef038d --- /dev/null +++ b/vitamins/gear_motors.scad @@ -0,0 +1,27 @@ +// +// NopSCADlib Copyright Chris Palmer 2023 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +// shaft shaft boss offset gearbox screw depth, screw boss motor hub motor boss tags +FIT0492_A = ["FIT0492_A", [6, 5.5, 14.7, 12], [12, -0.5, 6, grey(60)], [0, 7], [37, 0, 24.5, 0.6, grey(90)], M3_dome_screw, 10, [0, 0], [[0, 0, 0], 35.6, 32, 2, "#ECDCBB"], [10, 3, 1], [], [0.6, 2.8, 5.8, 23], + [for(a = [0 : 60 : 300]) 15.5 *[cos(a), sin(a)] ]]; // DF-ROBOT FIT0492-A Metal DC Geared Motor - 12V 50RPM +GMAG_404327 = ["GMAG_404327", [6, 4.0, 17.6, 15.8], [14.9, 1, 4.7, grey(20)], [5.85, 0], [36.4, 24.5, 26.7, 2, grey(20)], M3_dome_screw, 10, [5.9,0.5],[[2.3, -6.25, -5], 27.5, 38, 2, silver], [10, 3, 1], [27, 7, 1], [0.5, 2.8, 5.8, 23], + [for(x=[14.7, -13.8], y = [-1,1])[x, y * 8.75]]]; // Nidec Brushed Geared, 2.84 W, 24 V dc, 50 Ncm, 65 rpm + +gear_motors = [FIT0492_A, GMAG_404327]; + +use diff --git a/vitamins/geared_stepper.scad b/vitamins/geared_stepper.scad index 3f643ae..93c1ff1 100644 --- a/vitamins/geared_stepper.scad +++ b/vitamins/geared_stepper.scad @@ -65,6 +65,8 @@ module geared_stepper(type) { //! Draw the specified geared stepper bulge2 = gs_bulge2(type); wires = gs_wires(type); + $fa = fa; $fs = fs; + // Gearbox color(motor.y ? gearbox_colour : motor_colour) { difference() { diff --git a/vitamins/hygrometer.scad b/vitamins/hygrometer.scad index e445aff..614d891 100644 --- a/vitamins/hygrometer.scad +++ b/vitamins/hygrometer.scad @@ -51,6 +51,8 @@ function hygrometer_or() = flange_d / 2; //! The outside radius of a hygrometer module hygrometer() { //! Draw a hygrometer vitamin("hygrometer(): Mini LCD Digital Thermometer / Hygrometer"); + $fa = fa; $fs = fs; + explode(40) { color(grey(30)) rotate_extrude() diff --git a/vitamins/iec.scad b/vitamins/iec.scad index 71c54a0..e525436 100644 --- a/vitamins/iec.scad +++ b/vitamins/iec.scad @@ -21,6 +21,8 @@ //! IEC mains inlets and outlet. // include <../utils/core/core.scad> +use <../utils/rounded_cylinder.scad> + use use use @@ -36,7 +38,7 @@ function iec_body_h(type) = type[6]; //! Body height function iec_body_r(type) = type[7]; //! Body corner radius function iec_bezel_w(type) = type[8]; //! Bezel width function iec_bezel_h(type) = type[9]; //! Bezel height -function iec_bezel_r(type) = type[10]; //! Bezel corner radius +function iec_bezel_r(type) = type[10]; //! Bezel corner radius function iec_bezel_t(type) = type[11]; //! Bezel thickness function iec_flange_w(type) = type[12]; //! Flange width not including the lugs function iec_flange_h(type) = type[13]; //! Flange height @@ -46,6 +48,7 @@ function iec_width(type) = type[16]; //! Widest part including the lugs function iec_depth(type) = type[17]; //! Depth of the body below the flange function iec_spades(type) = type[18]; //! Spade type function iec_male(type) = type[19]; //! True for an outlet +function iec_can(type) = type[20]; //! If it has a can then the width, height, thickness and total width of the metal flange insert_screw_length = 10; function iec_insert_screw_length() = insert_screw_length; //! Screw length used for inserts @@ -78,6 +81,11 @@ module iec(type) { //! Draw specified IEC connector socket_r2 = 0.5; socket_offset = iec_bezel_h(type) / 2 - socket_h / 2 - (iec_bezel_w(type) - socket_w) / 2; + bw = iec_body_w(type); + bh = iec_body_h(type); + br = iec_body_r(type); + can = iec_can(type); + module socket_shape() hull() for(side = [-1, 1]) { @@ -114,12 +122,9 @@ module iec(type) { //! Draw specified IEC connector module body_shape() { hull() { - bw = iec_body_w(type); - bh = iec_body_h(type); - br = iec_body_r(type); bw2 = iec_body_w2(type); bh2 = bh - (bw - bw2); - br2 = 1; + br2 = can ? br : 1; for(side = [-1, 1]) { translate([side * (bw / 2 - br), -bh / 2 + br]) @@ -134,70 +139,112 @@ module iec(type) { //! Draw specified IEC connector } } - color(grey(20)) { - // Flange - flange_t = iec_flange_t(type); - linear_extrude(flange_t) - difference() { - hull() { - rounded_square([iec_flange_w(type), iec_flange_h(type)], iec_flange_r(type)); + translate_z(can ? can.z : 0) { + color(grey(20)) { + // Flange + flange_t = iec_flange_t(type); + linear_extrude(flange_t) + difference() { + hull() { + rounded_square([iec_flange_w(type), iec_flange_h(type)], iec_flange_r(type)); + + iec_screw_positions(type) + circle(d = iec_width(type) - iec_pitch(type)); + } + oriffice_shape(); iec_screw_positions(type) - circle(d = iec_width(type) - iec_pitch(type)); + circle(socket_r); } - oriffice_shape(); + head_r = screw_head_radius(iec_screw(type)); + screw_r = screw_clearance_radius(iec_screw(type)); + iec_screw_positions(type) + rotate_extrude() + difference() { + translate([screw_r, 0]) + square([socket_r - screw_r, flange_t]); - iec_screw_positions(type) - circle(socket_r); - } - head_r = screw_head_radius(iec_screw(type)); - screw_r = screw_clearance_radius(iec_screw(type)); - iec_screw_positions(type) - rotate_extrude() - difference() { - translate([screw_r, 0]) - square([socket_r - screw_r, flange_t]); + translate([0, flange_t - head_r]) + rotate(45) + square(10); + } + // Bezel + translate_z(iec_flange_t(type)) + linear_extrude(iec_bezel_t(type)) + difference() { + rounded_square([iec_bezel_w(type), iec_bezel_h(type)], iec_bezel_r(type)); - translate([0, flange_t - head_r]) - rotate(45) - square(10); - } - // Bezel - translate_z(iec_flange_t(type)) - linear_extrude(iec_bezel_t(type)) - difference() { - rounded_square([iec_bezel_w(type), iec_bezel_h(type)], iec_bezel_r(type)); + oriffice_shape(); + } - oriffice_shape(); - } + // Body + h = socket_d - iec_flange_t(type) - iec_bezel_t(type); + offset = can ? - can.z : 0; + translate_z(-h) + linear_extrude(h) + difference() { + offset(offset) + body_shape(); - // Body - h = socket_d - iec_flange_t(type) - iec_bezel_t(type); - translate_z(-h) - linear_extrude(h) - difference() { - body_shape(); - - oriffice_shape(); - } - // Back - translate_z(-iec_depth(type)) - linear_extrude(iec_depth(type) - h) - body_shape(); - } - if(!iec_male(type)) - translate([0, socket_offset, iec_flange_t(type) + iec_bezel_t(type) - socket_d]) { - translate([0, 2]) - pin(pin_h2); - - for(side = [-1, 1]) - translate([side * 7, -2]) - pin(pin_h1); + oriffice_shape(); + } + // Back + depth_offset = can ? br : 0; + translate_z(-iec_depth(type) + depth_offset) + linear_extrude(iec_depth(type) - h- depth_offset) + offset(offset) + body_shape(); } - for(spade = iec_spades(type)) - translate([spade[2], spade[3], -iec_depth(type)]) - rotate([180, 0, spade[4]]) - spade(spade[0], spade[1]); + // Can for filters + if(can) + color(silver) + hflip() { + linear_extrude(iec_depth(type) - br) + difference() { + body_shape(); + + offset(-can.z) + body_shape(); + } + + translate_z(iec_depth(type) - br) + rounded_top_rectangle([bw, bh, br], br, br - 1); + + linear_extrude(can.z) + difference() { + hull() { + rounded_square([can.x, can.y], iec_flange_r(type)); + + iec_screw_positions(type) + circle(d = can[3] - iec_pitch(type)); + } + offset(1) + oriffice_shape(); + + iec_screw_positions(type) + circle(socket_r); + } + } + + if(!iec_male(type)) + translate([0, socket_offset, iec_flange_t(type) + iec_bezel_t(type) - socket_d]) { + translate([0, 2]) + pin(pin_h2); + + for(side = [-1, 1]) + translate([side * 7, -2]) + pin(pin_h1); + } + for(spade = iec_spades(type)) + translate([spade[2], spade[3], -iec_depth(type)]) + rotate([180, 0, spade[4]]) { + spade(spade[0], spade[1]); + + if(can && spade[3] < 0) + color(grey(20)) + rounded_rectangle([10, 5.25, 2], 1); + } + } } function iec_spade_depth(type) = iec_depth(type) + max([for(spade = iec_spades(type)) spade[1]]); @@ -209,7 +256,7 @@ module iec_screw_positions(type) //! Position children at the screw holes children(); module iec_holes(type, h = 100, poly = false, horizontal = false, insert = false) { //! Drill the required panel holes - clearance = 0.2; + clearance = iec_can(type) ? 1 : 0.2; screw = iec_screw(type); insert_type = screw_insert(screw); insert_overlap = max(0, insert_screw_length + clearance - iec_flange_t(type) - insert_hole_length(insert_type)); diff --git a/vitamins/iecs.scad b/vitamins/iecs.scad index 0eefee0..d9b0490 100644 --- a/vitamins/iecs.scad +++ b/vitamins/iecs.scad @@ -36,10 +36,15 @@ inlet_spades = [[spade6p4, 9, -7, -5.5, 0], [spade6p4, 9, 7, -5.5, 0], [spade6p4, 9, 0, 5.5, 0]]; + atx_spades = [[spade3p5, 8, -7, -3, 90], [spade3p5, 8, 7, -3, 90], [spade3p5, 8, 0, 3, 90]]; +yunpen_spades = [[spade4p8, 8, -6, -3, 0], + [spade4p8, 8, 6, -3, 0], + [spade4p8, 8, 0, 5, 0]]; + outlet_spades = [[spade4p8ll, 8, -7, -2, 90], [spade4p8ll, 8, 7, -2, 90], [spade4p8ll, 8, 0, 2, 90]]; @@ -60,7 +65,8 @@ IEC_320_C14_switched_fused_inlet = ["IEC_320_C14_switched_fused_inlet", "IEC320 IEC_inlet = ["IEC_inlet", "IEC inlet", M3_cs_cap_screw, 40, 28, 18, 20, 3, 28, 20.5, 4, 2.5, 37, 23, 1, 2.5, 48, 14, inlet_spades, false ]; IEC_inlet_atx = ["IEC_inlet_atx", "IEC inlet for ATX", M3_cs_cap_screw, 40, 27, 18, 19, 3, 30.5, 22, 2, 2.0, 30.5, 22, 2, 4.0, 50, 15, atx_spades, false ]; IEC_inlet_atx2 = ["IEC_inlet_atx2", "IEC pressfit inlet for ATX", M3_cs_cap_screw, 0, 27, 18, 19, 3, 30.5, 22, 1, 0, 30.5, 22, 1, 4.0, 50, 15, atx_spades, false ]; // lugless +IEC_yunpen = ["IEC_yunpen", "IEC inlet filtered", M3_cs_cap_screw, 40, 29, 29, 21, 4, 30.2, 22, 3, 1.5, 29, 22.5,2,3.6, 50, 41, yunpen_spades, false, [32, 25, 0.8, 52] ]; // Canned filter IEC_outlet = ["IEC_outlet", "IEC outlet RS 811-7193", M3_cs_cap_screw, 40, 32, 18, 24, 3, 28, 20.5, 2, 0.0, 29, 29, 2, 2.8, 50, 23, outlet_spades, true ]; -iecs = [IEC_inlet_atx2, IEC_inlet, IEC_inlet_atx, IEC_fused_inlet, IEC_fused_inlet2, IEC_320_C14_switched_fused_inlet, IEC_outlet]; +iecs = [IEC_inlet_atx2, IEC_inlet, IEC_inlet_atx, IEC_yunpen, IEC_fused_inlet, IEC_fused_inlet2, IEC_320_C14_switched_fused_inlet, IEC_outlet]; use diff --git a/vitamins/jack.scad b/vitamins/jack.scad index 8ada475..d34c8cd 100644 --- a/vitamins/jack.scad +++ b/vitamins/jack.scad @@ -382,3 +382,132 @@ module post_4mm(colour, thickness, display_colour = false) { //! Draw a 4mm bind explode(5, true) washer() explode(5, true) nut(); } + +function power_jack_radius() = 9.8 / 2; //! Power jack socket flange radius + +power_jack_flat = 6.7; + +module power_jack_hole(h = 0, poly = false, center = true) + extrude_if(h, center = center) + intersection() { + if(poly) + poly_circle(4); + else + drill(4, 0); + + square([power_jack_flat, 8], center = true); + } + +module power_jack(thickness) { //! Draw a power jack socket with nut positioned for specified panel thickness + vitamin("power_jack(): Power jack socket"); + flange_r = power_jack_radius(); + flange_t = 3.3; + flange_ir = power_jack_flat / 2 - eps; + + thread = 8; + thread_d = 8; + thread_p = 0.75; + + barrel_ir = 5.6 / 2; + barrel_or = 8.9 / 2; + barrel_above = 0.7; + barrel_chamfer = 0.5; + barrel_h = 3; + + pin_r = 2 / 2; + pin_z = -2.3; + + nut_d = 10.8; + nut_t = 1.9; + + length = 17.7; + tag_w = 2; + tag_hole_r = 1.2 / 2; + tag_t1 = 0.4; + tag_t2 = 0.5; + tag_pitch = 5.64 - tag_t1 / 2 - tag_t2 / 2; + + colour = grey(20); + explode(length, offset = -length + flange_t) { + color(colour) { + tube(or = flange_r, ir = flange_ir, h = flange_t, center = false); + + r = (thread_d - (show_threads ? thread_p : 0)) / 2; + vflip() + linear_extrude(thread) + intersection() { + ring(or = r, ir = flange_ir); + + square([power_jack_flat, thread_d], center = true); + } + + translate_z(-thread) + linear_extrude(1) + intersection() { + circle(r); + + square([power_jack_flat, thread_d], center = true); + } + if(show_threads) render() + intersection() { + color(colour) + translate_z(-thread) + male_metric_thread(thread_d, thread_p, thread, false, solid = false); + + translate_z(-thread / 2) + cube([power_jack_flat, thread_d, thread], center = true); + } + } + + color(silver) { + translate_z(flange_t + barrel_above) { + rotate_extrude() + polygon([ + [barrel_ir, -barrel_h], + [barrel_ir, -barrel_chamfer], + [barrel_ir + barrel_chamfer, 0], + [barrel_or - barrel_chamfer, 0], + [barrel_or, -barrel_chamfer], + [barrel_or, -barrel_h], + ]); + + hull() { + translate_z(pin_z - pin_r) + sphere(pin_r); + + translate_z(-flange_t - barrel_above - thread + 1) + cylinder(r = pin_r, h = eps); + } + for(side = [-1, 1], offset = side > 0 ? 1 : 0) + translate([0, side * tag_pitch / 2, - length + tag_w / 2 + offset]) + rotate([90, 0, 0]) + linear_extrude(side > 0 ? tag_t2 : tag_t1, center = true) + difference() { + hull() { + circle(d = tag_w); + + translate([0, length - flange_t - thread - tag_w - offset]) + square([tag_w, eps], center = true); + } + circle(tag_hole_r); + } + + } + } + } + // Nut + translate_z(-thickness) + explode(-length) + vflip() { + color(silver) + linear_extrude(nut_t) + difference() { + circle(d = nut_d, $fn = 6); + + circle(d = thread_d); + } + + if(show_threads) + female_metric_thread(thread_d, thread_p, nut_t, false, colour = silver); + } +} diff --git a/vitamins/jhead.scad b/vitamins/jhead.scad index 45c85ae..d732d4f 100644 --- a/vitamins/jhead.scad +++ b/vitamins/jhead.scad @@ -132,6 +132,8 @@ module jhead_hot_end_assembly(type, filament, naked = false) { //! Assembly with tape_overlap = 10; tape_thickness = 0.8; + $fa = fa; $fs = fs; + jhead_hot_end(type, filament); vitamin(": Tape self amalgamating silicone 110mm x 25mm"); diff --git a/vitamins/led.scad b/vitamins/led.scad index a166e03..9a2ed43 100644 --- a/vitamins/led.scad +++ b/vitamins/led.scad @@ -30,32 +30,47 @@ function led_rim_t(type) = type[3]; //! Rim height function led_height(type) = type[4]; //! Body height function led_pitch(type) = type[5]; //! Lead pitch function led_lead_t(type) = type[6]; //! Lead thickness +function led_radius(type) = led_diameter(type) / 2; //! Radius -function led_hole_radius(type) = led_diameter(type) / 2; //! Radius of panel hole to accept LED +function led_hole_radius(type) = led_radius(type); //! Radius of panel hole to accept LED -module led(type, colour = "red", lead = 5) { //! Draw specified LED with desired colour and led length +module led(type, colour = "red", lead = 5, right_angle = 0) { //! Draw specified LED with desired colour and lead length d = led_diameter(type); vitamin(str("led(", type[0], arg(colour, "red"), "): LED ", d, " mm ", colour)); - color(colour) { - rotate_extrude() - rounded_corner(r = d / 2, h = led_height(type), r2 = d / 2); + rotate([right_angle ? 90 : 0, 0, 0]) + translate_z(right_angle ? right_angle - led_rim_t(type) : 0) + color(colour) { + rotate_extrude() + rounded_corner(r = d / 2, h = led_height(type), r2 = d / 2); - linear_extrude(led_rim_t(type)) - difference() { - circle(d = led_rim_dia(type)); + linear_extrude(led_rim_t(type)) + difference() { + circle(d = led_rim_dia(type)); - translate([d / 2 + eps, -5]) - square(10); + translate([d / 2 + eps, -5]) + square(10); + } } - } + t = led_lead_t(type); + len = lead - (right_angle ? t : 0); color("silver") - for(side = [-1, 1], len = lead - (lead < 3 ? 0 : side)) + for(side = [-1, 1]) translate([side * led_pitch(type) / 2, 0]) { vflip() - translate_z(len / 2) - cube([led_lead_t(type), led_lead_t(type), len], center = true); + translate_z(len / 2 + (right_angle ? t : 0)) + cube([t, t, len], center = true); + if(right_angle) { + translate([0, -right_angle / 2 - t]) + cube([t, right_angle, t], center = true); + + translate([0, -t, - t]) + rotate([0, -90, 0]) + rotate_extrude(angle = 90) + translate([t, 0]) + square(t, center = true); + } solder(); } } diff --git a/vitamins/mains_socket.scad b/vitamins/mains_socket.scad index 17882ed..032c6b5 100644 --- a/vitamins/mains_socket.scad +++ b/vitamins/mains_socket.scad @@ -24,16 +24,17 @@ include <../core.scad> include use -function mains_socket_width(type) = type[1]; //! Width at the base -function mains_socket_depth(type) = type[2]; //! Depth at the base -function mains_socket_top_w(type) = type[3]; //! Width at the top, might be tapered -function mains_socket_top_d(type) = type[4]; //! Depth at the top, might be tapered -function mains_socket_corner(type) = type[5]; //! Corner radius -function mains_socket_height(type) = type[6]; //! Height -function mains_socket_t(type) = type[7]; //! Plastic thickness -function mains_socket_offset(type) = type[8]; //! Offset of the socket from the centre -function mains_socket_pitch(type) = type[9]; //! Screw hole pitch -function mains_socket_screw(type) = M3_cs_cap_screw; //! Screw type +function mains_socket_width(type) = type[1]; //! Width at the base +function mains_socket_depth(type) = type[2]; //! Depth at the base +function mains_socket_top_w(type) = type[3]; //! Width at the top, might be tapered +function mains_socket_top_d(type) = type[4]; //! Depth at the top, might be tapered +function mains_socket_corner(type) = type[5]; //! Corner radius +function mains_socket_height(type) = type[6]; //! Height +function mains_socket_t(type) = type[7]; //! Plastic thickness +function mains_socket_offset(type) = type[8]; //! Offset of the socket from the centre +function mains_socket_pitch(type) = type[9]; //! Screw hole pitch +function mains_socket_counterbore(type) = type[10]; //! Screw counterbore +function mains_socket_screw(type) = M3_cs_cap_screw; //! Screw type earth = M3_ringterm; earth_screw = ringterm_screw(earth); @@ -56,7 +57,7 @@ module mains_socket_earth_position(type) { //! Position of earth terminal for D children(); } -module mains_socket_holes(type, h = 0) { //! Panel cutout +module mains_socket_holes(type, h = 0, earth = true, small = false) { //! Panel cutout mains_socket_hole_positions(type) drill(screw_clearance_radius(mains_socket_screw(type)), h); @@ -68,20 +69,26 @@ module mains_socket_holes(type, h = 0) { //! Panel cutout hull() for(x = [1, 2]) translate([side * mains_socket_pitch(type) / x, 0]) - circle(4.5); + if(small) + square([2 * 4.5, mains_socket_top_w(type)], true); + else + circle(4.5); - mains_socket_earth_position(type) - circle(d = washer_diameter(screw_washer(earth_screw)) + 2); + if(earth) + mains_socket_earth_position(type) + circle(d = washer_diameter(screw_washer(earth_screw)) + 2); } - mains_socket_earth_position(type) - drill(screw_clearance_radius(earth_screw), h); + if(earth) + mains_socket_earth_position(type) + drill(screw_clearance_radius(earth_screw), h); } module mains_socket(type) { //! Draw specified 13A socket offset = mains_socket_offset(type); screw = mains_socket_screw(type); height = mains_socket_height(type); + width = mains_socket_width(type); vitamin(str("mains_socket(", type[0], "): Mains socket 13A", offset.x || offset.y ? ", switched" : "")); @@ -91,7 +98,7 @@ module mains_socket(type) { //! Draw specified 13A socket face_plate(type); linear_extrude(height) - offset(-(mains_socket_width(type) - mains_socket_top_w(type)) / 2) + offset(-(width - mains_socket_top_w(type)) / 2) face_plate(type); } // Holes for pins @@ -110,13 +117,24 @@ module mains_socket(type) { //! Draw specified 13A socket face_plate(type); cube(50, center = true); + + cube([mains_socket_top_w(type), 13, 2 * height + 1], center = true); } // Screw holes mains_socket_hole_positions(type) { cylinder(r = screw_clearance_radius(screw), h = 100, center = true); - translate_z(height) + counter_bore = mains_socket_counterbore(type); + translate_z(height - counter_bore[0]) { screw_countersink(screw, drilled = false); + + if(counter_bore[1]) + cylinder(d = counter_bore[1], h = height); + + if(counter_bore[2]) + vflip() + cylinder(d = counter_bore[2], h = height); + } } } } diff --git a/vitamins/mains_sockets.scad b/vitamins/mains_sockets.scad index 07250a5..49f1594 100644 --- a/vitamins/mains_sockets.scad +++ b/vitamins/mains_sockets.scad @@ -21,9 +21,10 @@ //! UK 13A sockets at the moment. // -MKLOGIC = ["MKLOGIC", 86, 86, 86, 86, 3.6, 9, 3.6, [-9, -9], 60.3]; // Screwfix, switched -Contactum = ["Contactum", 84, 84, 80, 80, 4.0, 10.5, 3.6, [ 0, 0], 60.3]; // Old and unswitched +MKLOGIC = ["MKLOGIC", 86, 86, 86, 86, 3.6, 9, 3.6, [-9, -9], 60.3, [0, 0, 0]]; // Screwfix, switched +Contactum = ["Contactum", 84, 84, 80, 80, 4.0, 10.5, 3.6, [ 0, 0], 60.3, [0, 0, 0]]; // Old and unswitched +PMS9143A = ["PMS9143A", 85.75, 85.75, 85, 85, 1.5, 8.5, 3.0, [ 0, 0], 60.3, [3.3, 7, 5]]; // Screwfix Essential unswitched. -mains_sockets = [MKLOGIC, Contactum]; +mains_sockets = [MKLOGIC, Contactum, PMS9143A]; use diff --git a/vitamins/microswitch.scad b/vitamins/microswitch.scad index 28059ef..ffda560 100644 --- a/vitamins/microswitch.scad +++ b/vitamins/microswitch.scad @@ -85,7 +85,7 @@ module microswitch(type) { //! Draw specified microswitch translate(microswitch_button_pos(type) - [0, d / 2]) linear_extrude(microswitch_button_w(type), center = true) hull() { - circle(d = d); + circle(d = d, $fn = fn); translate([0, -3]) circle(d = d); diff --git a/vitamins/microswitches.scad b/vitamins/microswitches.scad index b8663eb..069c294 100644 --- a/vitamins/microswitches.scad +++ b/vitamins/microswitches.scad @@ -33,7 +33,7 @@ large_leg = [11.4, 0.8, 6.3, 1.8, [1.7, 0]]; // s a s w t p n e r c // n n o s l // s s r -small_microswitch = ["small_microswitch", "DM1-00P-110-3", 5.8, 6.5, 12.8, 0, 2, [[-3.25, -1.65], [3.25, -1.65]], 2.9, 1.2, [-1.95, 3.75], 0.2, 0.55, [[-5.08, -4.95], [0, -4.9], [5.08, -4.9] ], small_leg, grey(20), "white" ]; +small_microswitch = ["small_microswitch", "DM1-00P-110-3", 5.8, 6.5, 12.8, 0, 2, [[-3.25, -1.65], [3.25, -1.65]], 2.9, 1.2, [-1.95, 3.75], 0.2, 0.55, [[-5.08, -4.9], [0, -4.9], [5.08, -4.9] ], small_leg, grey(20), "white" ]; medium_microswitch = ["medium_microswitch","SS-01 or SS-5GL", 6.4, 10.2, 19.8, 1, 2.35, [[-4.8, -2.6 ], [4.7, -2.6 ]], 3.2, 2, [-2.8, 5.8 ], 0.5, 1.00, [[-8.05, -7.05], [0.75, -7.05], [8.05, -7.05] ], medium_leg, grey(20), "burlywood" ]; large_microswitch = ["large_microswitch", "Saia G3 low force", 10.4, 15.9, 28.0, 2, 3.1, [[-11.1, -5.15], [11.2, 5.15]], 4, 2.75,[-9.1, 9.55], 0.3, 1.2, [[19.7, 2.19], [19.7, -3.45], [8.3, -10.45] ], large_leg, "ivory", "white" ]; //G3M1T1PUL diff --git a/vitamins/nut.scad b/vitamins/nut.scad index 9513add..2e554b0 100644 --- a/vitamins/nut.scad +++ b/vitamins/nut.scad @@ -55,6 +55,8 @@ module nut(type, nyloc = false, brass = false, nylon = false) { //! Draw specifi vitamin(str("nut(", type[0], arg(nyloc, false, "nyloc"), arg(brass, false, "brass"), arg(nylon, false, "nylon"), "): Nut M", nut_size(type), " x ", thickness, "mm ", desc)); + $fs = fs; $fa = fa; + colour = brass ? brass_colour : nylon ? grey(30): grey(70); explode(nyloc ? 10 : 0) { color(colour) { diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index 0773457..c543985 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -43,6 +43,7 @@ use use use include +use function pcb_name(type) = type[1]; //! Description function pcb_length(type) = type[2]; //! Length @@ -61,6 +62,9 @@ function pcb_polygon(type) = type[14]; //! Optional outline polygon for odd function pcb_screw(type, cap = hs_cap) = Len(type[15]) ? type[15] : find_screw(cap, screw_smaller_than(pcb_hole_d(type))); //! Mounting screw type function pcb_size(type) = [pcb_length(type), pcb_width(type), pcb_thickness(type)]; //! Length, width and thickness in a vector +function pcb(name, desc, size, corner_r = 0, hole_d = 0, land_d = 0, colour = "green", parts_on_bom = false, holes = [], components = [], accessories = [], grid = undef, polygon = undef, screw = undef) = //! Constructor + [name, desc, size.x, size.y, size.z, corner_r, hole_d, land_d, colour, parts_on_bom, holes, components, accessories, grid, polygon, screw ]; + function pcb_component(type, name, index = 0) = //! Return the component specified by name and index [for(component = pcb_components(type)) if(component[3] == name) component][index]; @@ -897,7 +901,7 @@ module terminal_35(ways, colour = "blue") { //! Draw 3.5mm terminal block } translate_z(box_z - pin_l) - cylinder(d = pin_d, h = pin_l + box_z, $fn = 16); // pin + cylinder(d = pin_d, h = pin_l + box_z, $fn = fn); // pin solder(pin_d / 2); @@ -952,7 +956,7 @@ module molex_254(ways, right_angle = 0, skip = undef) { //! Draw molex KK header above = 9; pin_w = 0.64; r = 1; - a = right_angle ? depth / 2 - r - pin_w / 2 : above; + a = right_angle ? depth / 2 - r : above; ra_offset = 2.2; color("white") @@ -976,17 +980,27 @@ module molex_254(ways, right_angle = 0, skip = undef) { //! Draw molex KK header for(i = [0 : ways -1]) if(is_undef(skip) || !in(skip, i)) translate([0, i * pitch - width / 2 + pitch / 2]) { - translate_z((a + below) / 2 - below) - cube([pin_w, pin_w, a + below], center = true); + chamfer = pin_w / 2; + l1 = a + below; + translate_z(l1 / 2 - below) + hull() { + cube([pin_w, pin_w, l1 - 2 * chamfer], center = true); + + cube([pin_w - chamfer, pin_w - chamfer, l1], center = true); + } solder(); - l = above + ra_offset - r - pin_w / 2; + l = above + ra_offset - r; if(right_angle) { - translate([-l / 2 - r - pin_w / 2, 0, depth / 2]) - cube([l, pin_w, pin_w], center = true); + translate([-l / 2 - r, 0, depth / 2]) + hull() { + cube([l - 2 * chamfer, pin_w, pin_w], center = true); - translate([-r - pin_w / 2, 0, a]) + cube([l, pin_w - chamfer, pin_w - chamfer], center = true); + } + + translate([-r - pin_w / 2, 0, a - pin_w / 2]) rotate([90, 0, 0]) rotate_extrude(angle = 90) translate([r + pin_w / 2, 0]) @@ -1009,7 +1023,7 @@ module vero_pin(cropped = false) { //! Draw a vero pin color(silver) { translate_z(-l + above + collar_h) - cylinder(d = d, h = l, $fn = 32); + cylinder(d = d, h = l, $fn = fn); cylinder(d = collar_d, h = collar_h); @@ -1089,10 +1103,11 @@ module block(size, colour, makes_cutout, cutouts, r = 0, rtop = 0) //! Draw a co } else color(colour) - if(rtop) - let($fn = 32) rounded_top_rectangle(size, r, rtop); - else - rounded_rectangle(size, r); + let($fs = fs, $fa = fa) + if(rtop) + rounded_top_rectangle(size, r, rtop); + else + rounded_rectangle(size, r); module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb component from description function show(comp, part) = (comp[3] == part || comp[3] == str("-",part)) && (!cutouts || angle == undef || angle == comp.z); @@ -1131,6 +1146,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon if(show(comp, "block")) block(size = [comp[4], comp[5], comp[6]], colour = comp[7], makes_cutout = param(8), r = param(9, 0), rtop = param(10, 0)); if(!cutouts) { // Components that don't have a cutout parameter go in this section + if(show(comp, "button")) square_button(comp[4], param(6, "yellow"), param(5, false)); if(show(comp, "button_6mm")) square_button(button_6mm); if(show(comp, "button_4p5mm")) square_button(button_4p5mm); if(show(comp, "microswitch")) translate_z(microswitch_thickness(comp[4])/2) microswitch(comp[4]); @@ -1143,11 +1159,12 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon if(show(comp, "gterm635")) green_terminal(gt_6p35, comp[4], comp[5], param(6,"lime")); if(show(comp, "term35")) terminal_35(comp[4], param(5,"blue")); if(show(comp, "transition")) idc_transition(2p54header, comp[4], comp[5]); - if(show(comp, "led")) translate_z(eps) led(comp[4], comp[5], 2.6); + if(show(comp, "led")) let(z = param(6, 0)) translate_z(z + eps) led(comp[4], comp[5], 2.6 + z, param(7, 0)); if(show(comp, "pdip")) pdip(comp[4], comp[5], param(6, false), param(7, inch(0.3))); if(show(comp, "ax_res")) ax_res(comp[4], comp[5], param(6, 5), param(7, 0)); if(show(comp, "ax_diode")) ax_diode(type = comp[4], value = comp[5], pitch = param(6, 0)); if(show(comp, "rd_xtal")) rd_xtal(type = comp[4], value = param(5, undef), z = param(6, 0), pitch = param(7, undef)); // type, value, z, forced pitch + if(show(comp, "rd_electrolytic")) rd_electrolytic(type = comp[4], value = param(5, undef), z = param(6, 0), pitch = param(7, undef)); // type, value, z, forced pitch if(show(comp, "rd_disc")) rd_disc(type = comp[4], value = param(5, undef), z = param(6, 0), pitch = param(7, inch(0.2))); // type, value, z, forced pitch if(show(comp, "rd_module")) rd_module(type = comp[4], value = comp[5]); if(show(comp, "rd_transistor")) rd_transistor(type = comp[4], value = comp[5], lead_positions = param(6, undef), z = param(7, 5), kind = param(8,"Transistor")); @@ -1172,8 +1189,9 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon if(show(comp, "smd_qfp")) smd_qfp(comp[4], comp[5]); if(show(comp, "vero_pin")) vero_pin(param(4, false)); if(show(comp, "terminal")) terminal_block(comp[5], comp[4]); - if(show(comp, "text")) color("white") linear_extrude(eps) resize([comp[4], comp[5]]) text(comp[6], font = param(7, "Liberation Mono"), valign = "center", halign = "center"); - + if(show(comp, "multiwatt11")) multiwatt11(comp[4], param(5, 3)); + if(show(comp, "text")) color(param(8, "white")) + linear_extrude(0.04) resize([comp[4], comp[5]], auto = true) text(comp[6], font = param(7, "Liberation Mono"), valign = "center", halign = "center"); } } } @@ -1252,6 +1270,8 @@ module pcb(type) { //! Draw specified PCB w = pcb_width(type); l = pcb_length(type); + $fs = fs; $fa = fa; + module pcb_shape() if(Len(pcb_polygon(type))) polygon(pcb_polygon(type)); diff --git a/vitamins/pcbs.scad b/vitamins/pcbs.scad index 427614e..5948866 100644 --- a/vitamins/pcbs.scad +++ b/vitamins/pcbs.scad @@ -25,6 +25,7 @@ include include include <7_segments.scad> include +include // // l w t r h l c b h @@ -1052,34 +1053,119 @@ PanelDue_v3 = ["PanelDue_v3", "Panel Due v3.0a LCD Display interface", 53, 73, 1 // * battery and qwiik connectore just eyeballed Feather405 = let(size = [inch(2.0), inch(0.9)]) - ["Feather405", "Adafruit Feather 405", - size.x, size.y, 1.6, inch(0.10), - inch(0.1), inch(0.175), "green", false, - [[ inch(0.1), inch(0.1) ], // Holes +pcb("Feather405", "Adafruit Feather 405", [size.x, size.y, 1.6], + corner_r = inch(0.10), + hole_d = inch(0.1), + land_d = inch(0.175), + screw = M2p5_dome_screw, + holes = [ + [ inch(0.1), inch(0.1) ], [ -inch(0.1), inch(0.1) ], [ -inch(0.1), -inch(0.1) ], [ inch(0.1), -inch(0.1) ], - ], - [ - [size.x / 2, inch(0.05), 0, "-2p54header", 16, 1], - [inch(1.2), -inch(0.05), 0, "-2p54header", 12, 1], - [inch(1.3), size.y / 2, -90, "smd_qfp", QFP50P1200X1200X160_64N, "STM32F405"], - [ 3, size.y / 2, 180, "usb_C"], - [ 10, -6.5, 180, "jst_ph", 2, true, grey(25) ], - [ -5, 0.40 * size.y, 90, "jst_zh", 4, true, grey(30) ], - ], // components - [], // accessories - [inch(0.65), inch(0.05), 12, 2, gold, inch(0.1), inch(0.8), - inch(0.25), inch(0.05), 4, 1, gold, inch(0.1), 0 ], // grids of holes for the pins - [], // polygon - M2p5_dome_screw, -]; + ], + grid = [inch(0.65), inch(0.05), 12, 2, gold, inch(0.1), inch(0.8), + inch(0.25), inch(0.05), 4, 1, gold, inch(0.1), 0 ], // grids of holes for the pins + components = [ + [size.x / 2, inch(0.05), 0, "-2p54header", 16, 1], + [inch(1.2), -inch(0.05), 0, "-2p54header", 12, 1], + [inch(1.3), size.y / 2, -90, "smd_qfp", QFP50P1200X1200X160_64N, "STM32F405"], + [ 3, size.y / 2, 180, "usb_C"], + [ 10, -6.5, 180, "jst_ph", 2, true, grey(25) ], + [ -5, 0.40 * size.y, 90, "jst_zh", 4, true, grey(30) ], + ] +); -tiny_pcbs = [XIAO, MP1584EN, TP4056, ESP_01, LIPO_fuel_gauge]; +ESP_201 = let(size = [33.5, 25.5, 1.2], font = "Liberation Mono:style=Bold") +pcb("ESP_201", "ESP-201 ESP8266 WiFi module", size, colour = "white", + components = [ + for(side = [-1, 1]) [2 + inch(0.5), size.y / 2 + side * inch(0.45), 0, "-2p54joiner", 11, 1], + [2 + inch(1.1), size.y / 2, 90, "2p54header", 4, 1], + [-1.5, size.y / 2,-90, "text", 10, 1, "3.3V RX TX GND", font, "black"], + [2 + inch(0.5), -3, 0, "text", inch(1) + 2, 1, "3.3V 3.3V IO4 D3 D1 D0 CMD CLK D2 IO2 IO0", font, "black"], + [2 + inch(0.5), 3, 180, "text", inch(1) + 2, 1, "IO15 IO13 IO12 IO14 XPD CPEN RST TOUT IO5 GND GND", font, "black"], + [9.5, 13.5, 90, "smd_coax", U_FL_R_SMT_1], + [21, 18, 90, "smd_soic", SOIC8, ""], + [21, 9.7, 0, "chip", 5, 5, 0.8], + [-7, 9.7, 90, "smd_cap", CAP0603, 0.8], + [11.5, -5.5,180, "smd_res", RES0603, "301"], + [11.5, -7.0, 0, "smd_led", LED0603, "red"], + [14.5, -5.5,180, "smd_res", RES0603, "301"], + [14.5, -7.0, 0, "smd_led", LED0603, "blue"], + [14.5, -8.5, 0, "smd_cap", CAP0603, 0.6], + [15.5, 11, 0, "smd_cap", CAP0603, 0.6], + [15.5, 9, 180, "smd_res", RES0603, "123"], + [11.5, 7.8, 0, "smd_cap", CAP0603, 0.6], + [9.5, 8.7, 90, "smd_res", RES0603, "0"], + [15, 14, 0, "block", 3, 2.5, 0.6, silver, false, 0.2], + [15, 14, 0, "block", 3.1, 2.6, 0.5, gold, false, 0.195], + [15, 14, 0, "block", 3.11, 2.61, 0.3, "black",false, 0.195], + // Antenna + let(o = 5, x = [0.9 + o, 3.2 + o, 5.7 + o, 8.1 + o, 10.6 + o, 12.8 + o, 15 + o, 15.2 + o], c = "black") + each [ + for(i = [0, 5,6,7]) [2.8, -x[i], 0, "block", 4.8, 0.6, 0.2, c], // long verticals + for(i = [1: 4]) [2.05, -x[i], 0, "block", 3.3, 0.6, 0.2, c], // short verticals + for(i = [0, 2, 4,5]) [0.7, -(x[i] + x[i + 1]) / 2,0, "block", 0.6, x[i + 1] - x[i], 0.2, c], // top horizontals + for(i = [1, 3]) [3.4, -(x[i] + x[i + 1]) / 2,0, "block", 0.6, x[i + 1] - x[i], 0.2, c], // lower horizontals + ] + ], + grid = [2, size.y / 2 - inch(0.45), 11, 2, silver, inch(0.1), inch(0.9), + 2 + inch(1.1), size.y / 2 - inch(0.15), 1, 4, silver, inch(0.1), inch(0.1)] +); + +ESP_12F = pcb("ESP_12F", "ESP-12F ESP8266 WiFi module", [24, 16, 0.8], + colour = grey(25), + hole_d = 0.6, + land_d = [1, 1, 0, gold], + holes = [ + for(x = [0 : 7], y = [-1, 1]) + each[ + [1.5 + x * 2, 8 + y * 7], // Inboard hole positions + [1.5 + x * 2, 8 + y * 8] // Outboard half holes + ], + for(y = [0 : 5]) [0, 3 + y * 2] // Along the bottom edge + ], + components = [ + [1.3 + 7.5, 8, 0, "block", 15, 12, 2.3, silver, false, 0.1, 0.1], // can + [1.3 + 7.5, 8, 0, "block", 15.5, 12.5, 0.2, silver * 1.2, false], // pcb track it is solder on + [-6.4, 1.7, 90, "smd_led", LED0603, "blue"], + // Antenna + let(o = 0, x = [0.9 + o, 3.2 + o, 5.7 + o, 8.1 + o, 10.6 + o, 12.8 + o, 15 + o, 15.2 + o], c = gold) + each [ + for(i = [0, 5,6,7]) [-2.8, x[i], 0, "block", 4.8, 0.6, 0.2, c], // long verticals + for(i = [1: 4]) [-2.05, x[i], 0, "block", 3.3, 0.6, 0.2, c], // short verticals + for(i = [0, 2, 4,5]) [-0.7, (x[i] + x[i + 1]) / 2,0, "block", 0.6, x[i + 1] - x[i], 0.2, c], // top horizontals + for(i = [1, 3]) [-3.4, (x[i] + x[i + 1]) / 2,0, "block", 0.6, x[i + 1] - x[i], 0.2, c], // lower horizontals + ] + ] +); + + +tiny_buck = pcb("tiny_buck", "Ultra Small 3A buck regulator", [20, 11, 1.6], + hole_d = 1.2, + land_d = [2, 2], + holes = [for(i = [0: 3]) [1.5, 11 / 2 - inch(0.15 - i / 10)]], + components = [ + [4.5, 2.5, 90, "smd_cap", CAP1210, 2], + [4.5, -2.8, 90, "smd_cap", CAP1210, 2], + [10, -4.4, 90, "smd_inductor", IND2525, "4R7"], + for(i = [0 : 5]) [6.5 + i * 1.6, 1.5, 90, "smd_res", RES0603], + [17.8, 2, 90, "smd_pot", TC33X1], + for(i = [0 : 2]) [-1.5, -1.5 - i * 1.6, 0, "smd_res", RES0603], + [-1.5, -6.3, 0, "smd_cap", CAP0603, 0.8], + [-5, -1.5, 0, "smd_res", RES0603], + [-5.5, 5.5, 0, "smd_cap", CAP0603, 0.8], + [-5.5, 4.0, 0, "smd_res", RES0603], + [-4.8, -3.5, 90, "smd_soic", TSOT23_8, "DKAAD"], + for(i = [0: 3]) [4, 11 / 2 - inch(0.15 - i / 10), 0, "-text", 2.5, 1, ["VO+", "GND", "IN+", "+EN"][i], undef, silver], + ] +); + +tiny_pcbs = [ESP_201, ESP_12F, XIAO, MP1584EN, ESP_01, tiny_buck, LIPO_fuel_gauge]; big_pcbs = [BTT_RELAY_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_E3_TURBO, BTT_SKR_V1_4_TURBO, DuetE, Duex5]; -pcbs = [RAMPSEndstop, MT3608, KY_040, L9110S, ZC_A0591, ArduinoNano, Feather405, RPI_Pico, ESP32_DOIT_V1, RPI0, EnviroPlus, ArduinoUno3, ArduinoLeonardo, WD2002SJ, OPZ2, PanelDue_v3, RPI3A, RPI3, RPI4]; +pcbs = [KY_040, TP4056, L9110S, ZC_A0591, RAMPSEndstop, MT3608, ArduinoNano, Feather405, RPI_Pico, ESP32_DOIT_V1, RPI0, EnviroPlus, ArduinoUno3, ArduinoLeonardo, WD2002SJ, OPZ2, PanelDue_v3, RPI3A, RPI3, RPI4]; pcbs_not_shown = [Melzi, Duex2, PSU12V1A, Keyes5p1, PI_IO, ExtruderPCB]; diff --git a/vitamins/pillar.scad b/vitamins/pillar.scad index 5b8ed34..c6c6961 100644 --- a/vitamins/pillar.scad +++ b/vitamins/pillar.scad @@ -49,6 +49,8 @@ module pillar(type) { //! Draw specified pillar vitamin(str("pillar(", type[0], "): Pillar ", pillar_name(type), " ", sex, " M", thread_d, "x", height)); + $fa = fa; $fs = fs; + if(bot_thread_l > 0) translate_z(-bot_thread_l + eps) if(show_threads) diff --git a/vitamins/pillow_block.scad b/vitamins/pillow_block.scad index 9798bff..4e7c632 100644 --- a/vitamins/pillow_block.scad +++ b/vitamins/pillow_block.scad @@ -50,6 +50,7 @@ module kp_pillow_block(type) { //! Draw the KP pillow block b = type[11]; bolthole_radius = type[12]; + $fa = fa; $fs = fs; color(kp_pillow_block_colour) translate([0, -H, 0]) { fillet = 1; diff --git a/vitamins/pin_header.scad b/vitamins/pin_header.scad index fbd39a8..81366b4 100644 --- a/vitamins/pin_header.scad +++ b/vitamins/pin_header.scad @@ -99,7 +99,7 @@ module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cu translate([pin.x, pin.y - w / 2, pin.z - w / 2]) rotate([0, -90, 0]) color(hdr_pin_colour(type)) - rotate_extrude(angle = 90, $fn = 32) + rotate_extrude(angle = 90, $fn = fn) translate([0, -w / 2]) square(w); } @@ -165,7 +165,7 @@ module box_header(type, cols = 1, rows = 1, smt = false, cutout = false, right_a translate([pin.x, pin.y + pw / 2, pin.z - pw / 2]) rotate([0, -90, 180]) color(hdr_pin_colour(type)) - rotate_extrude(angle = 90, $fn = 32) + rotate_extrude(angle = 90, $fn = fn) translate([0, -pw / 2]) square(pw); } @@ -271,7 +271,7 @@ module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt color(hdr_pin_colour(type)) translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2) - w / 2, pitch * (y - (rows - 1) / 2) + width / 2 - w / 2]) rotate([0, -90, 0]) - rotate_extrude(angle = 90, $fn = 32) + rotate_extrude(angle = 90, $fn = fn) translate([0, -w / 2]) square(w); } @@ -369,7 +369,7 @@ module jst_xh_header(type, pin_count, right_angle = false, colour = false, pin_c color(pin_colour) translate([0, -pinWidth / 2, ra_z - pinWidth / 2 + y_offset]) rotate([0, -90, 0]) - rotate_extrude(angle = 90, $fn = 32) + rotate_extrude(angle = 90, $fn = fn) translate([0, -pinWidth / 2]) square(pinWidth); diff --git a/vitamins/pin_headers.scad b/vitamins/pin_headers.scad index da1e228..6d1cd19 100644 --- a/vitamins/pin_headers.scad +++ b/vitamins/pin_headers.scad @@ -25,10 +25,10 @@ // c h z o // f 2p54header = ["2p54header", 2.54, 11.6, 3.2, 0.66, gold, grey(20), 8.5, [0, 0, 8.7], 2.4, 0, 0, 0 ]; -2p54joiner = ["2p54joiner", 2.54, 6.86, 2.5, 0.66, gold, grey(20), 8.5, [0, 0, 8.7], 2.4, 0, 0, 0 ]; // Cropped pins for joining PCBs +2p54joiner = ["2p54joiner", 2.54, 7.5, 2.5, 0.66, gold, grey(20), 8.5, [0, 0, 8.7], 2.4, 0, 0, 0 ]; // Cropped pins for joining PCBs jst_xh_header = ["jst_xh_header",2.5, 10, 3.4, 0.64, gold, "white", 0, [4.9, 5.75, 7], 0.8, 0.525, 0.6, 6.1]; -jst_ph_header = ["jst_ph_header",2.0, 9, 3.4, 0.64, silver, "white", 0, [3.9, 4.5, 6], 0.6, 0.55, 0.25, 4.8]; +jst_ph_header = ["jst_ph_header",2.0, 9, 3.4, 0.64, silver, "white", 0, [3.9, 4.5, 6], 0.5, 0.55, 0.25, 4.8]; jst_zh_header = ["jst_zh_header",1.5, 7.4, 3.4, 0.5 , silver, "white", 0, [3.0, 3.5,4.5], 0.5, 0.45, 0.25, 3.7]; pin_headers = [ 2p54header ]; diff --git a/vitamins/potentiometer.scad b/vitamins/potentiometer.scad index 9e483d1..8554cad 100644 --- a/vitamins/potentiometer.scad +++ b/vitamins/potentiometer.scad @@ -99,6 +99,8 @@ module potentiometer(type, thickness = 3, shaft_length = undef, value = false) { shaft = pot_shaft(type); vitamin(str("potentiometer(", type[0], "): ", slice(type[0], start = -8) != "_encoder" ? "Potentiometer " : "", value ? value : type[0])); + $fa = fa; $fs = fs; + color(dia_cast_colour) { // Boss if(bh) diff --git a/vitamins/psu.scad b/vitamins/psu.scad index b022d62..3083667 100644 --- a/vitamins/psu.scad +++ b/vitamins/psu.scad @@ -103,6 +103,8 @@ module psu(type) { //! Draw a power supply faces = psu_faces(type); left = psu_left_bay(type); right = psu_right_bay(type); + $fa = fa; $fs = fs; + if(len(faces) < 2) translate_z(h / 2) color("silver") cube([l, w, h], center = true); diff --git a/vitamins/pulley.scad b/vitamins/pulley.scad index 002d618..fb0abea 100644 --- a/vitamins/pulley.scad +++ b/vitamins/pulley.scad @@ -68,9 +68,10 @@ module pulley(type, colour = silver) { //! Draw a pulley, any children are place or = od / 2; ir = pulley_ir(type); + $fa = fa; $fs = fs; module core() { translate_z(pulley_hub_length(type) + ft) - linear_extrude(w) let($fa = 1, $fs = 0.1) + linear_extrude(w) difference() { circle(or); diff --git a/vitamins/radial.scad b/vitamins/radial.scad index bd209de..ac26ae5 100644 --- a/vitamins/radial.scad +++ b/vitamins/radial.scad @@ -24,6 +24,7 @@ include <../utils/core/core.scad> use <../utils/sweep.scad> use <../utils/rounded_polygon.scad> use <../utils/rounded_cylinder.scad> +use <../utils/round.scad> use <../utils/pcb_utils.scad> use <../utils/bezier.scad> @@ -44,7 +45,8 @@ module lead_positions(p, z) { } module radial_lead(start, end, z, tail, lead) { - profile = is_list(lead) ? rectangle_points(lead.x , lead.y) : let($fn = 16) circle_points(lead / 2); + $fn = fn; + profile = is_list(lead) ? rectangle_points(lead.x , lead.y) : circle_points(lead / 2); color(silver) if(start == end) translate([start.x, start.y, -tail]) @@ -66,25 +68,24 @@ module radial_lead(start, end, z, tail, lead) { module radial_leads(ap, p, z, d, tail) color(silver) { - let($fn = 16) { - lead_positions(p, 0) - solder(d / 2); + $fn = fn; + lead_positions(p, 0) + solder(d / 2); - if(p != ap) { - assert(!is_list(p), "Bending four leads not supported yet"); - dz = d; - dx = p / 2 - ap / 2; - path = [[0, z, 0], [0, z - dz, 0], [dx, dz, 0], [dx, 0, 0]]; - rpath = concat(bezier_path(path, 20), [[dx, -tail, 0]]); - lead_positions(ap, 0) - rotate([90, 0, 90 * -$x + 90]) - sweep(rpath, circle_points(d / 2)); - } - else - lead_positions(p, -tail) - rotate(90) - cylinder(d = d, h = tail + z); + if(p != ap) { + assert(!is_list(p), "Bending four leads not supported yet"); + dz = d; + dx = p / 2 - ap / 2; + path = [[0, z, 0], [0, z - dz, 0], [dx, dz, 0], [dx, 0, 0]]; + rpath = concat(bezier_path(path, 20), [[dx, -tail, 0]]); + lead_positions(ap, 0) + rotate([90, 0, 90 * -$x + 90]) + sweep(rpath, circle_points(d / 2)); } + else + lead_positions(p, -tail) + rotate(90) + cylinder(d = d, h = tail + z); } module rd_xtal(type, value, z = 0, pitch = undef, tail = 3) { //! Draw a crystal @@ -97,18 +98,17 @@ module rd_xtal(type, value, z = 0, pitch = undef, tail = 3) { //! Draw a crystal d = rd_xtal_lead_d(type); r2 = 0.2; + $fs = fs; $fa = fa; color(silver) { translate_z(z) { if(s.y) { - $fn = 32; rounded_rectangle([s.x, s.y, s.z - r2], r); translate_z(s.z - r2) rounded_top_rectangle([s.x, s.y, r2], r, r2); } else - let($fn = 32) - rounded_cylinder(r = s.x / 2, h = s.z, r2 = r2); + rounded_cylinder(r = s.x / 2, h = s.z, r2 = r2); if(f) { rounded_rectangle([s.x + 2 * f.x, s.y + 2 * f.x, f[1]], r + f.x); @@ -154,32 +154,21 @@ function rd_module_pin_posns(type) = type[6]; //! list of pin positions module rd_module(type, value) { //! Draw a PCB mounted potted module, e.g. PSU or relay vitamin(str("rd_module(", type[0], ", \"", value, "\"): ", rd_module_kind(type), " ", type[0], " / ", value)); + $fs = fs; $fa = fa; r = rd_module_radius(type); size = rd_module_size(type); pin = rd_module_pin_size(type); color(rd_module_colour(type)) - hull() { - rounded_rectangle([size.x, size.y, eps], r); - c = [size.x / 2 - r, size.y / 2 - r, size.z - r]; - - translate(c) - sphere(r); - - translate([-c.x, c.y, c.z]) - sphere(r); - - translate([c.x, -c.y, c.z]) - sphere(r); - - translate([-c.x, -c.y, c.z]) - sphere(r); - } + rounded_top_rectangle(size, r, r); color(silver) for(pos = rd_module_pin_posns(type)) translate(pos) { translate_z(-pin.z / 2) - cube(pin, center = true); + if(pin.y) + cube(pin, center = true); + else + cylinder(d = pin.x, h = pin.z, center = true); solder(); } @@ -214,6 +203,7 @@ module rd_disc(type, value, pitch = undef, z = 0, tail = 3) { //! Draw a radial pitch = is_undef(pitch) ? opitch : pitch; lead_d = rd_disc_lead_d(type); + $fs = fs; $fa = fa; lead_positions = [for(side = [-1,1]) [-side * opitch.x / 2, side * opitch.y / 2]]; r = size / 2; @@ -233,7 +223,7 @@ module rd_disc(type, value, pitch = undef, z = 0, tail = 3) { //! Draw a radial r = lead_d[1] / 2; rl = lead_d[0] / 2; h = size.z - size.x / 2; - for(p = lead_positions, $fn = 16) + for(p = lead_positions) translate([p.x, p.y, z + r]) { dy = (size.y / 2 - r - 0.1) * sign(-p.x); @@ -269,6 +259,7 @@ module rd_transistor(type, value, kind = "Transistor", lead_positions = undef, z size = rd_transistor_size(type); colours = rd_transistor_colours(type); + $fs = fs; $fa = fa; translate_z(z) { if(type[0] == "TO92") { color(colours[0]) @@ -322,3 +313,83 @@ module rd_transistor(type, value, kind = "Transistor", lead_positions = undef, z radial_lead(start, end, z, tail, lead); } } + +function rd_electrolytic_size(type) = type[1]; //! Diameter, crimp diameter, height +function rd_electrolytic_radius(type) = type[2]; //! Corner radius +function rd_electrolytic_crimp(type) = type[3]; //! Width and height of crimp +function rd_electrolytic_lead_d(type) = type[4]; //! Lead diameter +function rd_electrolytic_pitch(type) = type[5]; //! Lead pitch +function rd_electrolytic_colours(type) = type[6]; //! Colour of jacket and stripe + +module rd_electrolytic(type, value, pitch = undef, z = 0, tail = 3) { //! Draw a radial electrolytic capcacitor + vitamin(str("rd_electrolytic(", type[0], ", \"", value, "\"): Electolytic capacitor ", type[0], " ", value)); + + size = rd_electrolytic_size(type); + crimp = rd_electrolytic_crimp(type); + colours = rd_electrolytic_colours(type); + opitch = rd_electrolytic_pitch(type); + pitch = is_undef(pitch) ? opitch : pitch; + lead_d = rd_electrolytic_lead_d(type); + jacket_t = 0.2; + jacket_ir = size.x * 5 / 16; + cross = 0.2 / sqrt(2); + + $fs = fs; $fa = fa; + radial_leads(opitch, pitch, z + jacket_t, lead_d, tail); + + x = (size.x - size.y) / 2; + h = crimp[0] / 2; + r = (h / x - x) / 2; + + stripe_angle = 50; + + module profile() + difference() { + round(rd_electrolytic_radius(type)) + difference() { + square([size.x / 2, size.z]); + + translate([size.x / 2 - x + r, crimp.y]) + circle(r); + } + + square([jacket_ir, size.z]); + } + + translate_z(z) { + color(colours[0]) + rotate(stripe_angle / 2) + rotate_extrude(angle = 360 - stripe_angle) + profile(); + + color(colours[1]) { + rotate(-stripe_angle / 2) + rotate_extrude(angle = stripe_angle) + profile(); + + z0 = crimp.y + crimp.x / 2; + translate_z((size.z + z0) / 2) + cylindrical_wrap(size.x / 2) + rotate(-90) + resize([(size.z - z0) * 0.9, 0], auto = true) + text(value, halign = "center", valign = "center"); + + } + + color(silver) + translate_z(size.z - 1) + render() difference() { + cylinder(r = jacket_ir, h = 1 - jacket_t); + + translate_z(1 - jacket_t) + for(a = [0, 90]) + rotate([45, 0, a]) + cube([size.x, cross, cross], center = true); + + } + + color(grey(30)) + translate_z(jacket_t) + cylinder(r = jacket_ir, h = eps); + } +} diff --git a/vitamins/radials.scad b/vitamins/radials.scad index 336019e..f01b498 100644 --- a/vitamins/radials.scad +++ b/vitamins/radials.scad @@ -25,16 +25,17 @@ HC49 = ["HC49", [10.5, 3.7, 13.5], [0.475, 0.6], 4.88, 0.45]; HC49_4H = ["HC49_4H", [10.5, 3.7, 3.5], [0.475, 0.6], 4.88, 0.43]; C_002RX = ["C_002RX", [ 2.0, 0, 6], false, 0.7, 0.2]; -ACT1700 = ["ACT1700", [10.8, 10.8, 5.3, 1], [1, 0.6], [ inch(0.3), inch(0.3)], 0.45 ]; -ACT1100 = ["ACT1100", [20.4, 10.8, 5.3, 1], [1, 0.6], [ inch(0.6), inch(0.3)], 0.45 ]; +ACT1700 = ["ACT1700", [10.8, 10.8, 5.3, 1], [1, 0.6], inch([0.3, 0.3]), 0.45 ]; +ACT1100 = ["ACT1100", [20.4, 10.8, 5.3, 1], [1, 0.6], inch([0.6, 0.3]), 0.45 ]; rd_xtals = [C_002RX, HC49_4H, ACT1700, ACT1100, HC49]; // Modules -HF33F = ["HF33F", "Relay", [20.5, 10.6, 15.7], 0.5, grey(20), [0.3, 0.8, 3.6], [ inch([-0.35, 0.15]), inch([-0.35, -0.15]), inch([0.35, -0.15]), inch([0.05, -0.15])]]; -VCE03 = ["VCE03", "PSU", [40.6, 19.1, 19.1], 0.5, grey(20), [0.64, 0.64, 4.8], [ inch([-0.7, 0.04]), inch([-0.5, 0.04]), inch([0.6, 0.04]), inch([0.7, 0.04])]]; +HF33F = ["HF33F", "Relay", [20.5, 10.6, 15.7], 0.5, grey(20), [0.3, 0.8, 3.6], inch([ [-0.35, 0.15], [-0.35, -0.15], [0.35, -0.15], [0.05, -0.15] ]) ]; +VCE03 = ["VCE03", "PSU", [40.6, 19.1, 19.1], 0.5, grey(20), [0.64, 0.64, 4.8], inch([ [-0.7, 0.04], [-0.5, 0.04], [0.6, 0.04], [0.7, 0.04] ]) ]; +LDE10_20B = ["LDE10_20B","PSU", [53.8, 28.8, 19.0], 0.5, grey(20), [1.0, 0, 6.0], inch([ [-0.9, 0.4], [-0.9, -0.4], [0.9, 0], [0.9, 0.4] ]) ]; -rd_modules = [HF33F, VCE03]; +rd_modules = [HF33F, VCE03, LDE10_20B]; // Disks ERZV07D471 = ["ERZV07D471", "Varistor", [6.5, 5.0, 8.0], [4.75, 3.1], [0.6, 1.4], [grey(20), grey(80)]]; @@ -48,4 +49,9 @@ E_LINE = ["E_LINE", [4.6, 2.3, 3.8], [grey(30), grey(80)], [0.45, 0.45], [[-1,0] rd_transistors = [ E_LINE, TO92]; +// Electrolytic capacitors +ECAP8x11 = ["ECAP8x12", [8.2, 7.5, 12.5], 0.5, [2.4, 2.5], 0.5, inch(0.1), [grey(20), grey(60)]]; + +rd_electrolytics = [ECAP8x11]; + use diff --git a/vitamins/rocker.scad b/vitamins/rocker.scad index c117a27..75c91cc 100644 --- a/vitamins/rocker.scad +++ b/vitamins/rocker.scad @@ -54,6 +54,7 @@ module rocker(type, colour) { //! Draw the specified rocker switch y2 = rocker_button(type); rocker_r2 = (sqr(x2) + sqr(y2)) / (2 * y2); + $fa = fa; $fs = $fs; explode(30) { color(grey(20)) { linear_extrude(rocker_flange_t(type)) @@ -72,10 +73,10 @@ module rocker(type, colour) { //! Draw the specified rocker switch rotate([90, 0, 90]) linear_extrude(rocker_w, center = true) difference() { - circle(rocker_r, $fa = 1); + circle(rocker_r); translate([rocker_h / 2, rocker_flange_t(type) + rocker_r2 - rocker_pivot(type)]) - circle(rocker_r2, $fa = 1); + circle(rocker_r2); } diff --git a/vitamins/screw.scad b/vitamins/screw.scad index 3bc1cbe..f2bc032 100644 --- a/vitamins/screw.scad +++ b/vitamins/screw.scad @@ -105,6 +105,8 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc pitch = metric_coarse_pitch(thread_d); colour = nylon || head_type == hs_grub ? grey(40) : grey(80); + $fs = fs; $fa = fa; + module shaft(socket = 0, headless = false) { point = screw_nut(type) ? 0 : 3 * shaft_rad; shank = length - socket - (has_shoulder ? 0 : thread); @@ -299,6 +301,23 @@ module screw_countersink(type, drilled = true) { //! Countersink shape } } +module screw_tearsink(type) { //! Countersink shape for horizontal holes + head_type = screw_head_type(type); + head_rad = screw_head_radius(type); + rad = screw_radius(type); + head_t = rad / 5; + head_height = head_rad - rad + head_t; + + if(head_type == hs_cs || head_type == hs_cs_cap) + translate_z(-head_height) + hull() { + teardrop_plus(h = eps, r = rad, center = false); + + translate_z(head_height - head_t) + teardrop_plus(h = head_t + eps, r = head_rad, center = false); + } +} + function screw_polysink_r(type, z) = //! Countersink hole profile corrected for rounded staircase extrusions. let(rad = screw_radius(type), head_t = rad / 5, diff --git a/vitamins/servo_motor.scad b/vitamins/servo_motor.scad index c55b001..38033df 100644 --- a/vitamins/servo_motor.scad +++ b/vitamins/servo_motor.scad @@ -20,10 +20,10 @@ // include <../utils/core/core.scad> -include <../utils/tube.scad> -include <../utils/round.scad> -include <../utils/quadrant.scad> -include <../utils/rounded_cylinder.scad> +use <../utils/tube.scad> +use <../utils/round.scad> +use <../utils/quadrant.scad> +use <../utils/rounded_cylinder.scad> function servo_motor_cap(type) = type[2]; //! Diameter height and corner radius of encoder cover function servo_motor_length(type) = type[3]; //! Total length from the faceplate diff --git a/vitamins/smd.scad b/vitamins/smd.scad index 0aee17e..d86bfcd 100644 --- a/vitamins/smd.scad +++ b/vitamins/smd.scad @@ -59,7 +59,7 @@ module smd_led(type, colour, cutout) { //! Draw an SMD LED with specified `colou lens = smd_led_lens(type); r = size.y * 0.32; - $fn = 32; + $fn = fn; if(cutout) poly_drill(r = 2.85 / 2, h = 100, center = false); // For lightguide made from transparent PLA filament @@ -174,7 +174,7 @@ module smd_sot(type, value) { //! Draw an SMD transistor ls = smd_sot_lead_size(type); r = ls.z; - gullwing = rounded_path([[0, 0, ls.z / 2], [0, ls.y - ls.z, ls.z / 2], r, [0, ls.y -ls.z + z1 - ls.z, z1 - ls.z / 2], r, [0, span / 2, z1 - ls.z / 2]], $fn = 32); + gullwing = rounded_path([[0, 0, ls.z / 2], [0, ls.y - ls.z, ls.z / 2], r, [0, ls.y -ls.z + z1 - ls.z, z1 - ls.z / 2], r, [0, span / 2, z1 - ls.z / 2]], $fn = fn); color(grey(20)) hull() @@ -217,11 +217,16 @@ module smd_soic(type, value) { //! Draw an SMD SOIC slant = 5; //! 5 degree body draft angle pitch = smd_soic_lead_pitch(type); span = (smd_soic_lead_span(type) / 2); - leads = floor(size.x / pitch) + 1; ls = smd_soic_lead_size(type); + leads = floor((size.x - ls.x) / pitch) + 1; r = ls.z; - gullwing = rounded_path([[0, 0, ls.z / 2], [0, ls.y - ls.z, ls.z / 2], r, [0, ls.y -ls.z + z1 - ls.z, z1 - ls.z / 2], r, [0, span / 2, z1 - ls.z / 2]], $fn = 32); + gullwing = rounded_path([ + [0, 0, ls.z / 2], + [0, ls.y - r, ls.z / 2], r, + [0, span - size.y / 2 - r, z1 - ls.z / 2], r, + [0, span, z1 - ls.z / 2] + ], $fn = fn); color(grey(20)) hull() @@ -235,9 +240,8 @@ module smd_soic(type, value) { //! Draw an SMD SOIC sweep(gullwing, rectangle_points(ls.x, ls.z)); rotate(180) - translate([0, -span / 2]) - translate([i * pitch - size.x / 2 + (size.x - (leads - 1) * pitch) / 2, -span / 2]) - sweep(gullwing, rectangle_points(ls.x, ls.z)); + translate([i * pitch - size.x / 2 + (size.x - (leads - 1) * pitch) / 2, -span]) + sweep(gullwing, rectangle_points(ls.x, ls.z)); } } @@ -296,7 +300,7 @@ module smd_diode(type, value) { //! Draw an SMD diode color(silver) translate_z(z1 / 2) rotate([90, 0, 0]) - linear_extrude(leads.y, center = true, convexity = 3) let($fn = 32) + linear_extrude(leads.y, center = true, convexity = 3) let($fn = fn) difference() { rounded_square([leads.x, z1], 2 * leads.z); @@ -364,7 +368,7 @@ module smd_tant(type, value) { //! Draw an SMD tantalum capacitor color(silver) translate_z(z1 / 2) rotate([90, 0, 0]) - linear_extrude(leads.y, center = true, convexity = 3) let($fn = 32) + linear_extrude(leads.y, center = true, convexity = 3) let($fn = fn) difference() { rounded_square([leads.x, z1], 2 * leads.z); @@ -394,8 +398,10 @@ module smd_inductor(type, value) { //! Draw an SMD inductor gap = leads[3]; gap2 = gap - leads.z * 2; + $fs = fs; $fa = fa; + color(smd_inductor_colour(type)) - difference() { + render() difference() { translate_z(z0) rounded_rectangle(size, 0.5); @@ -413,7 +419,7 @@ module smd_inductor(type, value) { //! Draw an SMD inductor color(silver) translate_z(z1 / 2) rotate([90, 0, 0]) - linear_extrude(leads.y, center = true, convexity = 3) let($fn = 32) + linear_extrude(leads.y, center = true, convexity = 5) let($fn = fn) difference() { rounded_square([leads.x, z1], 2 * leads.z); @@ -453,6 +459,8 @@ module smd_pot(type, value) { //! Draw an SMD pot track_or = size.x * 0.48; track_ir = track_or * 0.6; + $fs = fs; $fa = fa; + color(grey(90)) translate_z(size.z / 2) cube(size, center = true); @@ -486,7 +494,7 @@ module smd_pot(type, value) { //! Draw an SMD pot ]); r = (wiper_r4 - wiper_r5) / 2; translate([wiper_r5 + r, size.z + wiper_t]) - circle(r, $fn = 16); + circle(r, $fn = fn); } translate_z(size.z + wiper_t) @@ -540,7 +548,8 @@ module smd_coax(type) { //! Draw an SMD coaxial connector pin_r = smd_coax_pin_d(type) / 2; lug = smd_coax_lug_size(type); contact = smd_contact_size(type); - $fn = 64; + + $fs = fs; $fa = fa; color(grey(90)) translate_z(eps) @@ -562,10 +571,10 @@ module smd_coax(type) { //! Draw an SMD coaxial connector } hull() { translate_z(t.z - pin_r) - sphere(pin_r); + sphere(pin_r, $fn = fn); translate_z(0.1) - cylinder(r = pin_r, h = eps); + cylinder(r = pin_r, h = eps, $fn = fn); } for(side = [-1, 1]) @@ -606,7 +615,7 @@ module smd_qfp(type, value) { //! Draw and SMD QFP package r1 = g[2]; // top radius r2 = g[3] + pin.z / 2; // bottom radius pz = -size.z / 2 + pin.z / 2; - gullwing = rounded_path([[-1, 0, 0], [s, 0, 0], r1, [pin.x - l + r2, 0, pz], r2, [pin.x, 0, pz]], $fn = 32); + gullwing = rounded_path([[-1, 0, 0], [s, 0, 0], r1, [pin.x - l + r2, 0, pz], r2, [pin.x, 0, pz]], $fn = fn); color(grey(20)) hull() { @@ -640,6 +649,6 @@ module smd_qfp(type, value) { //! Draw and SMD QFP package text(value, halign = "center", valign = "center"); translate([(-(pins / 4 - 1) * pitch) / 2, (-(pins / 4 - 1) * pitch) / 2]) - circle(r = pin.y, $fn = 32); + circle(r = pin.y, $fn = fn); } } diff --git a/vitamins/smds.scad b/vitamins/smds.scad index de16083..26f6c2a 100644 --- a/vitamins/smds.scad +++ b/vitamins/smds.scad @@ -41,20 +41,23 @@ CAP0502 = ["CAP0502", [1.3, 0.6], 0.2]; CAP0603 = ["CAP0603", [1.6, 0.8], 0.3]; CAP0805 = ["CAP0805", [2.0, 1.2], 0.4]; CAP1206 = ["CAP1206", [3.1, 1.6], 0.5]; +CAP1210 = ["CAP1210", [3.1, 2.5], 0.6]; -smd_capacitors = [CAP0402, CAP0502, CAP0603, CAP0805, CAP1206]; +smd_capacitors = [CAP0402, CAP0502, CAP0603, CAP0805, CAP1206, CAP1210]; -SOT23 = ["SOT23", [3, 1.4, 1.0], 0.05, 0.66, 1.9, 2.6, [0.4, 0.45, 0.15], 0.4]; +SOT23 = ["SOT23", [3, 1.4, 1.0], 0.05, 0.66, 1.9, 2.6, [0.4, 0.45, 0.15], 0.4]; SOT223 = ["SOT223", [6.5, 3.5, 1.6], 0.05, 0.89, 2.3, 7.0, [0.7, 0.95, 0.25], 3]; smd_sots = [SOT23, SOT223]; -SOIC8 = ["SOIC8", [4.90, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]]; -SOIC14 = ["SOIC14", [8.70, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]]; -SOIC16 = ["SOIC16", [9.90, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]]; -SOIC18 = ["SOIC18", [11.40,7.50, 2.00], 0.10, 1.20, 1.27, 10.30, [0.31, .50, 0.20]]; +SOT23_6 = ["SOT23_6", [3.0, 1.6, 1.05], 0.10, 0.20, 0.95, 2.8, [0.40, .45, 0.125]]; +TSOT23_8 = ["TSOT23_8", [3.0, 1.8, 0.9 ], 0.10, 0.20, 0.70, 3.0, [0.31, .45, 0.17]]; +SOIC8 = ["SOIC8", [4.90, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]]; +SOIC14 = ["SOIC14", [8.70, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]]; +SOIC16 = ["SOIC16", [9.90, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]]; +SOIC18 = ["SOIC18", [11.40,7.50, 2.00], 0.10, 1.20, 1.27, 10.30, [0.31, .50, 0.20]]; -smd_soics = [SOIC8, SOIC14, SOIC16, SOIC18]; +smd_soics = [SOT23_6, TSOT23_8, SOIC8, SOIC14, SOIC16, SOIC18]; DO214AC = ["DO214AC", [4.0, 2.5, 2.0], 0.1, 1, [4.8, 1.2, 0.15, 2], grey(20)]; diff --git a/vitamins/veroboard.scad b/vitamins/veroboard.scad index 896b8ae..06e9e7b 100644 --- a/vitamins/veroboard.scad +++ b/vitamins/veroboard.scad @@ -35,6 +35,7 @@ function vero_breaks(type) = type[8]; //! Breaks in the tracks function vero_no_track(type) = type[9]; //! Missing tracks function vero_components(type) = type[10]; //! List of named components and their positions function vero_joints(type) = type[11]; //! List of solder joints +function vero_solid_tracks(type) = type[12]; //! List of solid copper tracks (at the edges of some boards) function vero_thickness(type) = 1.6; //! Thickness of the substrate function vero_track_thickness(type)= 0.035; //! Thickness of the tracks @@ -42,8 +43,8 @@ function vero_track_width(type) = vero_pitch(type) * 0.8; //! The width of th function vero_length(type) = vero_holes(type) * vero_pitch(type); //! Length of the board function vero_width(type) = vero_strips(type) * vero_pitch(type); //! Width of the board -function vero(name, assembly, holes, strips, pitch = 2.54, fr4 = false, screw = M3_cap_screw, mounting_holes = [], breaks = [], no_tracks = [], components = [], joints = []) = //! Constructor - [ name, assembly, holes, strips, pitch, fr4, screw, mounting_holes, breaks, no_tracks, components, joints ]; +function vero(name, assembly, holes, strips, pitch = 2.54, fr4 = false, screw = M3_cap_screw, mounting_holes = [], breaks = [], no_tracks = [], components = [], joints = [], solid = []) = //! Constructor + [ name, assembly, holes, strips, pitch, fr4, screw, mounting_holes, breaks, no_tracks, components, joints, solid ]; function vero_size(type) = [vero_length(type), vero_width(type), vero_thickness(type)]; //! Board size @@ -76,16 +77,21 @@ module veroboard(type) { //! Draw specified veroboard with missing tracks and tr colour = vero_fr4(type) ? "#BEB564" : "goldenrod"; tc = vero_fr4(type) ? "silver" : copper; no_track = vero_no_track(type); + solid = vero_solid_tracks(type); vitamin(str("veroboard(", type[0], "): Veroboard ", holes, " holes x ", strips, " strips")); + $fs = fs; $fa = fa; + color(colour) linear_extrude(vero_thickness(type)) difference() { rounded_square([length, width], r = 0.5, center = true); - for(x = [0 : holes - 1], y = [0 : strips - 1]) - vero_grid_pos(type, x, y) - circle(d = hole_d); + for(y = [0 : strips - 1]) + if(!in(solid, y)) + for(x = [0 : holes - 1]) + vero_grid_pos(type, x, y) + circle(d = hole_d); vero_mounting_hole_positions(type) circle(r = screw_radius(vero_screw(type))); @@ -100,9 +106,10 @@ module veroboard(type) { //! Draw specified veroboard with missing tracks and tr difference() { square([length - (pitch - tw), tw], center = true); - for(x = [0 : holes - 1]) - translate([x * pitch - (holes - 1) * pitch / 2, 0]) - circle(d = hole_d); + if(!in(solid, y)) + for(x = [0 : holes - 1]) + translate([x * pitch - (holes - 1) * pitch / 2, 0]) + circle(d = hole_d); } vflip() { vero_mounting_hole_positions(type) @@ -140,7 +147,7 @@ module vero_cutouts(type, angle = undef) //! Make cutouts to clear components module veroboard_assembly(type, ngb = false) //! Draw the assembly with components pose_vflip(exploded = true) -assembly(vero_assembly(type), ngb = ngb) { +assembly(vero_assembly(type), ngb = ngb, big = true) { veroboard(type); let($solder = [vero_track_width(type) / 2, 0, vero_thickness(type) + vero_track_thickness(type)]) @@ -176,6 +183,28 @@ module veroboard_fasteners(type, height, thickness, flip = false) { //! Draw the } } +module veroboard_base(type, height, thickness, wall = 2, tapped = false) { //! Generate STL for a base with PCB spacers + screw = vero_screw(type); + ir = tapped ? screw_pilot_hole(screw) : screw_clearance_radius(screw); + or = corrected_radius(ir) + wall; + + union() { + linear_extrude(thickness) + difference() { + hull() + vero_mounting_hole_positions(type) + poly_ring(or, ir); + + vero_mounting_hole_positions(type) + poly_circle(ir); + } + + linear_extrude(height) + vero_mounting_hole_positions(type) + poly_ring(or, ir); + } +} + module veroboard_fastened_assembly(type, height, thickness, flip = false, ngb = false) { //! Draw the assembly with components and fasteners in place translate_z(height) diff --git a/vitamins/washer.scad b/vitamins/washer.scad index 60bbc85..e5c9138 100644 --- a/vitamins/washer.scad +++ b/vitamins/washer.scad @@ -43,6 +43,8 @@ function washer_id(type) = washer_size(type) + 0.1; //! Inside diameter function washer_colour(type) = washer_soft(type) ? soft_washer_colour : hard_washer_colour; //! Washer colour module washer(type) { //! Draw specified washer + $fs = fs; $fa = fa; + hole = washer_size(type); thickness = washer_thickness(type); diameter = washer_diameter(type); @@ -72,6 +74,8 @@ module penny_washer(type) { //! Draw penny version of specified plain washer } module star_washer(type) { //! Draw star version of washer + $fs = fs; $fa = fa; + hole = washer_size(type); thickness = washer_thickness(type); diameter = star_washer_diameter(type); @@ -97,6 +101,8 @@ module star_washer(type) { //! Draw star version of washer } module spring_washer(type) { //! Draw spring version of washer + $fs = fs; $fa = fa; + hole = washer_size(type); thickness = spring_washer_thickness(type); diameter = spring_washer_diameter(type); diff --git a/vitamins/washers.scad b/vitamins/washers.scad index eae88d1..dc86dac 100644 --- a/vitamins/washers.scad +++ b/vitamins/washers.scad @@ -42,7 +42,7 @@ M3_washer = ["M3", 3, 7, 0.5, false, 5.8, 5.6, 1.0, M3_penny_w M3p5_washer = ["M3p5", 3.5, 8, 0.5, false, 6.9, 6.2, 1.0, undef]; M4_washer = ["M4", 4, 9, 0.8, false, 7.9, 7.0, 1.2, M4_penny_washer]; M5_washer = ["M5", 5, 10, 1.0, false, 9.0, 8.8, 1.6, M5_penny_washer]; -M6_washer = ["M6", 6, 12.5, 1.5, false, 10.6, 9.9, 1.6, M6_penny_washer]; +M6_washer = ["M6", 6, 12.5, 1.5, false, 10.6, 9.9, 1.9, M6_penny_washer]; M8_washer = ["M8", 8, 17, 1.6, false, 13.8, 12.7, 2.0, M8_penny_washer]; toggle_washer = ["toggle", 6.1,12, 0.6, false, 10, 0, 0, undef]; diff --git a/vitamins/ziptie.scad b/vitamins/ziptie.scad index f2e348d..f73b510 100644 --- a/vitamins/ziptie.scad +++ b/vitamins/ziptie.scad @@ -32,6 +32,8 @@ function ziptie_tail(type) = type[5]; //! The length without teeth module ziptie(type, r = 5, t = 0) //! Draw specified ziptie wrapped around radius `r` and optionally through panel thickness `t` { + $fa = fa; $fs = fs; + latch = ziptie_latch(type); zt = ziptie_thickness(type); lx = min(latch.x / 2, r + zt / 2);