Thursday, September 26, 2024

Monday, February 20, 2023

Photos of 2022

With another year gone, it's time for another recap. I think 2022 has been the year I've taken the most photos.

Clouds 2


Sunset


Antelope Canyon


Stargazing


Purisma

Tuesday, July 26, 2022

Microphone Amplifier: Shielding

My friend owns a ribbon microphone, which have notoriously low output levels even after their internal transformers steps up the output, and always need to crank the gain up to the max and use noise reduction to get anything usable. A common solution is to use an in-line preamp such as the Cloudlifter and the FetHead. I wanted to see if I could make my own amplifier after seeing a small snippet on ribbon microphone amplifiers in the Art of Electronics

After a little bit of Googling, I came across reverse-engineered schematics for aforementioned amplifiers. They both use JFETs in a differential pair, which allow for the gates to be biased at 0V straight from the microphone, and are powered directly off of phantom power with the phantom power resistors as the load. The Cloudlifter has a cascode configuration of JFETs, while the FetHead is just a single device. Someone already made a FetHead clone, and to keep my project simple I essentially cloned this. I added a few changes to my PCB:

  • Added a footprint for a two channel ESD diode device
  • Added places for emitter degeneration resistor if one wants to add them
  • Used the connector that has the shield separated from ground both the input and the output XLRs
    • Added jumpers that allow for configuration on how the shields are connected to each other/to ground
I was really interested in seeing how to properly shield the amplifier and the effects of grounding the shielding at the amplifier versus not. From several videos I watched on connecting up the shield in general for cables (not just audio and XLR), the idea is to form a continuous Faraday cage to keep out noise. You want all the shields joined through the cable to the chassis of all the devices in line. Whether you ground this shield at all points vs just at one point or only to earth or not at all (no DC connection but AC coupled) I'm still not clear on. With all the jumpers I wanted to test what happens under different conditions.

KiCAD Schematic.

I sent the boards out to made and ordered the parts from Mouser. A week later, everything showed up at my door and I filmed a making-of video just for fun:

I still got the footprint wrong for the ESD diode; I originally chose a SOT-23 part but changed to a lower voltage part just before sending out the design and forgot to change the footprint for SOT-523. Thankfully the part still soldered into place without much issue.

PCBs.

Parts.

Assembled.

The metal box I originally thought of putting the amplifier into ended up being just a little smaller than I thought, causing some interference with the connector screw holes. For now there is no enclosure, making proper shielding tests impossible. However, I can still generally test the amplifier. I handed off the amplifier to my friend and we saw significant gain (I don't really have any equipment setup to do a proper measurement of the absolute gain at home anymore and definitely don't have any to do a portable measurement.). There was very audible noise when there was supposed to be no sound but we'll need to figure that out another time. Some initial experiments with joining the shields on the board and to the ground gave inconclusive results along with a jank foil shield. The cable being used is also of questionable quality.

Sunday, June 12, 2022

CAD Practice: Mini Tripod

It's been awhile since I've done some real CAD work, so I decided to model a mini tripod that I regularly use. The legs have interesting geometry with smooth contours that were difficult for me to capture in CAD. 
Orthographic side view.

I still am not sure what is the best way to model these smooth contours; I initially started off by drawing a top-down view of the leg, thinking I would then extrude this profile and then cut it from the side with another profile like I did for the glasses I previously modeled. I quickly realized this would not work that well since the legs don't have parallel sides.

I backtracked and then decided this would have to be done with lofts. Using the top-down sketch as a guide, I created several cross-section profiles along the leg for the loft to follow and then created the leg out of two lofts. The modeled leg is definitely not perfectly accurate to the real leg as the real one has a smoother curve along the entire outer face and pinches in faster on the inner face. If I were to do this again I would use 3D curves and guide each edge with a rail. Also, at the hinge the curve should be more gradual and not bend in as quickly.



The bevel at the bottom of the leg is also too steep, but this was necessary for the bevel to line up with the tip of the leg and the outer edges. As a result, with the legs all the way out the bottom of the legs are still not parallel with the ground.

A video of the modelling process:


And a render:

Nice render with the tripod open.

Tuesday, May 3, 2022

iCE40 FPGA Tinkering

After my very short experience with getting the Vivado toolchain setup to use the the Pynq FPGA board a few years ago, I've decided to get back into doing some projects with a FPGA again. I only ever got around to blinking an LED before putting the board aside; I had no solid projects in mind to make. The only reason I tried using it was that I was able to get one for free and it is the board used in the digital design class at Berkeley. I know it is a very powerful device and has lots of nice peripherals directly on the board so I may come back to it in the future. (Most digital design time is really spent in simulation anyways so the exact hardware doesn't matter that much.)

