Raspberry Pi hands-on: PiHub and Bluetooth

Raspberry Pi hands-on: PiHub and Bluetooth

Summary: More adventures with add-ons: a four-port USB hub specifically designed for the Raspberry Pi, and a Bluetooth USB adapter. Also, as summary of hardware and costs so far.

SHARE:

This series is turning out to be a lot longer than I had planned; fortunately, it is also turning out to be a lot more fun than I had expected, and that's really saying something. 

So far I have looked at the Raspberry Pi NOOBS Linux distributions: Raspbian, Arch and Pidora; the XBMC focused Raspbmc and OpenELEC; and the non-Linux RISC OS.  Then in the most recent post I discussed the Pi Camera and USB WiFi adapters. Speaking of the camera, there was a very interesting new post on the Raspberry Pi web site about a python interface and a web page for accessing the Pi camera.

Now I have a couple more add-on hardware bits to explore, the PiHub 4-port USB hub designed especially for the Raspberry Pi and a Bluetooth USB adapter.

First up this time is the PiHub 4-Port USB hub. The Raspberry Pi Type B has only two USB ports (if you think that's tough, the original Type A had only one!), so it is pretty cramped when it comes to adding USB devices. But there is a bigger problem than that. 

If you add a simple non-powered USB hub, the Pi itself has to supply power to whatever you plug into that hub. But the Pi itself is likely to be running pretty close to the limit of whatever power supply you are using on it - how close depends on the specific power supply you are using, of course. 

Whatever the specifics are, what it means is that you could easily overload the Pi power supply by adding power-hungry USB peripherals into the hub. That's not good. 

Of course you can use an ordinary powered USB hub and solve that problem, but that means yet another power brick plugged in somewhere, and I hate having multiple power bricks.

The PiHub solves both of these problems. It is a 4-port powered USB hub, and it comes with its own 3 amp (3000mA) power supply, and one of its four USB ports is specially designed to output 5.2v at up to 1.1 amps so that it can power a Raspberry Pi. That is very cool.

I had to scratch my head over this one for a while, because it seems a bit counter-intuitive at first.  What you do with the PiHub is connect it to one of the USB ports on the Raspberry Pi using the USB A-B cable that comes with it. That's normal, like connecting any other hub. 

Then you connect the 3A power supply that came with it to the DC IN plug on the hub. Again, that's normal for a powered hub. Here comes the cool part: the USB ports on the PiHub are marked, three of them have the standard USB symbol and one has a Raspberry symbol.

Now you use a Micro-USB cable to connect the designated USB port on the Hub back to the micro-USB power input on the Raspberry Pi! 

That's the bit that I found counter-intuitive at first, the hub is actually connected to the Raspberry Pi twice - once for USB data and once to provide power to the Pi. 

The PiHub port that is being used to provide power is of course not being used for data, so I suppose you could then consider it a 3-port hub, but that is a small price to pay.

There are two advantages to this - you only need one power brick for the two devices, and the brick that comes with the PiHub is rated high enough that it can power the Pi and pretty much anything else you want to plug into it without overloading. 

In fact, for your amusement, here is a link to someone powering four Raspberry PIs from one PiHub, just to prove that it can be done.  It says at the top of the page "This is a gratuitously silly video post", that's probably true but I think it is fun and it is also interesting to look at the cool stuff he has done with the four PIs he uses in this video.

Of course, you don't have to connect the PiHub this way, you can use it as a normal powered hub and leave the Pi on its own power supply.  For that matter, you don't even have to use the power supply on the PiHub, it will work as a bus-powered hub if you leave off the power supply. It's up to you, use it in the way that you need it, and that works best for your situation.

Moving on to the next bit of add-on hardware: adding the Bluetooth USB dongle was a lot like adding the WiFi dongle. 

I ordered one from the Pi-Shop.ch, and then sometime after that I remembered that I had one around here somewhere; if my memory were a bit better, my wallet might be a bit thicker as well. 

It wasn't a total waste, though, because the one I already had is quite old, and is only Bluetooth 2.1 compatible; the new one is Bluetooth 4.0 as well. It is once again a complete "no-name" device - based on the packaging and the driver CD included with it, I suppose that it was even made by the same no-name company.

Like the wi-fi dongle, the drivers for the Bluetooth dongle are included in the Raspbian base distribution. 

You can check that for yourself by plugging the dongle in, and then doing a lsusb -v to see that it is listed. 

Unlike wifi, though, Bluetooth needs some additional software installed in Raspbian before you can actually use it - basically what you need is a way to detect and pair with a Bluetooth device. 

There are two ways to do this (at least), one which I think of as the "minimalist" approach (also known as the "I'm a very macho Linux kind of dude" or the CLI method), and the "user-friendly" method, which requires even more software to be installed.

Both of these approaches require installing the bluetooth software packages, either using apt or synaptic.

Once that is done, the following CLI procedure will detect, identify and pair with a bluetooth mouse (or keyboard). First, put the device in pairing mode, then give these commands:

    hcitool scan

    bluez-simple-agent hci0 xx:xx:xx:xx:xx:xx

    bluez-test-device trusted xx:xx:xx:xx:xx:xx yes

    bluez-test-input connect xx:xx:xx:xx:xx:xx

The xx sequences in the above commands must be replaced with the MAC address of your bluetooth device, which will be shown by the initial hcitool command.

Ok, I admit it, that doesn't look like much fun (and in fact it isn't), and I don't even know if devices paired this way will remain paired across reboots and power cycles.  So I recommend that you take the next step, and install the 'blueman' package for GUI Bluetooth management.  Once that is installed, reboot to activate it, or if you are impatient you can find it in the LXDE menus under 'Preferences / Bluetooth Manager'.

