Geodesic Light

I felt like making a stupid lamp and that’s how it looks like. More about it here: /thing/geodesiclight

Perlin noise for 3d-printed parts

Recently I spent a bit of time thinking about visually improving non-functional areas of a 3d-printed part. Some generated pattern which could be imprinted on some parts of the object while not creating any issues with geometries that are required for functionality and still being (somewhat) printable.
Disclaimer: I started this inquiry with very little knowledge about 3d stuff (point clouds, meshes and surface reconstruction algorithms) and there may be way better solutions if you’ve got a basic understanding of these topics.

What I ended up with is Perlin noise. That’s a pretty simple way of generating continuous noise patterns on a plane, in a 3d space or any other dimension. In the two-dimensional case you get a pretty nice landscape-like output with hills and valleys (but no caves, no overhangs). That’s one of the many usecases of Perlin noise: generate landscapes in games.

perlin noise example

Alternatives to classic or improved Perlin noise are apparently Value noise and Simplex noise, but I just went with the classic flavour. The hard part is understanding the algorithm since there are a lot of explanations of varying quality on differnet algorithms (new and classic). Picking and combining explanations from the posts by Adrian Biagioli and Raouf did work out somehow.

I refactored a bit of code from StackOverflow (as one does) with a slightly different set of gradients. (Python code is available here)

Once you’ve got the algorithm running you get a set of Z values for an XY coordinate grid. How do we make anything 3d-printable from this data? The problem is that STL files are polygon meshes with vertices, edges and faces, but all we’ve got at this point are raw coordinates.

Now we can either generate meshes by directly creating polygons in after computing the noise, or we can continue working with points.

Option A: Meshes

To obtain a mesh, we just connect every set of 4 points to two triangles. The script generates an STL by specifying a filename.
Example:

python3 perlin.py -x 100 -y 100 -z 10 -s 3 --output-stl mesh.stl --surface-only

Option B: Point Clouds

If we continue with points, we basically got a point cloud. Let’s look at that:

Example:

python3 perlin.py -x 100 -y 100 -z 10 -s 3 --output-xyz pointcloud.xyz --surface-only

The most convenient software for visualizing point clouds I could find is MeshLab. I did write the XYZ coordinates of my perlin noise computation to a file, one coordinate tuple per line. MeshLab can open that via File > Import Mesh. meshlab screenshot, points only

The nice thing about MeshLab is that it comes with a set of common algorithms for point cloud/mesh problems.

Apparently the correct term for getting from a point cloud to a mesh is “Surface Reconstruction” and the most straightforward way of doing this is a Screened Poisson algorithm. One requirement for that is to have the normals for all points and MeshLab can compute that easily by selecting Filters > Normals, Curvatures and Orientations > Compute normals for point sets.

Now one can just run Filters > Remeshing, Simplification and Reconstruction > Surface Reconstruction: Screened Poisson and hit Apply.

meshlab screenshot, mesh

That looks already pretty good! Apparently the algorithm creates a bit of padding at the edges of the point cloud, but that’s not a show stopper. The problem is that our mesh is not actually a body but just a surface.

Maybe there is totally conventient way of just extruding this and remeshing or something similar, but I did not find an easy way to do this. What I did instead is change my Perlin noise script to just create point coordinates for “walls” on all four sides and a bottom.

meshlab screenshot, complete mesh

Same steps as before and then hit File > Export Mesh As and select STL. And now we’ve got an STL file that we could just print.

No matter in what way we created an STL file, the following steps are the same:

Result

Prusa Slicer screenshot

But how can we use this STL file to modify another STL?

What I did was create another body in my CAD software which encompasses all the non-functional parts of the component. Everything bit of space that this body occupies could be kept or removed depending on the perlin noise output.

CAD model comparison

I exported this as an STL as well and combined these meshes with the simplest tool available: boolean operations in OpenScad.

OpenScad screenshot

union() {
    difference(){
        import("original_part.stl");
        import("allowed.stl"); 
    }
    intersection(){
        import("perlin.stl");
        import("allowed.stl"); 
    }
}

The preview looks pretty awful because OpenScad (or CGAL) is not able to deal well with meshes that have overlapping points/faces. The output is not perfect, but can be repaired with a mesh repair tool or a slicer.

Loading the resulting STL in the slicer looks like this:

Prusa Slicer screenshot

To be able to actually make the perlin noise pattern printable upside down I did cut off all noise values >= 0 (only the valleys, not the hills remain).

So, how does the print look like?

Single Lens Pi Camera image

Software?

You can find the script on github.

Raspberry Pi Power Via USB

