Procedure to produce small batches of devices

Over the past years, I’ve designed and built devices in small batches such as 10-25 units at a time. I’ve gained some experience doing such small builds. The following is a procedure for building a small batch SDI-12 + Analog USB devices.

The device has a USB serial converter IC FT232RL, an MCU ATMEGA328P (same as Arduino Uno’s MCU), an ADS1115 16-bit analog-to-digital converter, precision resistors, fuse, screw terminal blocks, jumpers etc.

I build the device first by reflow soldering the surface components, and then hand solder the thru-hole components once I’m done confirming the reflow soldered components are working. You’ll see why these devices can’t be sold at $4 a piece, not just because the components cost more from legitimate vendors such as digikey, Mouser, Newark, etc. Most of the steps can’t be completed by someone without proper training of what the device does.

Here it goes. Any recommendation? Post a response!

Manufacturing and inspection procedure

Date: 2016-11-23

1.    Preparation and printing solder paste:

  1. Remove solder paste from refrigerator and set it in room temperature for one hour.
  2. Clean board with alcohol and lint-free wipe.
  3. Visually inspect board for defects and reject boards with visual defects.
  4. Align board with stencil.
  5. Print solder paste.
  6. Check registration especially for ADC, MCU and FTDI chips. Reprint in case registration is too far off.
  7. Wash and dry stencil.
  8. Return solder paste to refrigerator.

 

2.    Components placement:

  1. Place MCU. Check alignment with 3X loupe.
  2. Place FTDI chip. Check alignment with 3X or 10X loupe.
  3. Place ADC. Check alignment with 10X loupe.
  4. Place (5) 100nF caps.
  5. Place (1) 10uF cap.
  6. Place (2) 22pF caps.
  7. Place (1) fuse.
  8. Place (1) EMI bead.
  9. Place (3) 10K resistors.
  10. Place (1) 100K resistor.
  11. Place (4) 1K precision resistors.
  12. Place (4) 10K precision resistors.
  13. Place (1) crystal.
  14. Place (1) mini-USB connector.
  15. Check resistor values with loupe. Replace wrong resistors.

 

3.    Reflow soldering:

  1. Place boards on reflow over racks.
  2. Attach thermal couple to a plated hole on one board.
  3. Turn on temperature gauge.
  4. Connector reflow oven to power.
  5. Follow reflow specifics, make sure to time each step with stopwatches. STOP if expected temperature is not reached within expected time.
  6. Disconnect reflow over from power.
  7. Remove boards and cool them off.

 

4.    Visual inspection:

  1. Visually check for solder issues on chip resistors, caps and other components.
  2. Check for solder bridges on ICs with a 10X loupe.
  3. Check USB connector for bridges.

Found any issues?

  • Y: fix with flux paste, solder braid, and iron
  • N: proceed

 

5.    Flash firmware:

  1. Connector programmer to PC.
  2. Place board on pogo pins.

Programmer detected board?

  • Y: flash firmware

MCU detected after flash?

  • Y: proceed
  • N: check soldering near XTAL pins
  • N: inspect MCU for solder issues and other issues (IC in wrong orientation etc.). Add flux paste and reflow pins.

 

6.    USB connection and initial ADC check:

  1. Connect board to PC.

USB port detected?

  • Y: proceed

Device responding to ID command?

  • Y: proceed
  • N: check MCU and FTDI chip for solder issues

Device returning analog measurements?

  • Y: proceed
  • N: check ADC and MCU I2C pins for solder issues
  • N: inspect connector and FTDI chip for solder issues

 

7.    Check ADC and resistors:

  1. Solder headers and connectors.
  2. Connect different resisters to analog pins.
  3. Set HIGH jumpers on all channels.
  4. Read single-ended inputs.

Results are as expected?

Command ‘zI!’ should return ‘z13Liudr   SDITRD130\r\n’. Command ‘zM!’ should return ‘z0014\r\nz\r\n’. Then command ‘zD0!’ should return ‘z+0.xxxxx+0.xxxxx+0.xxxxx+0.xxxxx ‘ where x is arbitrary but the first x in each number is unlikely going to change if you poll again. Command ‘zM1!’ should return ‘z0012\r\nz\r\n’. Then command ‘zD0!’ should return ‘z+0.000xx+0.000xx ‘ where x is arbitrary and positive signs may be negative signs at times but both values should be very small with at least 3 zeros after decimal.

  • Y: proceed
  • N: check resistors and ADC for solder issue

 

  1. Set LOW jumpers on all channels.
  2. Read single-ended inputs.

Results are as expected?

  • Y: proceed
  • N: check resistors and ADC for solder issue

 

