|
Neat project. I accidentally bought some I2S microphones a little bit ago. Those are nontrivial to get working on tiny micros, as I2S is a pretty speedy protocol, all things considered. Because I like to be pedantic, going from 8-bit to 16-bit on your digital audio doesn't do anything for the fidelity, it just lowers the noise floor. If you're using the same sample rate, then you get all your information in the same number of samples, but you get more quantization noise with a lower bit depth. CD players use a 1-bit DAC running at 16x sampling frequency, so it "acts like" a 16-bit (really 14-bit because of math) DAC. Can't wait until you get into your buttons and switches. Charlieplexing and diodes, aplenty, right?
|
# ¿ Nov 22, 2020 03:30 |
|
|
# ¿ Apr 25, 2024 11:06 |
|
Cory Parsnipson posted:Oh gently caress, I'm spreading misinformation. The audio is converted by the DAC into a band-limited signal. Everything above samplefreq/2 cannot be represented (as per Nyquist). Therefore, if your sample rate is the same, you get precisely one waveform of your sample points, whether or they're 8 bits or 16 bits or whatever. The 16-bit signal is "closer" to the original, but there isn't any more frequency information in it. Because an arbitrary analog signal falls in a random spot between sampling points, the average difference at a single sample point when summed across all the points is white noise. If you only have 8 bits of depth, then you're looking at a larger signal-to-noise ratio, as each point has a larger distance away it can be. This is called "quantization noise" and if your digitizer is any good (audio ones are) then this noise is exactly equivalent to tape hiss. 4 bits gives more "hiss" than 8, which is more than 16, etc. So if you're playing on a crappy low-fidelity speaker anyway, your sound and tones (especially if they're small numbers of sine waves added together) will sound the same at 8 bits and 16, but you will probably be able to hear the difference in a voice sample or a drum hit or something that's got a lot of complex frequency stuff in it. quote:I never got why they called it "charlieplexing" and not just "key matrix" but I think so? I've been using the buttons directly hooked up to GPIO, but now that I need like 16 of them, I need to switch to the matrix'd approach. I'm using this page as a reference. The key matrix and charlieplexing look basically the same to me, but I also never done charlieplexing before so I'm not sure if they're the same thing or if I'm missing some nuances. Normal switch matrix takes n pins to drive n2/2 pins, but charlieplexing uses n pins to drive n2-n pins. So a charlieplex 4x4 matrix only needs to use 6 pins, instead of 8. By being clever about which of your inputs are high, which are low, and which are input, you can get all your input with fewer pins, as long as you can sacrifice refresh rate.
|
# ¿ Nov 30, 2020 21:47 |
|
Looks pretty good. I used UnoJoy back in 2014 to make my two-axis-and-a-bunch-of-buttons. I think it used an Arduino Nano; it's buried back in the base of the joystick. Anyway, there are two chips onboard the device, an atmega8u2 which does all the USB stuff, and a standard atmega328p (normal arduino) that reads all the buttons and axes and stuff. Switching pin modes from INPUT to OUTPUT may take some time to stabilize; be mindful of switch debouncing and pullups/pulldowns/slew rate. When I did my joystick, I had to do the USB HID controller from scratch. My arduino code was very simple, code:
Then in the 8u2 code, it reads in the controller switch data and converts all the d-pads to actual d-pad values like such: code:
|
# ¿ Jan 4, 2021 04:45 |
|
Good on you for making it this far. The reason the d-pads are their own part of the report instead of extra buttons is: I wanted a pair of d-pads so I could just tell my app to "use this axis" and not have to map four buttons to 8+1 directions. This device had four analog axes, two d-pads, a 3-position selector, a couple of rockers, and six individual buttons, one of which was a two-stage. The USB spec handles all of these nicely, so they got their own breakouts in the report. If you say "this group of inputs is a D-pad" in the USB descriptor, then Windows Just Knows and it works; you don't have to worry at all about whether or not your software can do what you need it to do based on discrete buttons. I'll dig it out of the closet and plug it in and see what the windows "joystick button input" screen looks like, maybe.
|
# ¿ Jan 9, 2021 01:32 |
|
I love what you're doing here with conductive ink and first principles. How are you debouncing your switches in code? I've implemented https://hackaday.com/2015/12/10/embed-with-elliot-debounce-your-noisy-buttons-part-ii/ a few times and it has been "pretty good" for what I'm doing; but super-low-latency is typically king for gamepad stuff, so maybe actual schmitt triggers would be worth it.
|
# ¿ Jan 14, 2021 03:11 |
|
You are doing wonderful things. Your CAD is the best Cardboard Aided Design I've seen since Project Binky.
|
# ¿ Jan 26, 2021 15:56 |
|
Just to be 100% clear: the cardboard is for prototype only, and the final version is going to be out of something rigid? Or is the final design going to be cardboard for aesthetic purposes?
|
# ¿ Jan 28, 2021 16:35 |
|
Cory Parsnipson posted:Cardboard is for prototyping only. I want to make the final version by using kiCAD to make PCBs and then creating the case from a 3D printer. The prototype looks like it's going to turn out to be quite unpleasant to use. The cardboard is too squishy for pressing buttons fast and that's going to make playing games really un-fun. Ok. In that case, 400% do not agonize about things. 3d printer (or a LED laser cutter + acrylic) means all of these problems with height are a down-the-road problem. You just need the outlines and dimensions. Z-axis is for rev. 2, when you can print a stack of shims in .2mm thicknesses and then go with the height that works. In other words, you're solving a problem that you don't need to solve. I'm here to kindly tell you not to go down the path that so many of us have: trying to make THIS ONE absolutely perfect before moving to the next step. Remember: perfect is the enemy of good.
|
# ¿ Jan 28, 2021 23:09 |
|
Cory Parsnipson posted:Thanks. I've only made two thicknesses of padding and faceplate and I stopped there. I'm working on the wiring now. The more problems like this that crop up during cardboarding make me want to get to the actual designing that much faster... Just think of all the cardboard as "placeholder." It's good to have the placeholders, amm, in place. The conductive ink on paper is BRILLIANT prototyping as opposed to the rats' nest on a breadboard approach, and I sincerely hope it works for you; I'm watching with anticipation. Just think of your prototype as having things you learn from and things you ignore. What you learn from is placing and reach and stuff, not SPECIFIC, to-the-thousandth thicknesses. If you think "this cardboard is doing something the final plastic won't do" then just move on. For 3d-printed stuff, 6mm of thickness is PLENTY. At this point, I think your design looks great, and do not ascribe the weaknesses of your current medium to weaknesses in design nor execution.
|
# ¿ Jan 29, 2021 00:11 |
|
You'll never make any money selling tchotchkies with your 3d printer, but getting the Prusa means it'll Just Work (r) (tm) straight out of the box. Get away from GIMP for your scale drawings. Get Inkscape. It's a vector drawing program that outputs .svg, but more importantly, it natively works in real-world units. If you set your drawing units and page units to mm, then if the measurement tool says something is 9mm wide, then it's 9mm wide when it prints out.
|
# ¿ Feb 5, 2021 00:11 |
|
Cory Parsnipson posted:Is this from experience? What were some of the barriers to profitability? Everybody and their brother has a printer now. Unless you're selling directly to people you know for cheap, there's no market that's not already served.
|
# ¿ Feb 5, 2021 01:25 |
|
Cory Parsnipson posted:Also I'm going to have to apologize in advance because I wanna give the paper circuit the ole college try. I want that sweet cardboard game console street cred. I promise that this will become a proper PCB at some point. "The old college try" appears to be drinking and smoking weed instead of paying attention, so let's give that one a miss. <soapbox>The thing I love about projects like this is that there is A Goal, but not every step has to be laser-focused on achieving that goal. This cardboard version is a thing you want to do, even though it doesn't strictly get you closer to your goal, and may move you further from it. It has become its own thing to do in the larger project. I certainly don't want anyone to deter you from doing things you want to do, even though they are not tightly concerned with your stated overarching purpose.</soapbox> That said, let's look at your bus layout. Some lines need diodes, some do not. Try to figure out a way so you can use the diodes as your jumpers and move your bus lines so that the stuff that doesn't need jumpers stays planar. This may mean having pin assignments that look completely whacky in code, but make sense in the physical world. That's fine, the code doesn't have to make sense, it just has to produce the output. If having all the D buttons in one group, all the U buttons in another group makes the wiring make sense, then that's a valid plan, instead of forcing the layout to be a specific way because it makes the software look nice or easy.
|
# ¿ Feb 6, 2021 18:19 |
|
Cory Parsnipson posted:Yeah, I don't think you could call me a "real" 3D printing fan seeing as I got into this rear end backwards. I like it when things just work. I only have the attention span to hyper focus on one set of problems at a time. The prusa will serve you well. Back to button matrix, eh? That will massively lower your parts count, since you can use the internal pullups for all your buttons now, and don't need any more diodes. The insulating tape under the foil tape is pro-level stuff, man. Keep up the great work.
|
# ¿ Feb 8, 2021 19:12 |
|
Cory Parsnipson posted:So your friend Charlie turned out to be a psycho... Great talk. Good presentation. Are you running out of digital IO pins on your controller for all the buttons you have? If so, an I2C port expander is probably what you need. One of those means you use two pins to control the port expander and get 16 more inputs.
|
# ¿ Feb 9, 2021 15:33 |
|
Cory Parsnipson posted:Legend of Cory This is a good update. Keep at it. You are learning many disciplines at once and (unlike SO MANY OTHERS) paying attention to advice and doing things as close to the right way as the hivemind can steer you.
|
# ¿ Mar 25, 2021 08:01 |
|
Cory Parsnipson posted:Me neither, actually. I'm mostly just speculating. I'm missing something fundamental. The point of having three boards is so they're all reasonably dense, right? It is a common thing to "panelize" your boards yourself and submit them to the fab house as one "board." So you could have e.g. four copies of your d-pads and two copies of your mainboard in one footprint that meets the fab house's minimum dimensions. You get three or four of those by default, so you'd end up with six to eight bare boards for you to populate. Adding drill holes and stuff is pretty easy; a line of drill holes makes a decent perforation, but there are also guides on how to create edge-routing layouts to make actual 'mouse bites' breakoff tabs. https://www.pcbway.com/blog/PCB_Design_Layout/Manual_panelizing_of_PCBs_with_tabs_and_mouse_bites_in_Kicad.html
|
# ¿ Mar 31, 2021 13:49 |
|
Looking good so far. I have quite a bit of experience doing stuff in KiCad it wasn't really for. Global labels and sheet labels are your friends, as are net labels. The net labels carry over to the PCB. This helps a lot when you're ratsnest routing. You'll have a line that's marked "audio_left_trimmed" instead of NET_RV1-2_U6-3. In the "place power port" series of symbols, there are some quasi-magic power and ground rails; use the ground symbols to give global-net grounds. This means instead of having a bunch of individual wires labelled "agnd" you can have a ground symbol named "agnd" that connects all the "agnd" pins to the "agnd" net by default. Works for power stuff, too. In the schematic editor, it's the button under the "add symbol" button that looks like a ground connection.
|
# ¿ Apr 2, 2021 14:52 |
|
Cory Parsnipson posted:Does this still work if agnd is being driven by the decoder output pin? I'm using the "AGND" output of the Adafruit decoder and connecting the speaker grounds to that. Adafruit says the analog ground is useful for separating analog circuits from digital circuits that might introduce noise if they use the same ground. I suppose that helps, but if it doesn't really make a difference or if I'm misunderstanding my own design then it would be easier just to use the power pins. The name of the net is "agnd". What that means in your circuit is up to you. It could mean "analog ground" or "audio ground" or "-7VAC connected to the A pin of the UC-G". It's just a net label. It has no "real world" meaning other than what you give it, regardless of what the person who put the symbol in the library typed into the description box. I like to have sheet labels and net labels to make everything nice, and a couple of different ground/power nets means you can just drop a GND or CHASSIS or GNDREF or VCC/VDD/V+/+12V whatever symbol makes you happy. This schematic is for you, and if the nets are logically named and don't make a huge tangle of lines on your page, that's helpful.
|
# ¿ Apr 4, 2021 02:06 |
|
Cory Parsnipson posted:Kidding with KiCADirus I had forgotten all about that. The Fuse and Circuit Breaker symbols I use I customized and put in my custom library so their pins are both type "power output." It doesn't appear as though there's any way to tell KiCad that "this pin is internally connected to this other pin" in a symbol, other than having the same pin number; that leads to its own set of issues. Cory Parsnipson posted:Also, this means that AGND is now a global label that may be connected to other sheets that happen to use AGND? I think that should be okay no matter what, right? Yes, precisely.
|
# ¿ Apr 6, 2021 15:15 |
|
csammis posted:If you do need PWR_FLAGs then I find it convenient to keep them tucked away in a dedicated corner of the schematic that is only concerned with power sourcing. That way I don't need to search through the whole drat thing to find them. This is much nicer and more elegant than having custom symbols for normal things. I dread what will happen if KiCad ever updates its symbol library sufficiently that my library of "fuse" and "breaker" and whatnot stop working.
|
# ¿ Apr 6, 2021 17:52 |
|
Cory Parsnipson posted:All this work just to make a stu-PIIIIIIIIIIIIIID--g'drat gameboyyy~ This shows that you are a poster with superior performance, exceptional ability, personal initiative and total dedication. You reflect credit upon yourself and uphold the highest traditions of DIY service. Really great job. Post some gerbers and stuff before submitting to manufacturers; we'd love to take first crack at them.
|
# ¿ Apr 20, 2021 01:54 |
|
Cory Parsnipson posted:
I think the KiCAD forums get a bit full of themselves. You personally know that you're using a 2-layer board for this d-pad, so you can just make your plated through-hole in the center of your pad. I don't see how this isn't a via? Nomenclature? Will having a solid solder mask on the back cover the vent holes in your fake-vias? Obviously not a problem for any real board vias, but these are supposed to be vent holes too, right? Seems like that PTH pad you place could have the bottom soldermask drawn as well. Like, if you're using .3mm via hole, you'd place a .4mm pad with .3mm hole, soldermasked both sides. Won't matter at all on top, because of the larger footprint pad up there, but the bottom will be clear of mask just in case. Cory Parsnipson posted:My headache screams in a shrill howl that fills the room, piercing my vision with red pulsing spears. I clench my hands against my head even harder. The room blurs and undulates and I fall through the floor.
|
# ¿ Apr 29, 2021 01:34 |
|
You are using a 3d printer in a way that makes me very happy. Your designs look great and are wonderfully functional. This is pro AF; it took me a few seconds of HARD looking to determine it wasn't a factory part. Amazing work. As far as supports go, see how good your slicer is at supporting stuff before you worry about throwing them into your design. Tapping into plastic: Don't worry about it too much. It's plenty strong if your screw is long enough. Especially M1.6. If you put a 1.5mm hole in your design then you'll get a nice solid wall to thread into. If you have one, you can drill and tap with an actual tap kit. Above M6, you can model the threads into the part directly.
|
# ¿ May 2, 2021 21:22 |
|
https://www.mcmaster.com/inserts/heat-set-inserts-for-plastic-7/ Plastic inserts. Either drill or print your hole a nominal diameter, then press these in with a soldering iron and you have a permanent brass thread. https://hackaday.com/2019/02/28/threading-3d-printed-parts-how-to-use-heat-set-inserts/
|
# ¿ May 5, 2021 15:49 |
|
I love everything you've done! The gray plastic looks so Nintendo; it's perfect.Cory Parsnipson posted:Good enough There are two "extra" pins on those switches. Could you just fold those flat for mechanical retention for the switch instead of trying to secure it (flimsily) from the front?
|
# ¿ May 21, 2021 19:24 |
|
Cory Parsnipson posted:I think it's a neat idea. Unfortunately I didn't quite have the length from the pins to securely fasten the top in place. I also broke one of them off accidentally Unless you mean fold them to hold the tactile switch itself in place? Holding the switch in place is no problem but the front fastener is more to hold the button cover and flexible silicon membrane in place. Ah. I meant to hold the switch. Though, looking at that picture, maybe some thin wire to hold the membrane and button cover in place would work. There's going to be a case over top, right? Could something like blue tack or tape or a zip tie or silicone or... just hold the membrane and button cover in rough location until the front of the case goes on?
|
# ¿ May 24, 2021 02:15 |
|
Love all the progress! It's great to have something working in-hand. Great job!Cory Parsnipson posted:I poked around with my multimeter and looking through a teardown of the thumbstick I realized that the button wire seems to be left floating and then shorted to ground when the button is pressed down. This would explain why I'm seeing the weird behavior where the button just ends up flickering. Why didn't this show up in the breadboard version? I have no idea. I don't think circuits is turning out to be my strong suit. I haven't seen a wiring diagram of how you hooked it up this time, and seem to have missed the MOSFET stuff somewhere. Would you mind sharing your wiring setup (or kicad files) just so we can see what decisions you made? It's always fascinating how many ways there are to solve problems.
|
# ¿ Jun 5, 2021 19:39 |
|
Ahh. I get it. So the button floats, but connects to ground when pushed? Makes sense. Since you're already using the GPIO's pullups, why not just take the thumb buttons out of the row/column stuff and just use those GPIOs to sense the thumb buttons? It takes the MOSFETs and their diodes off the board. Lowers the part count for your PCB, too.
|
# ¿ Jun 5, 2021 21:54 |
|
Cory Parsnipson posted:Oops, all buttons! GREAT WORK! I love it when a plan comes together.
|
# ¿ Jun 17, 2021 07:01 |
|
I just want to say that the revelation in the electronics thread is exceptionally surprising to me. For those not in both threads, Cory Parsnipson found out that the joycons are driven at 1.7V in the actual hardware, but the arduino drives them at 5V. This means that at their minimum range, it is theorized the current can get high enough to smoke the little resistive pots that make the joycons work. This is news to me, and some amazing examples of value engineering from Nintendo. Cory, what are the resistance values at min and max on one of your still-working joycons? I think we should calculate power dissipation and see if this is a feasible failure mode.
|
# ¿ Jun 21, 2021 17:14 |
|
Cory Parsnipson posted:but in the future, I'd work around it by avoiding it entirely quote:or going to OSH park quote:or just buying a dremel tool instead... DON'T CHEAP OUT HERE. This is where tiny mistakes mean layer splits and broken vias and absolutely impossible-to-detect intermittent faults. Broken vias are terrible things. I had a via too close to an edge and I split the boards with scissors instead of a sharp cutter. On the bench, all the test points checked good. In the field, one of my signals would get lost. On the bench, fine. Probed? fine. The via was split and when the board heated above 90°F, the layer would split apart and continuity was lost. Drilled and filled the via with solder and saved the board, but what a pain. Your designs look great, and $25 is a reasonable price. If you keep your boards to 2-layer, I can maybe swing something to help you out. Hit me up in PMs if you want more information.
|
# ¿ Jul 21, 2021 17:44 |
|
Just caught up on this thread. Wonderful work; this battery stuff is nontrivial. I'm glad you're learning a lot so that revision (whatever this one is + however many it takes) will be to your liking. I experienced sublime joy when Iclicked back to the subforum screen to find that there was a new post! Excellent! I looked at the soft power switch pretty hard; I'm not sure it's what you need. That soft power switch still requires the device on the far side to enable/disable the power line. So you'd need some kind of tiny MCU attached to the soft power switch to actually enable/disable the power line and also be talking to the RasPi. Since you can't just have the raspi idling waiting for the power button to get pressed. If I'm reading the code right, every time the power button is tapped, the device on the far side of "system power" gets full system voltage. It's then up to it to determine what it wants to do. The example sketch has it turning system power off if the button was pressed for <100ms. I don't think a pi will come out of sleep in enough time for this thing to work standalone. You have another mcu onboard, right? One that could be super-fast-boot and low-power sleep (with a wake on pinchange interrupt) that could also do your power stuff? edit: didn't say the important stuff first. babyeatingpsychopath fucked around with this message at 00:48 on Aug 15, 2021 |
# ¿ Aug 15, 2021 00:41 |
|
These last three posts have been solid awesome. Myself, I love poring through datasheets and doing esoteric i2c stuff. I wonder if the [.1 Hr rate] is the 10C rate for the battery, or if it's the .1C rate.... The example makes it seem like it's 1/10 of the 1C rate, but who knows! To expand a bit: Say you have a "1AH" battery pack. The 1C rate would be 1 amp for 1 hour for the battery to go from full to empty. The 10C rate would be how many amp-hours you could get out of the battery at 10A. It may be more or less than 1AH depending on chemistry. The .1C rate works the same; how many AH you get from the battery at 100mA. This is very frequently more than the 1C capacity, but not always. Some chemistries love dumping power and don't trickle it out well. Some chemistries like giving a little juice for a long time. babyeatingpsychopath fucked around with this message at 08:09 on Sep 4, 2021 |
# ¿ Sep 4, 2021 08:05 |
|
This is a valuable use of your time, and I'm happy to continue to watch your progress. What's in the box?
|
# ¿ Sep 7, 2021 04:13 |
|
Cory Parsnipson posted:It's the latching power switch! Now I won't have to hurt my fingers pulling the battery out of the socket. After ripping a thumbnail nearly off trying to get an 18650 out of my battery holder, I installed a commercial snap-action 120V 15A switch in-line. Yeah, just a straight wall switch from the project box. Overkill, maybe, but prototypes are designed to have kludges.
|
# ¿ Sep 7, 2021 06:18 |
|
I've been thinking about your soft power switch A LOT, and I think using the buttons arduino to control it is a simpler path than trying to get the raspi to do it. The two controllers are already talking to each other, so signalling intent shouldn't be too difficult. Since almost all of the soft-power-on stuff can be in the setup() routine and the power-off can be in the raspi with hard clamping help from the arduino, that can also help narrow down where problems are happening and give a little bit of redundancy. Also, great work on the overlay! Why is the emulator on layer 10,000? That's silly.
|
# ¿ Sep 23, 2021 18:31 |
|
Cory Parsnipson posted:GPIO6 and GPIO16 are not used or connected to anything. For absolute simplicity, GPIO?? to the arduino for the power-off command and only ever pass USB one direction. Bidirectional USB can be irritating. Unless you're already sending stuff bidirectional, in which case n/m. I seem to remember you had 3 or 4 "spare" GPIOs available. Alternatively, have GPIO?? tied to the NMOS GPIO and, after the arduino powers the NMOS on, sometime later it just makes that an input. That way, when the pi pulls the NMOS low or de-asserts it, the arduino gets that signal by default. Seems a little bit more fail-safe as long as you trust the power protection and pullups/pulldowns (if enabled, probably not necessary). I'm not sure if you can use GPIO6 or if you have to use 16, honestly. The GPIO-overlay stuff is a bit esoteric.
|
# ¿ Sep 27, 2021 08:09 |
|
Cory Parsnipson posted:Holy shiiiit pisss!! The piece fits perfectly! Assemblies are my new best friend. WOOHOO! Great job! The iterations on this have been fascinating to watch. You're an inspiration.
|
# ¿ Oct 5, 2021 20:45 |
|
Cory Parsnipson posted:It's time to add on all the power supply components and wire them together and then turn it on and cross my fingers and see what happens. Bummer about the bracket being too short. Thankfully you're not getting these milled from billet aluminum and they take two weeks to show up. Good luck with the power-on and don't let the smoke out!
|
# ¿ Oct 11, 2021 08:00 |
|
|
# ¿ Apr 25, 2024 11:06 |
|
That's great, man. Great video! I thought you were taking it outside to put next to a literal brick for scale. Is it possible to get code into the arduino from its current assembly state and have it push ultra-verbose messages about what signals it's getting so you don't have to vivisect it and get in with the logic probe?
|
# ¿ Oct 13, 2021 21:06 |