Sometimes it’s not possible or really tedious to get a USB cable to the USB connector for power input on a Raspberry Pi. Since the 5V pins, the USB power connector, and the USB hub share the same power rail, it doesn’t matter where the electrons enter and exit. The only difference is that the Pi has a few capacitors, a resettable fuse, and a diode directly behind the USB input. When powering the Pi via the 5V pins on the 40pin header, this protection and the capacitors to deal with sudden power draws won’t work. This applies as well to the USB hub.

To make back-powering the Pi via the USB hub a bit more convenient, I made these backpower adapters that contain the same resettable fuse, capacitors and diode as the Raspberry Pi design.

adapter1 adapter2

You can find the schematics and EasyEDA design files here.

The ever-extending list of really weird cameras

I have a soft spot in my heart for really weird contraptions to take pictures. A non-exhaustive list of at least slightly unusual cameras which may get updated from time to time…

(in no particular order)


The SPUD - a self contained scanner camera

spud1 spud2 spud3


The Alulu Camera - The Receipt Paper Film Camera

spud1 alulu2 alulu3


The Brancopan - A 3d-printed panoramic camera that was crowdfunded to make the plans available to everyone
(made by the pretty cool Cameradactyl people)

brancopan1


The GameBoy Camera (of course) - the smallest and cheapest digital camera of it’s time

gameboycamera1 CC BY NC - Jess C on flickr

gameboycamera2 CC BY NC ND - Mario Durán on flickr


The Light L16 - A camera with 16 sensors (and 16 lenses)

L16


The Etch-A-Snap - A camera that draws its output on an Etch-A-Sketch

Digital Solargraphy or the Art of Taking a Photo for a Day

Finally managed to do a video on digital solargraphy and explain the concept a bit more visually.

gif / webm / mp4

gif / webm / mp4

gif / webm / mp4

gif / webm / mp4

gif / webm / mp4

Rapid Prototyping Curved Mirrors


Sometimes one may require a non-planar mirror. Usually you can do that by turning and polishing a chunk of metal on a lathe until it is so smooth that the metal works like a mirror. Or you can achieve a mirror surface by grinding a piece of glass or coating plastic in a vacuum chamber. All of that is pretty slow and expensive.

But is there maybe an easier or faster way at the cost of a bit of precision? (yes)

In general there are three different types of shapes:

types of shapes

The material I use is laminated and metallized polystyrene. Since there is already a mirror surface on the material we don’t need to coat it as a second step. And as a thermoplastic is easily deformable and at room temperature pretty stiff so it keeps its shape.

Before I settled on Polystyrene I did a quick test of different mirror-like materials:

  • Coated acrylic glass
  • Metallized polystyrene
  • PVC foil with an aluminium layer
  • and Rustoleum Mirror Spray on a PETG sheet

Comparing this works pretty easy by bouncing light against different mirror materials onto a sheet of paper. My reference material is a silver-coated glass mirror, which is pretty standard stuff and the highest quality mirror you’ll find in your household.

reflection setup

The reflection of the projected test pattern is already looking pretty good.

reflection comparison

But if we subtract the image from the reference mirror, we just see the differences, so all the tiny imperfections and errors.

reflection comparison diff

We can see that acrylic glass looks quite ok, but has a few tears or cracks in the reflection surface. Laminated polystyrene causes a bit of color banding and has some issues, but these are well distributed among the whole surface and not as local as acrylic PVC foil is just straight-up garbage and the mirror spray even worse.

So, we’ve got a winner. The laminated polystyrene is something you can usually get this at a half millimeter or 1 millimeter thickness pretty much everywhere around the world. Sometimes in small arts and crafts shops, sometimes online. One valid alternative is vinyl which may be easier to get in some countries. If you go thinner your mirror gets imprecise, if you go thicker you will have a hard time deforming the material.

So, back to the mirror: You can model that in any CAD program and just pretend you are doing metal sheet bending with a 1mm thick material. When you’ve got your desired geometry, you can just export the drawing or generate CNC tool paths from the contours (that’s what I did).

CNC milling

With a simple CNC milling operation, I carve and cut the part from the polystyrene sheet. I can spare myself a lot of frustration by using a 90-degree chamfering endmill to pre-carve the bending lines. Less hassle, more precision. If you don’t have a CNC handy, print the drawing on a sheet of paper and cut it manually with a hobby knife. Works totally okay, but is slightly less cool, of course.

CNC milling CNC milling

So, back to our mirror shapes. How can we make double-curved surfaces? First, we need to model something again and offset the surface by the thickness of the metallized plastic sheet. Then we can 3d-print the offsetted model as a mold for vacuum forming.

