Posted on Leave a comment

YM3812 Synthesizer

Believe it or not this is a fully functional music synthesizer with fully every possible parameter tweakable and can save presets. The synth sound horrible, but that was by design.

The YM3812 chip is from an old Soundblaster card from back in the Reagan days. This thing sounds like bad dog stuff. It’s so bad it’s fun. I fell in love with this little SPI chip. Designing a full blown synthesizer with hardware interface ended up being a fairly atrocious amount of work, but I was graduated and unemployed. The intention was to take what started out as an Arduino project and move into a legit project.

I ran into problems with this one on the mechanical side. I needed a way for buttons to feel “good” and I needed a user interface that felt sturdy….like I could throw it down the stairs and it not break. Of all theory of magnetic fields and high speed signal propagation I have studied, I had no background in making a product tough. So this is a fully functional synthesizer that worked in prototype mode, but by the time of V2 I was bogged down by the mechanical end and working a full time job. Eventually, it was out of sight and out of mind. I would love to go back now and slaughter this one.

Microcontroller: STM32 Blue Pill

I was really into these STM32 Blue Pills in 2020. They provided tons of bang for the buck, got me into Cortex M3 32-bit land, and were a big step up from the Atmega328p microcontrollers in the Arduino clones I had laying around. The price was basically the same. I ended up ditching the Cortex M3 because when it came time to design PCBs without modules, the MPN: STM32F103C8T6 was very expensive and had a lead time of a billion years due to the supply chain nasties that didn’t really go away until 2023 or so.

2020 = Mechanically Awful!

When I got my job at Macrofab as a “circuit board analyzer”, I had not studied many products for how to “do it”. I was coming from 4 years of aggressive Arduino hobbyist work followed by 4 years of hell in school and trying to put it all together. You can see that here. I just used a 3/4″ wooden box with butt joints as my “enclosure”. It’s one way to do it, but it’s a dumb way.

You can see from this rear view how much empty space I was working with. Granted, for this phase of the prototype it didn’t matter. I was experimenting with board-to-board connections using 2.54mm which was definitely the right track.

Looking at the front with the pretty cover removed, you could see I had 2 PCBs for the switches. This strikes me as expensive at the moment, but I say that about air, too. These front panel PCBs contained the switches but also contained the LEDs that were used to indicate the level/intensity/setting of every possible parameter on the synths.

It makes more sense if you look at what I had planned for the front panel. This would have been a 3U rack, if I remember correctly. My gut says this is a $1,000 product when I look at it. I had temptations to do all of this GUI stuff on a $70 tablet and call it a day. Talk to the main microcontroller through UART / bluetooth / wifi / whatever. That approach would have been radically cheaper.

Below is the money shot.

On the far left breadboards you can see old-school MIDI inputs. Just to the right of that is the actual YM3812 audio circuit. I’m trying to remember if I had 2 of these. I believe I did so that I could have more voices. You could argue the point using a primitive junk 80’s chip is to be limited, but my brain doesn’t work that way. I wanted the brain to be awesome. With more voices, I could detune one chip slightly and that allows for all kinds of big, nasty sounds one may hear in supersaw dance land.

Below the 2 YM2812 synth boards is an encoder PCB. It has 4 encoders but I was only using one or two of them. I had built that as a development tool back in the day and got plenty of use out of it on the breadboard.

To the right you can see the PCBs with 16 switches each. These, too, were prototype tools I developed. I need to look up the chip. I used a SPI expander so that I could have a ton of buttons with only only the CS, MOSI, MISO traces.

To the left of that was the TM1640 LED drivers. I need to look up how I drove these LEDs. Now I don’t remember and I’d like to pick my brain. I may have put real thought into this and came up with an interesting solution. I bet I came up with a matrix array thing. I’m not sure how I’d have enough IO otherwise.

On the far right, you can see the blue LEDs that were used to indicate level.

Posted on Leave a comment

Remote Audio Level Control

My friend wanted to control the level of his home stereo system built into his house. No problem. Sorta.

I bought an off the shelf Bluetooth audio receiver, ran that through this Remote Audio Level Control box. The box is USB powered. I used XXXXXXXXXXXX I2C digital potentiometers to control the level. I used a XXXXXXXXXX microcontroller. My friend is crazy and refused to use wifi….even though he’ll be streaming his music from Spotify. Okie dokie. Challenge accepted.

It turned out I needed a second board to be mounted in the 2-gang panel outlet. It measured the level of the standard potentiometers on the wall and checked the state of 2 switches. My friend is also crazy and wanted to be able to cut power to the amplifiers when not in use. So the 2 switches control relays to the audio power amplifiers.

