HackerBox 0059: Tessellate

Introduction: HackerBox 0059: Tessellate

Greetings to HackerBox Hackers around the world!

With HackerBox 0059 we'll explore inductors, construct a clever inductance meter, wind custom inductors, program the USB Digispark to control the excusive Hack-O-Lantern ornament, configure the WEMOS ESP32 Lite for use with the Arduino IDE, integrate a high resolution 3-axis accelerometer, and assemble tessellations of triangular PCB tiles into both flat and 3-dimesional geometries.

HackerBoxes is the monthly subscription box service for enthusiasts of electronics and computer technology - Hardware Hackers - The Dreamers of Dreams.

There is a wealth of information for current and prospective members in the HackerBoxes FAQ. Almost all of the non-technical support emails that we receive are already answered there, so we really appreciate your taking a few minutes to read the FAQ.

Supplies

This Instructable contains information for getting started with HackerBox 0059. The full box contents are listed on the product page for HackerBox 0059 where the box is also available for purchase while supplies last. If you would like to automatically receive a HackerBox like this right in your mailbox each month with a $15 discount, you can subscribe at HackerBoxes.com and join the revolution!

A soldering iron, solder, and basic soldering tools are generally needed to work on the monthly HackerBox. A computer for running software tools is also required. Have a look at the HackerBox Deluxe Starter Workshop for a set of basic tools and a wide array of introductory activities and experiments.

Most importantly, you will need a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. Take each step slowly, mind the details, and don't be afraid to ask for help

Step 1: Hack-O-Lantern

HAPPY HALLOWEEN

The Exclusive HackerBox Hack-O-Lantern kit uses an onboard USB Digispark as its controller and USB power connector. Two addressable RGB LEDs serve as frightfully colorful eyeballs and a piezo buzzer produces truly horrifying sounds.

Step 2: USB Digispark

The Digispark is an ATTiny85 based microcontroller development board similar to the basic Arduinos, only smaller and a bit less powerful. The Digispark is a great place to jump into microcontrollers, or perfect for when an Arduino is too large or simply overkill.

BEFORE SOLDERING to the USB Digispark, test the module out on its own and make sure your tools are set up to program it correctly. Follow the instructions under "Original Digispark - Getting Started" on the Digispark Documentation Wiki to set up support for the Digispark in the Arduino IDE. Next load some initial blinky LED sketches onto the ATTiny 85 to get oriented to the board.

Note that the Digispark does not have any dedicated hardware to connect to USB. Instead, the Digispark comes preloaded with Micronucleus to bit-bang USB signals from software. Micronucleus is a bootloader designed for AVR ATTiny microcontrollers with a minimal usb interface, cross platform libusb-based program upload tool, and a strong emphasis on bootloader compactness. It is, by far, the smallest USB bootloader for the AVR ATTiny.

Step 3: Assemble and Program the Hack-O-Lantern

Hack-O-Lantern LED Eyes

Solder two WS2812B RGB LEDs onto the front side of the PCB for eyes. Mind how the LEDs are orientated or they will not operate correctly. The white triangle corners of the LEDs go in the upper left corner on the PCB landing as shown by the red triangles on the image above. As can be seen in the example code, the data pin for the LEDs is attached to I/O P0 of the Digispark.

Hack-O-Lantern Squawk Box

Solder the buzzer onto the back of the PCB with the dot designating pin one oriented down closest to the "+" symbol on the silkscreen.

As can be seen in the example code, the the buzzer is attached to I/O P2 of the Digispark.

Hack-O-Lantern Brain

Solder both rows of header pins onto the USB Digispark module such that the pins extend from the rear of the Digispark (opposite side from the components). After the headers are soldered in, carefully slide the plastic spacers off of the headers. This will allow the Digisark to sit flush against the back of the Hack-O-Lantern. Mount the Digispark onto the BACK of the Hack-O-Lantern PCB. While wearing safety glasses, trim the leads (nearly) flush on both sides of the Digispark and the Hack-O-Lantern. Touch the soldering iron very briefly to the freshly cut header "wounds" to make them smooth with solder.

Hack-O-Lantern Program Code

From the Arduino IDE, program the USB Digispark with the HackOLantern.ino sketch included here. Stand the Hack-O-Lantern up into a USB power pack for a horrifying Halloween display!

Step 4: WEMOS ESP32 Lite