But man, the complete Vivado toolchain is nearly 80GB installed, and the bloat of everything with respect to it did not sit nicely with me. So recently I set out to find a different FPGA with a nicer ecosystem. From other projects I've seen online the first one I looked into and eventually settled on was the Lattice series of iCE40 FPGAs. The configuration bitstream has been reverse-engineered and a series of open-source tools have been developed for using these iCE parts. Synthesis, place-and-route, and bitstream generation all can be done through some simple steps. (Most other FPGAs still have locked down bitstreams and is why you need to use vendor-specific tools to do the synthesis and place-and-route. Being tools that are developed by large corporations with lots of money, they may/probably have better outputs from these steps (e.g. more optimized synthesis, better place-and-route of logic cells for better timing, etc.).)

I picked up a UPduino board with its iCE40-UP5K FPGA and installed the APIO ecosystem for the development and build toolchain. APIO makes it super convenient to develop for these FPGAs as it bundles together all of the open source tools.

General setup process (so I don't forget it; recently I had to re-lookup how I setup my STM32 toolchain back in 2018 so if I wanted to use them for a real project I would be able to):

  1. Install APIO
  2. Generally followed this guide.
  3. Initialize project with apio init --board iCE40-UP5K -s
    1. -s allows us to customize the SConstruct file so that we can the build process look into subdirectories for the source files.
  4. For simulation use apio sim
    1. Simulates from *_tb.v files
  5. apio build to build the verilog
  6. For some reason apio upload would not work for me; I suspect there is a PATH problem with my python setup (error: 'WindowsPath' object is not iterable)
    1. I just manually uploaded with iceprog -I A [path to bitstream]
Within minutes I had some blinky LEDs going current controlled by the internal LED peripheral, and running a simulation was relatively straightforward. Next steps are generating PWM and then maybe generating some VGA signals. Still not sure if this the best platform to be using but for small projects the simplicity is nice.

Aside: Some time ago I had did about a day's worth of tinkering with Verilog and getting simulation setup with iverilog and gtkwave after reading blog posts on zipcpu and gaining some interest in HDL again. Getting everything setup on Windows is slightly annoying with all the random things on my path and multiple terminal and shells installed over the years (got the windows CMD, git bash with mingw, msys2, and cygwin).

Tuesday, January 4, 2022

Switching Buck Regulator: from theory, through simulation, to implementation

I had a much longer introduction written up in my draft document of this but now looking back at it, it's a little unnecessary. To summarize my thoughts; in an attempt to provide some motivating direct applications of what I have learned in classes, I want to begin writing about some projects that directly apply the theory from class to something more tangible. Hopefully they can demonstrate real-world issues that one can run into when implementing these concepts for real. This is also a good excuse for me to refresh my memory on many of these topics and provide a good written reference to hold on to.

Any errors/things that are unclear are on me. Hopefully there aren't too many and I'm not saying anything too wrong. 🤷‍♂️

Part 1: Basic Buck Converter Theory 

This is a quick crash course of DC-DC switching buck converters using my knowledge from EE113, Power Electronics, and EE128C, Feedback Control Systems. In my power electronics class, we went over the basics of the most common types of power converters. Hopefully this is a good refresher for me and lets me put theory into practice. [This write up is really mainly for me and kinda but doesn't really begin from the very basics; it also tries to follow a linear progression to the best of my abilities but there many subtopics that loop back on themselves.]

In this design example I want to go through the basics of a buck converter again and then apply some feedback/controls knowledge to making a converter that can deliver a set output for a varying range of inputs. This will also allow us to look at the transient response of the output of the regulator, from startup and changes on the input, to sudden changes to the output load. Everything I write will be from what I remember from EE113/my notes/the textbook Fundamentals of Power Electronics by Robert Erickson. I didn’t look at the textbook that much during class, but as I now reference it for this project it reads very clearly and is an excellent reference.  If anything is unclear here, definitely take a look at that book.

Saturday, January 1, 2022

Photos of 2021

Nothing technical about this post; just a recap of some photos I took throughout 2021 that I liked.

Sunrise

Mt. Tallac

Morning

IMG04947

IMG09698

IMG00431

Comments: The forest one I like but feel the background should have either been more blurred (would have need a bigger aperture than the f/4 I had) or more in focus; currently it feels half-done both ways and is just a bit mushy. The Christmas one should probably be cropped tighter; the edges are messy. I should have framed the last one a little lower and wish the clouds were a little more dramatic.

I've also been going through some old photos and uploading/backdating a few I like.