blueman
The Blueman Devices Window

When blueman is running it will add a bluetooth icon to the LXDE panel. Click that icon to get the Bluetooth management window, put your bluetooth device in pairing mode, and click 'Search' in the blueman window. Your device should then be listed, where you can select it and then click 'Setup'.

If you have a Bluetooth input device (mouse or keyboard) as I do, don't make the mistake of just clicking the "+" to Add it.  That will simply put it in the known devices list without assigning any function to it, which is not very useful for an input device. 

The Setup Assistant will walk through both pairing and assigning functionality to the device. If it asks for a key to pair, every bluetooth mouse/keyboard I have ever used had a default key of 0000.

Bluetooth devices will remain paired and configured across reboots.  The first time you reboot after pairing, blueman might ask for confirmation before pairing with the mouse; if you say 'Always Trust' that will not be necessary any more.

So, my Raspberry Pi now has a PiHub connected to one of its USB ports, serving as a 4-port USB hub, and the "Raspberry" port on the PiHub is connected to the Raspberry Pi power input - so I only have one power brick in use. 

The other three USB ports on the PiHub all have nano- receivers plugged into them - one for wi-fi, one for Bluetooth and one Logitech Unifying receiver. All of them are working perfectly. Oh, and there is still one USB port free on the Raspberry Pi itself.

In normal use I would probably not have both a Unifying receiver and a Bluetooth USB adapter on the same system, I would set up both keyboard and mouse for one or the other.  I would probably also have the wi-fi USB adapter directly on the Raspberry Pi rather than the PiHub, leaving one or two ports free on the PiHub.

A couple of people have ased what my total costs have been so far. I agree, a summary of hardware and costs so far is a good idea at this point.  I'll also include a few comments about the hardware, necessity, alternatives and such.

  CHF Euro Sterling Dollar
Raspberry Pi Type B - required, or this would be a very boring project 45.90 37.25 31.00 50.70
Micro USB Power Supply, 5V/1.5A - optional.  If you already have a good smart phone charger, that could be used; if you know that you want to get a PiHub, you can use that to power the Raspberry Pi as well 16.90 13.70 11.40 18.65
Case - optional.  You can make your own, or run the Raspberry Pi without a case 23.90 19.40 16.15 26.40
SD Flash Memory Card, 16GB Class 10 - Optional, if you already have an SD Card, and it doesn't need to be this large or this fast, a 4GB Class 4 card would work just fine. 25.90 21.00 17.50 28.60
Heat Sink - Optional, not needed if you are going to run the Raspberry Pi normally, but strongly recommended if you are going to overclock the CPU 4.50 3.65 3.00 5.00
PiCamera, optional add-on 36.90 29.95 26.30 40.75
Camera case, optional 15.90 12.90 10.75 17.55
WiFi USB adapter, optional, you can just use the built-in wired network connection 19.90 16.15 13.45 22.00
PiHub 4-port USB adapter, optional 34.90 28.30 23.60 38.55
Bluetooth 4.0/2.1 USB adapter, optional 19.90 16.15 13.45 22.00

