SDI-12 USB + Analog prototype

So finally the boards and parts are here and I built the first batch of 3 boards (purple as in oshpark.com). Here is a photo of one of them with my hand as size reference:

2016-11-04-09-27-20

This board is twice the size of the original SDI-12 USB adapter and features the following additional features:

  1. 4 SDI-12 screw terminal blocks. The original adapter can handle multiple SDI-12 sensors if you wire them all together to the single SDI-12 block. On the other hand, I can make this easier by providing more connectors. 4 connections don’t mean limit of SDI-12 sensors to 4. You can wire any number of sensors to the same connection. More connections just mean more convenience when building your logger or swapping sensors in the field.
  2. External power supply block. With the original adapter, SDI-12 sensors are powered by 5V from USB. If it is not enough, you need another power source and some additional wiring. With the new version, just wire external power to this connection and select the SDI-12 power jumper to Ext., less wiring.
  3. Analog channels: Many users asked about using analog sensors that are NOT SDI-12 sensors. That requires additional hardware and distracts you from focusing on making your logger. Enter 4 analog channels! Each channel is capable of 16-bit analog to digital conversion and can have up to 16X gain. The smallest voltage you can read is down to 8 micro volts! You are welcome, pyranometers! You can use them as 4 single-ended channels, for PT1000 or other resistive temperature sensors or as 2 differential channels, best suited for pyranometers.
  4. Resistance sensors: resistance measurements are available on every analog channel. The channels come with select-able high-precision low-temperature-drift pull-up resistors. You can select 1K resistor for PT1000 and anything with low resistance or 10K resistor for 10K thermistors or anything with high resistance. If your sensor generates a voltage, such as pyranometer, you can disconnect the jumper to disable this pull-up resistor. Each channel is separately configurable and auto-scales for best precision.
  5. Analog channels are sensed the SAME way you would sensor an SDI-12 sensor. The address is ‘z’ (lower case). Just in case you wonder, there is also a differential mode to further increase precision of small signals if you pair channels 0 and 1 as a differential channel, or 2 and 3 as another differential channel. Send zM! to the adapter for single-ended measurements. Send zM1! for differential measurements. If you have them mixed, say channels 0-1 is used as differential for a pyranometer and 2, 3 are single-ended for two PT1000 temperature sensors, sense it twice, once as single-ended, discard values from channels 0 and 1. Then sense as differential, discard value from 2-3 differential.
  6. Every key component, such as the analog-to-digital converter IC, the ATMEGA328 processor, the FT232RL USB chip, crystal oscillator, fuse, and precision resistors, comes from reputable vendors such as digikey, mouser, or newark. Every adapter is assembled by myself and tested with an actual SDI-12 sensor (also an analog or resistive sensor). I don’t know how else to ensure excellent quality! There is no guarantee coming with ebay purchases!

I expect this product to be available in a few weeks after I conclude my testing phase. My estimate retail price is $89. I will release data logger code that can log both SDI-12 sensor and the analog channels when this is offered for sale.

SDI-12 eye candy! an SDI-12 + analog input USB adapter

The SDI-12 USB adapter is definitely a success! They are flying off the shelf! I guess people want to log data with PC/raspberry pi just as much as with Arduino (I have an SDI-12 data logging shield for Arduino). So I thought what else I can do to provide even better service to the community of SDI-12 sensor users.So here it is (well, just the design, actual device is not ready for prime time yet):

sdi-12-analog-usb-adapter

Here are the things that I added to make another version of the adapter:

  1. 4 SDI-12 screw terminal blocks. The original adapter can handle multiple SDI-12 sensors if you wire them all together to the single SDI-12 block. On the other hand, I can make this easier by providing more connectors. 4 connections don’t mean limit of SDI-12 sensors to 4. You can wire any number of sensors to the same connection. More connections just mean more convenience when building your logger.
  2. External power supply block. With the original adapter, SDI-12 sensors are powered by 5V from USB. If it is not enough, you need another power source and some additional wiring. With the new version, just wire external power to this connection and select the SDI-12 power jumper to Ext., less wiring.
  3. Analog channels: Many users asked about using analog sensors that are NOT SDI-12 sensors. That requires additional hardware and distracts you from focusing on making your logger. Enter 4 analog channels! Each channel is capable of 16-bit analog to digital conversion and can have up to 16X gain. The smallest voltage you can read is down to 8 micro volts! You are welcome, pyranometers!
  4. Resistance sensors: resistance measurements are available on every analog channel. The channels come with select-able high-precision low-temperature-drift pull-up resistors. You can select 1K resistor for PT1000 and anything with low resistance or 10K resistor for 10K thermistors or anything with high resistance. If your sensor generates a voltage, such as pyranometer, you can disconnect the jumper to disable this pull-up resistor. Each channel is separately configurable and auto-scales for best precision.
  5. Analog channels are sensed the SAME way you would sensor an SDI-12 sensor. The address is ‘z’ (lower case). Just in case you wonder, there is also a differential mode to further increase precision of small signals if you pair channels 0 and 1 as a differential channel, or 2 and 3 as another differential channel. A different command is used for differential channels also at address ‘z’ (lower case).
  6. Every key component, such as the analog-to-digital converter IC, the ATMEGA328 processor, the FT232RL USB chip, crystal oscillator, fuse, and precision resistors, comes from reputable vendors such as digikey, mouser, or newark. Every adapter is assembled by myself and tested with an actual SDI-12 sensor (also an analog or resistive sensor). I don’t know how else to ensure excellent quality! There is no guarantee coming with ebay purchases!

