Sunday, June 30, 2024

Bluetooth Bench Mixer

Readers: If you want to build the project featured in today's post, please go to PCBWAY's Community pages--gerber files (front panel, main board) ready to download and/or fabricate as well as STL and FreeCAD for the breakout board tray, KiCAD pro/pcb/schem files and a BOM are here.  

You can also help out this site immensely by checking out PCBWAY using the link here. Thanks!

==========

This time I decided to do something old school: a simple mixer circuit that isn't crammed onto the head of a pin. Yes, this 4x2 mixer doesn't have a lot of features, but does sport Bluetooth audio inputs derived from a popular breakout board: the XY-BT-MINI.







Did it work first time? Yep--one stupid mistake when sizing the PCB--but it all worked.

This mixer was designed around the Eurorack standard. It's 14HP , meaning it's pretty wide for a simple 4 x 2 Eurorack mixer. 

This meant less space for more and more Eurorack gizmos on my bench. But enough is enough--you don't need tiny hands to use this module--and sometimes it's OK when the thing gets big.

BLUETOOTH BREAKOUT BOARD

The star of the show was an inexpensive breakout board available from Amazon as well as from some of the larger Chinese electronic marketplaces, at least one of whom I no longer do business, with the initials "Ali Express", having gotten ripped off by those guys too many times.

I was introduced to this board from the video found here although the content creator never says which board he used. 

