Playing with LEGO and servos

Playing with OpenSCAD, LEGOS and a servo

I've been playing with an idea, to design a simple LEGO part to attach a standard servo. Here's the pic.

I'm using a https://github.com/cfinke/LEGO.scad[LEGO.scad]] (underfull library) and MCAD for the servo model.

Look great!

Here's the OpenSCAD code:


//11:35:10 - 13/09/2018
// Author: Tiago Charters de Azevedo
// Maintainer: Tiago Charters de Azevedo

// Copyright (c) - 2018 Tiago Charters de Azevedo

// This program 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, or (at your option)
// any later version.

// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301, USA.

include <../utils/polyholes.scad>;
use <lego.scad>;
use <servo.scad>;

//https://github.com/cfinke/LEGO.scad
//https://github.com/openscad/MCAD

module showservo(){
    translate([44.1/2-.5,-20.3,10+2*1.6]){
        rotate([0,-90,0]){
            color("grey")futabas3003();}}}
difference(){
    union(){
        rotate([0,0,90]){
            block(width=7,length=1,height=1,stud_type="baseplate");}
        servopin();}
    place(0,0,2.5){
        rotate([0,90,0]){
            cube([21,42, 36.1], true);}}}


module servopin(){
    difference(){
        place(-3, 0,1) {block(width=1,length=1,height=3,stud_type="hollow");}

        place(-3, 0,2)
        rotate([0,90,0]){
            poly_cylinder(h=50,r=1.5,center=true);}

        translate([0,0,10]){
            place(-3, 0,2) {
                rotate([0,90,0]){
                    poly_cylinder(h=50,r=1.5,center=true);}}}}

        difference(){
        place(3, 0,1) {block(width=1,length=1,height=3,stud_type="hollow");}

        place(3, 0,2)
        rotate([0,90,0]){
            poly_cylinder(h=50,r=1.5,center=true);}

        translate([0,0,10]){
            place(3, 0,2) {
                rotate([0,90,0]){
                    poly_cylinder(h=50,r=1.5,center=true);}}}}}

Looks great doesn't it?

Happy hacking!

Palavras chave/keywords: diy, openscad, servo, arduino, lego

Criado/Created: 13-09-2018 [11:22]

Última actualização/Last updated: 10-10-2022 [14:47]


Voltar à página inicial.


GNU/Emacs Creative Commons License

(c) Tiago Charters de Azevedo