Important! This version will be named SDI-12 + Analog USB adapter and the original adapter will still be offered. The original adapter works great as part of a desktop/lab test device and for data loggers mostly made up of SDI-12 sensors. The new adapter is more expensive due to added capabilities.

Any comments? Suggestions? Please feel free to tell me.

SDI-12 bus scan code

In case you need to diagnose your SDI-12 data logger, I posted SDI-12 bus scan code for the SDI-12 USB adapter (in Python) and for the SDI-12 data logging shield (in C for Arduino). Their links are under Data logger programs or Downloads.

Here is a screen shot of the Python code:

bus-scanner

The Arduino code has a similar interface without the serial port select (you select Arduino serial port in Arduino serial monitor). It’s fun translating C code into Python. C is famous for manipulating strings as arrays of ASCII characters. Doing such in Python seems like a hassle because it has no pointer mechanism, loose types, and aims to handle Unicode so it buries the ASCII characters under layers of things. Anyway, each language has its own strengths and weaknesses.

Notice that the scanner shows a Decagon 5TM sensor at address ‘1’ and also shows the SDU-12 translator at address ‘z’. Make sure that each sensor already has a unique address before scanning the bus. To configure sensors with unique addresses, run the configuration code for either the SDI-12 USB adapter or the SDI-12 data logging shield. Hope this helps. Comments?

SDI-12 USB adapter manual updated

I have just finished an update to the SDI-12 USB adapter documentation.

Updates:

  1. I added a document to the manual: Sensor connection guide. It lists a number of SDI-12 and other sensor wiring information from various manufacturers. Find it in the SDI-12 USB adapter page under documentation.
  2. All sections are now numbered now for easy reference.
  3. Two new sensors have been tested by customers to work perfectly with the adapter: Campbell Scientific CS650 and CS655 soil sensors.
  4. I added an appendix to explain how to use external power for your SDI-12 sensors, in case they don’t work with the 5V power supplied by the SDI-12 USB adapter. A wiring diagram is included.
  5. I added an appendix to explain how to easily connect a Decagon SDI-12 sensor with a stereo plug with a picture.

SDI-12 USD adapter with external power SDI-12 USD adapter with stereo adapter

Saving data to sparkfun server

If you’ve been following my posts, I discussed how to use my SDI-12 USB adapter and raspberry pi (or PC) to log data from SDI-12 sensors. Now that you have your data, you can also send them to sparkfun’s data server for storage and later retrieval. In the following video, I explained what you can do with this feature included in my data logger python script. I also constructed a sample webpage to display data saved on the server. Lots of customization can be made based on this sample webpage.

 

Log data with SDI-12 USB adapter

On my last post, I showed a couple of videos of how to connect an SDI-12 sensor to the SDI-12 USB adapter. Here is a video of how to configure an SDI-12 sensor and log data with the adapter:

 

Sorry there was some noise in the background that I couldn’t get rid off with the authoring software. Here is the transcript in case you need it. I will explain how to send data to sparkfun’s data server in my next post.

Let’s plug in the SDI-12 USB adapter. Windows will automatically install its driver and create a COM port, in this case, COM18. If this is your first time installing a COM port on your computer, you will need to be patient.

What we are looking at are two windows. The window on the left is the python shell. It shows you the input and output of python scripts. The window on the right side is the SDI-12 configuration script version 1.1. We run this script to set up the sensor’s SDI-12 address.

On the left window, you can see the messages printed by the configuration script in blue. This script runs on windows, mac, linux, and raspberry pi.

