Go On A Power Trip With Powerduino

powerduinoThings don’t always run the way we want them to or operate at the ideal temperature out of the box. Instead of spending extra for power controls that may or may not meet your needs, wouldn’t it make more sense to dial in the ideal level from the source? That’s what [dekuNukem] had in mind when he decided to make Powerduino, an arduino-compatible programmable power strip.

With Powerduino, [dekuNukem] can control the electrical consumption of all kinds of things without ever worrying about the irreversible deadliness of mains voltage. It actually uses a Teensy 3.1 which can be programmed with the Arduino IDE through the micro USB connector. He’s really tricked it out to the point of putting Kill A Watt meters to shame. A wi-fi module lets him control any of the outlets from anywhere, and the RTC module lets him make customized schedules for them. Powerduino has an SD card slot for logging energy consumption, and a 20 x 4 LCD screen makes it easy to directly interface with the power strip.

The Powerduino code is up on GitHub, and [dekuNukem]’s walkthrough video is after the jump.

Continue reading “Go On A Power Trip With Powerduino”

Software-Controlled Per-Port Power Switching For USB Hubs

[Befi] wanted to add a second stage backup disk to his ODROID embedded-board server, which typically draws ~1.5W at idle. After adding the disk, he saw power consumption increase by 2W when the new disk wasn’t spinning. He thought about using one of those USB hubs with the adorable little rocker switches for each port and replacing them with transistors, but that was going to be messy. After some poking around in the USB standard, he found that most support per-port power switching (PPPS), and set about to hack a USB hub to enable software-controlled per-port switching.

[Befi]’s NEC hub uses a uPD720112 chip which supports PPPS according to the datasheet. After tying the configuration pin labeled GANG_B to +3.3V, the hub declared itself PPPS-compatible. Of course, the manufacturer saved a penny or two by omitting the  individual switches, so [Befi] added an open-drain NMOS to each port. He is using this program to switch the port on and off and made the switching transparent with autofs. [Befi]’s current script has the bus ID and device ID of the hub hard-coded, but he intends to update it to find them automatically. This hack saves him 10W on average, which is about €30 ($40) per year.

If your hub is under powered, you could try adding an external power supply.

The Effect Of Code On Power Consumption

Of course putting a microcontroller into sleep mode or changing the clock rate has an effect on the power consumption of the chip, but what about different bits of code? Is multiplying two numbers more efficient than adding them, and does ORing two values consume more power than NOPping? [jcw] wanted to compare the power draw of a microcontroller running different loops, so he threw some code on a JeeNode and hooked it up to an oscilloscope.

For his test, [jcw] tested two instructions: multiply and shift left. These loops run 50,000 and 5,000 times, respectively (bit shifting is really slow on ATMegas, apparently) and looked at the oscilloscope as the JeeNode was doing its work.

Surprisingly, there is a difference in power consumption between the multiply and shift loops. The shift loop draws 8.4 mA, while the multiply loop draws 8.8 mA. Not much, but clearly visible and measurable. While you’re probably not going to optimize the power draw of a project by only using low-power instructions, it’s still very interesting to watch a microcontroller do its thing.