Please note, those are all based on list prices in Switzerland.  The list prices outside of Switzerland are certainly going to be lower, and in some places they are considerably lower. 

Also, I have converted to Euro, Pound and Dollar using whatever simple currency exchange calculator I found on the net; I take no responsibility for the accuracy of that.

It's interesting to note that the only item listed above a "mandatory" is the Raspberry Pi itself. The rest of it you can either cobble together with things you might have around the house or office, or do without at least initially. When you look at it that way, this is a heck of a lot of fun for less than 50 francs!

That's it for another day, a couple more Raspberry Pi add-ons, and a lot more fun!

More posts in this series

Topics: Linux, Hardware, Open Source, Operating Systems

J.A. Watson

About J.A. Watson

I started working with what we called "analog computers" in aircraft maintenance with the United States Air Force in 1970. After finishing military service and returning to university, I was introduced to microprocessors and machine language programming on Intel 4040 processors. After that I also worked on, operated and programmed Digital Equipment Corporation PDP-8, PDP-11 (/45 and /70) and VAX minicomputers. I was involved with the first wave of Unix-based microcomputers, in the early '80s. I have been working in software development, operation, installation and support since then.

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Talkback

6 comments
Log in or register to join the discussion
  • The cost IS considerably lower in the USA for example

    I have a Pi with case, an adapter just for the Pi, a 16 GB Class 10 SDcard, a USB SDcard reader/writer, a 4 port unpowered USB hub, an HDMI to DVI converter, and I got all that for 85 bucks shipped from a more "general purpose" online retailer.

    I really enjoy my Raspberry Pi as well. I could have saved a lot if I wasn't so deficient in my gadget collection. I mean, I didn't have a way to write to SDcards! And I didn't own any kind of USB hub.

    I agree -- the minimum cost is the raspberry pi itself shipped. Which in the US is $42. You can't get one for cheaper than that, unless you live next to some place that sells them for $35.
    matthew@...
  • P.S.

    So to get a Pi, adapter, and case cost you the equivalent of $95.75 -- I got the same thing for $52 with 2 day shipping (it's currently 49.95 shipped).

    I just bought a 7-port powered USB hub (highly rated, with a 3A power supply) for $17 (you paid $38.55)

    Your SDcard was $28.60 -- mine cost me $13 shipped (same specs).

    I haven't bought a Wifi adapter yet, but the ones I've seen aimed at the Pi have cost $10 shipped (not $22.00)

    Like I said, a lot of things are more expensive in Europe.
    matthew@...
    • Specifically Switzerland

      I think things are much more expensive in Switzerland than even the rest of Europe - but you are right, in Europe it is still more expensive than the U.S.

      Thanks for reading and comenting.

      jw
      j.a.watson@...
  • Brilliant for Media Centre

    RaspBMC or OpenElec plus the powered PiHub would work well for media. Typically you will build up hundreds of GBs of music & video files but your typical external 120GB-1TB 3.5" hard-drive requires two powered USB connections to drive it. The 1.1 Amp supply from the PiHub is sufficient to clock the PI and two of the other three powered USB connections can be used to power your hard-drive. Obviously you could attach an independently powered hard-drive but with this solution you only use a single wall plug that you can switch off completely when not in use. Your music playback is likely to be smoother too because you're not asking the poor little PI to stream over a network from a UPnP or DLNA server. Thanks for the info. I will price one of those hubs in New Zealand dollars.
    NewZed
    • What a Great Idea!

      This is an excellent idea, and it hits the "sweet spot" of the RPi and PiHub dead center. One power supply instead of as many as three, the PiHub has exactly the right number of ports (one for HDD data, two for HDD power, one for RPi power and Bob's your uncle!). Your point about the wall plug is equally good, I have a short three-plug power extension cord with a switch, the PiHub, display and Hercules audio unit are plugged into it, so I can easily turn them all on/off with one switch.

      Thanks for reading and commenting.

      jw
      j.a.watson@...
      • My PiHub order is in

        Jonathan from Pimoroni is shipping my PiHub directly to New Zealand as we speak. Since I was paying the same freight costs (~10 quid) I grabbed some other kit including the PI Wireless-n stick. Great that you can order PiHub unplugged ;-) I didn't want the clunky Brit power plugged adaptor. I'll source the adaptor locally with our smaller style plug to suit.
        NewZed