Rainbow DIP Switch Is The Coolest Way To Configure Your Project

Oftentimes, when programming, we’ll put configuration switches into a config file in order to control the behaviour of our code. However, having to regularly open a text editor to make changes can be a pain. This colorful little DIP switch dongle from [Glen Aikins] makes for a fun alternative solution.

Do want.

The build is simple, relying on a rainbow-colored 8-pin DIP switch as the core of the project. A PIC16F1459 then reads the position of the switches, with the 8-bit microcontroller doing the job of speaking USB to the host machine. The device enumerates as a USB HID device, and reports to the host machine when queried as to the state of its 8 switches. [Glen] used a basic C# app to show a digital representation of the switches on screen changing as per the real physical DIP switch plugged into the machine.

It’s a great tool for controlling up to 8 different parameters in a program you might be working on, without having to dive into your editor to change the relevant parts. Also, it bears noting that the rainbow design is simply very fetching and a cool thing to have plugged into your computer. It’s a more serious device than [Glen’s] hilarious 4-byte “solid state drive” that we saw recently, but we love them both all the same!

28 thoughts on “Rainbow DIP Switch Is The Coolest Way To Configure Your Project

    1. politically incorrect today, but in the Navy it was “Bad Boys R*** Young Girls, But Violet Gives Willingly” …don’t hate me, it was a different world 50 years ago…

      1. In comms I had to learn a lot of different color codes for things like cabling and many of the old color codes for capacitors and inductors.

        I learnt the resistor color code as Black, Brown, Red, Orange, Yellow, Green, Blue, Purple, Grey, White.

        It’s better to learn it this way as there is not a double conversion like, Black starts with “B” so it’s first in the rhyme “Big ….”, so It’s “0”.

        Without learning the double conversion you see yellow and think “4”. It’s much easier.

      1. Wire each switch in parallel with a resistor. Wrap the top of one switch/R pair to the bottom of the other. Switch in one direction, current must flow through resistor. Other direction, current shorts around resistor. This project already has inline resistors for each switch, it’d just be a matter of some simple trace re-routing and selecting whatever resistor values you’d like on it.

  1. Yeah, Seems I’ve exceeded my free limit of twitter and need to create an account.

    This project looked interesting, It’s a pity there is no like to the project outside twitter. I mean!, no one seriously uses twitter to post an entire project. I was wondering if the switches … oh never mind.

    And I only go to twitter on links from hackaday. So hey, hackaday, you’ve exceeded the maximum number of links to twitter.

  2. Why not make it a USB drive? It could have a single file called config.ini (or something), with a single [options] section with 8 options in it. Each one can be 0 or 1.

    Then in your application, open d:\config.ini and parse the options. Every time you read the file you get the current state of the switches as options for your program.

      1. I tried this. Windows and Mac both cache reads from USB mass storage devices. The first time you read the file, you get the state of the switches. The next time you read the file, you get the cached state of the switches. The only way to tell the OS that the switch state changed is to do a soft detach followed by a re-attach. This results in annoying unsafe eject / new file explorer windows / alert tones / etc every time the switch is changed. I decided to stick with good old trusty vendor-defined USB HID.

  3. Biggest advantage over config files that I see is: you won’t forget the save the file you edited. I can’t tell you how many hours I’ve wasted tracking down “bugs” because I forgot to save the configuration file.

    1. lol. I bought an 8 pack of (Merican brand) Sharpie permanent markers and they the right colours but missing grey and white. ie Black, Brown, Red, Orange, Yellow, Green, Blue, Purple. Perfect!

Leave a Reply to Stan. SWANCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.