Conceived as a piece of premium swag for the MAGwest convention, "Stylish!" investigates how cheaply one can make a real, useful monophonic, digital (virtual analog) music synthesizer! Borrowing the stylus-based keyboard from the venerable Stylophone, and adding complete synthesis features like multiple oscillators, filters, envelopes, vibrato, etc. that are fully adjustable so that you can make your own sounds! It may even end up with a step sequencer and drum loop!
Let's bring real music synthesis to the masses, stylishly!
Entries for the Hackaday Prize are required to disclose the licensing terms of all of the software used in the project.
I lost the LED ring somewhere between the Supplyframe Design Lab and 23b Shop in Fullerton.
Then, having returned home late, I accidentally left Stylish on the car seat and it melted in the heat of the day! Oh noes!
Worse, I need it to show off at Hackaday Superconference, as I won an award for it!
Well, Friday is a lost cause. It does still work, so I brought it, but it looked terrible!
I can reprint it, but it takes 27 hours! What to do?
Well, the back is still vaguely shaped correctly, so if I just print the front, it might be OK. That's only 8 hours...
Ok. And Alex Whittemore volunteered to print the back, so I sent them the link for the files for that, although I imagine it won't be done before he has to leave for the show, so I won't get it til Sunday in any event.
But what to do about the LED ring?
Well, there ARE traces on the PCB to solder it on directly, but two of the LEDs traces were kinda messed up, so I used the external ring instead.
Well, nothing to it but to do it. I soldered all of the WS2812B RGB LEDs to the board, using lots of bodge wires to fix the places where the traces were incorrect.
It took some debugging, as there was one bad LED in the bunch that had to be replaced, and I had to wire one LED completely floating in the air...
It can still be a little finicky, and the last LED has some strange extra colors in it, but it's good enough for show!
I also have a spare of the white part of the LED bezel, although I don't have the TPE part. I can reprint that Saturday night.
So I should have something decent for tomorrow's show.
So, the prototype was looking pretty decent, but it still had some noticeable holes around the LED ring, power switch, and the amplifier board.
Also, the belt synth should probably have a way to mount it on your belt.
I know, right?
So anyway, I spent a night doing CAD and 3d printing stuff.
I made the LED ring cover with flexible TPU/TPE/Ninjaflex filament . This allows me to have the cover flex to get around the ring and have some indents to lock the board and bezel in.
Printed the bezel in "natural" PLA filament. It turned out that all of the soldered vias on my homebrew 16 LED ring were pushing it up, so I ended up printing it again. That one also didn't fit, so I ended up going at it with nippers until it kinda fit.
So I designed that.
Hey, look here is a thing! This makes it sound like I didn't spend my entire working day on this. Rest assured that I'm STILL working on it.
Those colors sucked, so I reprinted in colors that match the existing case.
For some reason, the blue is less snug than the natural, so I had to use the natural white version of the switch.
But hey, I promised you a belt mount. Well, It kinda takes awhile to print, so you'll have to wait, but here is a cool render.
While I slog through boring bits like writing code and cleaning up the PCB design, it was nice to discover that the project got another accolade in the Hackaday Prize contest: the "Diva Plavalaguna" Achievement: You've built a musical item so unexpected it blows everyone's mind."
a USB port (USB B, because I hate all of the smaller USB jacks).
a headphone jack.
a new power switch that switches both power and ground, batteries properly in series.
diodes to allow batteries and USB to be attached at the same time and let the unit be powered by USB.
a fix for the lack of pins for the MODE button.
capacitors on all of the WS2812B RGB LEDs.
Here is a lovely 3d render. Note that it shows all thru-hole components mounted in most places, but rest assured that I actually have an option for surface mount parts for manufacturing. The thru-hole parts are used in the 3d render because those are larger and the case needs to be constructed around them because they are going to be harder to fit.
Back side of the board shows the new capacitors on the LEDs, and the USB and headphone jacks.
The USB port and headphone jack are optional; they can be removed to get the price down, although saving a dime seems silly here. Note that there is a little extension on the board for the headphone jack; that is because I now know that the boarder on the case is going to be at least 7mm, and it sticks out from the PCB so that the jack won't be recessed too far inside the case. Likewise, the edge location of the USB port.
Also, the batteries have been moved as far to the left and right of the board as possible, and all of the amplifier circuitry has been moved out from behind the batteries. Mostly, this makes it possible to mount the batteries to the PCB if one is using it without a case.
Finally, all of the battery and speaker connectors have been changed to vertical pin headers to make them a little easier to fit; there were a lot of problems before with the speaker connection getting stuck under the bezel
I've also prepared a parts order for AliExpress that I have posted for approval. I hope to get that order out by tomorrow.
While I wait for parts, I'll be getting back to working on the software.
Thank you everybody who "Like'd" "Stylish: The Trucker Belt Buckle Synthesizer" !
There is still a lot of work ahead!
If anybody hasn't "Like'd" it on the Hackaday site, please do so! Besides the (remote) possibility of placing in the top 5 of the Hackaday contest, there is still the chance for $5k in the Tindie manufacturing contest which judges on the 24th!
Because Stylish is designed to be a manufacturable product, and also a kit, I think I have a much better chance at this one than many of the other entries that are meant as a one-off, or are too big for the Tindie store.
I like having 3d models for PCB parts so that my 3d board renders will be accurate. I found a lovely switch on AliExpress (which I still haven't even placed the order for) and decided that I needed a model. But the internet didn't cough one up, so I wasted a whole evening and got it done.
This was made possible by the fact that they did include a very nice drawing of the part and some decent pictures.
I could have made a simpler model.
I could have done without.
But I had to do it.
And I had to do it right.
I don't know what that says about me.
EDIT: The component is here on AliExpress. It is listed as "YT2024Y MSS22D18 MINI Miniature SMD Slide Switch 2P2T 6Pin ".
I made the 3d model available on Pinshape here, but Pinshape seems to be focused on 3d printer stuff, so they won't take STEP files, which makes it kinda useless for KiCAD. So I put it in the GitHub for the project here.
FURTHER EDIT:This switch is crappier than I thought and kinda fell apart on me.
This project is powered by AA batteries. Normal, non-rechargable AA batteries. But I'd also like to attach it to USB for stuff, and draw power from there when it is so attached.
So, the worry is that USB power will back-bias the batteries and they will eventually leak or explode. That would be irresponsible. So I should probably do something about that.
Now, the easiest option is to simply use a 3 position switch, which has one direction for battery power, and one for USB power. But that's confusing, and I'm not sure what happens when you are attached to USB but on battery power. I don't want to do stuff that blows up computers USB ports, either.
Now there are plenty of solutions that provide all sorts of protection for circuits against voltage spikes, reverse polarity, etc. Some of the protection chips alone are $2.50-$5, tho, and whole board solutions from Adafruit are $10+. This project is shooting for a $10 price point for the whole thing, so the price points on that kinda stuff aren't really reasonable! And many of those parts just can't be sourced easily in China, where the PCBA happens. If it isn't on AliExpress, I can't use it!
So, I'm looking at a bare minimum solution that adds a few pennies to the design and doesn't impede performance.
The simplest transparent option seems to be to put a diode in series with the battery and the power in, and another on the USB side.
But I'm a n00b. What kind of diode?
I really had no idea, so I got in the Hackaday.io Hack Chat and talked to Al Williams and Jez Boxall. Al pointed out some useful articles ( 1 & 2) and suggested a Shottky diode with a low VR . After some looking around, I found the 1n5822 Schottky diode on AliExpress for barely over a penny! Al had decamped by this point, but Jez seemed to think the specs were in range for this project. Second opinions are good!
I also found a lovely set of articles on the topic of polarity protection which seemed to be in the right direction for what I was doing.
I finally decided to use a diode on the positive side of batteries, and on the positive side of the USB plug to prevent backflow from batteries. Adds 2.1 cents to the design; I think they client will accept it!
Next thing to do is to order parts and wire it up!
The 3d printer finally coughed up the finished print of the V2 case! It snaps together very nicely, and screws can be added for increased solidity.
From the front, it looks very similar to the V1 case, but you might notice a much larger bezel around the bottom of the keyboard, an indentation over the buttons, and the thru-hole parts for the PWM are now covered with a little bump.
The plastic under the banana plug socket had a tiny hole in it due to a very thin feature that I tried to patch with extra plastic and a soldering iron, but just ended up making it worse.
The USB port hole awaits a connector! On the real one, if this appears, it will probably be optional and perhaps differently located. Currently, you have to attach the USB cable directly to the microcontroller inside the case, which means I have to disassemble it to work on software every time. This should solve that.
The speaker mount got a redo as well, but because of some unintended relations in the model, it screwed up the rest of the model, so I had to revert all of that work. I can still get this part from the history, but having it attached to the rest of the design intent is not really possible unless I redo it.
I had also started on a bezel for the LED ring before I discovered this, so all of that work is gone as well.
I finished updating the schematic to reflect the changes I made to the board with bodge wires and cut traces, but I keep crashing KiCAD when I try to reroute the PCB to match. I've downloaded a new daily build of KiCAD, and will try to install it soon and see if it helps.
Now that the contest entry has met requirements, I'm hoping to slow down a little and get my sleep schedule (as well as various health issues) back in order, so work may be a little slower.
The whole case was mainly made for "dog-and-pony" purposes; the project wasn't really ready for that, but contest deadline was Monday, so being pretty is good. I intend to finish up the beautification with the USB port and the LED ring cover, and maybe do something about the amp board that sticks out, but after that I intend to finally get back to the code.
In the code, the state machine for the UI is being written, but because of the massive debouncing required to make this thing work, that system needs to be tweaked to accommodate the different needs of playing the piano keyboard vs touching UI buttons.
For example, when tracking the piano keyboard, if the user moves to a new key by sliding the stylus, you want to go to that immediately... unless it is a key you just left, because you might be sitting on the boundary between keys. In that case, you want to wait for it to be stable. But on the buttons, you want to wait a good long time for stability. Probably the best thing to do is to have them trigger on stylus UP, but then you think the user will be confused if they touch the thing and nothing happens. So buttons need a LONG debounce period, and states for both stylus down (update LEDs with solid color change) and stylus up (LEDs flashing in current "state color" to reflect a need for further input.)
This also applies even to synthesizer systems like the envelope generator state machine. Since the keyboard needs low latency, a "trigger" for envelope needs to start immediately on key down, but then debounce heavily any key up. This could potentially be done in the envelope generator by having "attack" reassert itself from whatever the current volume level is if there is a momentary off due to stylus motion. This works better with envelopes that are only "attack-decay" than with full ADSR tho, so this might not be an option after all.
Anyway, it's code that is in the middle of being written, but I'm in CAD land for a few more days...
I thought I'd take a few minutes to fix a couple of problems with the original case design and do a 2nd 3d printing, but I ended up spending all night on it.
A larger bezel means it might actually fit together properly. this time. I added alignment nubs and screw holes with proper recesses in the bottom for the screw heads. There are now proper holes in it for the stylus and USB plugs. The ring support on the front is now shorter, since I had to chop the original one way down, and the hole is bigger so maybe the ring will actually fit in it this time. I capped off the bump where the thru-hole components stick up. Recessed the area around the buttons a bit. Inside, I added support for the battery holders.
3d printer is running; hope it doesn't burn down the house while I sleep...
Previously in our adventures, I had to reuse the line for the MODE button for one of the keys, because the line it was using turned out to be used for USB. <Sad trumpet sound>
Well, I'd still like to have a MODE button, but I'm out of pins. I'm trying to keep the cost down, so I don't want to add extra shift registers and multiplexers to the design.
Now, if I could hit two pins at exactly the same time (say WRITE and PARAM), I could detect that in software. But if I just wired those two pins to the pad, it would hit both pins if I hit either of the original pads as well.
The obvious solution to that is to add two diodes going from those pins to the MODE pad that I want to trigger. Current can go to the MODE pin, but it can't come back up to the WRITE pin if the PARAM pad is touched, and vice versa. SMD Diodes are cheap, and PCB assembly houses usually have that kind of thing in their stock, so I'm not even worried about the price of these items.
The circuit for this is pretty simple:
I used a 1N4148 switching diode, which is pretty common in keyboards and such and is very good for this type of task. I still have a ton of them from when I was trying to build my own keyboards for the NanoEgg synthesizer project (I will get back to it eventually, I promise!)
So then, wiring it up:
The first thing to do is to disconnect the mode button pad from it's pin and from the pad for the key that needed to be remapped.
Then a bodge wire needed to be run to reconnect the keyboard pad to that pin again. That is in black in the picture below.
Then, two diodes need to be attached to the MODE pad (black line on that side for correct polarity, and the other end attached to the pins/pads for WRITE and PARAM. I put yellow insulation on the leads to keep it from shorting stuff out. It is easy to find such things on the floor if you never clean up in your workshop / home.
Here you can see the two diodes in yellow attached to traces going to their pins on the right, and the mode button on the left, and the wire rerouting the key's pad to the pin that was formerly for the mode button in black on the lower left.
Powered up in software and everything is worky! Yay!
How to do the software?
Just put an "if" statement before returning any key down and check for both pins together. If they are down, set the value to the mode button instead of either of those two pins. Standard debouncing applies.
So, there you go. A pretty basic hack that involves hardware and software, but saves a lot on money for a multiplexer. Obviously, one could use this technique to multiply pins to get more buttons, but at some point board real-estate, part and assembly costs come into play and you might be better off with a multiplexer or shift-register solution.
Pad multiplication with "charlieplexing"?
Another interesting possibility, similar to "charlieplexing" would be to move the stylus to a pin that can do input and output, and then use a diode on each pad to indicate whether it was sensitive to being an input or output. On some pins, the stylus would act to pull the pin, and the pin would be the input. One others, the pin would be the output, and you would detect it's touch on the stylus line. This does require one diode per key, and requires one additional pin for the stylus, but doubles the number of pads you could attach.
I'm not sure the "multiple downs per button" thing would work well here, since you have other pads reading current the other way that might be triggered when you change the line from input to output, but perhaps that wouldn't be a problem if the software isn't looking for that input at the time it is driven that way? I'm not sure; it bears further thought.
I know, I'll leave it as "and exercise for the reader" like they did in all of my old textbooks! Don't you just hate that? I always thought that was just the authors getting lazy. Which is exactly what I am going to do now...
If you milled or etched your own board, it won't have plated through vias. Put a small bit of wire in each via and solder both sides of the board.
Solder processor pin header
Use some perfboard to make sure the pins are straight, and double check by putting the processor on top of that. The right angled pins on the bottom should face away from each other. Make sure pins don't overlap PCB traces, especially if you milled your own board and have no soldermask. Solder all pins, but it will probably go easier if you solder the ends first.
Solder processor onto pin headers or solder female headers onto processor as desired.
You can either solder the processor in permanently, or else put female headers on it first. If you want the headers, just place them on top of the pins you just soldered and follow the instructions from there. Place the processor on the pins in such a way that, if the speaker hole is above it, the debugging connector is on the left, and the USB connector is on the right, and the reset button and jumpers are facing you.