The ESP32 is a low-cost, low-power system on a chip (SOC) with integrated Wi-Fi and dual-mode Bluetooth.

Make your initial test of the WEMOS ESP32 module BEFORE soldering the header pins onto the module.

Set up the ESP32 support package in the Arduino IDE.

Under tools>board in the Arduino IDE, select the "WeMos LOLIN32"

Load the example code at Files>Examples>Basics>Blink and program it to the WeMos LOLIN32

The example program should cause the LED on the module to blink. Experiment with modifying the delay parameters in the sketch code and re-programming it into the module. This will make the LED blink with different patterns. This is always a good exercise to build confidence in programming a new microcontroller module.

Once you are comfortable with the module's operation and how to program it, carefully solder the two rows of header pins into place and test program downloading again.

Step 5: Inductors

An inductor (wikipedia) is also known as a coil, choke, or reactor. It is a passive two-terminal electrical component that stores energy in a magnetic field when electric current flows through it. An inductor typically consists of an insulated wire wound into a coil around a core. When the current flowing through an inductor changes, the time-varying magnetic field induces an electromotive force (voltage) in the conductor, described by Faraday's law of induction. According to Lenz's law, the induced voltage has a polarity (direction) which opposes the change in current that created it. As a result, inductors oppose any changes in current through them.

Step 6: Inductance Meter Kit

Components:

  • Green Prototyping Board 4x6 cm
  • LM393 Comparator IC (8 Pin DIP)
  • 1uF Poly Film Capacitor
  • 1N4001 Diode
  • 330 Ohm Resistor
  • 150 Ohm Resistor
  • Six Red Header Pins
  • 330uH Toroid Inductor

The Inductance meter can be assembled on a prototype board as shown, which is always good practice, or it can be assembled on a solderless breadboard if you prefer. The meter works with pretty much any microcontroller at either 3.3V or 5V including the WEMOS ESP32, or just about any Arduino Board.

The attached Arduino Sketch (L_Meter) has two pin defines (kickpin 27 and sensepin 26) which can be updated to whichever pins are used with the meter circuit.

Test the Inductance Meter with the 330uH Toroid Inductor. It should measure within 10-20uH of the nominal value.

Theory of Operation

The MCU drives the "kickpin" high to charge up the LC tank circuit. L is the unknown Inductor (Device Under Test) and C is the 1uF Poly Film Capacitor. When "kickpin" in released to low by the MCU, the LC tank will ring at a frequency determined by L and C. This frequency can be measured by turning the ringing sinusoid into square pulses using a fast comparator IC. The square pulses are read into the MCU at sensepin and the measured pulse frequency allows us to calculate L.

Mechanical Analogy

The LC portion of the circuit is a resonator, just like a mass on a spring, or a bob on a pendulum. You can set up a pendulum and "kick" it so that it swings back and forth. The period of the swing (or "ringing") can be measured with a stop watch. Since the period is sqrt(L/g) and g is a constant of gravitational acceleration, the measured period allows us to calculate "L" which is the length of the pendulum. It doesn't mater how high you displace (kick) the pendulum or how much mass is on the end since it will have the same period regardless. Likewise, it doesn't mater how much we charge the LC tank circuit (for example, with 3.3V or 5V) prior to letting it ring to time its period.

DIY Inductors

While it is a bit difficult, or at least unorthodox, to make our own resistors or capacitors, we can easily wind custom wire inductors. For example, try winding about 200 turns of the copper magnet wire onto a PVC pipe, large pill bottle, dowel, or film canister. Check the inductance with the meter. Compare it to the theoretical value by entering the coil diameter, coil length, and number of turns of your DIY inductor into this calculator. The measured and theoretical values should be quite close.

Step 7: Tessalation

Tessellation (wikipedia) is covering a flat surface using one or more geometric shapes, called tiles, with no overlaps and no gaps. In mathematics, tessellations can be generalized to higher dimensions and a variety of geometries.

A periodic tiling has a repeating pattern. Some special kinds include regular tilings with regular polygonal tiles all of the same shape, and semiregular tilings with regular tiles of more than one shape and with every corner identically arranged.

We will focus on tiles approximating equilateral triangles like the black PCBs rendered in the image above.

Step 8: Assemble the White Triangle Tile

LEDs

Solder six WS2812B RGB LEDs onto the front side of the white tile. Orient each LED such that the white triangle is in the corner with the small flag designator on the silkscreen placement of the LED.

