SDI-12 USB adapter
***Where to buy***Documentation and logging scripts***
We ship worldwide! (click for details)
Description
This extremely popular $49 SDI-12 USB adapter is the easiest way to add SDI-12 sensors to a raspberry pi or a PC running windows, Linux, Mac OSX. Similar products on the market sell for a lot more with less features. This adapter essentially allows you to send SDI-12 commands directly to your sensors and read back their responses. You may decide to run the free and open-source data logger code I provide and maintain, or develop your own code. The adapter has been tested for long-term deployment for about 6-month of continual logging.
Here is my 2021 video playlist with introductions and detailed setup guidance:
To integrate SDI-12 sensor on your Arduino instead of on PC, Raspberry Pi, or Beagle Bone Black, check out my SDI-12 data logging shield and dongle:
http://www.inmojo.com/store/liudr-arduino-and-physics-gadgets/item/sdi-12-serial-logger-shield/
SDI-12 sensors are widely used in environmental monitoring including soil, streams, plants etc. On the other hand, data loggers designed for SDI-12 sensors are usually expensive and proprietary, making it harder to monitor and study soils and streams on a budget. This SDI-12 USB adapter makes it possible to directly interface SDI-12 sensors with a PC running Windows, Mac, Linux, Raspberry Pi, or Beagle Bone Black, on a budget. I have built numerous SDI-12 sensor data loggers. This is my latest design that is very easy to use. All you need is the adapter and a PC/Raspberry Pi/Beagle Bone BlackCS215 Air Temperature and Relative Humidity Sensors (Thank Lee!). It also comes with free data logger program (Python script) for all the above operating systems. A section on SDI-12 sensors will guide you through it. FYI, a $150 windows 10 netbook running on Intel ATOM Z3000 series or faster is more than enough to log data. All of the examples in this manual came from one such netbook. A first-generation Raspberry Pi is more than enough for data logging.
Data logging with a Beagle Bone Black
Introduction to the adapter
Live data stream
I provide free open-source data logging scripts in Python. The following link was a live data stream from a test logger in the summer and fall of 2018, which has successfully concluded:
https://thingspeak.com/channels/462583
The soil is frozen now and you can download the complete 5-month data set below:
Sensor Data file: here
Sensor: METERS group ECH2O 5TM soil sensor (formally Decagon 5TM)
Data: dielectric constant, temperature (DegC)
Logger: Raspberry Pi Zero W
Description: The soil sensor is not buried in soil and indoors. I use this sensor to test new batches of SDI-12 USB adapters so I don’t bury it in soil. As a result, the dielectric constant is close to 1 (air, or carpet) and temperature is indoor (DegC).
SDI-12 sensors tested
In theory, all SDI-12 sensors should work with my adapter. In practice, not all sensors were made equal. So far, I have been able to test the following sensors with the adapter, with some help from users like you. There has not been reports of any SDI-12 sensors that are incompatible. The following is a list:
List of sensor vendors:
- Acclima
- Apogee
- Aquacheck
- Campbell Scientific
- Decagon
- Ecotech (Stevens Water)
- EnviroPro
- FTS inc.
- Gill Instruments:
- Greenshield:
- Hongyuv:
- HSTI:
- METER grou
- Ponsel
- Sentek
- Sutron
- Unidata
Analog sensors tested:
Resistive sensors:
- Any sensors having resistance between 100Ω and 100KΩ can be measured with SDI-12 + Analog USB adapter
- PT1000 temperature probe
Voltage sensors:
- Any sensors producing up to 6V of DC voltage can be measured with SDI-12 + Analog USB adapter
- Apogee SP-110 Self-Powered Pyranometer (Decagon sells them under PYR part number)
- Apogee SQ-500 Self-Powered full spectrum quantum sensor
- METER group ECH2O EC-5 (Decagon EC-5) (Soil volumetric water content sensor)
Data Logging (Windows/Mac/Linux/Raspberry pi/Beagle Bone Black)
The adapter has been designed for long-term data logging, not just hours, days, or weeks, months at a time. The data logging software can also run without problems for months. You can sit back and watch the Python data collection script collect data automatically. My Python script is free and open source and has the following features.
- Automatically names files with start date such as 20160426.CSV
- Uploads data to a server so you can remotely access you data, or plot them with Google Charts (Python logger code)
- A free web page is provided so you can start making your own remote dashboard for your logger (Python logger code)
- Select sensor address
- Enter total data points
- Enter delay between data points
- Select GMT or Local time zone for time stamp stored in local log file
Data logger running on a Raspberry PI 2 B
Web page dashboard for my sample data logger (use it for free)
Just run the python data logger script in Tera Term. Your data will be stored where this script is so if you store the script in a cloud drive, you will be able to view your data remotely. Otherwise, use the data server to store your data and retrieve them.
5-month dielectric constant and temperature
Data file for the 5-month dielectric constant and temperature
Local data log file Format
Your data will be stored in comma-separated-value (.CSV) format. The file name is the date and time when the script starts logging data. There are at least three columns. The first column is the date and time the data point is collected. Depending on your choice, it is either in GMT/UTC or local time. The next column is the sensor address. The third column is the first value returned by your sensor. If your sensor returns more than one value, additional columns will contain additional values.
This file format is ready to be read by any major data analysis tools such as Excel, Open Office Calc, or the more expensive Origin Pro. Here is a sample of data collected from a Decagon 5TM soil temperature and moisture sensor. The first data column is the relative dielectric constant (1 for air, yes, it’s NOT in soil). The second data column is temperature.
2015/10/31 18:30:59, 1, +1.04, +25.0
2015/10/31 18:31:27, 1, +1.04, +24.9
2015/10/31 18:31:56, 1, +1.04, +24.9
Where to buy:
This hardware is for sale in several online stores. I ship all over the world from USA. The following are ways you can make your purchase.
Square online store:
- Square online store powered by Square. Square-brand registers are widespread among small retail businesses. You can read more about square here: https://squareup.com/us/en It’s easy to use and provides integrated postage purchasing features. You don’t need any account to make purchases. They accept credit card, Google Pay, PayPal etc. The processing fee is comparable to Paypal. I recommend using my Square online store.
Over the phone/email:
- I can process your credit card directly via my square register. My personal email zliudr@gmail.com still works but all new requests should go to my new email liudrelectronicsolutionsllc@gmail.com. Square-brand registers are widespread among small retail businesses. You can read more about square here: https://squareup.com/us/en
PayPal Invoice:
- I can send you Paypal invoices if you email me the items, quantities, and your shipping address with preferred shipping method, First class or Priority. Email me at liudrelectronicsolutionsllc@gmail.com
Tindie market place:
- Tindie market place has many things I sell and provides different buying options. I have been selling on tindie for a few years. It is geared towards makers and online businesses. Although PayPal processes your payment, you don’t need a PayPal account to make a purchase. Tindie charges a hefty transaction on top of PayPal processing fee so if you’re somehow unable to use other purchasing methods, you can use this market place. It doesn’t have a postage purchase integration so I have to copy your shipping information to another site to purchase postage.
Documentation:
Sensor connection guide 2016-08-18
Mechanical dimension in mm units of the latest SDI-12 USB adapter (Letter)
Mechanical dimension in mm units of the latest SDI-12 USB adapter (A4)
Data logger programs:
All my code are in Python. You can run them on Windows PC, Linux, Raspberry Pi, and Mac OSX. For Beagle Bone Black, please install the necessary components per this post.
I recommend anyone to start with the simple code below, then to V1.5.0 (2021 version), and if necessary, to V1.5.7 (saves your settings so you don’t have to enter them every time) and/or V1.6.0 (multiple adapters on one system). A version 1.0 is also included for you to learn and hack with.
Simple sensor detection and reading (2018-12-03)
This script demonstrates how to integrate SDI-12 sensors into your existing Python data logging system by providing the minimal necessary features. It is highly recommended if you are just starting with Python and/or SDI-12. It MUST run with a single sensor on the bus. For full-featured logging script, download the Data Logger script.
- Only one SDI-12 sensor is allowed on the adapter.
- It asks you to choose a serial port (the adapter has VID=0x0403).
- It then asks the sensor for its address “?!”.
- It then bases on the address to get sensor information, assuming sensor address is 1 it sends “1I!”.
- It then requests measurements “1M!”.
- Lastly it requests the results “1D0!”.
Sensor configuration download (2016-02-09)
This script discovers the address of the sensor and gives you the option to change its address. It MUST run with a single sensor on the bus. Run this script with each new sensor to set their addresses to a unique value 0-9, A-Z, A-y (z is used by the adapter).
SDI-12 bus scanner V1.0 download (2016-09-25)
This script scans the bus and prints all discovered sensor addresses and information. It helps with system diagnostics. The sensors on the bus MUST have been configured with unique address, with sensor config script. Otherwise they may all be at address zero.
Data Logger V1.6.0BP download (2019-02-07) stable release but please read about 1.5.0 and 1.5.7 first
- This version is relatively sophisticated. I recommend you to start with the simple sensor detection and reading and then try the version 1.5.0 or 1.5.7 (below) before trying this first.
- If you have used version 1.5.0, please read the changes notes in the link below. There has been significant changes since 1.5.0.
- This is a back-ported (BP) version, which means it is essentially 1.6.0 but has one feature update taken from my most recent experimental version (not released). This feature makes the script properly recognize onboard serial ports usually on desktop computers so it won’t throw an error when it is running on a desktop PC with onboard serial ports.
- This version has incorporated a lot of new features so it’s best if you run 1.5.0 if you are just starting unless you need the following features.
- Multiple adapters on the same computer/raspberry pi
- Multiple sensing commands per sensor, such as M!, M1!, M2! etc.
- Serial ports are opened by unique ID instead of device name such as COM3 or /dev/ttyUSB0 to make sure always the correct port is opened
- Updates to make the script more stable.
- … Read the changes below.
Data Logger V1.5.7 download (2021-10-25) stable release
This version differs from 1.5.0 because it will save the settings you enter to a file Liudrlogger.conf including the serial number of your SDI-12 USB adapter. Upon running it a second time, it will NOT ask for parameters but instead read from the config file. This is best for running the script a an auto run when your computer starts. If you are just getting started, experiment with the simple code first and then use 1.5.0 instead.
Data Logger V1.5.0 download (2021-10-25) stable release
This version has updated API address of ThingSpeak.com for data upload with up to 8 fields and basic visualization. It supports only a single SDI-12 USB adapter, which is typical in most situations. You will need to enter the sensor addresses etc at the start of the script or redirect the content of such inputs from a file. This is the most recommended script version.
Features:
* Logging multiple sensors to local storage
Just enter all sensor addresses when prompted for sensor address, for instance “12345” if you have five sensors 1 thru 5.
* Data upload to ThingSpeak.com
* Option to read analog channels with SDI-12 +Analog USB adapter
* Lists vendor ID for each serial port
Many computers have virtual serial ports that get listed in the list. To find which one is the adapter, just choose the port that has VID=0403.
Data Logger V1.4.1 (2017-02-02)
This version has added support to multiple sensors. Just enter all sensor addresses when prompted for instance “12345” if you have five sensors 1 thru 5. Yeah!
Data Logger V1.3 (2016-11-12)
This version adds support to reading 4 analog inputs on the SDI-12 + Analog USB adapter. There is an additional interactive question asking you whether to read analog inputs (Y/N). Select N if you have a regular SDI-12 USB adapter. If you stored answers to these interactive questions in a file to start the logger program without human interaction, you will need to add an additional answer Y or N to your answer file.
Data Logger V1.2 (2016-07-01)
This version lists USB vendor ID (VID) of each serial port. The VID for my adapter is 0403. This helps you identify which serial port is the adapter.
Data Logger V1.1 download (2016-04-25)
This version also logs data to a phant server and to a local file. You need internet connection for telemetry.
Data logger V1.0 download (2016-02-09)
This version logs data to a local file. This is a good starting point to learn how data logging is done once you finish the simple sensor detection and reading script.
Firmware update
If your simple adapter is already version 1.2 or higher, you don’t need any update. The following is included here ONLY if you absolutely need it.
Firmware update instructions (also in the manual)
Update utility files (download this and a HEX file below to same folder)
V 1.20 HEX file (SDI-12 USB adapter purchased before 2016) (2016-06-06)
- Routine update
V 1.49 HEX file (SDI-12 USB adapter and SDI-12 + Analog USB adapter) (2019-04-07)
- Timing after sending a command is corrected to work with some “fast” sensors
- Updated firmware version in identification string
V 1.59 HEX file (SDI-12 USB adapter and SDI-12 + Analog USB adapter) (2023-04-04)
- A lot of updates to improve functionality of the analog/digital/pulse counter channels (will update manual to reflect the updates)
- Updated firmware version in identification string
V 1.59Y HEX file (SDI-12 USB adapter and SDI-12 + Analog USB adapter) (2023-04-04)
- Did you accidentally assign a sensor to the address ‘z’ or were you given a sensor that has address ‘z’ and realized that ‘z’ is reserved for the adapter’s own functions?
- This firmware makes the adapter take ‘y’ as its address so you can either just use this firmware in case you MUST have address ‘z’ for one of your sensors or change that sensor with address ‘z’ to something else and switch back to your existing firmware.
Need some help?
If you need more sophisticated data logging scripts such as logging multiple sensors or sensor with more than 6 output values or integrating SDI-12 sensors in projects using Arduino, I should be able to help. Contact me on inmojo.com or leave a message on my blog. I am a full-time physics professor so my time during semesters may be limited. I have more time during the summer though.