Porting SDI-12 Electron library to Boron LTE

Has anyone had success in using the SDI-12 on the Boron or other mesh devices without using a shield?

We came across the electron-sdi12-library and referenced the Electron and Boron pinouts when changing the library’s source code to match the pins on the Boron.

Upload the modified library to the Web IDE and add it to our project.

When compiling in the Web IDE, the following errors are returned:

error
lib/electron-sdi12-library/SDI12Master.cpp:79:16: ‘Serial4’ was not declared in this scope
error
lib/electron-sdi12-library/SDI12Master.cpp:84:16: ‘Serial5’ was not declared in this scope
error
lib/electron-sdi12-library/SDI12Master.cpp:85:12: ‘MO’ was not declared in this scope
error
lib/electron-sdi12-library/SDI12Master.cpp:272:17: ‘C3’ was not declared in this scope
error
lib/electron-sdi12-library/SDI12Master.cpp:275:12: ‘MO’ was not declared in this scope
error
lib/electron-sdi12-library/SDI12Master.cpp:322:12: ‘C3’ was not declared in this scope
error
lib/electron-sdi12-library/SDI12Master.cpp:326:12: ‘MO’ was not declared in this scope
error
lib/electron-sdi12-library/SDI12Master.cpp:361:12: ‘MO’ was not declared in this scope

Is there a possibility of this library working with the Boron, or will I need to develop one for the Boron based on the SDI-12 specification? If not we are just going to use the already working Arduino for SDI-12 data collection and connect the Boron to it.

1 Like

The simple answer to your question is that you should be able to port this library easily to your boron by removing the offending lines as shown in the error message.

The complex answer to your question is that SDI-12 is a little finicky – your hardware will need to match whatever the creator of that libraries hardware looked like.

My advice would be to try to get your Boron talking to your SDI-12 sensor via a transceiver chip with simple Serial.print commands and whatnot and go from there.

1 Like

@Eyeohtee, that library was written for the Electron’s multiple serial ports. It would not take much work to either remove the Electron-specific code or add compiler directives to turn on and off sections of code based on the Particle device type.

2 Likes

Have you had any luck porting the SDI-12 library to the Boron? This is also something we would like to do.

@crispy I know this might sound bad, but we didn’t have time to port the library and instead just used an Arduino Nano copy to handle the SDI-12 from our ClimaVUE50 weather station. We parsed it on the Nano and then sent the data to the Boron’s RX pin through a voltage divider. From there it made it to our server. Sorry I couldn’t be of more help on the mesh SDI-12 library.

@crispy, the library is perfectly suited for the Boron. I can clone the repo and make the necessary changes. It also needs to be updated to the v2.0 library format. The testing I will need to leave to you as I don’t have an SDI-12 device to test against.

Thanks for responding and that works!

1 Like

Hi @peekay123, Thank you!

In looking at the original library posted, it looks like it requires external hardware to be able to do SDI-12. It has been implemented without extra hardware using softwareserial. Does anyone know if softwareserial could work on the boron or do we need to build some external circuitry (or use @Eyeohtee solution)?

@crispy, softwareserial is not possible on the Mesh devices at this time. It will run on the Gen2 devices if @ScruffR’s ParticleSoftSerial is used and adapted.

1 Like

Thank you!