Cool App: Environment Sensing Station    

App Name: Environment Sensing Station
Author: Chris D. Odom
Date: 9.1.06
Filename: EnvironmentSensingStation.bas (View) | (Download)
MAP File: EnvironmentSensingStation.mpp
Construction Tutorial: ESSguide.html
Images: (Click on images to enlarge them.)
       
       
       
Description: The Environment Sensing Station (ESS) is a homemade instrumentation station made of 3" PVC pipe (inner diameter) that uses NetMedia's BX-24p and Robodyssey's Advanced Motherboard (RAMB II) to make simultaneous readings of up to seven sensors. (The BX-24 has eight A-to-D ports, but I use one of them to determine if the apparatus should be in data-taking mode or printing mode. See the Notes section at the bottom for more details. If you use eight Robodyssey Multiflexers, you can simultaneously read up to 49 sensors!) The station is weather and water proof and is capable of collecting data for many days -- or longer if you use a solar panel to recharge the batteries. I have configured my ESS with five sensors that measure: (Since creating this page, I have added another sensor to the turbidity tube -- one that measures the amount of light scattered perpendicular to the light beam. The code files at the top of this page include this new sensor. See my construction and operation tutorial for more information.)

To learn how to make your own Environment Sensing Station, see my ESS Construction Guide. In that tutorial, I walk you through all the construction steps and give you the dimensions of my ESS as well as a complete parts list.

The limit to the amount of data you can collect is dependent upon the amount of EEPROM available. The BX-24 has 32Kb of EEPROM built-in, which is really 32768 bytes. (You can add more with an external EEPROM chip.) From the MAP file you can see that my program consumes less than 6000Kb, but to be safe, I start writing to the EEPROM at byte 10,000. That means I have 22768 bytes with which to store data. Each sensor is connected to an A-to-D channel on the BX-24 and each data point is stored as an Integer data type, which is equivalent to 2 bytes. I decided to also store the time from the BX-24's built-in real time clock (or RTC) which requires 12 bytes of storage. Therefore, each time I save data (5 sensors + time) to the EEPROM, 22 bytes of EEPROM is consumed.

This means, for example, that my application can collect data each second for 1034s (or 17.2 minutes). Or, it can collect data, say, every 15 minutes for a total of 86.2 hours (or 3.6 days).

Not bad, huh?

 
  • See Chapter 5 in my book for an explanation of Data Types.
  • See Chapter 10 in my book to learn how to program the RTC.
  • See Chapter 17 in my book to learn how to use Voltage Dividers to sense the environment.

The images above show the ESS operating underwater in Newtown Creek, which runs through George School where I teach.

I programmed the Environment Sensing Station to record data every two minutes for 18 hours. At precisely 6:10p.m. on August 7, 2006 I started the application in my lab. At 6:20p.m., I left my office and and then carried the instrument to the creek. At 6:37p.m., the ESS was placed in the creek and submerged under about 25cm of water. (Two additional PVC tubes were filled with rocks and attached to the instrument module so it would remain submerged.)

Data was collected all night. You can see that raw data here. This data was imported into Excel and then graphed. (See my Excel tutorial.)

 
  • See pages 313 and 315 in my book to learn how to save data output to the screen directly into a file on your PC.
  • See page 316 in my book to learn how to import a data (text) file into Excel.

Below is one of the images taken from one of the Excel worksheets. (Click on the graph to enlarge it.)

You can download the entire spreadsheet if you wish. I have added a few VBA touches, so you should "Enable Macros" if prompted. Notice that there are several worksheets to choose from, one for each sensor. Play around with the bottom graph on each page; you can alter the zoom factor by changing the scale (in hh:mm format) in the yellow cells.

As you study the graphs, you should know that the official time of sunset on August 7 was 8:07p.m., and sunrise on the 8th was at 6:05a.m. Also, that night there was a brief but powerful thunderstorm that occurred between 9:53p.m. and 10:15p.m.

Here are the detailed weather reports from Wunderground for August 7, 2006 and August 8, 2006. You could teach an entire science class on this one experiment. Here are some things to examine and think about:

General Questions:

  1. Which direction, up or down, on the vertical y-axis corresponds to an increase in temperature?
  2. Which direction, up or down, on the vertical y-axis corresponds to an increase in light intensity?
  3. Which direction, up or down, on the vertical y-axis corresponds to an increase in conductivity?
  4. Which direction, up or down, on the vertical y-axis corresponds to an increase in turbidity?

Questions regarding the Temperature data:

  1. How long does it take for the water to warm up after the sun rises?
  2. How long does is required for the internal temperature to equalize with that of the surrounding atmosphere?
  3. Does the internal temperature of the ESS ever match the external temperature? Is it possible to tell since we know nothing about the calibration of either temperature sensor?
  4. Generally, which is warmer: the surrounding water or the dry internal compartment of the ESS? Is this what you expected? What could cause this? Is it even possible to determine this since we know nothing about the calibration of either sensor?
  5. What happened to the water temperature an hour or so after the thunderstorm? Why?

