The Overheated Router Dilema - Part 2
Let's make the schematic!!!! what we will use!!!???
Wifi Bee (http://www.seeedstudio.com/wiki/Wifi_Bee)
Power Supply with 3.3V and 5V outputs
Relay (http://www.seeedstudio.com/wiki/Grove_-_Relay)
Digital Temp Sensor (DS18B20, from Dallas)
<<why don't you use something like a thermistor or something like that!! is very complicated this digital temperature sensor!!>> What is this!!?? a cat that discuss my components choosing? where did you study electronics, Mothi? on BBC? watching Open University episodes in the morning, with people with strange-funny hair and horrible ties???
<<Borja, you are an idiot. I'm going to sharp my nails in the sofa...>> The Dallas one wire temperature sensor is a wonder!! and you do not need much code to make it work... is very stable, robust, looks nice and not very expensive. I just hate thermistors... anyway.
This is how we should make the connection... the communication line of the device with the Wifi Bee has to be using a resistance with the main voltage. In our case 3.3V (because the Wifi Bee works with 3.3V).
Then you can check this place to get the OneWire Library for the Arduino.
I assume you know how to add a library to Arduino... but you can find info here if you need it.
#include <OneWire.h> float readTemperature() { byte i; byte present = 0; byte data[12]; byte addr[8]; if ( !ds.search(addr)) { ds.reset_search(); delay(250); } if ( OneWire::crc8( addr, 7) != addr[7]) { Serial.print("CRC is not valid!\n"); return; } ds.reset(); ds.select(addr); ds.write(0x44,1);
delay(1000); // maybe 750ms is enough, maybe not present = ds.reset(); ds.select(addr); ds.write(0xBE); // Read Scratchpad for ( i = 0; i < 9; i++) { // we need 9 bytes data[i] = ds.read(); } byte MSB = data[1]; byte LSB = data[0]; float tempRead = ((MSB << 8) | LSB); //using two's compliment float TemperatureSum = tempRead / 16; return TemperatureSum; }
With this code you can get easy the temperature from any point in the loop() process.
This Relay is working at 5V, that's why wee need a power supply in the project that can give 5V also. We feed the relay, and then for the signal we will use one digital output from the Wifi Bee, the PD6.
You know how a Relay works... it has two terminals (the green ones) that will be connected when we rise the PD6 to HIGH (3.3V).
ATTENTION!! - To work, we have to connect the Ground for the 3.3V and the 5V power sources, if not, will obviously not work the gadget... Referenceeeee is the key!!!
image is from SeeedStudio
What else we neeed???? just to put everything together. MOTHI!!! what are you doing with the curtains??
Sorry, I didnt found the power supply in Fritzing that we are using, so I have put some batteries... just details... mmmm.
<<Borja, you are sooo lazy sometimes...>> And you, Mothi, so annoying singing at 3am in the morning...