November 22, 2016 2 Comments
What can this new board do?
Guesses? Comments? Answer revealed after US Thanksgiving holiday (2016-11-24)!
(There is nothing on the back side)
Arduino raspberry pi circuits programming python Linux and physics
November 18, 2016 Leave a comment
Reading analog sensors are easy. The adapter has SDI-12 address of ‘z’, lower case. So reading the analog sensor just involves querying the SDI-12 address ‘z’. There are two sensing modes: single-ended, and differential. If you have mixed single-ended and differential channels, read single-ended, then differential. Discard channels you don’t need. It won’t hurt the sensors or the adapter if you wire them in differential mode but read in single-ended mode. The reverse is also true.
The sensing commands are ‘zM!’ for single-ended readings, and ‘zM1!’ for differential readings.
In both modes, you use ‘zD01!’ zee-Dee-zero-!, to get data. Essentially, the adapter itself is an SDI-12 sensor that reports 2 or 4 values, depending on sensing mode. This makes it very easy to integrate analog sensors into your existing data logger that is based on the original SDI-12 USB adapter. It is still advantageous to keep the original SDI-12 USB adapter so it can split SDI-12 sensors with the SDI-12 + Analog adapter. In case one SDI-12 sensor gets broken and interferes with the rest of the sensors on that adapter, the SDI-12 sensors on the other adapter will be unaffected.
To make this complete, the SDI-12 USB + Analog adapter also responds to the following commands:
Response: ‘z\r\n’ This means that the adapter is responding to queries.
Response: ‘z13Liudr SDITRD130\r\n’ This indicates that the firmware is in version 1.3.0.
Response: ‘z0014\r\nz\r\n’ This means that the adapter needs 1 second to acquire 4 single-ended auto-scale analog values. The second ‘z’ indicates it completed the acquisition.
Response: ‘z0012\r\nz\r\n’ This means that the adapter needs 1 second to acquire 2 differential auto-scale analog values. The second ‘z’ indicates it completed the acquisition.
Response: ‘z+1.23456+2.34567+3.45678+4.56789\r\n’ or ‘z+1.23456+2.34567\r\n’ These are single-ended or differential channel readings, depending on whether M or M1 was issued before D0.
November 12, 2016 Leave a comment
Here is an update:
In case you wonder what all those green screw terminal blocks are doing, here is a graphical explanation:
Both the SDI-12 USB and SDI-12 + Analog USB are explained in this illustration.
To maintain the same compact size, I printed all the pin information on the bottom of the board again. So if you don’t know what a certain pin on a block does, just flip it around and you’ll see it. The jumper information is all on top side.
The SDI-12 + Analog USB adapter comes with a jumper to select either internal 5V or external voltage at the Ext. Power screw terminal block. You may connect a small 9V battery to the Ext. Power screw terminal block. You can also connect your 12V battery that powers your logger to this pin. The external power is only sent to the SDI-12 sensors. It’s not powering the adapter or sent to the analog inputs’ “+” connections. Those “++ connections are always from the 5V USB power. There are 3 pins on the terminal block and the center pin is not connected to anything. It makes it easier to separate the + and – of the external power and I don’t have to source 2-pole blocks besides 3-pole blocks.
All four SDI-12 blocks have “+ S -“. The “+” is either USB 5V or external power depending on the power jumper. “S” is SDI-12 signal. “-” is ground. All grounds should be connected together. These four blocks are all connected. They are not four separate buses. There is no way to transparently bridge one USB serial port to more than one SDI-12 bus. If you wish separate SDI-12 bus for each sensor, which is unnecessary, get a separate adapter for a separate SDI-12 bus. This need for separate SDI-12 bus may come from some suspicion that if a single SDI-12 sensor breaks, it may take the whole bus down with it. I have not been so unfortunate and broken SDI-12 sensors I have had didn’t affect good ones. In any case, a broken sensor needs replacement. Unless you deploy redundant sensors one set on each SDI-12 bus, you are OK with a single adapter that bridges a single SDI-12 bus for all sensors.
The four analog channels are as accurate as 0.02mV when the signal is small, below 0.256V. The adapter automatically uses the best scale to determine the signal. The highest signal allowed is 6.144V on any channel. There are 6 ranges (gain levels), with maximal ranges of 6.144V, 4.096V, 2.048V, 1.024V, 0.512V and 0.256V. Within each range of voltage, the analog input is turned into a numerical value between 0 and 32767. So if you have a signal that is 0.1V, using the largest range of 6.144V will give an smallest change of 0.1875mV. This sounds very accurate, because this change is 0.1% of the signal. But the real resolution of the ADC is not the smallest change. It is usually many times that. Plus there is fluctuation in supply voltage and noise in the signal. The result is likely in the neighborhood of 2mV. This becomes 2% of the signal magnitude. But if you use the 0.256V range, its smallest change is 0.0078125mV. The accuracy is about 0.02mV to be conservative. Since SDI-12 standard has no way to change scale, the adapter does it automatically.
The auto scale is done with a 10%~90% range. The adapter starts with the largest scale to protect the converter and reads the signal. It then calculates the smallest scale that will fit the signal within 10%-90% of the scale. It reads at this scale and returns the value. Each channel is auto scaled independently from the other channels so you may have some larger signals automatically read at a larger scale and smaller signals automatically read at a smaller scale.
The meaning of single-ended channel is that each one of the four channels is read against the common ground. This is less accurate for small signals over long wires. If you have a pyronometer or some other small voltage signal sensor, you may want to use two channels in differential mode. In this mode, the “+” wire is connected to say channel 0, and the “-” wire is connected to channel 1. The difference between these two are read and the difference may either be positive or negative. Range of the difference between these wires can be +-6.144, … +-0.256Vetc.
(to be continued)
November 4, 2016 3 Comments
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:
This board is twice the size of the original SDI-12 USB adapter and features the following additional features:
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.
October 2, 2016 2 Comments
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):
Here are the things that I added to make another version of the adapter:
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.
June 23, 2016 1 Comment
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.
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.
April 15, 2016 Leave a comment
I have just released an update to the SDI-12 USB adapter. This update makes the adapter recover from errors in communication so it won’t hang your data logging process in case a sensor is broken while you are logging.
To make the firmware update easy, I wrote a Python script to use avrdude.exe to load the firmware to the adapter. You will run the script just like the data logging script or config script:
Here is the output from Python:
I had the adapter on COM4.
Once updated, try connect to it using a terminal program and send zI! (zee-EYE!) and you will see the response has version 1.2 in it.
(Updated) This script now works on Windows, Mac OSX, GNU/Linux (64-bit) and Raspberry Pi.
February 8, 2016 2 Comments
I have successfully developed Python code to run the SDI-12 USB adapter data logger on Raspberry PI. It was quite a learning experience for me but I was able to boil down the steps into a tutorial on how to install the latest Python on Debian/Raspbian here.
Here are some screen shots of the data logger:
I was using a Decagon 5TM soil temperature and humidity sensor (hanging free in air and sometimes touching my table).
I have translated the Tera Term scripts into Python so it would run on all operating systems, including Win 10, Linux (Debian), and Raspberry PI (Raspbian). I have not got my Mac fixed but don’t expect any issues.
Now you have two Python scripts:
The configuration script detects the SDI-12 sensor’s address, prints the name of the sensor, and you can change it to a different address.
The data logger script lists all available serial ports to let you choose the correct one, then asks for sensor address, total data points, delays between data points, and also what time (GMT or local) to use. You can expand the script to take data from multiple probes and upload data to a server. I’ll add more info on the server upload to sparkfun’s phant data server.
While developing the code, I also discovered that the serial port console was very useful. You can set up auto login and run the data logger script upon auto login. This way the data logger starts logging data once the RPI boots up and auto logs on. No need to log in or use VNC (not good if your logger is using 4G hotspot for internet). Just a command prompt is all that is needed. Next step is to add a config file so the data logger will no longer ask for user inputs when this file exists and takes parameters from the file. This config file will reside in the FAT partition so that the user can easily update the parameters without having to boot into raspberry pi. Just remove the sd card and change parameters on a PC.
November 8, 2015 Leave a comment
After some delay, the SDI-12 USB adapter is finally here:
This adapter is extremely easy to use. Just connect it to your PC and SDI-12 sensor. Then you can use any serial monitor or terminal emulator program to talk with your sensor. Just open the serial port at 9600 Baud rate. You can start by sending device identification command such as ?!. You will see a response from your sensor, which is the one-character address of your sensor. If you have not set its address, it is most likely to be zero (0). Then you can use 0I! to find out the manufacture and model of your sensor, before getting measurements from it. Getting measurement is easy as pie. First send 0M!, then wait for response. Then send 0D0! to fetch the measurements.
For PC users, I even wrote a data logger script that can automatically log data using the popular Tera Term program. You can choose sensor address, total number of data points, delay between points, and time zone when logging, then the program will keep logging data. The following is a screen grab of Tera Term. The sensor is a Decagon 5TM soil temperature and moisture sensor. The address is one (1) and the returned values are relative dielectric permittivity and then temperature in Celsius.
Once you get data logging going, you can import the .CSV file into your Excel and plot it. You can choose a proper refresh rate so your data and plot are up to date when you look at them.
I’m still ordering more circuit boards but should be able to sell these on my inmojo.com store starting now. There is even a quantity discount if you need 10 or more.
April 23, 2015 Leave a comment
I have recently developed an open source device based on arduino, with an ATMEGA1284P chip. I need to build a number of them and program/test them as well. I did some research and found this article from sparkfun to be quite useful:
For me, my device is rather large, not a small breakout board. So I need something for its size. The device has LCD, rotary encoder, RTC, SD card, etc. All need some tests before I flash a standard firmware. So I need some software that can flash at least two different firmware to a target with some human interactions. Luckly Nick Gammon has done all the great work with hex loader code. You can turn an arduino into a hex loader that programs fuse values on a target, and load hex files from an SD card to a target. Here is his repo:
I used his Atmega_hex_uploader code. It is interactive. You open the serial port and type in commands and see printouts. Very nicely done. Thanks Nick!
For my programmer, I thought about just using an arduino and a jumper wire. Then I have to solder male pins to my device’s ICSP pins. It’s a bit unnecessary and time-consuming, say if I need to program 100 devices (at least a couple extra hours to solder the pins). So I based on my original device design, moved the ICSP header to a different location, and placed a target ICSP header where the original device has ICSP header. I then kept the SD card, RTC, power supply, FTDI chip, and the MCU from the original design. The result is a device that can program other devices. I put it on standoffs. Since this device has the same screw hole locations, I can slide a newly-assembled device down the standoffs to make contact with the programmer. Then use nuts to hold the new device. I can then program it using serial port (fuses, hex code etc.) The programmer also has 2 push buttons. In the future, I will get rid of serial port and have the programmer standalone. If I press button 1, it will flash the target with one hex file that runs a series of tests. Then if all tests pass, I press the second button to flash the target with standard firmware and move on to the next board. I also have 4 LEDs (not yet soldered on) and a buzzer to show audio and visual indications of success and failure firmware flash. I also have a 8-dip switch row to further customize what I do with the target, such as program different standard firmware versions to the target for different variations of the device etc.
Here are some pictures:
Front side (left side has programmer’s own ICSP header, right side is 6 pogo sticks)
Back side (SD card, MCU, two buttons, RTC, power supply):
Programmer with a target board on top (angled top view):
Programmer with target board on top (side view). You can see the gold pogo sticks to the left of the right standoffs.
In the future, I will also write a more capable hex programmer with Nick’s code to do:
I’ll post some videos when I get a chance.