Triple Axis Accelerometer

The ADXL345 (datasheet) is a tiny, low power, 3-axis MEMS accelerometer with high resolution (13-bit) measurement. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface. The ADXL345 is well suited to measure the static acceleration of gravity in tilt-sensing applications.

Mount the ADXL345 module on the rear side (opposite the LEDs) of the white tile. Orient the module such that the VCC and GND markings of the module align with those on the tile PCB. Similarly, the SCL and SDA pins of the ADXL module align with the IO16 and IO17 markings on the tile PCB. Once solder into place, trim the header pins of the AXDL module on the front side of the white tile since this is where the ESP32 module will be placed.

WEMOS ESP32 Lite

Carefully solder the two rows of header pins from the ESP32 module onto the front side of the white tile. Once soldering into place, program the attached sketch TiltColors to demonstrate basic control of the LED colors by tilting the tile.

Step 9: Interconnecting Tessellated Circuit Boards

Each of the black tiles has six WS2812 RGB LEDs in a chain on the front of the PCB. The chain is fed from the data in (DIN) pad. The end of the chain continues to either DOUT-A or DOUT-B depending upon how the A/B "switch" is set. The setting is made by bridging a blob of solder (or a tiny length of wire) from the center pad of the "switch" to the pad labeled A or B (but never both).

Whichever DOUT pad is select is aligned with the DIN of the neighboring triangle. This allows a path through multiple tiles to be traversed. The arrows in the diagram show examples of the LED data path being properly connected among a tessellation of triangular tiles. The last black tile in the chain should have neither A or B shorted in the A/B "switch".

All of the edge pads should be jumped between neighboring tiles. The center pad contains the LED data signal (if selected) and the outer four pads connect power and ground. The jumpers can be made with short pieces of stiff wire, such as the included magnet wire. When using magnet wire, the thin insulating coating can be removed using a blade or sandpaper to allow solder to flow onto the metal.

Remember to update the "number of LEDs" specified in the code to six times the number of connected tiles. There is also a for loop at the very end of the file in the function UpdateLEDs() that cycles through the first six LEDs setting the colors. This should be updated to however many LEDs you want to light up. However, you might not want to light up all of the LEDs at once unless you keep the brightness very low or use a beefy power source. Large numbers of brightly lit LEDs can draw a lot of current.

Step 10: Platonic Solids

A platonic solid (wikipedia) is a three-dimensional, regular, convex polyhedron. It is constructed from congruent (identical in shape and size), regular (all angles equal and all sides equal), polygonal faces with the same number of faces meeting at each vertex. There are five solids that meet these criteria. They are the tetrahedron, cube, octahedron, dodecahedron, and the icosahedron.

In addition to flat tessellations, our triangle PCB tiles can be arranged three-dimensionally into any of the three platonic solids having triangular faces: the tetrahedron (4 faces), octahedron (8 faces), or icosahedron (20 faces). The flattened "nets" of those three solids in the image illustrate example "connected path transversals" that can be used to route the LED signals (DIN/DOUT) through each face once and only once.

A lithium polymer (LiPo) battery can be connected to the WEMOS ESP32 Lite board and placed inside the polyhedron before the tiles are soldered together.

While they are generally not required, the two 1000uF can be placed into the center of two of the black tiles to smooth out the power supply. The capacitors can be placed inside the polyhedron. The polarity of each capacitor must be aligned with the "+" marking on the PCB silkscreen.

When used with tiles in a polyhedral geometry, the example code could be modified such that each face is a different color and the colors respond to the tilt sensor or "rolling" of the polyhedron like a die.

HackerBox 0059 Expansion Pack

While enough tiles are included in HackerBox 0059 to construct the tetrahedron or octahedron, 12 additional black triangle tiles (and associated LEDs) are required to construct the icosahedron. A very limited number of expansion packs providing these extra parts are available for sale here.

Musical Instrument Challenge

In addition to the LED colors shifting in response to the IMU as you rotate the object, we could use some sound effects! The ESP32 supports Bluetooth which can be used to turn your 3D tessellation into a MIDI instrument that generates notes as it is rotated.

MIDI (Musical Instrument Digital Interface) is a technical standard that describes a communications protocol, digital interface, and electrical connectors that connect a wide variety of electronic musical instruments, computers, and related audio devices for playing, editing and recording music. The specification originates in a paper published all the way back in 1981. (Wikipedia)

Adafruit Guide on Web MIDI and BLE MIDI

BLE MIDI Demo for ESP32

Step 11: Hack the Planet

We hope you are enjoying this month's HackerBox adventure into electronics and computer technology. Reach out and share your success in the comments below or other social media. Also, remember that you can email support@hackerboxes.com anytime if you have a question or need some help.

What's Next? Join the revolution. Live the HackLife. Get a cool box of hackable gear delivered right to your mailbox each month. Surf over to HackerBoxes.com and sign up for your monthly HackerBox subscription.

Halloween Contest

Participated in the
Halloween Contest

13 People Made This Project!

Recommendations

  • Stone, Concrete, Cement Challenge

    Stone, Concrete, Cement Challenge
  • Summer Fun: Student Design Challenge

    Summer Fun: Student Design Challenge
  • DIY Summer Camp Contest

    DIY Summer Camp Contest

61 Comments

0
laveur
laveur

9 months ago on Step 11

If you're a Mac user be really careful. The Tessalation part of this month took out a USB-C port and is no longer charging my battery.

0
eburman
eburman

Reply 4 months ago

Too late now, but for future reference it's wise to always check your circuits on an independent power supply before plugging it into your computer just in case something is shorted. I believe that Macs have a protection circuit that kicks in when too much power is being drawn. I've seen it work on my Mac before. I guess it's not fool proof though. Sorry that you wrecked your expensive Mac.

0
churchjw
churchjw

Question 5 months ago on Step 5

Does anyone have a better pin out for the Inductance Meter? New to this and can't figure which pin goes where on the chip. I see where the traces go but not what pin on the chip they are on. Thanks

0
HackerBoxes
HackerBoxes

Answer 5 months ago

The pin numbers are shown in the image for Step 6. You can also google the LM393 chip to find a datasheet but the info you need is in that image. The pins for whichever MCU you are using just have to match the ones specified in the code.

0
churchjw
churchjw

Reply 5 months ago

Thanks for the help but I guess what I am actually asking is best shown in this image.

FSVAKAWKFV4815F.png
0
HackerBoxes
HackerBoxes

Reply 5 months ago

That one is pin 1 (with pin 8 straight across from it). You are correct that isn't totally obvious. Some clues though:

The 330 ohm resistor (orange orange brown stripes) is adjacent to, and connected to, those two pins (1 and 8). The 330 ohm resistor is shown in the schematic to connect between pin 1 and pin 8.

Also the "unknown inductor" and 1uF cap are connected to the 1,2,3,4 side of the chip. While the other side of the chip only has connection to pin 8 (going over to the VCC header pin).

0
churchjw
churchjw

Reply 5 months ago

Thank you so much That was exactly what I needed.

0
anthonywylam
anthonywylam

7 months ago

I never got more than mixed results post white board. I could get the white triangle working as intended but the other boards never really worked for me. I have used parts from this box in many other projects to make my wife ooh and ahh at the pretty colours.

0
DavidS926
DavidS926

Tip 8 months ago

For larger projects (the icosahedron) the ESP32 may not be powerful enough to light the entire strand at full brightness. This may result in weirdness in the display or in a "red-out" where everything just dumps to a dim red color. To verify that this is your problem check the temperature of the ME6211 voltage regulator. It's location on the ESP32 is shown in the picture at the top of step 4. I don't recommend checking this temperature directly with your fingertip. (Guess how I learned that!)

There are a couple of ways to fix this:

1) Dim the LEDs-
Add these lines to your TiltColors.ino sketch
(to show line numbers in the Arduino IDE, go to "File", "Preferences")
-In your "define" section, maybe at line 45, add:
#define BRIGHTNESS 32

-in void setup(), after you Initialize LEDs, maybe at line 129, add:
FastLED.setBrightness(BRIGHTNESS);

In the FastLED library, .setBrightness is a number from 0 to 255. a value of 32 is 1/8 brightness. You can reduce and increase the value of BRIGHTNESS in your #define statement until you find a value that is maximum brightness without overheating. You may have to let the board cool between attempts.

2) Swap the board-
I switched the white triangle board out for an Arduino UNO, and later an Arduino Nano, to power the whole set. I haven't adapted it for the ADXL345 accelerometer, although it seems like you easily could. Wire the data pin of the Arduino to the "DIN" pad of your first black panel. The ground pin of the Arduino wires to either of the pads closest to the point of the triangle. Wire the 5V pin of the Arduino to one of the pads on either side of the "DIN" pad.