Questions regarding the Light and Turbidity data:

  1. Can the photodetector detect a decrease in light intensity before sunset?
  2. How long after sunset does it take to become dark?
  3. When does the morning twilight begin? Why does the sky brighten before the sun is visible?
  4. How long did it take for the creek to become as clear as it was prior to the storm?
  5. Describe the water's turbidity the hour or so after the thunderstorm. Can you explain this behavior?
  6. Even though the moon was nearly full this night and the skies cleared up after the storm, the ESS's ambient light sensor showed no indication that there was a bright moon. Can you give some possible reasons for this?
  7. Does the ambient light measurement flatten out because of the sensitivity of the photoresistor, or is it a natural phenomena? Can you develop an experiment to test your hypothesis?

Questions regarding the Conductivity data:

  1. Why does the conductivity reading take a nose-dive around 6:38p.m.? What does a nose-dive mean? Does this indicate an increase or a decrease in the actual conductivity? Recall that this data being plotted is simply raw voltages as read directly from the voltage divider boards.
  2. What happens to the creek's conductivity in the period following the storm? Why?
  3. Compare the conductivity and temperature graphs. Do they follow the same trends? Why or why not? When do they? When don't they?

I'd sure like to hear from you.
If you find my tutorial helpful or if you would like to leave a comment,
please send me an email.


Robot Hardware: For a complete list of hardware, electronics supplies, and tools, see my tutorial on how to build and operate the ESS.

Notes:
  1. While this is not a tutorial, let me explain how to get the program running. (If you are interested in building your own Environment Sensing Station, I have written a full tutorial on how to build and operate the ESS.)

    First, connect all the hardware as described in the Robot Hardware section above. Then, you'll need to make a shorting connector, which is shown in the image below on the left. Then plug in the shorting connector to pin 15 on the RAMB (BX-24 pin 20). That is, short signal pin 20 to ground as shown in the image below on the right. You see, the program is designed to first check pin 20. If the pin reads zero (or ground) the variable DataWrite is set to True. The ESS is now ready to collect data.


    [Click on images to enlarge them.]

    The shorting connector can now be removed. The next time the program runs, the value of DataWrite is checked. Since it is True, the program will begin collecting data. Once the data collecting begins, the program sets DataWrite to False. From now on, every time the program is executed it will see that DataWrite is False and will not collect more data but rather will print the contents of the EEPROM to the computer screen. Simple, huh?

    If you want to collect more data -- and write over the last set of data stored in EEPROM -- simply reconnect the shorting connector and repeat the above steps.

  2. To keep track of the DataWrite variable after the power was turned off, I defined it as a persistent variable. The same is true for the variables that kept track of the number of bytes to be used during the experiment as well as the starting time.

  3. All the sensors were inserted into a Robodyssey voltage divider boards (VDB) equipped with variable resistors. These VDB's were then connected to the BX-24 A-to-D pins via the RAMB. While I generally prefer the fixed resistor VDBs, the variable ones are nice during the development stages of an experiment.

  4. None of the sensors have been calibrated. To calibrate the sensors, ask your local physics department to help -- they are sure to have the right equipment.

     
    • See pages 318-321 in my book for a detailed explanation on how to convert raw signal data into actual temperatures.

  5. A note on the turbidity measurement: I measured the turbidity by shining a bright light directly into a photoresistor. This is not the traditional way of doing it. I should also place a photoresistor pointing perpendicular to the beam of light, which will measure the scattered light as well. This sounds like a perfect job for one of my students!

    (Note on 5-1-07: I have since included this extra turbidity sensor and the code at the top of the page makes use of this new sensor. See construction and operation tutorial for more details.)

  6. Speaking of jobs for my students, I would like to make the ESS capable of measuring pressure and therefore depth. This can be done with a sliding potentiometer secured to the flexible rubber end cap. This feature would greatly add to the functionality of the instrument. Also, if this proves to be successful, it could be used in conjunction with an autonomous submarine. Knowing the depth of the vessel would be important!

  7. While the ESS worked well, I found that it did leak a small amount of water during the 18-hour experiment. Fortunately, the electronics were placed on the slide-in shelf and did not get wet. The source of the leak must be investigated -- again, sounds like the perfect task for an eager young engineer.

  8. Conductivity was simply measured with a gold IC wire-wrapping socket. The pins along one side were soldered together and connected to a wire, as were the pins along the other side. The two wire leads were then connected to a VDB. In air, the resistance between the two rows of pins is very high so the signal read by the BX-24 is nearly equal to the input voltage of 5V. In water, the resistance varies according to its mineral content, which is quite variable.

     
    • See pages 318-320 in my book for a detailed explanation of the physics behind the voltage divider, complete with mathematical formulas and derivations. What fun!

Copyright 2006, Chris D. Odom. All Rights Reserved