Tank Day 18: Hubs and Clicks

On day 17, we identified two major issues with the Raspberry Tank’s setup – the Raspberry Pi’s inability to power both the WiFi dongle and the camera via its USB ports, and that the “press and hold” web interface causes problems in mobile browsers (its main target).

Today, we fix both of those.

Integrating a USB Hub

In order to supply the two power-hungry USB devices (and potentially others), we decided to integrate a USB hub into the tank. To power the hub from the tank’s internal battery, a Recom R-78B5.0-1.5 switching DC/DC was chosen. This is a slight variation on the part used to supply the Pi itself, differing only that it can supply 1.5A at 5V rather than only 1A.

This was connected up to the power pins of a D-Link DUB-H4 powered USB hub, chosen due to its convenient size for fitting inside the tank. (Its footprint is roughly identical to the smoker unit that was removed from the back.)

Originally, a smaller bus-powered hub was tried, with its host cable split to take its power from the DC/DC and its data from the Pi. However, this did not work, and I was duly schooled by Stack Exchange. I then switched to the properly externally powered DUB-H4.

Inside the tank, the Raspberry Pi now sits quite neatly on top of the USB hub. The electrical schematic now looks like this:

Modifying the Web GUI

By comparison, the quick hack to make the web GUI usable from mobile devices was very easy indeed – I simply removed the onmouseup() JavaScript from each button. This means that when the user touches a button, the tank now performs that action until another button (such as STOP) is touched. Although not an ideal way of exercising fine control over the tank, this at least means that the tank can carry out commands for more than the one second or so that mobile browsers take to open their “right click” window.

There are currently two 5V DC/DCs in the system. A 1A version supplies the Pi, while a 1.5A version supplies the hub (and hence the attached Wifi dongle and webcam). As you say, the Pi could have been powered from the hub, which would remove the need for one of the DC/DCs. However, you’d have to upgrade the one supplying the hub to a 2A or 3A variant to make sure it can supply enough current for everything.

If I were starting again from scratch, that’s what I’d do for sure, as it would make the wiring a bit neater.