Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jsadler2 committed Nov 20, 2014
1 parent ffcd2d8 commit 311c251
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
95 changes: 95 additions & 0 deletions Adjustment for Software Serial and SDI12 library conflict.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
**Contributed by Kevin Smith of Stroud Research Center**

If you look at the SoftwareSerial library -
https://github.com/arduino/Arduino/blob/master/libraries/SoftwareSerial/SoftwareSerial.cpp

- you will see a section of code copied below:

#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
SoftwareSerial::handle_interrupt();
}
#endif

#if defined(PCINT1_vect)
ISR(PCINT1_vect)
{
SoftwareSerial::handle_interrupt();
}
#endif

#if defined(PCINT2_vect)
ISR(PCINT2_vect)
{
SoftwareSerial::handle_interrupt();
}
#endif

#if defined(PCINT3_vect)
ISR(PCINT3_vect)
{
SoftwareSerial::handle_interrupt();
}
#endif


It basically says, if the hardware has something called PCINT0, PCINT1, PCINT2, or PCINT3,
claim it for the SoftwareSerial library to use. ArduinoUNO only has up to PCINT2, but
other models have more PCINTs available.

Anyway, we do not need to be so greedy. We only need pins 2 and 3 for SoftwareSerial, which
is PCINT2. So we simply "comment out" the sections in the SoftwareSerial library that
we aren't using for SoftwareSerial. Commenting out is better than deleting, since you
may want to get this functionality back later.

//#if defined(PCINT0_vect)
//ISR(PCINT0_vect)
//{
// SoftwareSerial::handle_interrupt();
//}
//#endif

//#if defined(PCINT1_vect)
//ISR(PCINT1_vect)
//{
// SoftwareSerial::handle_interrupt();
//}
//#endif

#if defined(PCINT2_vect)
ISR(PCINT2_vect)
{
SoftwareSerial::handle_interrupt();
}
#endif

//#if defined(PCINT3_vect)
//ISR(PCINT3_vect)
//{
// SoftwareSerial::handle_interrupt();
//}
//#endif

Next, we are going to do the complementary action in the SDI-12 Library, which is also
being greedy. Since we are using pin 9 for SDI-12, we give it to PCINT0:

//6.3
#if defined(PCINT0_vect)
ISR(PCINT0_vect){ SDI12::handleInterrupt(); }
#endif

//#if defined(PCINT1_vect)
//ISR(PCINT1_vect){ SDI12::handleInterrupt(); }
//#endif

//#if defined(PCINT2_vect)
//ISR(PCINT2_vect){ SDI12::handleInterrupt(); }
//#endif

//#if defined(PCINT3_vect)
//ISR(PCINT3_vect){ SDI12::handleInterrupt(); }
//#endif

Restart the Arduino IDE, and it should recognize the changes to the libraries and your
code should compile without issue.
22 changes: 22 additions & 0 deletions implementation instructions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
This package was designed to automatically insert sensor data using HTTP requests from a GPRS Sim900 Shield attached to an Arduino code.
The Arduino code is called 'sensorToHSL'

To use the package, do the following:

1. put inputSensorData.php into the 'client' folder of HydroServerLite

2. in 'sensorToHSL.ino' modify these variables found at the top of the sketch:
- the 'SourceID' variable to the ID of the desired source (created in HSL)
- 'SiteID' to the ID of the desired site (created in HSL)
- 'VarID1' to the ID of the desired variable (created in HSL)
- 'VarID2' to the ID of the desired variable (created in HSL)
- and the 'url' of the 'inputSensorData.php' file

3. modify the 'sensors()' function in 'sensorToHSL.ino' to read the data from YOUR sensor(s)

4. modify 'recTime' and 'recIntv' to change when the first reading occurs (what minute) and at how often respectively

5. upload sketch to Arduino


written by Jeff Sadler

0 comments on commit 311c251

Please sign in to comment.