Vibe 'o Nacci Lamp

From NURDspace
Revision as of 16:48, 31 December 2025 by Anus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Vibe o Nacci Lamp
Vibeonaccibal.jpg
Participants
Skills 3D design + printing, Arduino, Programming (arduino), 3D Printing, ai, Archeology
Status Being Consumed
Niche Infra
Purpose Saving energy and money
Tool No
Location Rookhok
Cost nihil
Tool category

Vibe o Nacci Lamp

Vibeonaccibal.jpg {{#if:No | [[Tool Owner::{{{ProjectParticipants}}} | }} {{#if:No | [[Tool Cost::nihil | }}

SCAD file for generating the dome.

// =========================
// Parameters
// =========================
diameter = 150;          // mm
thickness = 2.5;         // mm
hole_diameter = 8;       // mm
hole_count = 50;         // aantal gaten (tweakbaar)
$fn = 256;

// =========================
// Afgeleide maten
// =========================
R = diameter / 2;
r_inner = R - thickness;
hc = ceil(hole_count * 2.323);

// =========================
// Dome (halve bol, hol)
// =========================
module dome_shell() {
    difference() {
        sphere(r = R);
        sphere(r = r_inner);
        translate([0,0,-R])
            cube([2*R,2*R,2*R], center=true);
    }
}

// =========================
// Radiaal georiënteerd gat
// =========================
module radial_hole(theta, phi) {
    rotate([0, 0, phi])
    rotate([0, theta, 0])
    translate([0, 0, r_inner])
        cylinder(
            d = hole_diameter,
            h = thickness*2,
            center = true
        );
   
        x = r_inner * sin(theta) * cos(phi);
        y = r_inner * sin(theta) * sin(phi);
        zc = r_inner* cos(theta);

        echo(
            str(
                x, ",",
                y, ",",
                zc, ",",
                theta, ",",
                phi % 360
            )
        );
} 

// =========================
// Fibonacci-verdeling
// =========================
module holes_fibonacci() {
    golden = (1 + sqrt(5)) / 2;

    for (i = [0 : hc - 1]) {
        z = 1 - 2 * (i + 0.5) / hc;
        theta = acos(z);
        phi = 360 * i / golden;

        // alleen bovenste hemisfeer
        if (theta < 90-hole_diameter)
            radial_hole(theta, phi);
    }
}

echo("x,y,z,theta_deg,phi_deg");

// =========================
// Eindmodel
// =========================
difference() {
    dome_shell();
    holes_fibonacci();
}

// =========================
// Gatenteller
// =========================
function valid_holes() =
    [
        for (i = [0 : hc - 1])
            let(
                z = 1 - 2 * (i + 0.5) / hc,
                theta = acos(z)
            )
            if (theta < 90 - hole_diameter)
                i
    ];

echo("Aantal gaten:", len(valid_holes()));


Leuk toch?

Arduino code voor aansturen van LEDjes

   #include <Arduino.h>
   #include <FastLED.h>

   #define LED_PIN     6
   #define NUM_LEDS    50
   #define BRIGHTNESS  255
   #define LED_TYPE    WS2812B
   #define COLOR_ORDER GRB

   CRGB leds[NUM_LEDS];

   void setup() {
       FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
       FastLED.setBrightness(BRIGHTNESS);
   }

   void loop() {
       static uint8_t hue = INT8_MAX;

       for (int i = 0; i < NUM_LEDS; i++) {
           leds[i] = CHSV(hue + i * PI, 255, 255);
       }

       FastLED.show();
       hue--;
       delay(1);
   }