Tag: XBee
Solar-Powered Temperature Sensor
by Steve Struebing on May.18, 2009, under technoPHILE
Solar Powered Temperature Sensor
In case you’ve not heard, there is a Green Revolution in progress. To quote a popular commercial, “The way we use energy now can’t be the way we use it in the future. It’s not conservation, or wind, or solar. It’s all of it.” I have long kept a solar-energy project in the back of my mind, so I ordered a 12v/.2A solar panel power supply from a vendor (note: I erred while filming and said it is a 2A panel. It is a .2A panel). As a first step project, I figured I would power up my Arduino, use my shiny new XBee modules, and relay some sort of meaningful data back from this wireless solar-powered microprocessor.
httpv://www.youtube.com/watch?v=7A7coLAUyfQ
How is the weather outside today? If I am getting data, its sunny! And 65 degrees on my deck according to my newly built solar temperature probe.
XBee Communications
I did some first-steps using 2 Arduinos communicating over the default broadcast configurations over a span of about 2 feet.
Arduino 1: “Yo. How you doing?”
Arduino 2: “Fine thanks. Wow, we are talking wirelessly.”
Arduino 1:” These are great days we’re living in, man.”
Arduino 2: “Now, if only I could unhook from this power cable.”
I settled down Arduino 2 after his diatribe likening himself to Pinnochio, and told him that I would take care of it.
Serial Communications
After getting the Arduino twins talking (and hey, its all serial!) I grabbed my ioBridge and slapped on the Serial Communications smartboard. In about 1 minute, I had my ioBridge chatting with my Arduino. Sweet…. Now, on to untethering my Arduino. “I got no wires…to hold me down… la-la-la-la”
The Wireless Temperature Probe
I ran out to Radio Shack and picked up the right barrel plug adapter, and added some wires to run into the Arduino. Note: the jumper must be set on the Arduino to take power from external. My Solar Panel provides 12v, and the Arduino can take power up to 12v.
I used the temperature probe that I had from my ioBridge, crafted a quick sketch (see below) on the arduino (the analog scaling factor may be off since its not precisely linear, but c’est la vie) and waited for the sun. As soon as I plugged it in, the Arduino woke up, lights blinking, and was soon processing and wirelessly communicating! All this achieved because of energy provided by that flaming ball in the sky. Now that’s cool.
A quick run upstairs onto the ioBridge dashboard and guess what? The serial monitor widget was telling me what the temperature is outside. 65.31 degrees Farenheight. Wirelessly and without another power source…
Conclusion
Now that I have a solar powered wireless microprocessor at my disposal, I am thinking of giving it some legs, and onboarding some Artifical Intelligence. Its top priority could be to take over the world. Take some solace in the fact that the processor is 1KB of RAM, 512 bytes of EEPROM, and runs at a “blazing” 16 MHz. If that’s not enough, then know that all you need to do to shut down its diabolical scheme is stand over it and block the sun. Hmm. Perhaps its better served as a temperature probe….. for now…
Sketch for Arduino
#include <NewSoftSerial.h> NewSoftSerial xBeeSerial = NewSoftSerial(2, 3); void setup() { // Initialize the on-board LED pinMode(13, OUTPUT); //Initialize the HW serial port Serial.begin(9600); Serial.println("Ready to send data:"); // set the data rate for the SoftwareSerial port xBeeSerial.begin(9600); } void loop() // run over and over again { //Read from the analog input from analog pin 0 int tempValue = analogRead(0); // Send the message to the XBEE Transmitter xBeeSerial.print("Time: "); xBeeSerial.print(millis()); xBeeSerial.print(" Value:"); // Do scaling ~6.875 float scaledValue = tempValue / 6.875; xBeeSerial.print(scaledValue); xBeeSerial.print("\n"); // Update every 2 seconds delay(2000); }