Logging temperature using an Arduino and AD7410 sensor

This article is a quick and dirty demonstration to hack yourself a temperature data logger which saves its results to an SD card. The sensor of use is a HTU21D, a I²C temperature and humidity sensor.

hookup

Schematic:

hookup_bb

I hooked up a HTU21D sensor to an Arduino Uno + SD-card shield and let it monitor temperature (and humidity) over an entire day:

24h_log

Here is a close-up of what happens at night:

3h_log

Source code:

/*
 SD card datalogger

This example shows how to log data from three analog sensors
 to an SD card using the SD library.

The circuit:
 * analog sensors on analog ins 0, 1, and 2
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 4

created 24 Nov 2010
 modified 9 Apr 2012
 by Tom Igoe

This example code is in the public domain.

*/
 /*
 HTU21D Humidity Sensor Example Code
 By: Nathan Seidle
 SparkFun Electronics
 Date: September 15th, 2013
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

 Uses the HTU21D library to display the current humidity and temperature

 Open serial monitor at 9600 baud to see readings. Errors 998 if not sensor is detected. Error 999 if CRC is bad.

 Hardware Connections (Breakoutboard to Arduino):
 -VCC = 3.3V
 -GND = GND
 -SDA = A4 (use inline 330 ohm resistor if your board is 5V)
 -SCL = A5 (use inline 330 ohm resistor if your board is 5V)

*/

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include "SparkFunHTU21D.h"

//Create an instance of the object
HTU21D myHumidity;

const int chipSelect = 4;

// make a string for assembling the data to log:
String dataString = "";

void setup() {
 // Open serial communications and wait for port to open:
 Serial.begin(9600);
 while (!Serial) {
 ; // wait for serial port to connect. Needed for native USB port only
 }

 myHumidity.begin();
 Serial.println("HTU21D ready!");

Serial.print("Initializing SD card...");

// see if the card is present and can be initialized:
 if (!SD.begin(chipSelect)) {
 Serial.println("Card failed, or not present");
 // don't do anything more:
 return;
 }
 Serial.println("card initialized.");
}

void loop() {
 readTemp();

Serial.println("Writing data...");
 // open the file. note that only one file can be open at a time,
 // so you have to close this one before opening another.
 File dataFile = SD.open("datalog.txt", FILE_WRITE);

// if the file is available, write to it:
 if (dataFile) {
 dataFile.println(dataString);
 dataFile.close();
 // print to the serial port too:
 Serial.println(dataString);
 }
 // if the file isn't open, pop up an error:
 else {
 Serial.println("error opening datalog.txt");
 }
 delay(10000);
}

void readTemp() {
 float humd = myHumidity.readHumidity();
 float temp = myHumidity.readTemperature();

 // make a string for assembling the data to log:
 dataString = "Time: ";
 dataString += String(millis());
 dataString += String("; Temperature: ");
 dataString += String(temp);
 dataString += String("; Humidity: ");
 dataString += String(humd);
 dataString += String("%");
}

This was just a quick and dirty hack to get some instant results. I’m planing to do some more logging in the future to get a better understanding of how to approach my self build climate control. Stay tuned for more.

BIOS bypassing, yet again

Well, not so long ago I had to bypass a BIOS password on a government computer. Some google wizardness quickly revealed a lot of laptops actually have some kind of admin/master password which can reverse engineered or brute forced, any way you want. I already told you about the http://bios-pw.org/ website which could help you for a great deal. If not, maybe Dogbert’s Blog is something for you. He has some nice tools for you to download, including the source code. Great job man!

Dell E4300 BIOS hacking

I just got my hands on a 2nd hand Dell Latitude E4300 laptop previously owned by the Belgian Ministry of Justice. The computer has a functional Windows license on it, however the computer is currently configured in a Administrative Domain so any normal users that could possible log into this machine is not allowed to install any software. Furthermore, since I didn’t have any user credentials I was forced to find a way to bypass the AD user login. Linux  gives us some possibilities, however since the BIOS is locked by a administrative password I was not able to select or change any other boot device aside of the hard drive. One solution is to unscrew the hard drive and install it into another computer where you do have the boot options available. However, bypassing the BIOS admin password is not so hard either on these machines and requires just some googling…

To get into the administrative password protected BIOS, first press f12 during system boot to get into the E4300 BIOS. You’ll notice the unlock button at the bottom. Press it and you’ll be asked for the admin password. You can however obtain the master password from the following website: http://bios-pw.org/, enter your serial number (might look like this: 1234567-2A7B), and use the password that is given by “Dell by serial number”. So in the BIOS, press the unlock button, next enter the password and press ctrl + enter and now you should get into the unlocked BIOS. One remark here: the password should be entered on a QWERTY keyboard, for AZERTY keyboards you’ll have to convert your password to a QWERTY string. So, if for example you get the following response from the BIOS-PS.ORG website: “Dell by serial number: hTfn7Xz3yWqg8”, then you should enter “hTfnèXw”yZag!” on a Belgian AZERTY keyboard. So the trick here is to enter numbers without using the shift button as you’re used to, switch “q” with “a”, “z” with “w”, and “m” with “,”.

Now, make yourself a LINUX life boot cd, mount the windows drive and save whatever data you wanted to safe. Good luck!