Hacker News new | past | comments | ask | show | jobs | submit login
Dip Switch USB Stick (twitter.com/bikerglen)
209 points by tambourine_man on Feb 3, 2022 | hide | past | favorite | 70 comments



One of my favorite things in life is the the feeling I get when I open something up to find a pcb populated with dip switches (or jumpers) that are clearly labeled on the pcb. This practice has most likely disappeared to save pcb space, but it feels great when you don't have to grep config files or search for a long lost manual pdf.


This would have backfired on one project I worked on. Near the end of the project I was asked to document the working of the DIP switches. I discovered that the settings were too complex, I couldn't document it in any way that would make sense to a user. But then I realized that they were being interpreted in software, and it was my software - I could make them do anything I wanted! So I wrote the documentation the way I thought made sense, then changed the software to match the documentation. If the switches had been labeled on the PCB it would have been too late for that.


That's an interesting situation that I hadn't really thought of, having only been on the user side of the switches. It seems like they would be painful to implement when adding them to a large project where software, hardware, and documentation may be handled by separate teams.


That was exactly the case here, I was asked for the switch description so the documentation folks could complete the user manual. It was just lucky that the switches weren't controlling the hardware directly.


On the other hand, whoever would have labelled them on the PCB could come to the same conclusion, right?


No, because I'm the one they would have been asking for the appropriate labels and they would have accepted them without question. There was a direct correlation between each switch and a board feature originally, so making up labels wouldn't have been hard. The problem was that the features interacted in a way that made it difficult to describe combinations that would deliver the desired outcome, and some combinations were flat out invalid.


It's a well-known way to create sensible interfaces. If it's hard to document, it is probably a bad idea!


I love it when there are three pins clearly labelled "UART" or "Console", and when you wire up to it, it gives you a "Welcome, Hacker!" style banner message and a text interface to do the configuration.


In the future, it would just use voice control. No need for any manuals or things printed on the PCB.


The only downsides are an always-on microphone and a few GB of voice models and recognition software. I think a switch is preferable.


"Hey Siri, toggle setting 3"

"Here's what I found on the web for toggle setting 3"


"Hey Siri, toggle setting 3"

"Got it. Toggling setting 4".


Cache of this article which does not require javascript to view:

https://nitter.net/bikerglen/status/1482516332432162820


Another way to avoid JavaScript is to send a Googlebot User-Agent to Twitter. Nitter is better of course.


Doesn't Twitter check the reverse IP, per Google's recommendation in their official documentation?


It didn't last time I checked.


Wow, that loads so much faster than "real" twitter!


I can recommend Nitter Redirect. I'm thankful of it every time I happen to click on a Twitter link. https://addons.mozilla.org/en-US/firefox/addon/nitter-redire...


Installed and already benefiting from it. Thanks!


If you make a stick with switches I would choose something more easily toggled and durable than DIP switches. Those work fine in a situation where you rarely touch them if ever, like a luxury version of a jumper grid. But if you go out of your way to add them to a system, odds are you're going to need to change them more often and usability and durability become a factor.


I think that's the idea of the project, dip switches are used on boards to select a configuration (since you only need to do it on setup)... speaking of which, i wonder if a jumper version is planned for the IDE HDD nostalgia.


Back when I was very first learning to use the USB driver for the PIC MCU I made something similar except it was even dumber, it was just one push button and one LED. I showed it to a few buddies and same thing, they started thinking of all kinds of funny use cases for it, like a USB controlled light switch or whatever.

But seriously, the PIC USB driver, super simple to use and very useful for many real useful purposes.


If PIC programmers/debuggers didn't cost about the same as a months rent, or at least didn't use proprietary Windows-only drivers... I love PIC stuff too but jesus they make it hard to choose their stuff for hobby work.


Haven't touched PICs in a while, but PICkit seems to still be a thing. I remember getting into microcontrollers by saving pocketmoney for pickit2 when I was in school. They also now have an even cheaper option - mplab snap ~30 Eur. That's approximately same as 1-2 official Arduinos. Not exactly month's rent.

At the same time a good JTAG probe like J-Link for arm micros can cost 300-800 Eur. There are both cheap and expensive solutions for most microcontrollers.


The pickit guy was giving the other dev tools people at Microchip a run for their money for a long time, implementing the features of the fancier debuggers and more, like a simple logic analyzer.

My impression was it was basically one engineer or a very small team implementing the pickit who took the opportunity to make it a tour de force.

Recommended, if it will do what you need.


> a good JTAG probe like J-Link for arm micros can cost 300-800 Eur

I’ve never understood how they stay in business. Dirt cheap SWD programmers work with pretty much any arm chips and give you all the debugging features like breakpoints over just 2 wires.


Just did a quick search for JTAG debuggers on Aliexpress, and the majority seem to be clones of Segger J-Links, so yeah... it's easy to produce the (simple) hardware and sell for cheap if you just steal the software, it's the same with Saleae Logic Analyzers.


