HNTE Desk Hub: September 2014

Not that long ago, while shufling about on the floor plugging usb cables into the back of my computer, I thought to myself "I really should just buy a USB hub".
So I did.. I bought this one, a D-Link DUB-H7

Not Quite Finished

Sure this USB hub works great and everything, it was just not useful enough. I could really use an ethernet switch sometimes. Or a DC power supply. I have been using an old PC power supply for years now and I could always use a few extra DC outputs. Or what about some digital outputs for playing around with, they always come in handy.
Or maybe a way of reading or logging data from different digital communications protocols, I hate writing communication software for new embedded hardware with no way of testing it.
Also wouldn't it be cool if I could see how much current my random projects were using without having to use my pesky multimeter.....
Alright time to break out the pencil and paper..

Now Were Talking

After sketching up a few concepts I came up with something worth cadding up. Something to squeeze all of these ideas I was having into. Something that could sit proudly on my desk as if it was made to be there.. The Bloody Useful Desk, Box, Thing...

The Hardware

What we have here is a bunch of laser cut acrylic pannels that fit together with box joint edges and fasten up with M4 bolts and t-slot nuts. The construction is quite simple, apart from a few (probably optional) pockets CNC'd in the front panel all of the parts can be laser or water cut from a single sheet of 6mm acrylic. I went for laser cut because I wanted a nice surface finish on the cut edges, water cutting is quite abrasive and leaves a dull sanded finish.
Another great thing about laser (or water) cutting is that you get all sorts of extra features and parts essentially for free, such as the power supply mounts and snap out spacers.

Cut Acrylic Panels

I got a bit carried away with my first design, I had drawn up a nice set of machined plates with routed features for easy assembly and helicoils inserted along the edges of the plates for fastening. I had hoped that despite the multiple setups required to NC it all, I would still be able to get it machined for a reasonable price in China.
After getting a couple of quotes I didn't like much, I decided I needed to be a bit cleverer with the design. What I ended up with is the laser cut plates you saw above. The slightly clever part I liked was the box joints and t-nuts at the edges, they are neat and the nickel plated fasteners look great with the black acrylic.

Box Joints

Everyone that sees this on my desk looks at it and says, "Right, cool, so what does it do?"
I still haven't really come up with a good answer to that, because it doesn't really do anything... But it has all sorts of handy outputs.

• 2 x 24V, 12V, 5V and 3.3V, 50W DC outputs (4mm bananna plug)
• 2 x 5V DC output (USB)
• 5 x USB 2.0 hub
• 4 x Ethernert Switch
• 3 x Switched Mains Sockets
• 32 x digital IO's (Arduino Mega)
• 1 x UART, SPI and I2C Input
• 24 x 4 Backlight LCD
• Displays DC current usage
• Displays recieved UART, SPI and I2C
• Cooling Fans
• Piezo Buzzer (because why not?)

The Electronics

So far I think it looks pretty good, but from here it starts to get a bit messy. I tried my best to keep the wiring neat inside, but every time I added a new feature it got a little messier. I guess it serves the purpose of keeping all the mess in one place which is something
Remember always be careful when playing with mains voltages, especially after reading my dodgy website!

Block Diagram

The block diagram / schematic above shows you what's inside the box. Nothing too ground breaking in there but I'll go through some of the electronics and software that I had fun with while building it.

Update: Tidy That Mess

I was unhappy with the mess of wires inside so I completely stripped it back and strarted again. The result is a much more manageable setup. Probably the biggest improvement was to grap a protoshield for the Arduino mega and wire everything up with some nice ribbon cables and IDC connectors.

Switching 12V loads with 5V logic using BJTs

There are plenty of different ways to switch 12V loads using the 5v logic from your microcontrollers, usually the first thing that comes to mind is a relay. At the time all I had was a bunch of transistors, for low current switching all you need are two resistors and two transistors. Make sure you calculate the resistor values specifically for the transistors you have selected, the wrong resistor values can cause the PNP transistor to operate in its active region which will cause it to overheat.
In my case I was switching 4 fans wired in series that draw 110mA each so I_load = 440mA, and Vbe is the base emitter voltage drop of the transistor which is usually about 0.7V.