Author: BlockWorker

  • BlockBox v1: The Conclusion?

    With the end of the BlockBox v1 build, I had finally accomplished my long-time ambition of building my own Bluetooth speaker – it really felt like I had reached a new level in my electronics projects, with the ability to build more complex systems.

    Let’s summarise the features of the completed speaker:

    • Two-way cross-over speaker system
    • 100W 6.5″ bass/midrange driver
    • Two 15W tweeters
    • -3dB bass roll-off frequency around 72Hz
    • Theoretical maximum sound pressure level around 110-113dB (@ 1m)
    • Bluetooth audio playback (SBC or AAC), effective range ~10-15m
    • (Roughly) music-synchronised LEDs
    • 166Wh battery (in practice, lasts for more than 10 hours of continuous playback)
    • Battery protection and fast charging
    • External USB (5V 1.5A) for phone charging
    • Optional analog AUX input (not implemented due to lack of practical need)
    • Diagnostics LCD for showing battery and Bluetooth status

    Sure, there are many imperfections and mistakes in the design, as is expected for my level of experience at the time, and I tend to focus on these imperfections too much myself when looking back at it.

    But taking a step back, looking at the bigger picture of what I built in the BlockBox v1 – I’m very proud of it overall. It’s a powerful, functional, portable speaker, and while its audio quality isn’t “hi-fi” by any means, I would also never call it bad, it’s certainly good enough for most use cases.

    However, just being proud of it was apparently not quite enough for me. Yes, it was a good achievement for me, but I wasn’t quite satisfied. The bass roll-off was too high for my taste, the button control scheme was too basic, and the low-volume audio output was too noisy.

    And thus, just a few months later, the BlockBox v2 project was born.

  • BlockBox v1: The Build

    The first part of the BlockBox build process was the circuit board. Once my custom boards arrived, along with the components for them, I decided it would be best to build and test the power supply circuits first.
    Because battery management is not trivial in itself, I would start with external adapter power – which I needed to get from somewhere. So, it was time to modify my laptop power supply, adding a compatible connector.

    With that done, I could solder the necessary components for basic power path.
    This was followed by constructing the main switching power supplies (52V, 12V, and 5V), allowing me to test that they work and produce the desired voltages.

    Next, I added the Bluetooth module and auxiliary controller, as well as the corresponding connectors and support components.
    I also soldered the power amplifier chip, since its small pin pitch would make it annoying to solder with more components in the way later.

    To do any real testing, I would also need the user buttons mentioned in the previous post. They were soldered on a separate little board, to be inserted into the enclosure later.
    I chose some nice tactile buttons with LED backlights. They also support custom labels to be inserted into them, for which I took some printable transparent foil, resulting in presentable, self-explanatory buttons.

    After adding the rest of the analog audio path and amplifier output stage, the circuit was ready for testing and firmware development.
    And yes, some of the power amplifier output components (especially the inductors) were severely undersized in hindsight, leading to more distortion at high power.
    As you can see, the amplifier also got a heat sink, along with a temperature sensor and a temperature-controlled fan, which worked quite well.

    During firmware development, I also realised that my initial idea for LED music synchronisation didn’t work – so I had to work around it, and the results were quite mediocre, but still did work somewhat.

    Finally, all that was left was the battery protection and charging circuit, as well as some transistor heat sinks, and we have a complete and working circuit board!

    Speaking of the battery – that needed some assembly as well. I ordered 16 Li-ion cells (in the standard 18650 size) with pre-installed spot-welded nickel tabs. To keep them arranged nicely and safely, I also got some plastic cell spacers.

    These cells were then arranged into four groups of four, creating the desired 4s4p (four series, four parallel) configuration.
    I soldered the four parallel groups together, before using some solder wick to connect them in series.
    Soldering isn’t ideal, as it could overheat the cells – spot welding is the way to go, but needs tools I don’t have, so I just had to carefully solder the nickel strips – it ended up working out quite well.

    Now I could get to the last piece of the puzzle: The enclosure.
    I didn’t have access to the ideal tools for such a build (CNC mill, or at least woodworking power tools) – so I made everything by hand out of plywood stock, using a drill, various hand saws, files, and sandpaper. The resulting cuts were far from perfect, but good enough for this project.

    For the RGB lighting, I glued RGB LED strips to some acrylic rods, before gluing everything (except for the back wall) together to create the enclosure (just missing the side compartment in this image).

    The only thing left to do now was to install all of the components inside it, and I had a complete BlockBox!

    This would be the time to say something along the lines of, “That concludes the BlockBox project, thank you for reading”.
    But… let’s not rush it.

  • BlockBox v1: Electronics

    One reason why I initially dismissed a Bluetooth speaker project as “too complicated” was, put simply, the Bluetooth part of it. At the time, I barely understood most conventional electronics, so the idea of getting involved with something as complicated as RF communication seemed completely out of my reach.
    Looking back, I was absolutely right about that feeling – trying to design my own Bluetooth receiver would have been a bad idea. Even years later, at the time of writing, I’m not sure I could succeed at that task, unless I spent many more hours researching the topic – and even then, it would be quite a lot of work for a single person, due to the hardware and software complexity involved.

    In light of this, there was only one thing that made me feel confident in pursuing this project anyway: Discovering the existence of Bluetooth audio modules – in particular, for this project, it was the Microchip BM62.

    I found that such a module struck the perfect balance: It satisfied my desire to have the system be “designed by me” to an acceptable degree, while abstracting away the complicated task of maintaining Bluetooth links and sending/receiving wireless audio data, instead providing a relatively simple interface.

    For simplicity, the module has an integrated digital-to-analog converter (DAC), directly outputting the raw audio signal. In my design, this signal would then pass through an analog pre-amplifier and filter circuit, conditioning the signal to the levels I wanted and implementing the driver cross-over (at around 5000Hz).
    The last amplifier stage included trimmer potentiometers, allowing me to adjust the maximum output levels, in order to not overdrive and damage the speaker drivers.

    Looking back at it, this was not a great design by any means – the op-amps I chose are quite noisy, I was using Class-2 ceramic capacitors (which cause distortion), the voltage supplies were not designed with noise reduction in mind at all (likely the biggest single mistake I made here), and so on. But, despite that, it did still work – which is all that mattered to me for this first design.

    The pre-amp/filter stage was followed by a power amplifier – namely, the Texas Instruments TPA3255. It was configured in 2.1 channel mode, with two single-ended channels for the tweeters and a differential high-power channel for the bass/midrange driver.

    Aside from the audio path, I needed a power supply. This was based on a large lithium battery (4s4p configuration), with corresponding battery protection, balancing, and charging ICs.

    With the base battery/adapter voltage available, I now needed multiple voltage converters to generate the various system voltages (3.3V, 5V, 12V), as well as a high-power voltage rail for the power amplifier (52V, which turned out to be overkill for these drivers).
    For the design of these converters, the Texas Instruments WEBENCH Power Designer proved invaluable, especially for a beginner without any switching power supply design knowledge.

    For controlling the speaker, I again decided to go with the easiest option, letting the Bluetooth module’s integrated controller operate on its own, controlled using a set of buttons.
    Aside from that, I just added a low-performance microcontroller (Microchip PIC18 K42 series), to handle auxiliary tasks like battery charge estimation, diagnostic display (using a text LCD), and controlling some RGB LEDs that I wanted to sync to the music.

    Since I only had a soldering iron available (no hot air or reflow tools), I ended up being quite limited in terms of component selection. Thankfully, I was able to find everything I needed in “soldering-iron-friendly” packages, but it did mean choosing suboptimal components in many cases.

    Some design work later, I placed and routed everything onto a single 12 x 12 cm PCB.

    The full schematics and PCB design files (for Autodesk EAGLE) are available on GitHub here.
    However, be aware that this design is NOT GOOD overall, containing many beginner mistakes, and the firmware code quality is likely bad for the same reason. Therefore, I do not recommend that anyone actually use these designs, but they may be useful for anyone who’s curious.

    With the electronics designed, it was time to begin the actual build!

  • BlockBox v1: Speakers and Enclosure

    As I started my research into designing the BlockBox, I realised one thing: Speakers are really complicated.
    So many speaker drivers to choose from, priced anywhere between affordable and astronomically expensive, with different sound profiles, efficiencies, features, and drawbacks.
    And what the hell are “Thiele/Small Parameters”?!

    Hours of research later, I figured out what most of these things mean, and found out that the final size (volume) of the speaker would play a major role in the low-frequency sound design. Since most commercial Bluetooth speakers are very small, I always imagined making one of a manageable size too – so that is what I decided on. It’d still be larger than the typical “handheld” mini-speakers, but small enough to fit in a backpack.

    Finally, I decided on a set of speaker drivers to use for this project. I wanted my speaker to be loud, so driver efficiency was very important, and my budget was quite limited, of course.
    Therefore, I went for a two-way crossover speaker, using the 6.5″ Monacor SP-6/108PRO as a bass/midrange driver, and the Monacor DT-74/8 tweeter (or, in fact, two of them – mostly for the sake of symmetry, as you will see later).

    In order to get the most out of these drivers, the design of the enclosure was quite important. Using SpeakerBoxLite, an incredibly useful free tool for speaker design, I determined that a vented enclosure with a volume of 8.7 litres would be perfect given these drivers and my size requirements.
    Combined with a port resonator of the correct size (Monacor BR-50HP), this results in a 33 x 26 x 13 cm speaker enclosure with 10mm plywood walls.

    According to the SpeakerBoxLite calculations, this should result in a flat frequency response down to 90Hz and a -3dB roll-off point of 72Hz. Not great, especially for fans of music with lots of bass (including myself), but not terrible either.
    I’m sure it’s possible to do better within the constraints of this project, but all better options I found back then were too expensive, too inefficient, or just too complicated for me, as a beginner.

    Based on this rough sketch, I created a more detailed enclosure design in Autodesk Fusion 360 – featuring all drivers, some translucent bars for LED lighting, a cutout for buttons to control the speaker, a side compartment to house a diagnostic display, the main power switch, and connectors for charging etc., and of course, enough space in the back for the battery and electronics.

    With that out of the way, it was time to move on to the electronics design.

  • The BlockBox Project

    The BlockBox Project

    Before I even started my first electronics project ever around 2017 (at age 16-17), I already had an idea on my mind: I wanted to build my own Bluetooth speaker someday.
    Why? I’m not sure myself. Maybe it was just a naive ambition of a curious teenager, maybe I just wanted to look cool at parties as “the guy who built his own speaker”, or maybe there was something else that interested me about them.

    As I was starting out with no real electronics experience and very limited knowledge, the idea of building an entire speaker by myself seemed nearly unattainable.
    I would have probably been able to make something by buying and chaining together pre-built modules (battery management, Bluetooth receiver, amplifier, etc.) – but this approach, while quite popular in beginner DIY/maker spaces, has never felt appealing to me. It just felt like it wouldn’t really be my project, but just an amalgamation of others’ (commercial) projects.
    Therefore, I put the idea aside, though it never left my head entirely.

    Eventually, in 2019, I felt ready to try my luck at actually building such a speaker, from the ground up. And thus, the BlockBox project was born.
    Looking back, I was still naive and clueless about a lot of the intricacies involved, but despite that, I feel it would be wrong to call the project anything but successful.

    Start here to read the full story of the BlockBox project.

    All chapters
  • Preview: Liquid Cooled PC Case

    Liquid cooling for my PC has been a distant dream of mine for a while, and with this project starting in late 2021, I’ve fulfilled that dream, in the best way possible: By building my very own PC case designed for liquid cooling.

    The case is mostly made of laser-cut acrylic and features an external pump and radiator, as well as integrated RGB lighting with my own self-built controller for cooling and lighting.

    When I have the time, I will, of course, create a full series of documentation posts about this project. Until then, enjoy the pictures!

  • The 8 Bit Computer – Conclusion and Outlook

    Find the introduction here.

    With that, the 8 Bit Computer project was essentially finished.

    This was my second large electronics project, and it was a lot of fun to work on. It’s difficult to consider it “completely done” (some minor issues and optional improvements remain), but I decided I’d call it done and maybe get back to it later – though that seems to be a recurring theme with all hobby projects, at least in my experience.
    Also, none of these imperfections change what this project is: A fully functional basic computer that, in my opinion, looks great, and is a nice tool to show how computers work on a basic level.

    This project was designed and mostly built before I started my university education in computer science. The experience from it helped me a lot in my first computer architecture courses, as I already knew a lot of the concepts. However, there were many things that I didn’t know prior to taking those courses, and many things I’ve learned about computer architecture that I didn’t know when designing this computer. So looking back at it, there are quite a few things I would do differently if I were to start a project like this now. Still, I am proud of it and happy with how it turned out.

    In the future, I may design a new computer, perhaps implementing some more advanced computer architecture features and avoiding some of the problems that I encountered and worked around in this one. Until then, I recommend everyone who’s interested to keep looking into this topic – there is much more to learn than what I’ve covered here!

    Until the next project!

  • The 8 Bit Computer – Instructions and Programming

    Find the introduction here.

    With the electronics finished and working, the computer now needs to be told what to do. This is realised by implementing instructions that perform small individual tasks on the computer, like moving a value between registers or adding two numbers. These instructions can then be combined to create more complex programs.

    Each of these instructions is associated with an opcode (operation code) which is used to identify the instruction in the binary program. The computer reads an opcode from memory, executes the associated instruction, then reads the next opcode, executes that, and so on. This fetch-execute cycle continues until the program ends, i.e., a special instruction tells the computer to stop executing the program.

    To the programmer, the instructions are atomic, which means they are the smallest steps the program can be divided into. However, in this computer implementation, these instructions are subdivided into even smaller microinstructions (as discussed in the “Modules, Part 5” chapter). Each of these microinstructions is exactly one clock cycle long and defines the hardware control signals that should be set for the execution of the desired behaviour. For example, to read a value from memory, first the target memory address needs to be moved to the memory address register, then the value at that memory location can be read. Some of these microinstructions are also used to implement the fetch-execute cycle (read next opcode and pass it to the control logic).

    To manage the programming of these instructions, I wrote an app in C# where you can define the control signals that exist in the computer, use them to program instructions out of microinstructions/steps, and use those instructions to write programs that can run on the computer:

    Control signal configuration window
    Control signal configuration (not all signals shown here).
    Instruction definition window
    Instruction definition and microinstruction programming.
    Assembly programming window
    Editor for writing programs using the defined instructions.

    The instructions and programs can then be written to instruction ROM or computer RAM, respectively, using an Arduino (which is controlled from this same app).

    With this, you can program the computer to do essentially anything that it’s physically capable of with the provided hardware. The program shown in the third screenshot above prints “Hello World!” to the LCD screen (bottom left). Here is a video of it running:

    To avoid waiting too long for the message to appear, the program is running too quickly for the human eye (tens of clock cycles per second), so you can’t really see the individual instructions running – but it is rather spectacular to watch the control signals (white LEDs) going crazy! If you look closely, you can see the “HLT” LED at the right light up pink at the end – this is the “halt” signal that tells the computer to stop running when the program is done.

    So with that, we have a working and programmable computer! In the final post for this project, I will discuss the end result and give an outlook of what may come next.

  • The 8 Bit Computer – PCB

    Find the introduction here.

    In the previous posts, I explained the schematics of the different modules of the computer. Based on those, I made a large PCB (printed circuit board). You can click the images to zoom in.

    Total board view (looking through from the top)
    Board top view
    Board bottom view

    As you can see, the board is quite cramped. I wanted to reduce the board size as much as possible, to save costs and make it more portable. This made signal routing quite challenging, as the through-hole component pads (green) don’t leave a lot of room for the over 2000 wire connections required. I also fit it all into 2 layers (top and bottom) – I didn’t want to use a 4-layer PCB, as it’s significantly more expensive (at this size), and I believed that it could be done with just 2. It seems that I was right.
    As expected, given this was my first dense circuit board design ever, it does contain some beginner mistakes – for example, not using any ground planes, and making power/ground traces thinner than ideal. But it’s fine, I learned from it, gained experience with PCB design, and the board did end up working anyway.

    The total board size ended up being 31.5 x 16.1 cm (12.4 x 6.4 inches), which is a lot smaller than I initially expected, considering the breadboard prototype was about 40 x 40 cm (15.7 x 15.7 inches).

    I wanted to keep the individual modules visually separated on the board, to show how the computer is made of these somewhat independent pieces working together. I went through multiple layout iterations for each module, to make it stand out as a separate entity, but still fit in well with the other modules. Additionally, I drew some thick lines on the silkscreen as rough outlines between the modules and labelled them all. The LEDs are also arranged in nice bit strings in the correct reading order, and labelled if necessary.

    Here’s the raw PCB, fresh from the friendly neighbourhood Chinese factory:

    Raw PCB Front
    Raw PCB Back

    And here are some impressions from the assembly process:

    Immediately noticed the first PCB mistake… Rather easily fixed though 🙂
    Clock and user input built and tested
    Program counter and RAM modules complete
    Remaining registers and arithmetic modules done
    And finally the control logic.
    Initial power up looks good!

    The assembly was surprisingly fast, it only took about a week. Most of it was rather repetitive, soldering thousands of component pins, but seeing it come together felt great anyway.

    Now that the PCB was assembled, there was still one thing missing for the computer to work: Programming the instruction behaviour. This is what we will look at next.

  • The 8 Bit Computer – Modules, Part 5

    Find the introduction here. Previous parts: 1, 2, 3, 4.

    Program Counter

    Schematic page 4: Program Counter

    Another one of Ben’s modules that’s been slightly expanded, the program counter is a basic tool that is required for program execution: The computer needs to keep track of its current position in the running program. That way, it always knows where in memory the next instruction can be found. The program can also overwrite this counter with an arbitrary value, which has the effect of jumping to that point in the program.

    The counter itself is implemented using four 74LS161 4-bit binary counter chips which are cascaded to create one 16-bit counter. As the data bus is only 8 bits wide, the counter input and output is divided into two virtual registers, P (“page”, higher 8 bits) and C (“counter”, lower 8 bits). As usual, the output is managed using 74LS245 bus transceivers, and there are some LED packs to display the counter value.

    Instruction control logic

    Schematic page 11: Instruction Control

    Now this module is where the magic happens: It tells all the other modules that we’ve seen what to do and when to do it. Ben’s version can be found here.

    Let’s start on the left side: There are two 4-bit register chips that store the current instruction code, which is 7 bits long. Above that, there’s a 4-bit counter that keeps track of the so-called microinstruction. Microinstructions are small steps that are exactly one clock cycle long and do a very basic task like moving a byte from one register to another. Multiple microinstructions are combined in sequence to execute an instruction which does something more complicated, like fetching a value from memory, or adding two numbers. Afterwards, a few extra microinstructions are executed to retrieve the next instruction from memory, this is called the “instruction fetch” cycle.

    There are some LED packs to display the instruction and microinstruction values. These two values are then fed into the next part of the circuit, which is combinational logic. Here it’s implemented using three ROM chips, similarly to the numerical output module (see part 4). This logic translates the instruction code and microinstruction step into the control signals that are fed to all other modules in the computer (input enables, output enables, other behaviour controls). The topmost chip’s outputs are fed into two 74HCT154 1-of-16 selectors (also called demultiplexers). This way, the 8 bits from the ROM output can be expanded out into 16 bus input enable controls and 16 bus output enable controls, using the fact that at most one input and one output need to be enabled at any point. All of these control signals are displayed using some white LEDs, and some of them are inverted, if the corresponding modules require a different signal polarity.

    To help the computer’s timing, the microinstruction counter increments on an inverted clock pulse (see the inverter on the left of the counter chip). This way, the computer alternates between executing a microinstruction (rising clock edge) and setting the control signals for the next microinstruction (falling clock edge).

    The details and implementation of instructions will be discussed in a separate post, but for now, let’s look at the PCB that I made from this schematic.