Data Center Energy Sensor Platform – Arduino Based
I have had the opportunity to work on Data Center Energy management projects. They are great: you see the payout as soon as you start instrumenting your environment, and the value grows every time you add sensors or data analysis and presentation software.
However, the biggest push back you get from current data-center owners is the cost of deploying the sensors: It can be overwhelming at first. Most of the time the cost is not on the devices itself, but on the cost of deploying them. I have made integrations with ControlByWeb (a $200 USD device that provides temperature readings in HTTP / XML format). ControlByWeb works great, but it has two drawbacks: network wired (waste a switch port) and wired (waste a Power Distribution Unit electrical outlet). It works for some customers, but not all. Then there are other solutions like Synapsense - wireless sensors, but a bit on the expensive side – and a bit cumbersome and closed. Great for another set of customers as well, but not for all.
What I was looking for was an open source, easy entry Datacenter Energy Management platform. I think I have found a match – inspired by Libelium (Squidbee) and others I have found on the web: A micro-controller based wireless sensor platform. (Note: If I had to do a big scale project, I would probably contact Libelium or similar companies for mass production of the device). Essentially, the solution must have:
- Wireless capability of at least a few hundred feet (better if mesh).
- Low power consumption (we do not want to waste power trying to reduce power consumption).
- Easy to deploy: Something small that you can throw, Velcro or duct-tape inside every rack of your Data Center.
- Easy access to power (plug in any USB port of any server, no need to interface with the server).
- Very extensible – to a wide arrange of sensor equipment. (Energy, Temperature, Humidity – at least).
- Capability of multiple sensors per box.
- Firmware upgradeable.
- Open-Source.
- Open standard output.
- Inexpensive – Read: less than $100 for a single sensor.
The Arduino micro-controller captured my attention some time ago. It is programmable in a C-like language, has a serial / USB interface, plenty of digital and analog inputs, and there is plenty of enthusiasts out there willing to help in building projects with it. Most importantly, many people have already made most of the effort on the projects that interest me: you just have to add a few details and it provides value. For the wireless part, I decided to use ZigBee / XBee (see the implementation notes on that one) due to the quick implementation timeframe.
Once I received the components the sensor platform was working as expected in less than an hour (and that includes the effort to learn how it worked).
What I got:
- Arduino USB board (Sparkfun: $30, Seedstudio Clone: $19)
- XBee stamp (1mW, wire antennae, Sparkfun $23)
- XBee shield (interface) for Arduino (Sparkfun $25 – Clones available for $10-15)
- 10kohm thermsistor $2
- 10kohm resistor
- USB cable, some jumper cables, small breadboard
- Code and simple schematic from Arduino playground.
General procedure:
- Get the Arduino IDE, install on your system, connect your Arduino via Serial or USB as per instructions.
- Program and set up the sensor as you would like it to work and make sure it outputs data to a serial port. By default it comes with a very high speed on the serial port, but I decided to downgrade it to 9600 bps for easy interfacing tot he Xbee (although I think Xbees can work at higher speeds). The Arduino playground example is a good starting point. Actual code used on the project attached. I connected the test voltage to pin Analog 0 as the code suggests.
- Check that you get output on the Serial output of your Arduino IDE. (as attached picture).
- Prepare your XBee as described on the Xbee posting (with Destination address set to FFFF – broadcast).
- Insert your Xbee on the Xbee shield, and insert the shield on the Arduino board (you will have to temporarily remove the Analog 0 input and reconnect on the bypass plug on the shield.
- Your USB / Serial console will stop reporting measurements. Your Xbee is capturing the serial output and sending it wirelessly. Check on the other Xbee by watching the serial port on which that one is connected.
That is it! You got a wireless sensor that feeds out of the widely available serial port.
Future of this test:
- Better, digital sensors.
- Humidity.
- Energy (current), split-cores.
- Getting it to be in the sub $50 USD range.
- Experimenting with PIC micro-controllers.
- Building a better receiver.
- Recording the data to a database for reporting.
Code:
#include <math.h>
//Schematic:
// [Ground] ---- [10k-Resister] -------|------- [Thermistor] ---- [+5v]
// |
// Analog Pin 0
double Thermistor(int RawADC) {
// Inputs ADC Value from Thermistor and outputs Temperature in Celsius
// requires: include
// Utilizes the Steinhart-Hart Thermistor Equation:
// Temperature in Kelvin = 1 / {A + B[ln(R)] + C[ln(R)]^3}
// where A = 0.001129148, B = 0.000234125 and C = 8.76741E-08
long Resistance; double Temp; // Dual-Purpose variable to save space.
Resistance=((10240000/RawADC) - 10000); // Assuming a 10k Thermistor. Calculation is actually: Resistance = (1024/ADC)
Temp = log(Resistance); // Saving the Log(resistance) so not to calculate it 4 times later. // "Temp" means "Temporary" on this line.
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp)); // Now it means both "Temporary" and "Temperature"
Temp = Temp - 273.15; // Convert Kelvin to Celsius // Now it only means "Temperature"
// BEGIN- Remove these lines for the function not to display anything
Serial.print("ADC: "); Serial.print(RawADC); Serial.print("/1024"); // Print out RAW ADC Number
Serial.print(", Volts: "); printDouble(((RawADC*4.860)/1024.0),3); // 4.860 volts is what my USB Port outputs.
Serial.print(", Resistance: "); Serial.print(Resistance); Serial.print("ohms");
// END- Remove these lines for the function not to display anything
// Uncomment this line for the function to return Fahrenheit instead.
//Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert to Fahrenheit
return Temp; // Return the Temperature
}
void printDouble(double val, byte precision) {
// prints val with number of decimal places determine by precision
// precision is a number from 0 to 6 indicating the desired decimal places
// example: printDouble(3.1415, 2); // prints 3.14 (two decimal places)
Serial.print (int(val)); //prints the int part
if( precision > 0) {
Serial.print("."); // print the decimal point
unsigned long frac, mult = 1;
byte padding = precision -1;
while(precision--) mult *=10;
if(val >= 0) frac = (val - int(val)) * mult; else frac = (int(val) - val) * mult;
unsigned long frac1 = frac;
while(frac1 /= 10) padding--;
while(padding--) Serial.print("0");
Serial.print(frac,DEC) ;
}
}
void setup() {
// Use 9600 and FFFF for low destination address on the Xbees.
Serial.begin(9600);
}
#define ThermistorPIN 0 // Analog Pin 0
double temp;
void loop() {
temp=Thermistor(analogRead(ThermistorPIN)); // read ADC and convert it to Celsius
Serial.print(", Celsius: "); printDouble(temp,3); // display Celsius
temp = (temp * 9.0)/ 5.0 + 32.0; // converts to Fahrenheit
Serial.print(", Fahrenheit: "); printDouble(temp,3); // display Fahrenheit
Serial.println(""); // End of Line
delay(10000); // Delay a bit... for fun, and to not Serial.print faster than the serial connection can output
}
Comments
Pingback from Pachube | Actions & Results – Technical Notes by Jose Anes
Time February 18, 2010 at 5:49 pm
[...] to collect the data. They are on an wide open beta. Check them out. And they do favor Arduino folks, and that is how I found the site. I decided to try them out. I may use them as a [...]




Pingback from XBee / ZigBee | Actions & Results – Technical Notes by Jose Anes
Time February 9, 2010 at 9:46 am
[...] those properties, I decided I had to give it a try for the Arduino Data Center Energy Sensor Platform [...]