Prototyping and Fabrication Techniques Sound and Music Computing, Aalborg University Autumn 2020
When facing this project, I set a series of constraints:
- Light should play an important role on the project, but it should be non-intrusive, the light equivalent to ambient music.
- Each object must be unique: the system or tool must be able to generate different designs following a series of rules.
- The resulting object had to be aesthetically pleasing and minimalistic / sober.
- Technology should be hidden as much as possible. In this way, wires, cords, PCBs... won't be visible. Screens are out of the question.
- The object will be "closed" in the sense that it will function in isolation, autonomously, it will not connect to an external data source.
- I should be able to build more than one copy of the object.
By chance, I found a video by The Warthog Project, a channel dedicated to building a A-10C Warthog simulator. In this video, the author explains how to build the fuel panel from scratch.
The idea of a black acrylic backlighted panel seemed really interesting for me to explore.
The first iterations revolved around the idea of random panels: placing different controls and labels on the panel. The random panel placed nonsensical controllers to create something resembling a formal controller. Upon closer inspection, the user realizes that the panel does not make any sense, but leaves some leeway to imagine what strange contraption could be controlled by this weird panel.
Another possibility would be for each panel to be a unique analog synthesizer: the tool generates the panel, the bill of materials, the schematics...
These panels present certain issues:
The nonsense panel doesn't "do" anything, the controls don't work, they are mere decorations, in fact, operating the controls won't produce any output, because there is no output as such.
The analog synthesizer could produce an output, but in return, the electronics are much more complicated. If we want the synth to be a little interesting, we must provide a minimum of controls, which complicates the programming, wiring and therefore the time required to build a copy.
Thinking about the black slab, a minimal interface, and the use of LEDs, I thought about constellations, stars and the blackness of space, and that sparked the idea of creating a "constellation generator" to map the universe with brand new constellations. Cartografía celeste (Celestial cartography) was born.
By using only LEDs (plus a microcontroller and a battery) the project would be simple, allowing me to build more than one copy, but at the same time producing an object interesting enough to display it at home.
Cartografía Celeste covers all the bases stated in the starting point:
- Light: the stars shine and twinkle against a black background. The emitted light should be dim enough not to blind you if you look at it directly, and blend with the environment. This makes me think of candlelight, most visible in dim environments.
- Uniqueness: a tool (the generator) will randomly place the stars in the canvas, draw the lines linking them and also generate some astronomical information, so every generated constellation will be unique.
- Minimal interface: a black slab of acrylic, with white lines, white LEDs and white text. No colors, no buttons, no wires.
- Hidden technology: using only LEDs allows the use of a simpler, smaller microcontroller. All the electronics and a small cell battery to power the system are hidden inside the slab.
- Closed object: by using a simpler microcontroller, I can avoid the temptation of overcomplicating the code.
- More than one copy: once the process is streamlined, building a new constellation from scratch should not take more than four hours.
The code and schematics are available at GitHub and are open source and distributed under the MIT license.
The main files are:
arduino/attiny_cartografiaSource code for the ATtiny firmware.
arduino/attiny_testSimple blink sketch to check that the chip burner is working.
processing/generatorSource code for the generative tool.
schematics/attiny programmer.fzzSchematics for building the programmer shield.
schematics/attiny_cartografia.fzzSchematics for connecting the battery and microcontroller to the copper buses.
schematics/cartografía_celeste.schKicad schematics file.
Development and learnings
The project is divided into four main blocks:
Generator A tool to generate the different constellations (star placement, connecting lines, information about the constellation) and save the files needed to build the object.
Physical object The materials must be laser-cuttable and have a finished professional look. The object must feel solid and elegant. Final size should be carefully chosen, so the information is not crammed, but also not to make the object disproportionately big.
Firmware The code should be small enough to fit in a microcontroller, as well as interesting enough so the users feel compelled to turn the system on.
Hardware The combination of microcontrollers, actuators, power source, etc. keeping in mind that there is not going to be a lot of room for the electronics, and the components should be on a budget.
During the development, a series of design choices have been made, motivated by:
- The available time for the project, including the time allocated for the development, the delivery of materials, the delivery date...
- The materials and tools available.
- Aesthetic reasons.
- Balance between new techniques and things I've already know.
The tool generates an infinite series of constellations, placing twelve stars at random, joining them and generating additional information. The process is automatic: pressing the space bar generates and records a new constellation, including the additional parts needed for assembly. The SVG file includes the necessary line thicknesses for the cutter to cut the pieces or raster the lines and texts. The only manual task is to rescale the design by 65.415% from the program where the cutter will be used, since the generated SVG file does not include any units of measurement.
Parametric design One of the decisions I made at the beginning was to parameterize all the measurements (margins, padding, LEDs size...). During the development process, I had to adjust them very often and by using parameters I avoided a lot of hassle.
Soldering aids To facilitate the process of soldering the LEDs, each copper tape is labelled (the columns marked A-D). Also, every LED is also labelled, showing to which pair of columns the LED is to be soldered to and in which position. For example, -CD+ means that at that position a LED is soldered to columns C (cathode) and D (anode)
The LEDs are placed randomly in the available space, following a series of rules that will facilitate soldering them to the copper tape:
- A LED will never be placed on the copper tape.
- There will never be two LEDs less than 4.5mm (32 pixels) apart.
- There will never be two LEDs with the same Y-coordinate, even if they are more than 4.5mm apart.
- If the LED has to be soldered to columns C1 and C2, the LED will be placed between those columns. For example, the +AB- LED will be always placed between columns A and B, and never between columns C and D.
Generation of the constellation To generate the lines that form the constellation I was trying to reinvent the wheel (joining some stars, joining all of them and refining, removing some lines) until I realized that I could use existing algorithms. The constellation is created by following these steps:
- Calculate the Delaunay triangulation to obtain a mesh of triangles avoiding acute angles and segment crossing. This step returns a list of segments between stars.
- Calculate the convex hull, i.e. the list of segments that encompass all the stars. This step returns another list of segments.
- Remove the segments from the hull from the triangulation segment list.
- Break up the remaining triangles, removing one of the segments at random.
- If a star is connected to more than three stars, remove the extra connections.
- Assign a random radius to each star.
After this process, we can be left with some disconnected stars, but this is usual in the depictions of the constellations.
Texts The name of the constellation is chosen at random from a list of Latin nouns. The surname of the discoverer of the constellation is chosen at random from a list of Flemish, French and English surnames. The year of cataloguing is assigned between 1600 and 1825. The rest of the astronomical data is generated at random, but by choosing plausible values. The number of stars in the constellation is the number of connected stars.
Extra parts The SVG design includes the additional spacer ring parts that we will need for assembly.
- Because of the way the stars are distributed, the design can be off-center.
- The pieces could be placed differently to avoid wasting the acrylic.
- Not all the additional parts are included, only those needed for the spacer ring. The pieces to hold the magnets and a possible support are not included in the SVG file.
The hardware consists of an ATtiny25 microcontroller, twelve 3mm diameter white LEDs and a 3v CR2032 battery. The LEDs are soldered between the four copper tapes, each of them attached to the corresponding output of the microcontroller.
ATtiny25 The ATtiny25 microcontroller is used as an alternative to the Arduino (ATmega328) microcontroller. The ATtiny25 has six I/O lines, operates between 2.7-6 volts and can be programmed from the Arduino IDE, so no additional toolchain is needed. If the amount of program memory (2kb) and SRAM (128b) weren't enough, it can be replaced by the ATtiny45, a pin-by-pin replacement, with twice the amount of program memory and SRAM.
Charlieplexing Charlieplexing is a technique used to control several LEDs using a minimum amount of output pins. Using this technique, the LEDs are turned on for a brief period of time, and the persistence of vision makes us believe that they are always on.
By using charlieplexing, with outputs one can control LEDs, so using 4 output pins we get to control 12 LEDs.
The first tests were made on an Arduino compatible board and the ported to the ATtiny25. A very naive version of the charlieplexing code is available at the GitHub repository, using 35% of the available program memory and a 86% of RAM memory.
Power source The system is powered by a standard CR2032 battery. A fresh battery lasts for 22 hours. To keep the battery in place, I'm using a bent header pin. It is a provisional solution, but good enough as it supports the battery weight, and the object can be moved around without the battery getting loose.
- To turn the constellation on and off, the battery must be removed from its holder. A switch would be more convenient.
- Although in the tests carried out connecting the battery upside down does not damage the chip (it simply does not work), to avoid future problems it would be convenient to add a diode to the circuit.
- Using a smaller perfboard, the button cell could be replaced with a rechargeable lipo battery, which provides a longer life (36 hours in our tests), in exchange for having a suitable charger for these batteries.
- The code has not been optimized to use the power saving possibilities of the ATtiny.
The code is a combination of charlieplexing and PWM to achieve regulation of the intensity of the LEDs and create the flicker effect.
Burning the code In order to burn the code in the ATtiny25, and considering building more than one object, I built a small programming shield, instead of just using a protoboard and needing to check and recheck the wiring every time.
The programming shield is based on the tutorials by Viktor S at Hackster.io and NotoriousRapper2Chainz at instructables, with an extra LED in the pin 9 of the Arduino, used as feedback and a second LED connected to the ATtiny pin 4 to check that the ATtiny is working as expected by running a test sketch.
In order to program the ATtiny25, four steps are required:
- Install the package extension for ATtiny microcontrollers:
Arduino > Preferences > Additional Boards Manager URLsand paste
https://raw.githubusercontent.com/sleemanj/optiboot/master/dists/package_gogo_diy_attiny_index.json. This step is needed only once.
- Transfer the ArduinoISP code to the Arduino board. ArduinoISP is included in the standard Arduino IDE release in
File > Examples > 11.ArduinoISP. This step is needed only once.
- Choose the chip
Tools > Board > DIY ATtiny > ATtiny 25and burn the bootloader
Tools > Burn bootloader. This step is needed once per chip we want to program. To burn the bootloader, make sure
Tools > Use Bootloaderis set to
- Upload the ATtiny code to the microcontroller. To upload the code, make sure
Tools > Use Bootloaderis set to
no. The sketch
arduino/attiny_testavailable at the GitHub repository can be used to check that everything is working as expected.
The code The code is based on the article Twelve PWM Outputs from an ATtiny85 by David Johnson-Davies and includes the function to generate pseudo-random numbers developed by Rob Tillaart and published in the Arduino forum.
Johnson-Davies' code interprets an array of 12 integers as the intensity of each LED, using those values to adjust the duty cycle of the PWM while charlieplexing. In my case, I update the array every 10 milliseconds to achieve the flicker effect. In the current version, the LEDs are always lit at 12.5%. There is a 1 in 128 chance that a LED will light at 25% and a 1 in 1024 chance that it will light at maximum level. These values produce slight lighting intensity variation but do not distract or blind the user.
The final version uses 910 bytes (44%) of program storage space and 29 bytes (22%) of dynamic memory.
Initially, I had tried randomly changing the light intensity, but the effect was similar to a faulty power connection. A second version turned the panel into "Christmas lights" and it was also discarded.
- As there are spare pins, a button could be added to allow a choice of operating modes.
The resulting object measures approximately 142x87x14mm and consists of three layers of glossy black acrylic 4mm thick and one layer of mate black / white laminate 1.6mm thick.
Laser cutter configuration An Epilog Fusion M2 60w laser cutter was used for cutting, with the following configuration:
Raster laminate / acrylic Speed: 90% Power: 60% Freq: -
Cut laminate Speed: 10% Power: 100% Freq: 100
Cut acrylic Speed: 6% Power: 100% Freq: 100
Layer 1: Front Panel The front panel is made of laminate, so when you rasterize the texts and lines, the black layer disappears, leaving the white layer visible. This panel has to be made in two independent passes. In the first one, the texts and lines are rasterized. Then, the piece is covered with painter tape and the holes for the stars and the panel are cut. If the cut is made without covering the part, the laser leaves too many markings. However, if the part is protected from the beginning, the text appears blurry.
Layer 2: electronic components This layer and the following ones can be cut in the same operation. This layer includes an additional cut to embed 1) the perfboard and 2) some metal strips to keep the cover in place with magnets.
Layer 3: spacer ring The spacer ring is used to make room for the electronics, both the soldering of the LEDs and the chip and battery. To make better use of the material, the spacer ring is cut into pieces, although this makes the assembly slightly more difficult.
Layer 4: back cover The cover hides the electronics. It has two magnets glued to hold the cover in place. The back cover does not have an SVG template as such, I reuse the main template by erasing the contents of the front panel and leaving only the cutting shape.
Assembly The assembly starts by gluing the copper tape, soldering the electronic components and soldering the perfboard. The next step is to glue the spacer ring. With the ring in place, we can glue the metal strips and the magnet. To diffuse the light and hide the LEDs, we glue a piece of tracing paper on the front to the layer 2 + 3. Finally, we glue the magnets.
- Magnets are placed manually.
- The assembly process is cumbersome: each part of the ring is glued separately, requiring precision and patience. A ring cut in a single piece, even if it wastes acrylic, it makes assembly easier, and will allow automatic magnet placement.
- The black layer of the laminate used is very thin, so even surface scratches uncover the next layer.
- Using some kind of supporting structure will provide it with more stability, and it may hold the back cover in place, thus avoiding the use of magnets.
- Improve the battery holder.