Close
0%
0%

Record Scratch SAO

A SAO with circular capacitive touch for digital scratching of vinyl records. Wacka-wacka!

Similar projects worth following
This SAO has:

- A RP2040 MCU
- 4 MB flash
- A MAX98357A I2S amplifier
- 4 capacitive touch pads
- A Teeny-weeny speaker
- A USB Type-C receptacle (data only)
- A Circuitpython fork (lol)
- An addressable RGB LED
- A debug header
- An ON/OFF switch. Yes, this SAO is highly optimized for consuming power.

To top it all of, the capacitive touch pads made it necessary to route the entire design on a single layer. The pads cover the entire front layer of the design, so any vias would short to the pads.

**Record scratch**

Yup, that's me. You're probably wondering how I ended up in this situation.

Well, to understand that, we need to go back to where this all started... It was just another ordinary Tuesday morning, or at least, that’s what I thought. Ok, I'll stop the meme before you stop reading. The story about the SAO *does* continue in the project logs though

Documentation is still a work in progress. Project logs written so far:

Log 1 - Motivation

As the project description emphasizes, this SAO is kind of ridiculous.

I'll be the first to admit that the feature list above grew a bit out of hand. The SAO has ended up closer to a badge than it has to any other SAO I've ever designed (I guess the main thing missing is a SAO port? 🤔). 

You could argue, and you'd probably be right, that the only things really needed on this SAO are the four capacitive touch pads, and possibly the i2s amplifier. The badge could do the rest. But in my opinion "the SAO" (as a concept) is at its strongest when you can give it away to someone, they can plug it in, and it will start doing its thing.

[read the full log entry]


Log 2 - First Prototype

I pretty quickly landed on the idea that I would be doing a vinyl record that could be touched to control the playback speed of a beat, to create the classic "wacka-wacka" record-scratching sound of the late 20th century. 

The problem of course, was that I've never done capacitive touch (either in hardware or software), I've never done software for audio use, I would have to fit everything within the physical constraints of the contest (40x50 mm), and I initially wanted to do it on a cheap Chinese microcontroller that did not have a hardware peripheral for I2S to talk to the amplifier. I could bit bang that though. Or so I thought.

[read the full log entry]

Log 3 - A working prototype

My initial, cheap and simple, design idea had failed before I even received the boards I had ordered. I had to start over, but the time was running out. 

As the first prototype had stopped at the first possible roadblock (I2S streaming) and there were many more unknowns I hadn't bothered checking yet (flash size for sound file and touch-pad sensing, among others) I felt like spending time finding another cheap MCU, with an actual I2S peripheral, would be risky. I instead embraced my inner over engineer and went full overkill.

[read the full log entry]

LP-Vinyl-SAO.kicad_pcb

PCB Layout

kicad_pcb - 1.38 MB - 10/17/2024 at 17:10

Download

LP-Vinyl-SAO.kicad_sch

Schematics

kicad_sch - 245.26 kB - 10/17/2024 at 17:10

Download

LP-Vinyl-SAO.kicad_pro

KiCad project file

kicad_pro - 16.92 kB - 10/17/2024 at 17:10

