User Tools

Site Tools


3dprint:strobo-tumbling-cubes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
3dprint:strobo-tumbling-cubes [2026/01/08 18:40] – [Circuit] ivo3dprint:strobo-tumbling-cubes [2026/01/09 07:13] (current) – [Code] ivo
Line 4: Line 4:
  
  
-A hall sensor measures the passing of four magnets to compute the angle.+A hall sensor (outputting just high or low) measures the passing of four magnets to compute the angle.
  
 ===== Files ===== ===== Files =====
 ==== 3D ==== ==== 3D ====
-    * {{ :3dprint:strobo-tumbling-cubes.scad|}} +    * {{ :3dprint:strobo-tumbling-cubes.scad|}} (OpenSCAD) 
-    * {{ :3dprint:motorbracket.fcstd |}} +    * {{ :3dprint:motorbracket.fcstd |}}  (FreeCAD) 
-    * {{ :3dprint:pinwheel.fcstd |}} +    * {{ :3dprint:pinwheel.fcstd |}} (FreeCAD) 
-    * {{ :3dprint:sensorbracket.fcstd |}}+    * {{ :3dprint:sensorbracket.fcstd |}} (FreeCAD) 
 +    * {{ :3dprint:case.svg?linkonly |}} (Inkscape)
 ==== Code ==== ==== Code ====
 +Used an ESP32 (Doit DevBoard), with Platformio
 <code cpp main.cpp> <code cpp main.cpp>
 #include <Arduino.h> #include <Arduino.h>
Line 56: Line 58:
         double dt = ts[tsi]-ts[(tsi+3)&3];         double dt = ts[tsi]-ts[(tsi+3)&3];
         dts[tsi] = 0.8*dts[tsi]+0.2*dt;         dts[tsi] = 0.8*dts[tsi]+0.2*dt;
-        double sum = 0.0; +        unsigned int w = dts[(tsi+1)&3]*(nextAngle-angle)/step;
-        for (int i=0; i<4; i++) { +
-          sum += dts[tsi]; +
-        } +
-        //double realStep = dts[(tsi+1)&3]; +
-        unsigned int w = dts[(tsi+1)&3]*(nextAngle-angle)/step; // dt*(nextAngle-angle)/step*(realStep/step);+
         if (w<200000) {         if (w<200000) {
           delayMicroseconds(w);           delayMicroseconds(w);
Line 80: Line 77:
 </code> </code>
 ==== Circuit ==== ==== Circuit ====
 +
 +Circuit for driving the 12V LED strip. Not very efficient and inverted logic, so it light up until the microcontroller has booted. But you do with what you have lying around...
  
 {{ :3dprint:circuit.svg |}} {{ :3dprint:circuit.svg |}}
3dprint/strobo-tumbling-cubes.1767897657.txt.gz · Last modified: by ivo