SenseShoot = ArduinoBT + pda

hello, :wink:
i am currently in an intership at the college of ingenieering and architecture of fribourg.
first i present you the aim of the project : the idea is when you go in holidays you want to take picture to show your trip to your friends. But memories are not only a picture it was also the atmosphere. So we want to make a camera who can take the information of environment which surrounds us.

So we have done a program which allows you to take a picture, send an order to the arduino (by bluetooth). The ArduinoBT capture temperature, humidity, luminosity, GPS coordinates and send it to the pda. Then the program register the picture and the informations in the same folder with the same name (.txt for the informations and .jpg for the picture)
:smiley:

two screenshoot of the application running on pda :

ps: sry for my english

Hi,

interesting project! Not sure I'd use any of that information apart from the GPS coords though. Do you mind explaining the different components to it?

Till

our project is a part of a bigger project: an intelligent living room. Information will allow us to adapt the atmosphere of the room to those of the shoot.

For the temperature/humidity we use an SHT11 (Wayne's Raging Reality: Ardunio and the SHT15)
the pressure : MPXA4115A6U
luminosity :TSL252R
and an arduinoBT with GPS (http://www.libelium.com/squidbee/index.php?title=GPS_module)

for all component we found in arduino forum or in the web how to use them with arduino ^^

the difficulty was the communication bluetooth between the pda and the board (I knew nothing about bluetooth ^^)

a part of the source code :
on the arduino board :

//--------MAIN----------
void loop(){

Serial.println("Elements mesures: ");

float vP = analogRead(pressurePin); //take and print the pressure
capteurPression(vP);

float vL = analogRead(lightPin); //take and print the luminosity
//capteurLumiere1(vL);
capteurLumiere2(vL);

int temp_raw = getTempSHT(); //take the temperature
Serial.print(" *Temperature: “);
float temp_degc = (temp_raw * D2) + D1; // temperature in degree
serialPrintFloat(temp_degc);
Serial.print(” degC"); // print temperature
Serial.println();

int rh_raw = getHumidSHT(); // take the humidity
Serial.print(" *Humidity(%RH): ");
float rh_lin = C3 * rh_raw * rh_raw + C2 * rh_raw + C1;
float rh_true = (temp_degc * (T1 + T2 * rh_raw) + rh_lin);
serialPrintFloat(rh_true);
Serial.println();

localisationGPS(); //GPS

dormeur(); //Sleep
}
//--------------------------------------------[ch8195]

The Sleep function for that we use information in arduino.cc website:
//----Sleep function----------
void dormeur(){
Serial.println("Pour une mesure appuyez sur une touche, puis faites ‘entrer’ ");
Serial.println();
Serial.println();
delay(100);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
attachInterrupt(0,wakeUpNow, LOW);
sleep_mode();
sleep_disable();
detachInterrupt(0);

}
//--------------------------------------------------

and a part of the c# code implanted on the pda which do the communication between pda and arduino:
i use the inTheHand Bluetooth library (http://inthehand.com/content/32feet.aspx)

BluetoothClient client = new BluetoothClient(); //create a bluetooth client

– to connect to the arduino –
private void connectionArduino(BluetoothClient client){
InTheHand.Net.BluetoothAddress adresseBt;
adresseBt = BluetoothAddress.Parse(“000780861AD1”); // arduinoBT adress

BluetoothEndPoint ep = new BluetoothEndPoint(adresseBt, BluetoothService.SerialPort);
try
{
client.Connect(ep); // connect
label1.Text = label1.Text + "connection a " + adresseBt + “etablie \n”;
}
catch(Exception e) {
label1.Text = label1.Text + “connexion echouée”;
Connection = false;
}
}

— to wake up the arduino and receive information –
private void ReveilArduino(BluetoothClient client)
{
Stream peerStream = client.GetStream(); // open a stream between arduino and pda
Byte buffer = System.Text.Encoding.ASCII.GetBytes(“a”);
peerStream.Write(buffer, 0, buffer.Length); // send something to wake up the board
peerStream.Flush(); // close send stream
StreamReader sr = new StreamReader(peerStream); // open a read stream
String Donnees = “”;
StreamWriter writer = new StreamWriter("\Storage Card\Sense\" + “Shoot” + DateTime.Now.ToString(“ddMMyy-HHmm”) + “.txt”); // name of the.txt
for (int i = 0; i < 6; i++)
{
Donnees = sr.ReadLine(); // read the information from arduinoBT
writer.WriteLine(Donnees); // write them in a .txt
}
writer.Close(); // close the stream wich write in .txt
peerStream.Close(); // fermeture du flux de lecture bluetooth
client.close() ;
}