Download

  • Log 3 - A working prototype

    Applied Procrastination10/19/2024 at 08:56 0 comments

    My initial, cheap and simple, design idea had failed before I even received the boards I had ordered. I had to start over, but the time was running out. 

    As the first prototype had stopped at the first possible roadblock (I2S streaming) and there were many more unknowns I hadn't bothered checking yet (flash size for sound file and touch-pad sensing, among others) I felt like spending time finding another cheap MCU, with an actual I2S peripheral, would be risky. I instead embraced my inner over engineer and went full overkill. 

    An RP2040 ought to do it. It actually ought to do it 👏so 👏much that what I had previously failed to do fast enough in C could now probably be done in Python (i.e. by running fast C code written by smarter people than me).

    As hinted at in the last log entry, this had always been my plan B. I had routed the touch pads to the SAO connector on the prototype boards and ordered a Xiao RP2040 along with the I2S amplifier breakout board to avoid being delayed too much by the possibility that my bit-banging approach would fail. 

    Plan A was honestly a long-shot, and mostly done in the hope that a PY32 would be enough. I had to spin a prototype PCB to get my hands on some circular touchpads anyway, and slapping a 25 cent MCU in there wouldn't cost me much additional time or money. You might even have noticed that the prototype didn't have an amplifier on it, as I always planned for a version two. 

    So with the prototype boards in house I could get to working on a breadboard prototype. This time I would make a functional prototype before ordering another PCB.

    Step 1: Touch pad sensing

    As revealed above, I hoped to do the code in python. I was now using a mature MCU, and there should be lots of open-source code out there for all the things I needed to do in this project. So, I naturally assumed it would be smooth sailing to get to a prototype.

    After a tiny bit of research I opted for using Circuitpython instead of Micropython, as it has better library support and I wasn't going to be doing anything revolutionary here. The Circuitpython filesystem is also way easier to work with than Micropython's (and honestly, this makes a huge difference for any project in my opinion).

    For captouch sensing, I didn't even have to install any libraries. The necessary "touchio" library is built-in with the so called "core modules". This library provides both a digital touch/no touch output for each pad, as well as an analog "raw" signal that I assume is a representation of the discharge time. To be honest, the documentation is a bit lacking, so without digging into the source code it's kind of difficult to know exactly what's going on. Luckily, I'm not the first person to use these libraries, and I don't really need to understand what's going on underneath the hood - so looking through some of Todbot's repositories, like the code for his picotouch product series or the code for his Supercon 2023 badge hack, quickly got me going with the syntax.

    Converting the raw values to cartesian and polar coordinates was also ridiculously easy, as I was using a 4 touchpad design. Many resources indicate that no more than 3 pads are really necessary for circular pads of this size, but my nervously over-designed layout really paid off in terms of simplifying the code. Here's how I ended up doing the conversion:

    y = T1 - T3                 # T1 is up, T3 is down
    x = T2 - T4                 # T2 is left, T4 is right
    angle = np.arctan2(y, x)

    In the actual program I've first applied a moving average filter to the raw values, but I've simplified the example for clarity.

    How to filter the input values is honestly one of the most complex tasks of this project, and still something I need to spend more time fine tuning at the time of writing. Ideally, I want a ridiculously fast response time, so that I can catch the fastest "wacka-wacka" movements, while not letting through any noise. Letting through noise is horrible because changes...

    Read more »

  • Log 2 - First prototype

    Applied Procrastination10/17/2024 at 19:50 0 comments

    I pretty quickly landed on the idea that I would be doing a vinyl record that could be touched to control the playback speed of a beat, to create the classic "wacka-wacka" record-scratching sound of the late 20th century. 

    The problem of course, was that I've never done capacitive touch (either in hardware or software), I've never done software for audio use, I would have to fit everything within the physical constraints of the contest (40x50 mm), and I initially wanted to do it on a cheap Chinese microcontroller that did not have a hardware peripheral for I2S to talk to the amplifier. I could bit bang that though. Or so I thought.

    With nothing but naïve optimism and a head full of unanswered questions I did what any sane hardware hacker would do: as little research and maths as possible. I crossed my fingers and started the hardware layout.

    Step 1: What is a capacitive touch sensor?

    Ok, I had a general understanding of this already, and I'm not going to dive into the details of the physics behind it in this post. But I had a surprisingly hard time figuring out how the seemingly simple sensor could actually be designed and wired up to a microcontroller. What were the requirements for the pin on the MCU? 

    All the App Notes I could find in the beginning were tens to hundreds of pages long, and written by big companies trying to convince me that I would have to buy their custom ASIC to solve this incredibly difficult issue.

    After skimming through a lot of mind numbingly long PDFs I realized I had heard someone talk about the wiring of capacitive touch sensors on a Discord server a while ago. And that's where I found my answer from prolific badge maker Bradán Lane:

    captouch schematic
    Discord to the rescue
    Ok, that's a lot easier than what the top results on Google suggested. Turns out the main principle behind the sensing technology is to configure a digital output pin on the MCU to apply a voltage to the touch-pad, then change it to a digital input and wait to see how long it takes before the pad has lost enough voltage to measure a logic low signal on the pin.

    If a finger is near the touch pad, there is a capacitive coupling between the pad and the finger that increases the capacitance, and makes the discharge a tiny bit slower. The resistors are to reduce the effect of random noise.

    In other words: no real requirements on the pin, except being able to measure this discharge time fairly quickly. So I hooked the pins up to pins with a timer peripheral in my schematics and moved on

    (warning: I never actually verified whether the timer peripherals were capable of sensing this signal as you will see in the next few steps, so replicate that at your own risk).

    Step 2: How does one design circular capacitive touch pads?

    Righty-o, schematics out of the way. Now on to the layout... Let's have a quick look at some inspiration, and:

    Captouch layout

    The final design has 4 touch pads with a weird geometry

    Eeeh... That looks... complicated. Where do you even start designing something like that?

    Luckily, this time, there's an app note to the rescue. This excellent app note from TI named Automating Capacitive Touch Sensor PCB Design Using OpenSCAD Scripts was exactly what I was looking for. The app-note provides OpenSCAD scripts for parametric generation of all the most common capacitive touch geometries, along with a thorough explanation of the parameters.

    Since KiCAD has a healthy plugin-system I seriously considered porting the script to a python extension, but felt like that was a bit out-of-scope for this project, especially considering the contest deadline. I may have a closer look at that if I ever start another project where I need various sized captouch pads.

    My final workflow ended up being as follows:

    1. Export only the top touchpad geometry from OpenSCAD (Touch 1 in the figure above), as described in the app note.
    2. Import the DXF into the footprint editor of KiCAD as a graphic (File -> Import -> Graphics... )
    3. Convert it to...
    Read more »

  • Log 1 - Motivation

    Applied Procrastination10/17/2024 at 18:01 0 comments

    As the project description emphasizes, this SAO is kind of ridiculous.

    I'll be the first to admit that the feature list above grew a bit out of hand. The SAO has ended up closer to a badge than it has to any other SAO I've ever designed (I guess the main thing missing is a SAO port? 🤔). 

    You could argue, and you'd probably be right, that the only things really needed on this SAO are the four capacitive touch pads, and possibly the i2s amplifier. The badge could do the rest. But in my opinion "the SAO" (as a concept) is at its strongest when you can give it away to someone, they can plug it in, and it will start doing its thing. 

    I mean: their badge firmware is already busy doing other things, the person receiving the SAO is already busy being at a hacker-con, and they might soon swap your SAO out for another one. Especially if it requires *work* to make it interesting.

    For this reason, most of my SAOs (yeah, this is my 7th or 8th since last years SuperCon - depending on how you count) doesn't do much other than blinking an LED or two. Some of them will not even blink the LEDs, just light them. This way I can keep the cost at a minimum and personally assemble them in large enough volumes that I can hand them out like candy.

    At SuperCon 2023 I brought around 30 SAOs of a single design, and I quickly felt like that was too little. At Hackaday Europe earlier this year, I increased my stock - but also the number of different designs I brought. At some point during the evening I realized I could look around me and see one of my SAOs in almost every group of people located around me. I thought that was really cool and that's why, when Hackaday announced their 2024 SAO design contest, I felt it was right up my alley. After all, designing SAOs is the main hobby activity I've been doing over the last 12 months.

    However, "there's a catch!", as the official contest page phrases it.

    Traditionally SAOs have been all about the look, PCB art and blinking LEDs. This year, we want to change that. We’re challenging makers and hackers to build functional SAOs, or as we’ve come to call them, Supercon Add-Ons.

    The designs I've been making over the last year have been superhero designs, to which I obviously don't own the copyright - even though I did the actual artwork myself (with comics as reference). In other words: they are not eligible to the contest. Even if they were, they don't respond to this call-to-action.

    Superhero SAOs
    All my hardware-projects since last years SuperCon can be held in the palm of my hand and snapped in a single picture

    So I was forced to come up with something completely different if I wanted to participate in the contest. And I did! But I wanted to stay as close to my original philosophy of handing out cheap working SAOs as possible. That being said, I allowed myself to break the rules about cost and assembling a lot of them by myself if it became necessary. After all, the prize of the contest is that someone else will pay for, and assemble, the design - so who cares, right?

    I've been curious about capacitive touch for a while, and been on the lookout for a project where I could get more familiar with them, so this contest was the perfect opportunity to dive deep and learn how to design (and use) those.

View all 3 project logs

Enjoy this project?

Share

Discussions

nestorg780reen wrote 2 天前 point

Thanks for this info . https://www.yourtexas-benefits.com

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates