Monday, 6 August 2012

Power Over Ethernet for Raspberry Pi

This weekend I tested powering my Raspberry Pi and two webcams via a simple passive Power Over Ethernet (PoE) adapter. Success! It was only a 2m ethernet cable, but I hope to use about 40m in order to set this up at the bottom of the garden to monitor the webcams in my bird boxes.
Raspberry Pi serving two webcams under Motion, 5V supplied by PoE

The main bit of equipment was a simple passive PoE kit bought on eBay for just £3. This comes in two parts, one with a female 2.1mm power connector to 'inject' power into the ethernet cable, and the other with a matching male 2.1mm power connector to 'split' the power back out. This is the same type of plug commonly used for CCTV cameras, and indeed the power supply for my EQ2 Telescope motor (although those don't use just 5V).
PoE female power injectorPoE male power out

I supplemented this with a matching 2.1mm male (Maplins part HH60Q) and female power adapter (Maplins part JK11M), plus solder and a soldering iron coming to just over £10. With hindsight, several years absence had not improved my soldering skill, and I'd have been better off spending the money on some of the solder-free solutions available on the Maplins website.

The final part of this was a male USB-mirco plug to connect the power supply to the RPi. Maplins don't sell these (and soldering one would be beyond my skill anyway), so took my perfectly good 5V mains adapter to micro-USB power supply (bought with the RPi), and butchered it. Then I managed to solder the 2.1mm female socket to the USB-micro plug, at least well enough for the test in the photo above.

The setup works as follows: Mains --> 5V power power adapter --> 2.1mm plug --> Ethernet injector --> Ethernet cable --> Ethernet splitter --> 2.1mm plug --> USB micro --> Raspberry Pi.

Update - Longer cable, 40m

The PoE kit did say it should work up to 30m, but I tried it with a 40m ethernet cable anyway. I was expecting quite a voltage drop, so with the supply at 5V getting just a weak little red glow from the RPi power LED wasn't a surprise. Using my variable voltage adapter I tried increasing this to 6V, then 7.5V, and 9V. These were enough to get a healthy brightness from the PRi's power LED, and without the webcams enough to light the green OK LED too, but not enough for it to boot up. I'll see if I can find my volt meter, or borrow one, to see what exactly is reaching the RPi. Perhaps while the voltage is enough, the current is too low? I'm a little nervous about trying any higher input voltage without taking measurements though!

Update - Medium cable, 30m

I was more hopeful for this cable, and with a 5V input the RPi's red power LED was quite bright - but still didn't boot up and connect to the network. Nor would it with 6V or 7.5V, even without the webcams. However I did try connecting it to my TV with the HDMI out, and realised that the flashing green OK LED meant it had actually booted up - but for whatever reason hadn't connected to the network.

So I was tempted, and stepped it up to 9V input to the passive PoE, and had some success with no external USB devices. It wasn't at all stable, but the RPi did manage to connect to my network for short moments. Watching the boot log on screen it was clear that the ethernet adapter itself is USB based (confirmed online), and it was connecting/disappearing as a USB device. My assumption is there isn't quite enough power getting through.

I think I should find/replace my electrical meter before pushing my luck any further - the next setting on this power supply is 12V, and that seems quite a risk.

If anyone is interested, I've been using a Maplin Low Power Multi-Voltage Desktop Power Supply - model VN10L . The claimed output is 2.5A at 5V/6V, 2A at 7.5V, and 1.7A at 9V/12V, and 1.5A at the maximum 13.2V setting.

Update (9 September 2012)

I found my voltage meter, so was able to measure the actual voltage reaching the Raspberry Pi using the TP1 and TP2 connections (test points one and two, down from the logo and by the yellow video out jack respectively). This confirmed what I was hoping - I just hadn't been brave enough till now about ramping up the input voltage :)

Using no external USB devices (and no monitor), giving the power via the 30m ethernet cable, I found the input of 9V was reaching the RPi as about 4.8V, just about enough to power up the ethernet. Upping the input to 12V gave the RPi more than enough - it wobbled around 7.1V but the network worked.

Using the 30m ethernet with one USB web camera, 9V input was not enough. However, either the 12V input (measured as about 5.3V) or 13.5V input (measured as about 6V) worked fine and I could stream the image (not a great frame rate, but it works).

Using the 30m ethernet with two USB webcams physically connected, I had to use the maximum 13.5V from my supply to boot with ethernet, but only one camera would work. The measured voltage seemed to wobble from 4.2V to almost 7V, probably linked to the total USB activity.

So - success at 30m - with some potential room for improvement if I want to try and monitor two cameras at once (although I know this will give a poor frame rate). I've now also got a DC/DC step down converter to try (mentioned in the comments below), and there is also the option of removing (or bridging to bypass) the resetable fuses protecting the Raspberry Pi's USB outputs - which has been reported to help with power hungry USB devices (herehere and elsewhere). Reassuringly, these fuses have been removed in the recently announced Raspberry Pi revision 2.0 board.

Update (16 September 2012)

Here are a couple of photos from field testing with the 30m cable, actually at the bottom of the garden connected to the camera in Birdbox 3. It took me a while to relocate the secondary router, but as a bonus my wifi signal now extends far enough for an in situ test with my iPod touch showing the live feed from the Raspberry Pi.
Spare birdbox with Raspberry Pi in itLive nestbox webcam test!

Unfortunately the 30m cable only just reaches this spot, so I'll need to get this to work with my 40m ethernet cable...

Update (2 October 2012)

Trying this with a 12V to 5V DC step-down didn't seem to help, but powering the Raspberry Pi with 24V passive POE works at 40m (indoor testing).

Update (30 Jan 2013)

Successful 40m outdoor 24V passive POE Raspberry Pi installation.

5 comments:

  1. Great blog, I'm hacking my Logitech 500 webcam with a mic, IR LEDs on order, will be using a RPi, Motion for recording later on. I'm testing the webcam with IR LEDs from my laptop first using motion to record any movement and sound.

    ReplyDelete
  2. Perhaps you already understand this, but -
    It's worth bearing in mind that, as you've expected, voltage drop occurs over longer cable runs. The trick, though, is that it's likely to increase while higher current is being consumed, possibly causing difficult-to-diagnose behavior.

    If you had an oscilloscope you'd be able to see the end voltage briefly dipping under 5v during such events.

    The usual solution in more-fancy PoE arrangements is to push some extra voltage at the head end, and regulate it down to the target voltage at the destination. Since the raspberry pi does include a voltage regulator, this matches what you did in the 30m update, and most likely the USB devices introduce current spikes causing further voltage drops.

    Although you want to be careful pulling too many volts+amps through a linear regulator, you could try using a switchmode regulator instead if it can withstand an input voltage of (say) 13 or 20 volts:
    http://hackaday.com/2012/07/07/another-switch-mode-regulator-swap-for-the-raspberry-pi/

    ReplyDelete
    Replies
    1. Hi Tim - thanks for the detailed comment. I don't have an oscilloscope but I have now found my electronic multi-meter so will be able to take some voltage measurements. I have also ordered a DC/DC step down converter (nominally 12V to 5V for use with a car battery or similar) which should let me apply extra voltage to the head end.

      Delete
  3. I should have added to my last comment, switchmode PoE at higher voltage carries the added advantage of supporting the same power draw with a lower current.

    The main trick, then, is selecting a regulator with sufficient output current. I note the regulator in my link supports 600ma, and it has a 1.3A big brother at the manufacturer's website. The 1.3A version would seem safer in this application.

    The regulator could be added inline with the PoE extractor, rather than replacing the onboard regulator. In this scenario, however, it'd be highly beneficial to add a bypass wire to the onboard regulator.

    ReplyDelete
  4. no need to do difficult with poe adapters as your ethernet connection only use 4 wires(1,2,3,6) the remaining 4 (2 pairs) you directly connect to the 5v reducing the voltage drop significantly.
    measure the resistance of your cable before connecting the rpi, you need to supply at least 1.5Amp (1.2 rpi, 140mA for webcam and some headroom)

    ReplyDelete