8.    Check SDI-12 bus:

  1. Connect SDI-12 sensor to one SDI-12 terminal.
  2. Poll SDI-12 sensor.

Does sensor return values?

Command ‘1M!’ should return ‘10012\r\n1\r\n’ Then command ‘1D0!’ should return ‘1+1.xx+2x.x’ where x is arbitrary but unlikely to change if you poll again. The second number is temperature so indoor reading should be above 20.0 C.

  • Y: Device passed QC test J
  • N: check MCU SDI-12 bus pin for solder issues

Teaser photo

What can this new board do?

2016-11-22-11-08-48

Guesses? Comments? Answer revealed after US Thanksgiving holiday (2016-11-24)!

(There is nothing on the back side)

Read analog sensors on SDI-12 USB + Analog adapter

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:

Command:’z!’

Response: ‘z\r\n’ This means that the adapter is responding to queries.

Command: ‘z!’

Response: ‘z13Liudr   SDITRD130\r\n’ This indicates that the firmware is in version 1.3.0.

Command: ‘zM!’

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.

Command: ‘zM1!’

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.

C0mmand: ‘zD0!’

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.

 

Update on the SDI-12 + Analog USB adapter

sdi-12-usb-analog

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)

 

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

Arduino Nano for battery-powered projects

Since Arduino Nano is very small in size and cheap, it might be a good choice for a battery-powered project.
Clones are abundant on ebay and other websites for around 4USD and mostly come with CH340 series USB/TTL adapter, instead of the original FT232.

To see how effective it is as a battery-powered platform, I made some measurements and would like to share my results.

First, to save power, you will need a boost converter (or DC-DC converter) instead of using siz AA batteries or 9V batteries on VIN pin. The on-board converter is a 1117-5.0 linear regulator that is not very efficient. I recommend something like this:

https://www.sparkfun.com/products/10968

You can also find some similar boost converters on ebay for less.

You can use two AA batteries to power the converter and get 5V output. Supply it to 5V on Nano. I measured currents on the battery side (@3V), not the 5V side, since I was trying to estimate battery life. I also measured currents on the USB side in case I use a power bank.

When Arduino is sleeping with POWER_DOWN sleep mode, the whole board consumes 15.5mA @3V from the battery. If you are using USB to power it (say you use a power bank), it consumes about 18.5mA. This is definitely not good enough for batteries. Even with a gigantic 20,000mAh power bank, the maximal time is 45 days. The efficiency of the boost converter and activities (other than sleeping) will reduce this to just a handful of days.

Next, the power indicator LED consumes a lot of current, if you want to use batteries, such as two AA batteries. You will need to remove the chip resistor next to it.

My clone has a 1kohm resistor in series with the LED. Once removed, the consumption went down from 15.5mA to 8.8mA (@3V). The resistor I removed was the 3rd one from the right side of the white reset button:


This is 50% saving, which is good and easy to do. You just hold your iron on the chip resistor until it is hot enough to remove it. Having a pair of tweezers helps a lot. Your project may now last weeks on two AA batteries.

After this, you will have to remove the 1117-5.0 regulator to get more power saving. This step is difficult. I used a hot air rework station to carefully heat up the regulator and removed it with only a little damage on the male headers’ plastics. If you don’t plan on putting the regulator back, get a small flush wire cutter and just cut out the regulator at the pins. This should do:

https://www.sparkfun.com/products/11952

The wide tab might be difficult to cut but once you cut the three small pins, you can just hold your iron on the wide tab and remove it.

Once removed with the Arduino put to sleep, only 0.74mA of current is consumed at 3V on the battery. This will project into months of operation, if you are logging data at moderate rate.

So if some of you thinks this is not really what a “pico” processor promises, then I am sorry to tell you that the Nano just wasn’t designed for battery operation. The CH340 consumes a certain amount of power even when sleeping. About 0.15mA at 5V so it could translate to 0.25mA at 3V. Its pull-up and pull-down resistors also cost similar amount of current draw. There is no way to remove the CH340 chip and still use the USB port. Using an arduino mini will solve this problem since it has no USB chip.

On a data logger I designed around ATMEGA1284P, I used FT232 but it will not receive power from the battery. The power consumption is about 0.4mA when sleeping. Not as low as it can go but good enough for 6 months.

So the conclusion is to at least remove the LED’s resistor if not 1117-5.0 regulator as well. If you want to use AA batteries etc. get a boost converter.

Then, if you have other devices, such as sd card, rtc, sensors, you need to power them with a transistor so you can but their powers when arduino goes to sleep.

Hope this helps. I’ll write about parasitic power and how you eliminate it another day.

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.

 

%d bloggers like this: