fab​.s‑ol.nu

cool experiments with shaders

electronics design

main assignment - board design

This week I am designing a small board around the ESP-WROOM-32 module. The ESP-WROOM-32 is a very feature-rich module, containing two CPU cores, a WiFi and BLE radio, capacitive sensing (and many other) peripherals, and supports running in a low power operation mode.

I am designing a control panel for IoT lights around it to control the (Philips Hue brand) smart lights in our home with.

On the board there will be a rotary encoder with a builtin switch (Bourns PEC11R), six 3535 RGB LEDs (WS2812B-mini), and the necessary Serial connection header and boot/program switches.

I have used the LEDs and encoder with an FPGA before, and done some basic capacitive touch sensing on the knob via the mounting pins and the conductive shaft of the encoder. I’m hoping to use the advanced capsense peripheral of the ESP32 to wake the board up when it is touched, so that it can be used immediately.

For the board design, I am using KiCAD. Here is the schematic:

The reset and programming circuit is taken directly from Neil’s hello-board design. The WS2812Bs are connected to a random I/O pin, since the ESP32 has extensive I/O MUX capabilities. The encoder signals are passively filtered using the recommended filtering network from the datasheet, and routed to inputs that are accessible to the low-power processor (RTC pins). This way I will have full flexibility with regard to powersaving features when I get to the firmware development phase.

After some trial and error, I managed to lay out the whole board on a single layer without any jumpers (or jumper resistors). This took quite a while and multiple redesigns, but I’m pretty happy with the result. Here are renders of the full board:

I also used the excellent InteractiveHTMLBOM Kicad plugin to generate this interactive BOM/board view.

And the individual layers (traces, through-holes, outline; SVG with mm units):

I exported these using the File > Export > SVG feature in pcbnew:

The through-hole and outline SVGs need some post-processing in Inkscape to be usable with mods; In the drill file (which is simply the B.Cu layer showing the pads and holes), all the drilled holes have to be colored black (slots have to be converted to filled shapes using Path > Stroke to Path). Then the pads around the holes can be deleted.

For the outline image, the outline first has to be converted to a complete shape. First everything should be ungrouped. Then, with all parts of the path selected, they can be merged using Path > Combine. However this doesn’t create a filled shape yet: using the Edit paths by node tool, all vertices have to be selected and then joined using the Join selected Nodes button. At this point a solid shape should be visible after adjusting the Fill color and alpha. Now a rectangle can be created using the rectangle tool. It should span over the whole document and be filled in black. It can then be sent to the background. Finally, with both the rectangle and the board shape selected, applying Path > Difference should leave you with a black canvas and the board outline as a solid white shape, ready for mods.

The SVGs can then be milled out using the default mods programs: The outline and drill paths both use the ‘outline’ preset, and in fact could be done in a single pass, the two files are only separate to ensure proper ordering: while the through-holes are milled, the board should be fixed securely still.

The original fabmodules.org implementation for Roland MDX machines supported the MDX-15, MDX-20, MDX-40 and SRM-20 via a dropdown list. When mods was created, the general structure was reused, but apparently only the MDX-25 variant was implemented.

In the end, there are only very small differences between the different models: the MDX-15 and MDX-20 have a lower resolution (0.025mm) whereas the MDX-40 and SRM-20 make steps of 0.01mm. Since the RML file format describes positions in terms of machine steps, the NC code has to be generated taking the correct scale factor into account.

Apart from the step size, the only other value that differs in is the home position. Once I found this information in the original source, I could update the new implementationto also support all of the four models. This patch has been applied to the mods community edition, which you can try out online: fabfoundation.github.io/mods.

Unfortunately, due to the ongoing health crisis I do not currently have access to the lab, and so fabbing the board has to wait currently.

When I returned to the lab, I could make the board with the toolpaths generated using fabmodules (see above) and stuff it. I decided to use solderpaste and a hot-air rework station, since the ESP32 has very small castellated pads (and even a completely covered ground pad on the underside).

kludges

It turned out that we didn’t stock the voltage regulator in the size that I had designed for, so I went up one size and used some copper enamel wire to connect the output paddle to where it was supposed to go.

I also realized that I did not have the 3535 WS2812B-minis that I thought I did anymore. Instead, I found an Adafruit Neopixel ring which complimented the size of the aluminum knob I was going to use well. Since they use the same protocol, I simply left the LED pads unpopulated, and hooked up 3.3V, ground and the data-in pin with more enamel wire:

I also laser-cut a case that clamps down on the PCB from both sides and holds the LED ring and encoder in place:

During bringup I noticed another mistake: the GPIO12 pin I used as the A-input for the encoder’s quadrature signals is actually a bootloader pin, and if it is pulled high when the chip is powered, the board cannot be flashed. I fixed this by cutting the old trace between the filtered encoder output and the GPIO pin (IO12) and instead connecting it to IO25 with more copper enamel wire.

bringup

Since the main circuitry of this board is based on Neil’s ESP32 hello board, the programming process is the same: the slide switch selects whether the board will wait for new code or boot the application on the next reboot. After changing its position, the board has to be reset either by power-cycling or pressing the reset button.

Like for the ‘later’ embedded programming projects (that I actually finished before this work, during lockdown), I used the esp-idf toolchain. With the board connected with a TTL-232R-5V FTDI USB-Serial cable and in flash-mode, make flash is enough to build and upload the project. See the linked log for more information on setting up esp-idf).

This little clip shows everything the hello board does: It lights up the LED ring in all hues, with one LED being off. By turning the knob, the LED that is turned off can be rotated around the ring. While the knob is touched, the saturation of all LEDs is increased. When the knob is pressed down, a rainbow cycling animation is played back.

files