YES THE 5V PIN!

These little lights love 5V! Since your USB cable is giving the Arduino 5V to begin with, the board doesn't have to shed as much heat through the voltage regulator, keeping the entire project more stable. Also, 5V will have a lower relative voltage drop-off along the length of the wire to the last LED.

If you try this, there are two great example sketches that look awesome on the finished project. I started with "strandtest" from the AdaFruit NeoPixel library. More recently I moved to "DemoReel100" from the FastLED library. (Thanks @TimGTech!)

Note that your total NUM_LEDS needs to be reduced by 6 when you ditch the white triangle.

3) Directly power the LEDs-
I include this one only because I looked into it and decided against it. Someone with more patience than me might get it working.

You could etch the white triangle in two places on the back (accelerometer side) to break the 3V connection to the LEDs. You could then wire in 3V directly to the +V pad while bypassing the regulator on the ESP32. But even if you tapped the power of the USB input, you would still have to add your own 3V regulator with its own heatsink. You also couldn't power the board from the LIPO without some additional handiwork.

Another thought was to just power the lights from a 5V tap. But then your data signal is still 3V coming out of the ESP32. AdaFruit recommends a logic-level converter to make this work. Again, that exceeded my patience. Plus, where would you get that 5V from if you wanted to use the LIPO?
Ultimately, I went with option 2, and I'm very pleased.

A HUGE thank you to HackerBoxes for a fun and amazing kit. I knew NONE of this stuff 4 weeks ago. I had NEVER surface-mount soldered anything, much less these little guys. I have learned so much and had a great time doing it! Well done, Hackerboxes!

0
stu228160
stu228160

8 months ago

i dont speck smart

0
CrittersWeb
CrittersWeb

9 months ago

I tested the entire magnet wire coil on the spool and here's what I was getting:

High for uS:51.00 frequency Hz:9803.92 inductance uH:263.54
High for uS:50.00 frequency Hz:10000.00 inductance uH:253.30
High for uS:51.00 frequency Hz:9803.92 inductance uH:263.54
High for uS:51.00 frequency Hz:9803.92 inductance uH:263.54

I didn't measure the width and length of the spool and have no idea how many coils is on it, but I suppose that is about right. Maybe I have enough information, after measuring width and height, to calculate number of coils.

20201023_000622.jpg
0
Bob5920
Bob5920

9 months ago

Great Box this month! I built everything and it all eventually worked, some due to a slight error with the TiltColors script. Thanks for everyone's feedback on the fix. I added a battery to the Octahedron, which worked great. As a do over I would secure it inside. I also like these projects that you can further experiment with changes to the software.

1
DavidS926
DavidS926

Tip 9 months ago

I had the worst time soldering the tiny LEDs on the boards until I made a jig out of some thin cardboard.
Tin one of the pads with an oversized glob of solder.
Load one of the LEDs into the jig and slide it into position.
Hold the iron on the solder glob and slide the LED into position.
Pull the solder iron away and let the solder cool before you move the jig.
Then solder the other pins before coming back to touch up the pin with the glob on it.

LED Jig.jpg
0
eric.hokanson
eric.hokanson

Reply 9 months ago

Nice idea! Wish I thought of this while soldering the left LED eye on my hack-o-lantern; couldn't get the LED to work and I reworked it so many times I melted off one of the pads.

1
lmperkins
lmperkins

Reply 9 months ago

Fine point tweezers are really good for this.

1
DavidS926
DavidS926

Reply 9 months ago

That's what I thought orginally, but I either have crappy tweezers or crappy fine motor skills, because these little lights kept flying out of the tweezers.

0
petronivs
petronivs

Question 9 months ago on Step 9

What types of wire are best for the jumpers between the panels? Would stainless steel rings work, or am I best off sticking with copper?

0
TimGTech
TimGTech

Answer 9 months ago

If you have spare header pins they work fantastic! You can cut and bend them to any angle you need.

0
mrGman123
mrGman123

Answer 9 months ago

I found 22 AWG solid hookup wire cut to 1.5mm length works great.

0
HackerBoxes
HackerBoxes

Reply 9 months ago

The magnet wire on the spool in the box works well. You do have to strip (scrape?) the enamel insulation off the magnet wire anywhere that you want solder to flow.