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

Watchers

 avatar

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.