Iām looking to make case for a Norns sheild that will let me play with that Norns in a more stand-alone way. Iām taking some inspiration from the qy-70. Can anyone recommend some nice little buttons for use as a small thumb piano sized keyboard? Velocity and pressure sensitivity would be nice to haves but idk if thatās possible.
Does Teensy 4.0 have a built in DAC like 3.6? Very new to this and having a hard time deciphering the information on the website?
No, it doesnāt.
They suggest using either an audio shield (for prototyping), or a similar I2S DAC separately for genuine stereo and higher-quality output.
The reason for this, more specifically, is the microcontroller chip itself that a Teensy 4.0 is running doesnāt have a DAC in it. Itās not that they cut anything from the hardware, itās that the chip never had one to begin with.
Yes, this makes many of the DIY audio projects that have just used the 14-bit DAC on a 3.2 no longer immediately compatible with a bare 4.0.
Thank you very much!
Iāve been prototyping some USB selectable switches/power splitters so I can run my tt keyboard and grids into one unit, and select what modules they go. So 2 usb in, and up to 4 usb out. Kinda like a mega switch.
I was able to get things running pretty easily with a bulky analog solution. I have a DP4T rotary switch that sends the D+ and D- signals out to their selected usb out, and an 2PDT toggle to select between the grid or keyboard usb in and the power being supplied externally via USB.
But the aesthetic definitely doesnāt fit in with the rest of my equipment and a slimmer, digital alternative would be a fun project for me, and likely look better (to my eye). I started to tinker around with some leftover Arduino Nanoās and hobbled together enough to read the analog input from a 10k pot, but there is a ton of jitter. Nothing a little extra code couldnāt help smooth out. But now Iām wondering whats the best way to proceed with this?? Iām definitely out of my element here, but this is what Iām considering moving forward and a few questions I have about design choices.
Goal: two channel selectable input, 4 channel selectable output for usb D- and D+ lines.
- Should I be using a potentiometer, or is an encoder better suited for controlling an Arduino/Teensy?
- My plan was to use a 4052 dual 4-channel multiplexer to route the D- and D+ signals. The logic table being controlled by either a potentiometer or an encoder.
- After tinkering a little tonight with the Arduino, I was able to get the analog pin values fairly smoothed out, but do worry about the possibility of unwanted changes driving the logic table output. The analog pin would read values mapped between 0 and 3, and I could sometimes find the spots where a jump from one value to another would happen unintentionally.
All advice welcome!
Iām really keen to have a go with Teensy, where did you all start? Iām interested in driving a display, but struggling with the basics of knowing what hardware to use. Iād love to drive a couple of these: https://www.mouser.co.uk/ProductDetail/Newhaven-Display/NHD-312-25664UCW2?qs=sGAEpiMZZMshRHSPqbouvOvHakcQfxTK8NYNn%2FEobNn3B1TqCw3COQ%3D%3D
Anyone know of any good tutorials for utilising a separate DAC with the Teensy? Iāve been working off the O_c schematics and firmware to try and get something extremely basic together but itās perhaps just out of my reach right now.
Letās think about UI first.
Whilst there are ways to smooth data reads from analog, there will likely always be points āin betweenā two values, and it doesnāt sound like jittering between two sets of USB inputs is a good thing to be doing. So whilst you could use a library like ResponsiveAnalogRead
to smooth out that input (I like it a lot, beats implementing it by hand all the time), you donāt really address the real problem.
An encoder might make more sense, because itās a digital input: usually emitting Gray code, you can decode it to basically get āleft one click/right one clickā type data. But: encoders can be mechanically funky, theyāre always harder to work with than you think, and they can still have bounce.
Have you considered something like a pair of up/down toggle buttons? Can be small, means you absolutely, positively, wonāt swap inputs unless you want to. You just need one digital pin per input, debounce them, and then maybe use some LEDs as indicators. If you think youāre running out of pins, youāre really not - a LED driver chip or GPIO expander will help here. You might be able to get away with one button for ācycleā.
In term of āsuitedā to controller a microcontroller - thereās not really an answer. You need analog inputs for a pot (which most MCUs do), wheras an encoder is digital. I think the question really is: are you asking it to do an analog thing? And I donāt think you are, so Iām not sure the pot is a good idea. Really, youāre doing digital switching, so some kind of digital input - be it a button or encoder - is probably the right answer. Iād lean towards buttons, frankly.
Regarding the rest of the pile: something like a 4052 is a smart idea. However, itās a fairly old (CMOS) part, and you might want to test it behaves itself with USB data if you havenāt already. It looks like it should work from what I can make out on the datasheet, but Iām not an expert there, and I donāt know if itāll interfere with the USB data in any way).
Does that help?
(Iād also note thereās a way of doing this pretty much without an MCU, involving a handful of CMOS parts (counters, mainly) and doing analog switch debouncing).
Yes, thanks @infovore, this was super helpful!
Iāve considered toggle buttons for exactly what you are describing. But I like to make things hard on myself, for the sake of design. At least, design thatās pleasing to me
But just to make sure weāre both talking about the same thing, I am only considering an encoder for the 4 possible outputs. I wasnāt sure if thatās what you were getting at when you mentioned āwonāt swap inputsā in reference to the toggle buttons.
Either way, both intuitively and mechanically, I like the idea of choosing output location by rotary selection. And as Iāve had some time to think and tinker with it, I do feel like itās really doable with an encoder (by ensuring the encoder turns āxā amount in one direction before we start doing stuff). Iāve been practicing some basic forms of this with the vast pile of potentiometers I have sitting in my basement, and have made some headway.
I do plan on changing my design from a toggle switch to two push buttons for input selection. This seems like an easy task for the Arduino, and something basic that will provide more learning/problem solving opportunities.
As for the 4052, Iāve got my fingers crossed thereāll be no issues with the USB data lines. I do plan on getting an order in soon (also for the rest of my Fates build Iāve been putting off) and will find out, but Iām starting to wonder if I actually need one, as youāve mentioned earlier. This project would require 4 input pins for the two USB sources, and 8 output pins for the 4 USB outs. Some pins for the encoder and the buttons. All that could be handled with a GPIO expander?
Makes sense. And yes, with an encoder, you could, say, require a āsignificantā number of steps to swap the input. See what feels best to you. There are Completely Fine⢠encoder libraries out there, and I would recommend just using one of them.
ah, no, sorry, youāll still need the 4052-or-similar: a GPIO expander just gives your microcontroller more pins. You still need the switches to run the USB data through. So: your 4052 will take two inputs and mux them each to four outputs. Youāll need four pins from the MCU to control the 4052, then two for the encoder, one for each LED you want to use (because how else will you know which input/output is selected?), plus one for each button. I think you should still be fine with pincount on a Teensy 3.x, though!