Lori has been working hard on our basic lesson plan. We have a prototype from a group last year but we are extending that and making it more relevant to our particular project. She has continued searching for relevant videos and online activities for to engage the students. She has also been looking at real world applications by looking into what research is going on in Texas streams and rivers with a particular focus on water quality and pollution. She has also begun a broad search of published lesson plans that might be similar to what we intend. Some of the titles she has pulled so far include:
Springs of Life
Rachel Carson: Sounding an Environmental Alarm
Water Pollution Hot Spots
The Watershed Quest
When Things Heat Up
Water Pollution
Surface Water Model
Biodiversity Debate
What's in the Water
Lori hard at work |
Here is a link to one of the videos Lori found. The video discusses the use of water sensors in ALWAS, Bathy Boats and buoys on the great lakes. These buoys cost $32k! The ACT-Aliance for Coastal Technologies is an alliance formed by universities to test all of the aquatic sensors being developed so that those seeking sensors can go to their site and be able to pick the best sensor needed for testing purposes.
While Lori has been grinding out research on the lesson plan Joe has been hard at work sourcing the materials we will need to build both our table top model stream and the parts to make our sensor cluster.This is a pretty thankless task and he has done a great job with it so far. In addition he also took point on building a skeleton for the research paper we will be putting together. We are still assigning ourselves portions of the paper to work on but here is how it looks so far:
- Title Page
- Abstract (Joe)
- Table of Contents (any)
- Introduction (Joe)
- Literature Review (Lori)
- Methods (Any)
- Results
- Zac -Arduino, XBee, sensor probes, wireless network. Effectively how everything in the sensor cluster works
- Lori - Real World v. Artificial aquatic ecosystems: How they are currently being monitored and why. How does this tie in with what we did.
- Joe - Anything and everything to do with the table top model.
- Discussion (any)
- Recommendation (any)
- References (any)
For a quick tutorial on formats and conventions concerning writing a research paper we had a quick seminar with the research librarian at the Discovery Park Library and Joe also found a couple of websites you can check out if you find yourself needing to pound out a research paper.
http://umech.mit.edu/freeman/6.021J/2000/writing.pdf
http://suite101.com/article/how-to-write-a-scientific-research-paper-a161079
http://suite101.com/article/how-to-write-a-scientific-research-paper-a161079
Mine day has been a mixed back of success and frustration. I started out the morning doing some research trying to figure out what temperature and dissolved oxygen probes we would use in our sensor cluster. I already knew we were using the Atlas Scientific pH probe but that was about it. Based on my research I figured it made sense to go with the temperature sensor and DO sensor that Atlas produced since we had already started down that path. My reasoning was two fold. 1) We were already using an Atlas product so it stands to reason that if we continued using their sensors the underlying logic would be the same and that should simplify coding. 2) The price is actually pretty. It was in line with all the other probes I looked at and actually lower than most. Right as I started to type up an email to Dr. Fu he walked in and handed me an Atlas Scientific temperature sensor and said, "Why don't you try to get this working." Yay logic! So, I started in on the temperature sensor.
You will recall that yesterday I managed to get the pH sensor up and running using this code:
#include <SoftwareSerial.h> //add the soft serial libray
#define rxpin 2 //set the RX pin to pin 2
#define txpin 3 //set the TX pin to pin 3
SoftwareSerial myserial(rxpin, txpin); //enable the soft serial port
String inputstring = ""; //a string to hold incoming data from the PC
String sensorstring = ""; //a string to hold the data from the Atlas Scientific product
boolean input_stringcomplete = false; //have we received all the data from the PC
boolean sensor_stringcomplete = false; //have we received all the data from the Atlas Scientific product
void setup(){ //set up the hardware
Serial.begin(38400); //set baud rate for the hardware serial port to 38400
myserial.begin(38400); //set baud rate for software serial port to 38400
inputstring.reserve(5); //set aside some bytes for receiving data from the PC
sensorstring.reserve(30); //set aside some bytes for receiving data from Atlas Scientific product
}
void serialEvent() { //if the hardware serial port receives a char
char inchar = (char)Serial.read(); //get the char we just received
inputstring += inchar; //add it to the inputString
if(inchar == '\r') {input_stringcomplete = true;} //if the incoming character is
//<CR>, set the flag
}
void loop(){ //here we go....
if (input_stringcomplete){ //if a string from the PC has been recived in its entierty
myserial.print(inputstring); //send that string to the Atlas Scientific product
inputstring = ""; //clear the string:
input_stringcomplete = false; //reset the flage used to tell if we have recived a
//completed string from the PC
}
while (myserial.available()) { //while a char is holding in the serial buffer
char inchar = (char)myserial.read(); //get the new char
sensorstring += inchar; //add it to the sensorString
if (inchar == '\r') {sensor_stringcomplete = true;} //if the incoming character is a
//<CR>, set the flag
}
if (sensor_stringcomplete){ //if a string from the Atlas Scientific product has been
//received in its entirety
Serial.println(sensorstring); //use the hardware serial port to send that data to the PC
sensorstring = ""; //clear the string:
sensor_stringcomplete = false; //reset the flag used to tell if we have received a
//completed string from the Atlas Scientific product
}
}
Today I did something similar for the temperature sensor. First I wired up the circuit on the breadboard. This one was actually really easy. I could have gone directly into the Arduino but I didn't want to start stripping cable, especially when I was going to need to use a breadboard later to make things work together. I digress. Here is what the circuit looked like:
Once I had that set up I put in the code (from Atlas) and compiled. No errors, so I uploaded it to the Arduino.
//Connect the black lead to GND
//Connect the red lead to pin 4
//Connect the white lead to pin A0
float temp; //where the final temperature data is stored
void setup() {
Serial.begin(38400); //set up the hardware serial port to run at 38400 baud
pinMode(4, OUTPUT); //set pin 2 as output
}
void loop() { //main loop
temp = read_temp(); //call "read_temp" and return temp in degrees C
Serial.println(temp); //print the temperature data
delay(1000); //wait one second
}
float read_temp(void) { //the read temperature function
float v_out; //voltage output from temp sensor
float temp; //final temp stored here
digitalWrite(A0, LOW); //set pull up on analog pin
digitalWrite(2, HIGH); //turn on temp sensor
delay(2); //let temp stabilize
v_out = analogRead(0); //read input pin
digitalWrite(2, LOW); //turn off temp sensor
v_out*=.0048; //convet ADC points to volts (using 5V)
v_out*=1000; //convert volts to millivolts
temp = 0.0512 * v_out -20.5128; //convert millivolts to temp
return temp; //send back temp in call
}
Success! Here is what the serial terminal showed when we ran the program:
Great. So I have function code for the pH sensor and I have functioning code for the temperature sensor and I know how to wire both of them. How hard can it be to combine those two? Turns out... it's hard. I still haven't managed to make it work when they are combined. The wiring seems to be fine. I can't find an error in it and neither can Yixing. The only change I had to make was moving the on/off signal for the temperature probe from digital pin 2 to digital pin 4 since the pH probe was already using 2 and 3. Here are some pictures of the combination circuit.
That looks reasonable and everything seems fine. It's not though. I don't know why. Here is the code I currently have slapped together for the combination circuit. I will warn you now that it is haphazardly commented and that it is essentially garbage judging by the output I am getting (it's all over the place). I am too fried to figure out what my mistake is right now and Yixing didn't see it either. I might have to sleep on this and try again tomorrow. If any of you readers spot the error(s) or have suggestions for more elegant (and functional) code I would love the feedback.
#include <SoftwareSerial.h> //add the soft serial libray
#define rxpin 2 //set the RX pin to pin 2
#define txpin 3 //set the TX pin to pin 3
SoftwareSerial myserial(rxpin, txpin); //enable the soft serial port
String inputstring = ""; //a string to hold incoming data from the PC
String sensorstring = ""; //a string to hold the data from the pH probe
char input;
boolean input_stringcomplete = false; //have we received all the data from the PC?
boolean sensor_stringcomplete = false; //have we received all the data from the pH probe?
float temp; //where the final temperature data is stored
void setup(){ //set up the hardware
Serial.begin(38400); //set baud rate for the hardware serial port to 38400
myserial.begin(38400); //set baud rate for software serial port to 38400
inputstring.reserve(5); //set aside some bytes for receiving data from the PC
sensorstring.reserve(30); //set aside some bytes for receiving data from pH probe
pinMode(4, OUTPUT); //set pin 4 as output for temp probe
}
void serialEvent() { //if the hardware serial port receives a char
char inchar = (char)Serial.read(); //get the char we just received
inputstring += inchar; //add it to the inputString
if(inchar == '\r') {input_stringcomplete = true;} //if the incoming character is a <CR> flag it.
}
void loop(){
if (input_stringcomplete){ //if a string from the PC has been recived in its entierty
input = inputstring.charAt(1);
if (input = "c" || "C") {
temp = read_temp();
Serial.println(temp);
delay(1000);
myserial.print(temp);
}
else {
myserial.print(inputstring); //send that string to the pH probe
inputstring = ""; //clear the string:
input_stringcomplete = false; //reset the flage used to tell if we have
//recived a completed string from the PC
}
}
while (myserial.available()) { //while a char is holding in the serial buffer
char inchar = (char)myserial.read(); //get the new char
sensorstring += inchar; //add it to the sensorString
if (inchar == '\r') {sensor_stringcomplete = true;} //if the incoming character is a <CR>,
//set the flag
}
if (sensor_stringcomplete){ //if a string from the pH probe has been received in its entirety
Serial.print(sensorstring); //use the hardware serial port to send that data to the PC
sensorstring = ""; //clear the string
sensor_stringcomplete = false; //reset the flag used to tell if we have received a completed
//string from the pH probe
delay(1000);
}
}
float read_temp(void) { //the read temperature function
float v_out; //voltage output from temp sensor
float temp; //final temp stored here
digitalWrite(A0, LOW); //set pull up on analog pin
digitalWrite(2, HIGH); //turn on temp sensor
delay(2); //let temp stabilize
v_out = analogRead(0); //read input pin
digitalWrite(2, LOW); //turn off temp sensor
v_out*=.0048; //convet ADC points to volts (using 5V)
v_out*=1000; //convert volts to millivolts
temp = 0.0512 * v_out -20.5128; //convert millivolts to temp
return temp; //send back temp in call
}
Joe's Journal
Check and see if there is any literature from the manufacturer about possible interference between the two sensors if they are linked together on the same board. How is the accuracy of the data looking with just one sensor running?
ReplyDelete