Hackaday Prize Entry: A Bit Dingus

There was a time when just about every computer – even laptops – came with a parallel port. That’s 25 pins of bit-banging goodness, accessible from every programming environment, that could control any random pile of electronics sitting on a desk. The days of parallel ports are behind us now, and if you want to blink a pin with a computer, you’re looking at controlling a microcontroller over USB or something.

[ajlitt]’s Tiny Bit Dingus is just that: a microcontroller stuffed into a USB plug with a few pin headers. With the right app, you can control these pin headers over USB. It’s the closest you’re going to get to a parallel port with modern hardware.

This bit dingus isn’t meant to replace the Bus Pirate, an Arduino, or anything else; it’s meant to be a small and simple way to connect random electronics to a computer with as few parts as possible. If you’re looking for a part to add to your electronic tinkerer everyday carry rig, this would be it.

There’s a few bits of interesting hardware inside the Bit Dingus. A while back, [ajltt] ran into the Freescale KL27, a Cortex M0+ that does USB without a crystal, has a USB bootloader, and doesn’t require many additional components at all. It’s the perfect size for the project at 5x5mm, and is unbrickable while still being flashable over USB.


The 2015 Hackaday Prize is sponsored by:

44 thoughts on “Hackaday Prize Entry: A Bit Dingus

    1. Right. There’s many options like that. Even before the FTDI chips, we had the Cypress FX2 which is good for parallel I/O + I2C + SPI (same CPU as used in many popular projects like the Saleae Logic). And before that, we used good ol’ 8255’s PPI’s on ISA card and we liked it!

        1. https://www.pjrc.com/teensy/benchmark_usb_serial_receive.html The USB-FS engine should be as good if not better than the KL20.

          I worked on a project a while back using the KL25 which is a predecessor in the same series, and doing raw bulk transfers (in a poor excuse for benchmarking) got not too far from those numbers using the off-the-shelf mbed library. Unfortunately my application needed to transfer small packets frequently, so it was limited by the 1ms USB-FS frame rate.

  1. Please pardon the noob question, but what makes a parallel port so special, other than allowing use of older parallel equipment. What advantages or ease does this device or a parallel port have when being used?

    1. Parports used to be basically memory-mapped I/O. You could write and read to a spot in memory and make the lines wiggle. It was pretty good for making a PC do useful things via relatively simple code. It eventually got harder under Windows as they abstracted more of the hardware and finally parports started disappearing.

      1. Back In The Day applications on PCs primarily ran on bare metal and owned the machine. Writing a byte out the parallel port took one instruction and required no permissions or drivers, and there was no scheduler to preempt your application. This can still be done (Mach3) but it’s no longer trivial to get consistent timings.

        Throwing a micro at the problem to provide real-time and talk to a modern PC interface (USB) takes away some of the limitations. Arduino and the like fill this void for the most part.

        1. It was fun being able to control relays with a simple GW-Basic program. I hated it when Visual basic omitted the peek and poke commands. Yes, there were ways around it, but the simplicity of native, built in support was gone.

  2. I built a computer just over one year ago and the gigabyte motherboard for my quad core athlon has both serial and parallel port hardware ONBOARD. The parallel port is not completely dead and you can still get it on motherboards. Heck, this motherboard was even one of the cheaper ones at the time.

    As for doing gpio with a microcontroller from the usb port without an external crystal, there are several AVR chips that have built in PLLs that can run the v-usb software without an external crystal and do much the same thing. There are also several PIC16, PIC18, and PIC32MX chips that have hardware usb and onboard PLL that can do it too.

    I find this an interesting thingie and fun build to look into, it is not the only kid on the block.

    1. It may not be dead but the abstraction layer is pretty deep. IIRC on the software side, Windows no longer allows direct acess to either of these ports without going through the abstraction layer. An issue I ran into as far back as the ’95/NT days when trying to program the the old Motorola chips. I had to install a custom driver written by a friend in another department.

      Even Linux can be hobbled depending on the hardware. This was an issue in another project since we found that the serial/parrallel communication was across a bridge for the selected hardware and the bridge didn’t allow direct “old school” access (I can’t remember which bus it was sitting on). We resorted to a different control scheme using an off the shelf USB based I/O board.

      After that, I quit trying to leverage the parallel ports for anything and resorted to microcontroller solutions.

      1. +1. The hardware is still easy to find in desktops (at least having a header, or via PCI/PCI-e cards). The problem is that the OS very much gets in the way making it useless for our purposes. Back in the DOS days, all it took was one line of assembly to set the pin states: OUT 378h,al These days are long gone…

      2. Never had a problem with not being to access the parallel or serial hardware on my pc. I run debian and sometimes have to give my user permission to access the /dev/ entries but that’s just security. There is also ye olde parport kernel module for your enjoyment and such. As I avoid windows like the plague whenever I do any development work,,,or web browsing or anything at all from home,,,I have not run into the windows blocking access although I have seen many others complain about it.

    1. I was just going to mention the USB Bit Whacker. I have one of the original 8bit boards. I do not use it often, but when I need a quick way to bit bang something, it is the board I grab.

    2. This project didn’t start out with that aim, but yes, the UBW was kind of an inspiration. I have one at my desk, and in fact, you had recommended it to me for remotely controlling some resets on some development hardware. For slow bit twiddling, it’s great.

      This wouldn’t be $2 in its current incarnation since the micro is at least twice that, though I’m sure it could be manufactured well under $10.

  3. The second closest to a parallel port was an pata port, which is just a peice of the ISA bus. To prove such I built http://hackaday.com/2011/02/03/stk200-pocket-change-programmer/ Now with serial ata thats not an option, serial has even worked its way down to the pci bus with pcie. It seems that direct processor io is going away, everything will pick up the latency of having to go thru a protocol stack and need complex libraries that build packets for you.
    For the kids stuff I do, I was going to set up an avr with a simple serial controled port, 8 bits for input, 8 bits for output, whatever you write comes up on the output pins, it streams back the input pins. But serial io isn’t really straight forward enough and comes with a whole heap of other issues.
    Why are there no pcie to parallel cards from china yet?

      1. Unfortunately, rue_mohr’s pata/gpio hack will not work with an SATA to PATA adapter. I tried. It requires very low level access to toggle pins, much like accessing a parallel port vs a usb-parallel adapter.

        BTW, rue_mohr is my hero when it comes to hacking.

  4. I am playing around with SiLabs Universal Bee series for a commercial project. They are cheap staring at $0.81 QTY 1 – 8051 core based Full speed USB device with internal clock and LDO. So all you’ll need.is a couple of decoupling caps.

    Their USB library code from their GUI generator unlike Freescale’s messy is actually very readable. They given you a license Keil’s C compiler. You get full hardware debugger with a $30 eval board.

    1. I considered the EFM32HG, $1.80 qty 1 at Mouser. It’s slower and has less storage than the KL27 but that shouldn’t be a problem for the purpose I’m considering. Not gonna lie, the HaD vendor prizes made me rethink the KL27, and for now it’s the HID bootloader in ROM that’s keeping me from switching. Lack of official mbed platform support and pricing are real problems for the KL27 and reasons I may switch to EFM32 in the future.

    2. Funny that I have been using Freescale parts twice for HaD contests because it was the cheapest ARM with features that I need and most memory in smaller packages. The EFM32 parts have too few I/O. The Freescale parts I am using are a pain as they also have no bootloaders. I am going to take a look at the KL27 as bootloader would be handy.

      BTW I used Keil uVision – one less headache to set up the tool chain under windows.

      1. The pricing I’ve been working with is from Mouser, which seems to be the cheapest for KL27 of the low volume distys. However I noticed Freescale has much lower direct sales pricing: $2.95 qty1 and $2.50 qty99+. Given that SiLabs doesn’t seem to have budgetary pricing or do low volume direct sales, I’m ok with $1 more for 4x the RAM and flash alone.

  5. “It’s the perfect size for the project at 5x5mm, and is unbrickable while still being flashable over USB.”

    If you think it is unbrickable, you’re not trying hard enough!

    1. It’s very brickable. Freescale insists on putting security fuses near the top of the flash, so you’re one flash write screwup from locking out the bootloader and debug port.

  6. IMO the parallel port’s strongest advantage was that it was already on basically every computer. When you got the bright idea to make your PC do something with a bit of external hardware, there was nothing to buy!

    1. It was also the way external hard drives, scanners, and all sorts of other stuff that needed high speed data used. They invented a few standards to allow proper non-bit-banged communication through it, then eventually tossed it and invented USB.

    2. USB isn’t that bad except for the VID/PID and drivers. Since it comes with a power source, so it is handy.

      Windows changed the serial port stuff a few times so far, so I gave up on it. USB – serial chip in your own device is a pain as the COM port can change. I do native USB device. I like the USB error handling and packet interface which makes the coding more organized than the roll your own packet format over serial port.

        1. Dunno if it’s allowed for application-level programs to allocate serial ports. Still, if you’re writing your own software, not trying to be compatible with others’, you can just check each serial port with some pre-set query response. I think Tekkieneet was more pissed off over them changing methods of access, rules, settings etc, altho he did mention the COM port changing.

      1. It is a waste of my time to code for some API that will change multiple times on a device that is limited to stream access.

        It is hell lot easier to find my own USB device using libusb-win32, so that’s what I would do these days. With low level access in my vendor specific commands, I can do bulk transfer or do interrupt transfer. In libusb, the API looks like a and feel like a remote function call for my microrcontroller. That makes it easy to understand.

        Serial port is simple to debug, but once you have done coding for custom USB device, it isn’t that bad. In one of the projects using ATMega8, I needed all the I/O lines, so I didn’t even have UART to spare. I don’t have any forms of debugging until USB is up and running.

      1. Yes. I have no shortage of FTDI boards and cables. My problem is with things like programming SPI flash or quickly polling I2C sensors, both of which are painful and slow without some smarts at the other end of the USB port.

Leave a Reply to ajlittCancel 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.