The software (OpenOCD) is free and open source.

Alternatively you could use a programmer that doesn’t require any software and just exposes a GDB server over a tty: https://1bitsquared.com/products/black-magic-probe


If you're a (non-commercial) hobbyist/student, there's the official Segger J-Link EDU Debug Probe for 50€, same functionality as the J-Link BASE.


True, not ideal for hobby stuff. Not sure the best hobby alt for USB stuff, seems like an opening there for something cool maybe in the Arduino realm? Could be something out there on that front, but I am not super up on that space, but I bet Sparkfun has something, those guys are awesome for hobby stuff IMO.


The Raspberry Pi Pico is pretty easy to work with and has you covered if you need USB.


Yeah it's pretty easy now to build USB HID gadgets with various boards from Sparkfun/Adafruit/Arduino... even the small Digispark board based on the ATtiny85 can act as an (emulated) USB HID device :-)


Wow, figured uniquely colored switches would drive up cost[1], but certainly didn't expect over US$10/ea at 10 units MOQ...hard pass.

[1] https://www.newark.com/erg-components/sds-8-014/dip-switch-8...


>$10

Wow that’s insane.

For anyone wondering, a normal DIP switch is around $0.30 which is already kinda expensive in the context of cheap consumer electronics.


In related news, there is the tetrabyte SSD drive: https://threadreaderapp.com/thread/1484017857696464898.html


FYI: The Tetrabyte SSD is by the same guy as this, Glen Akins.


Very few write cycles!


This seems super pointless but fun.


Good excuse to use the pretty rainbow switches.


The best projects are.


It can also serve as the simplest user-configurable hardware key. Many hardware keys from 1990s were not that more complex.


I once hooked up a parallel port to a garage door opener to emulate dip switches. Back then garage doors use an 8 pin dip to set your code differently from your neighbors.


How long did it take to try all 256 codes?


Could be a PITA with a DIP switch; they can be fiddley.

To actually broadcast all the codes in IR would take seconds, though.


Yes, JSON or XML would probably be overkill. How about a simple text file with a sequence of 8 '0' or '1' characters?


Nah, it would be best to use a custom piece of hardware that occupies a USB slot to store that data instead

Jokes aside, it's a fun and cool project to learn about microcontrollers


I was thinking of putting the text file on a USB memory stick, so you could continue to waste the USB port. You could probably pick up an old obsolete one for less than the BOM of this project.


fun stuff... use cases?

here is a couple...

1. profile location switching. pin 1 on/off = work/away - switch system configs appropriately. 2. desktop workspaces, flipping pin 2 on enables workspace switching. pin 3 and 4 control workspace number.

What else?


With this sort of switch you have to worry about the lifecycle of the switch. They aren't meant to be toggled routinely. For the mentioned DIP switch (https://www.farnell.com/datasheets/5461.pdf) it's basically assured it'll be fine through 1000 cycles, and likely dead at 10,000.

1000 cycles is only ~3x/day for a year.


addblock on/off, javascript on/off, vpn on/off, qwerty/dvorak, default editor is vim/emacs, indentation is tabs/spaces, the dress is blue and black / white and gold, fund police/defund police, those are/aren't the droids we're looking for


to be/not to be


A form of two-factor authentication? (Something you have + something you know.)

Simply set the value to match a rotating 8-bit token and plug-in to login :)


Integrate with Linux bootloader / boot process.

pin 0 on = normal boot, pin 0 off = single user mode.

pin 1 on = GRUB interactive screen enabled, pin 1 off = GRUB interactive screen disabled.



I had something like that hanging off a parallel port in a PC in 1990; it read the status bits of a printer port and booted accordingly. Could still do it today, via a $1 USB serial port's status bits.


This could be useful for conferencing on the go. Toggle switches for webcam, mic, mute, uhh...different channels?


Could be useful with home assistant in a lot of ways, though your use cases kind of cover them.


   : w q !
   1 2 3 4


Wow, it's more than $1 a bit!


At least they’re reusable


Those rainbow colored DIP switches are sweet! I've got think of a use for them now.

https://www.newark.com/erg-components/sds-8-014/dip-switch-8...


Are they actually good switches?


Glen said this to me about them a few days ago: "They're expensive, finicky, and not readily available. 5 to 10x the price of their surface mount and through hole competitors."


Amazing project, I think programming this thing may be a good entry intro USB device drivers programming world.

This should be also reproducible on Arduino, since a long time ppl are making USB arduino keyboards. Making USB arduino dip switch should not be more difficult.


I would have preferred jumpers… but I’ll accept this.


So how do you connect to the device? Serial? or it drops a file in a virtual drive?


I have a similar, slightly more usable (but still stupid) project in the works :P


This is so weird, I love it


Jumpers or nothing for me.


I, too, am a member of Generation Jumpers. In the 90s, manufacturers of consumer hardware saved the money for dip switches, so for me, hardware has jumpers and nothing else!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: