Giter Site home page Giter Site logo

sdiserial's Introduction

SDISerial

An SDI-12 Serial Library for Arduino.

This library was designed around filling a niche that was lacking and allow Arduino boards to communicate freely with SDI-12 Serial peripherals. It is largely based off of the Arduino SoftwareSerial Library, modified to support the SDI12-Serial Specifications.

Works flawlessly with an assortment of Decagon Devices Soil Moisture Sensors.

Verified for the following boards:

This is currently untested with more than two addressable devices on the sdi-bus, although I would fully expect it to work for N devices. hopefully I will have time soon to try it with more devices on the serial bus.

INSTALLATION

###Option 1: Git checkout###

  1. Open your terminal and cd to your root arduino folder
    • I use cd C:\Arduino\arduino-1.0\
    • you will know your in the right place because it will contain "arduino.exe"
  2. Change to your libraries folder cd libraries
  3. Clone the git repository git clone [email protected]:joranbeasley/SDISerial.git

###Option 2: Zip File###

  1. Download Zipfile from link on the right
  2. Unzip to the libraries folder listed above
  3. Rename the extracted folder from SDISerial-Master to SDISerial

INSTALATION VERIFICATION

  1. Open The Arduino IDE by running arduino.exe in the <Arduino_Root> folder.
  2. Goto File > Examples > SDISerial > SDISerialExample

The wiring for the example program is Wiring Diagram note:Depending on the sensor used you may need more than 5V, for Decagon Sensors 5V should be sufficient.

DOCUMENTATION

Simple Example

This library was designed with ease of use in mind. Here is a simple example program to get you started.

for more info see the included examples

#include <SDISerial.h>
#include <string.h>
#define DATA_PIN 2
SDISerial connection(DATA_PIN);
char output_buffer[125]; // just for uart prints
char tmp_buffer[4];

//initialize variables
void setup(){
      connection.begin();
      Serial.begin(9600);//so we can print to standard uart
      //small delay to let the sensor do its startup stuff
      delay(3000);//3 seconds should be more than enough
}

//main loop
void loop(){
    //print to uart
    Serial.println("Begin Command: ?M!");
    
    //send measurement query (M) to the first device on our bus
    char* resp = connection.sdi_query("?M!",1000);//1 second timeout
    //this really just returns a message that tells you the maximum wait before the measurement is ready
    
    sprintf(output_buffer,"RECV: %s",resp?resp:"No Response Recieved!!");
    Serial.println(output_buffer);
    delay(10000);//sleep for 10 seconds before the next read
}

sdiserial's People

Contributors

joranbeasley avatar oarchner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdiserial's Issues

32u4 based boards

Thank you for this effort. It's working well on UNO.
We tried to run SDISerial on 32u4 boards such as Arduino industrial 101 and 32u4 based Nano.

@joranbeasley Do you have any suggestions to solve this issue ?

Thanks

Co-exist with Software Serial

I got this to work with an EnviroPro Soil probe however I wanted to also leverage the HC-06 Serial BT module in the same project. And SDISerial conflicts with SoftwareSerial... is there an easy fix for this?

Occassionally receive RECV:0 instead of response

First off, thank you so much for this library!
I hooked up my 5TE sensor as per the diagram, and it seems to work, but not all the time.

The serial monitor shows that 80% of the time, the output is just RECV:0.
The other 20% correctly shows the sensor reading string - so I know it works.

Per the 5TE documentation, you can append a time after the M! command which should make the sensor always return a reading. By changing M! command on line 28, I was able to stop the RECV:0.

Instead of the original command, "?M!"
I used the example in the documentation and changed it to this, "?M!10013"

Thought I'd pass this along in case anyone was having the same trouble.

It definitely could've been something specific to my Arduino or 5TE, but just in case.

Thanks again!

Library compatibility with Arduino Droid android App

Hi Joran...Thanks for letting us use this library, it helped allot with my soil moisture project. At the moment I'm using an android app to program the Arduino in the field(irrigation field), because it is quite an effort to take a Laptop with. The App is called Arduino droid by Anton Smirnov. I just cant seem to get the library to work on the App, so I asked Anton, and he stated that it was a typical library incompatibility. Is it possible for you to make it compatible to use on that App? He sent this as a guide: https://arduino.github.io/arduino-cli/latest/library-specification/#library-metadata

Only first character displayed when displaying measurement result 1D0!

Hi,
I'm getting only the first character of sensor measurement data.

Here how it should work:
Master: 1M!
Sonde: 10617[CR][LF]
The bus master sent a measurement command. The Sonde will take a maximum of 61 seconds to finish the measurement. Upon completion, it will have 7 sensor data available.
Sonde: 1[CR][LF]
Master: 1D0!
Sonde: 1+17.5+12.05+98.7+8.25+6.45[CR][LF]
Master: 1D1!
Sonde: 1-325+10[CR][LF]

The only thing I receive after 1D0! command is 1. I think it must be the + - operator and wrong integer type for the variable which stores the output. Any thoughts on how to read the output containing + - operators?

typo

typo in README.md

  • SDISerrial connection(DATA_PIN);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.