Hello all,
I'm making a portable weather station that communicates via bluetooth.
bluetooth: http://www.sparkfun.com/products/158 thermistor: http://www.sparkfun.com/products/250 humidity: http://www.sparkfun.com/products/9569 barometer: http://www.sparkfun.com/products/9694 arduino 2560: http://www.sparkfun.com/products/9949
The thermistor and humidity are analog voltage, but the barometer is an I2C connection, which I don't quite understand yet. (But i found this: http://mitat.tuu.fi/?p=78 links to http://sensorapp.net/?p=278 and broken down and described at http://interactive-matter.eu/2009/12/arduino-barometric-pressure-sensor-bmp085/)
Once I get this working on the 2560, I'd like to hardwire it on a lilypad, pro, or other similar small-scale board.
The bluetooth will be sending the results to my phone via amarino preferably.
What do I need to do in setup(), how do I read the I2C from the barometric pressure, and how do I write out to the phone over bluetooth?
Also, since the Baro is a 3.3V board, I need a logic Level Convertor? Like this -> http://www.sparkfun.com/products/8745
How do those work/how are they wired in?
Many Thanks, Steve
Here's the pseudo in my mind:
function temperature(){
thermVal = analogRead(thermistor)
thermVal = thermVal * 5 / 1023;
thermVal = thermVal/((5 - thermVal)/10000);
tempK = 1 / ((.003354016)+(.0002569850(log(thermVal/10000)))+(.000002620131(pow((log(thermVal/10000)),2)))+(.00000006383091*(pow((log(thermVal/10000)),3))));
return tempK
}
function humidity(){
humidityVal = analogRead(humidity)
(humidityVal - 0.8) / 0.03 = relHumid
return relHumid
}
function gamma(tempC,Humidity){
gammavalue = ((17.271 * tempC) / (237.7 + tempC)) + ln(humidity/100)
return gammavalue
}
function baroPres(){
baroVal = ....barometer input of I2C
}
function vapor(dewpoint){
pow = (7.5 * dewpoint) / (237.7 + dewpoint);
vaporPres = 6.11 * pow(10,pow);
}
function virTemp(millibar,vapor,tempK){
denom = ((1 - (vapor / millibar)) * (1-0.622));
virTemp = tempK / denom;
return virTemp;
}
function airDensity(inHg,virTemp){
inner = (17.326 * inHg) / virTemp;
middle = 1 - pow(inner,0.235);
density = 145366 * middle;
return density;
}
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
tempK = temperature();
tempC = tempK - 273.15;
tempF = (tempC * (9/5)) + 32;
humidity = humidity();
dewPoint = (237.7 * gamma(tempC,humidity)) / (17.271 - gamma(tempC,humidity));
baro_Millibar = baroPres();
baroInHg = baro_Millibar / 0.0295333727;
vaporPres = vapor(dewPoint);
virTemp = virTemp(baro_Millibar,vaporPres,tempK);
airDensity = airDensity(baroInHg,virTemp);
****
Send tempF, humidity, baroInHg, vaporPres, and airDensity to phone over bluetooth
****
}