The script has discovered a number of COM ports and listed them all on the left window. The first one, item zero, is our SDI-12 USB adapter, i.e. COM18. Type zero and enter. Ignore the rest. If you are unsure about the COM port number, run this script with the adapter disconnected and then run it again with the adapter connected. This way you can see which port belongs to the adapter.

After a short moment, the script has detected the SDI-12 sensor at address 1. The information printed out indicates sensor address 1, compliant with SDI-12 standard version 1.3, and the manufacturer is Decagon. The sensor is a spectral reflectance sensor and its serial number is also printed out.

What this script does is to detect the one-character SDI-12 sensor address, print out the sensor information, and allows you to change its SDI-12 sensor address. Valid address includes 0-9, A-Z, and a-z.

Let’s set the sensor address to 2. To check that this has taken effect, we run the script again.

Now it has detected the new address. The address is saved on the sensor until it is changed again.

Now let’s look at the data logger script.

What this script does is: it logs data to two places, a file on the computer, and it also sends the same data to a server at sparkfun electronics. Everyone that runs this sample data logging script shares the same storage on the server and can see results from everyone else. You can also create your own storage or stream on sparkfun so you can keep the data to yourself.

Here I have python shell and sdi_12_logger script version 1.1. Let’s run the script with F5. This time there is a longer printout and it does say it runs on Mac OSX.

Next we see a list of serial ports. We select zero for COM18, like before.

Then we are required to enter the total number of data points. Let’s try 5. You can enter any large number of data points and stop the data acquisition anytime with Ctrl-C. Data saved on your computer and sent to the server will not be lost if you stop the script.

Delay between data points is specified in seconds. We’ll use 10 seconds. Then we decide whether to store each data point with local or universal time. Enter 1 to pick local time.

Enter the SDI-12 sensor address, 2.

Here is the first data point. Date and time, then two spectral reflectance values, and then 2.0 for facing upward.

The curl command that appears on the next line will only appear if you have curl installed, which is a tool to send HTTP requests. So besides a local copy of your data, you also have an online copy on sparkfun electronics server.

OK now we finished collecting 5 data points and the python shell prompt has returned.

We will take a look at the data file and the server data next.

Connect SDI-12 USB adapter to a sensor

If you wonder how to connect your SDI-12 sensor to the SDI-12 USB adapter, here are two videos showing you how to. In the video, I was using a Decagon PRI spectral reflectance sensor. It comes with 3 wire leads. Bare wire is ground. Wire wire is power. Red wire is SDI-12 bus. If you purchased a Decagon sensor with the 1/4″ stereo plug, you can purchase an adapter from them that break out the wires into 3 wire leads.

Decagon sensor wiring

The jeweler’s screw driver that I used was 0.1″ wide flat-head. On my next post, I will demonstrate how to run configuration and data logging scripts.

30-day temperature data

Since I was going away for a month, I decided, before I left, to set my SDI-12 data logger to run a 30-day data collection routine, just to see how robust the software is. Here is the result:

30-day temperature

The temperature sensor was in my office so its variation was small. The steep slope towards the end was because I opened the window after I got back and kept the window open for a whole day. You may notice the lack of variation of temperature between 5/10 and 5/13 but that WAS what happened. History data from wunderground.com showed less-than-average variation of outdoor temperature in my area during the same period:

wundergroundSo my conclusion was that my python data logger code running on raspberry pi was robust enough for at least 30 days so was the SDI-12 USB adapter. If this were done outdoors, then the raspberry pi and the SID-12 USB adapter both need protection from the element. Also a solar panel and battery will be needed.

Parts and components:

Raspberry pi 2 B (or 3 B)

SDI-12 USB adapter (Free python data logger code)

Decagon 5TM soil sensor

 

Soil data logger telemetry

I have finally found time to build a simple website for my soil data logger with telemetry. The system works as the following:

  1. The data logger consists of a raspberry pi and my SDI-12 USB adapter with a Decagon 5TM soil sensor
  2. The data logger runs the open-source datalogger code I wrote in Python to first get parameters from the user (COM port, SDI-12 address, delay etc.), and then collect data, save to a local .CSV file, and then send the same data to sparkfun’s phant server.
  3. I constructed a web interface to plot the data using Google Charts and download .CSV version from sparkfun’s phant server.

Here is a screen shot:

soil logger webpage

I’ve uploaded the webpage to a server with a link below. The sensor is apparently NOT buried in soil so I can easily take the setup and set it up in different places to test its stability.

Link to the website: Link