Home › Forums › Mayfly Data Logger › Atlas Scientific EZO logging program › Reply To: Atlas Scientific EZO logging program
The error you’re getting is because the SoftwareSerial library uses an interrupt method that conflicts with the SODAQ_PcInt library. In order to use those 2 libraries together, you have to use the modified versions of the libraries we posted in our Github repo, along with modifying the library names in your sketch in 3 places. Plus you’ll need to change the pins for your Atlas sensors to use 10 and 11 instead of 6 and 7. This is because the SoftwareSerialMod library ignores interrupts on the port that includes all of the analog pins (where the DS3231 interrupt is on A7) and it ignores pins D0-D7. This allows people to use the SDI12_Mod library to look at SDI12 sensors on pin D6 or D7.
So download all of the libraries from our repo: https://github.com/EnviroDIY/Libraries/tree/master and be sure to follow the instructions on that page about how to download the .zip file from the tree and not use the green “clone or download” button.
Once you have the libraries installed, restart you IDE and then modify the top section of your code to point to the new library filenames and update the pin numbers. It’ll look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <Wire.h> #include <avr/sleep.h> #include <avr/wdt.h> #include <SPI.h> #include <SD.h> #include <SoftwareSerialMod.h> #include <RTCTimer.h> #include <Sodaq_DS3231.h> #include <Sodaq_PcInt_Mod.h> RTCTimer timer; #define rx 11 //D11 to Tx on EZO (white on Grove conn) #define tx 10 //D10 to Rx on EZO (yellow on Grove conn) SoftwareSerialMod myserial(rx, tx); //define how the soft serial port is going to work. String dataRec = ""; String sensorstring = "EZO data"; //a string to hold the data from the EZO product |
I compiled your code with the above changes and get no errors.
Or if all of this is too complicated, and you have Mayfly board v0.4, you can simply cut the trace on the back of the board on JP1 to change the clock interrupt from A7 to D10, so you can use the board’s third hardware interrupt pin to wake it up instead of using the PcInt pin change library. Then you can remove all reference to the PCInt library from your sketch, change the wakeup pin from A7 to 10, and then use the regular SoftwareSerial library, and putting your sensors back on D6-7. Another user brought this issue up recently: http://envirodiy.org/topic/low-power-project/