For vacuum forming you just need a few basic tools:

Thermoforming basic tools

I am using slightly undersized screw holes in the mold, so I can drill a small hole in the mirror after vacuum forming to fit a screw and permanently fix the mirror to the plastic. Glue would probably do the job as well, but the screw holes make it easier for air to escape as well, so the vacuum forming is a bit easier.

3d-printed mold

Then we just need to heat up the sheet of polystyrene, press it on the mold, turn on the vacuum and wait a few seconds till it’s hard again. Cut away the excess plastic and permanently bond the polystyrene to the mold.

Vacuum formed mirror

The resulting mirror is quite okay when it comes to precision, pretty good in terms of reflection, and extremely good concerning manufacturing time and price.

A few caveats:

Do not use PLA! PETG works okayish with a few extra perimeters and anything that’s more heat tolerant works even better. In any case: If your plastic sheet transfers too much heat into the printed mold, it’s game over so do not overheat the sheet.

Stretchtest

The metallized polystyrene can handle a bit of stretch but at some point it will rip. In most cases that’s probably not an issue.

Stretchtest


Other videos which might be interesting:

Smoothing 3d-printed parts with resin and coat them chemically with silver.


A bit of theory and a lot of making mirors with glass blanks.

Pico Projectors for Raspberry Pis

When building prototypes that require tiny projectors capable of projecting an okay-ish image over short to mid-sized distances, finding something decent is not easy. In my case I needed something that is as small as possible, has a wide field of view and should ideally be compatible with a small Raspberry Pi Zero.

Texas Instruments DLP LightCrafter Display 2000 EVM for BeagleBone Black

LightCrafter Display 2000 EVM

Thats an evaluation kit for the smallest of the TI “LightCrafter” projector units, meant to be used as a Beaglebone Black hat. Luckily with an adaptor PCB this can easily be adapted for a Raspberry Pi as well. The Raspberry Pis GPIO pins can be repurposed as a parallel display interface (DPI) to get the image data to the projector, so no HDMI is required.

Pinout and I2C commands to configure the projector interface can be found on the website of Frederick van den Bosch Another very nice build that includes an adapter board made by MickMake can be found on MickMake’s website

Keep in mind: we are talking here about a DLP projector, so manual adjustment of the focus plane is necessary.

focus plane lever

This can be done with this ultra-unhandy tiny lever that moves a part of the optical assembly (there is no way to fix it in position).

Ultimems HD301-A2

Available via Chip1Stop, or rebranded as a Nebra Anybeam Developer Kit.

Ultimems HD301A2

A tiny laser projector, running at 1280x720 pixel. Full-sized HDMI input, requires 5V/1.5A via micro USB.
To save a lot of space, an HDMI-to-FFC adapter comes in handy, but may degrade the HDMI signal.

FFC HDMI

The tricky part is getting the HDMI settings right:

In ‘boot/config.txt’ the HDMI modes can be set. The Ultimems chipset supports (among others):

mode 4: 640x480@60Hz
mode 8: 800x600@56Hz
mode 14: 848x480@60Hz 
mode 85: 1280x720@60Hz

mode 85 results in some nasty glitches with cheap adapters and long FFC cables. That’s what worked well for me:

hdmi_force_hotplug=1
hdmi_drive=2
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=14

One nice advantage of having separate modules for projector and control stage is to be able to just fold it for a close fit (removing the projector stage with the TI LightCrafter 2000 EVM is a pain since the cable is connecting cable is quite stiff).

Ultimems folded

drawing1 drawing2

Custom Raspberry Pi Camera Cables

Sometimes one just needs a custom flat flex cable. In my case this was a Raspberry Pi Zero camera cable. A quick search told me that flex PCBs have fancy stuff like polyamide stiffeners to make certain parts more … stiff (obviously). This increases the PCBs thickness slightly so connectors are chosen to accomodate that. Flex PCBs are apparently really expensive. Not so much the per-unit price but the base price. PCBway charges about a hundred USD minimum. That’s slightly too expensive for my little test project.

Luckily OSHpark is offering a flex PCB service as well at 10 USD per square inch, exactly twice as expensive as their regular PCBs. Sadly, OSHpark flex PCBs come without stiffeners. Luckily, … I came across this handy tweet. Add a copper area on the backside of the connector part and you’re good. Except that the ZIF connectors used for Pi cameras require 0.3mm thickness.

What worked for me well was adding two layers of Kapton tape (which is basically the same group of chemical compounds as polyamide) and trim the excess with a pair of sharp scissors.

customFFC customFFC2

Not pretty but works like a charm.