Matching the look of the board in the video against the many BT boards out there I determined it had to be the "XY-BT-MINI" so I got a few from Amazon for next to nothing. (Amazon link that works as of 7-7-24 is here


I couldn't find a datasheet nor a schematic for the XY-BT-MINI, nor even figure out what main IC the breakout board uses, but, at about $1.80USD per breakout board how risky could this be? 

I wired it up on my bench (5v, left out, right out, ground) and the Bluetooth board worked great.

From here it was a matter of designing the XY-BT-MINI into a simple 4x2 mixer.  

Using Kicad and FreeCad I did just that and in a few days the boards were back from my patient sponsor, PCBWAY:


 

Simple enough to build:





For hookup wire I used JST connectors purchased from Tayda. These came recommended from other techs, who said JST's can't be beat in terms of price, reliability, and ease of use. Indeed! The JST's were extremely easy to incorporate.

I used FreeCad to design a tray for the XY-BT-MINI board. 2mm nylon screws and nuts were used to fix the breakout board to the tray; 2.5mm screws and nuts to affix the tray to front panel. Once I knew I had a good .stl file I uploaded the 3D .stl file to PCBWAY for 3D printing; the prints came out great.

For pots I used 12mm A250K's because it's all I had in my junk box, anything from maybe A25K to A500K should work (12mm or 15mm panel mount will do the trick)


Not a bug--a feature: I normalled the BT outputs to pairs of mixer inputs: left in 1 to 3, right in 2 to 4. To get a bit of extra boost from the BT module I could increase volume on 2 pots in series but of course this benefit was lost if I use inputs 3 and 4 for other purposes. 

Not completely ideal, but this avoided having to use more amplification for the XY-BT-Mini's slightly weak output (see "improvements" below). With all pots all the way up, the XY-mini's output better matches the output of the 7-10V P/P modules found on my bench.

MISTAKES? Yep. One BIG one.

I spent a lot of time and energy making sure the 3d printed tray fit onto the front panel, the XY-BT-MINI could be screwed to the tray, and the hardware (JST's, regulator, 3.5mm jacks) were correctly sized for the PCB. 

However I forgot to check if the width of the PCB was too wide for the front panel. 

Turns out the PCB stuck out about 2mm from the left side:


DOH!!!


Not a big deal; this issue was corrected via the next PCBWAY PCB run; the better fitting PCB was then uploaded to the PCBWAY community site. Thanks to PCBWAY for their support and for turning around the improved boards in only a few days for testing.

 Fixed!



CONSTRUCTION:

Eurorack designs often try to accommodate "Skiff" modules, allowing shallow enclosures for all your modular synth crap. 

Great for big synthesizers in small studios, but for prototyping: not always the best approach. 

For instance: what if I had the wrong jack label for a given silkscreen?  

"Skiff" is no good for "What if," I have found.

A certain amount of hook up wiring, that I could cut and re-solder might be helpful, and least until my design was finalized.

Thus for this project I used through hole parts, a relatively large front panel and main PCB, and a lot of 22 gauge hookup wire. 

Think of construction techniques one might see on a Large Format module? 

I assumed that that would make any improvements or modifications, followed by a "rev 2" of the project, easier to resubmit and retest. 

Eventually I'd get it right?

Fortunately other than the BIG mistake mentioned above it all worked great--no trace cutting and bodge wires were needed. 

Overall this was a refreshingly simple project, super easy to build. 

IMPROVEMENTS:

As previously mentioned: the line out of the xy-bt-mini is a bit low--maybe 2-3v peak to peak. To match the levels of other audio devices found in my rack--mostly 7 to 10v p/p--it might make sense to gain the xy-bt-mini up by say 12db and bias it for bipolar operation (which would eliminate the need for the 4.7uF decoupling caps) using a TL072 or equivalent dual op amp configured for non-inverting gain.  

Also: I could bring the stereo output jacks to the front panel; maybe in parallel with the rear mounted screw terminals. This would allow it to be used on the bench or in a standard Eurorack setup. But: no need for that right now.

A male plug to female 3.5" jack could be employed to bring the BT module's headphone output to the front.   

Different jacks? That would probably be an improvement. There are ongoing issues with the footprint for the Switchcraft RAP35ACV jack. I am yet to find a 3.5" horizontal jack and footprint that works in 100% of my designs, and I never had one I like for Eagle.

Update 7-25-24: I am still working on revising my RAP35 Kicad custom footprint. I might update the gerbers posted to the PCBWAY community site down the road if I can come up with something I really like for this useful component but for now what is posted works. 

Update 7-29-24 Thanks to PCBWAY for getting me more boards to sort the RAP35ACV issues with fit. This time around I had luck using 6mm spacing between round (not oval) pads for this jack. This isn't the pad spacing found in Switchcraft's datasheet but my footprint for this part seems to work well for holding the jack in place during assembly.  I also modified pad 1 (ground), making it asymmetrical, to allow for better edge cuts and a better, more flush front panel fit. I uploaded the newest gerber and Kicad files to PCBWAY's community page; these updated files incorporate these and a few other minor changes and fixes (here). Should be good to go.

Update 8-1-24: more minor cosmetic fixes/silk screen improvements uploaded to the PCBWAY Community. Have fun!


OUTTRO:


Now I have integrated BlueTooth on my bench that I can mix with other audio sources. 

Funny, I didn't think a lot about the practicality of this module while designing and building it, but I really like how this module turned out, and find myself using it a lot more than expected.  Like: for listening to music while building, without cluttering up my bench with more cabling.

Overall what I created for now--good enough, for me anyway. Keeping it simple is always stupid?  It's not stupid if it works? Something like that. 

Wednesday, June 19, 2024

Frequency Counter using an RP2040

Readers: If you want to build the project featured in today's post, please go to PCBWAY's Community pages--a gerber file ready to download and/or fabricate as well as Kicad files and a BOM are here.  Firmware for the reader (work very much in progress but frequency reading the OLED display function) is here.

Also please visit PCBWAY's site--using the link here--it will help this blog immensely. Thanks.

====

I want to build a clock multiplier for my bench, but first I needed a way to accurately read frequencies of incoming signals. Between 10hz and 100K?  Sure. Good start.  

I got that working this morning:


For prototype hardware I used an already fabricated PCB I designed: post here.

This time, as with many times before: my patient and tolerant sponsor, PCBWAY, helped ameliorate my frustration with breadboarding....for $5 and shipping, I threw most all my error prone dupont jump cables into the dumpster.  

Then I coded  in C using more reliable hardware--a PCB:

When I breadboard, and it doesn't work, why not?  Is it a broken dupont cable? A wire put into the wrong .1mm hole? A dumb design mistake? All of the above? The PCB I used this time is an encoder + GPIO  development board centered around a PICO dev board which in turn is centered on the RPI RP2040 MCU.  A mouthful but it saved time and anguish. Get this PCB here.


Unfortunately for this bench configuration not all the breadboards were gone! 

To buffer the incoming signal I tried out two different designs, "anything to clock", see posts here and here--each A2C version was on its own PCB which in turn was mounted on a breadboard. 

These small PCB's rectified incoming signals to turn them into rising and falling edges and clamped the output to 0-3.3V so as to not blow up the RP2040's GPIO inputs.  


The firmware for the reader is based on a cool RP2040 counting algo by Jeremy P. Bentham--see his blog post here and Github page here

I modified Mr. Bentham's code a little, but not much, and made it display observed frequencies on a small OLED display using David Schram's open source C library for SSD1306'shere

A few minor code changes were needed, for instance, the frequency reading algorithm put the frequency value into an integer in memory, but for the  Schram1306 library I needed a string.

Easy--there is a function in C to change ints to strings that I didn't know about--snprintf:

#include <stdio.h>

#include <stdlib.h>

char buffer[10];

int value = 234452;

snprintf(buffer, 10, "%d", value);

//buffer -- input string

//10  -- base for conversion

//%d   decimel output

//value   input number to convert to a string.

Another cool thing--the Bentham code traps the frequency and sends it out the RP2040's UART pins if you configure CMAKE to do so. Not sure what I'd use that serial stream for, but hey, it worked, and for the final build I will probably bring this data to the front panel on a TRS jack.

The ink on the firmware from the reader is still wet--there might be bugs? This is version  "less than point one", folks. 

But for me, JOY! it worked.

Get the code here.

WIRING

Adding a wiring diagram below because in 3 days I will forget how I wired all the dev board crap on my bench and be extremely unhappy to have to figure it out again. Live and learn?  Usually nope, this time--maybe.



The breadboard equivalent of the dev board. LED's and GPIOs currently not implemented in code are not shown.




Pico Pinout.....


Still to Do:

--I need another algorithm to analyze incoming low frequencies--say .5hz or .1hz to maybe 10hz. Not useful for audio, but in music synthesis, recording studios, bench automation and other environments I see these low frequency rising and falling edges--frequently

--Utilizes the second core of the RP2040--looks pretty easy, see the video here. I've been putting experimenting with this important feature; maybe next time?

--Auto-ranging--the counting algorithms should change based on the rough frequency seen at input. So far I can think of 3 different settings: .01hz to 10hz, about 10hz to 2K, and 2K and above. So some sort of ranging is needed but I will probably get lazy and put this on a switch which might be good enough.

And of course, once I have everything jumpered together on the bench I need to turn it into a working prototype. More to come, but this project is starting to feel like a nuisance to me. 

The gerber to PCB part is super easy, thanks to my sponsors.  My own dedication to finishing this one--not as much.

More coming up. Until then, enjoy the beginning of summer.



JTAG to SWD Converter

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file, KiCAD ...