I really wanted this thing to last 15+ years and I was concerned about scratchy pots. I wasn’t exactly sure how long the cable from from the panel on the wall was going to be to the amplifiers. So, I decided to put a XXXXXXXXXXX microcontroller in the wall and send a UART signal to the controller on the audio level board. This worked out pretty well.

Problem #1: I used Fosi amplifiers from Amazon. These use a TI TPXXXXXXXX chip for impressive efficiency in audio power land. I’ve built one very similar. When power is cut to the amplifier, these amplifiers pop HARD. When power is first given to these amplified, they pop HARD. It’ll blow the speakers eventually. It turns out the soft turn-on circuit only works from the switch on the amplifier. It’s a simple MOSFET with a capacitor on the gate. So my relay approach would not be possible. HOW DID I SOLVE THIS?

Posted on Leave a comment

Reading Light Bar

Requirements:

  • Diffused RGBW light that is great for reading that can be mounted to the wall
  • Requires different modes of operation. a) Crazy light show b) Adjustable R G B and W light via faders
    • Reading mode should start out at the set brightness and then fade incrementally for an hour until eventually shutting off. You shouldn’t notice the light is getting dimmer.

This was a basic project. The ESP32 is overkill for this, but I had it on hand. For linear faders that are normally used on a mixing console create voltage dividers that are read by the ADC on the ESP32. The light is dimmed with standard PWM and MOSFETs. Fun artifact. My son wanted to know why his ceiling fan was spinning backwards. He learned all about aliasing! Fun stuff. The PWM frequency I chose is just a hair faster than the rotation of the fan. Persistence of vision says humans can see light when it blinks fast enough, but tell that to the fan. It knows!

Lessons Learned

I don’t know what I was thinking! I used a linear regulator to step down from 12V to 3.3V. That’ll never happen again. Dissipating 8V+ when an ESP32 is pulling hefty power for a modern microcontroller is a bad, bad idea. I should have used a switching regulator. People worry about the noise. Fair enough. I worry about melting!

Those hefty VM3.96mm connectors at ref des: J5 and J3 are strong. They are also a bit too snug. They are meant to be plugged in and stayed plugged in. That’s good. The problem is if you ever want to take the connector off. They are kinda terrible. Granted, I’m sure I got these from Ali Express for $0.00001. Maybe you get what you pay for sometimes.

This was a fun little project. The greatest challenge was getting the clearance right on the 3D printed “tracks” for the LEDs.

As always I always struggle with wiring and connectors. The NAME OF CONNECTOR GOES HER wasn’t nearly as handy for plugging and unplugging as I had hoped. I used an RJ45 connector for the ESP32 to talk to the fader. That worked well. The lesson is a consumer-approved connector should always be used for “consumer approved tasks” whatever that means.

Posted on Leave a comment

USB 3.1 2-port Hub

The world needed another USB 3.1 hub. Nevermind that they can be purchased for the cost of a sugar-laden cup of coffee. I needed this module block for the future and I always like to design these in chunks when I can.

I chose to design this with parts I could get from Digikey / Mouser. Higher end assembly factories tend to require that and I don’t want to get addicted to insanely cheap parts from LCSC. For a just-for-fun board it doesn’t really matter, I guess.

EDA Tool: Altium Designer

Key Features: 6 layers ( overkill ! ) , 10Gbs digital signals, high speed differential signals.

Experiment #0:

I’m new to USB 3.1. 10Gbs is fast for me. The rise time is in the picoseconds (according to Google) and that means I need to focus on signal integrity. I’ve read Signal Integrity and Power Simplified book twice. Luckily, I’ve forgotten most of it and need to read it again. SMILIE

Experiment #1:

0201 – How will JLCPCB handle 0201 passives? No clue. Will it cost a fortune? Probably. I doubt if they are really necessary, but they were recommended by the datasheets so I’m just gonna run with it for now. At the 0201 scale, soldermask dam thickness minimums start to get pushed. This can be overcame with a stencil but it relies on someone paying attention. I’m nervous.

Experiment #2:

I’ve always wanted to use TI’s WEBENCH-CIRCUIT-DESIGNER. For some reason it always recommends Texas Instrument switching regulators. I smell bias. For certain passives, it also recommended 0201s. I’m all all for keeping loops tight, but is this really necessary on a wimpy power rail? We’ll see. I followed directions this time. I’ll optimize later.

Experiment #3:

MPN: TUSB8020BPHP Why buy a complete 4-power USB hub with enclosure when I can buy just the controller chip for that price!! I’ve never used it before. We’ll see!

I’m going with JLCPCB on this one and using their JLC06161H-2116A Stackup.