+1 vote
in hardware by (120 points)

In Meet Je Stad Amersfoort we are working on developing our own soil moisture sensor that measures soil capacity at different depths. See https://meetjestad.net/en/Soil_Moisture for more info. 

The measurement concept (by Andries Lohmeijer) uses a schmitt trigger to create an oscillating signal, of which the requency depends on the capacity at the schmitt trigger input and the resistance between input and output.

 

Currently we use the following schematic / PCB to perform the measurement. https://github.com/meetjestad/mjs_soil_moisture/tree/master/PCB

We use 1 schmitt trigger (U2) channel connected to a base capacitor (C4: 47pF) and use two multiplexers that add a reference capacitor (C3: 39pF) or soil electrode in parallel. Two multiplexers (U4,U5) are used to switch both the GND and V+, to ensure electrode pairs on the sensor are floating and do not crosstalk (add additional capacitance in the vertical plane). The signal from the schmitt trigger is connected to an ATTINY84 external interrupt pin that counts the number of pulses within a set amount of time. Another multiplexer is connected to ATTINY analog pin A5 to measure the voltage over NTCs that are placed next to the electrodes in the sensor to allow for temperature corrections. The data is transferred to the MJS node using I2C. 

The current setup has some issues: see for example https://meetjestad.net/en/Soil_Moisture_Data_Analysis 

Can we make further improvements to the PCB to make the signal more stable? 
Or any other improvements we can make for a second version?

Improvements that we would like to incorporate at this point:
- Wider footprint for reference capacitor (C3)
- Use a high precision capacitor for C4 as well, or even identical to C3. 
- Connect Vout from the 2.5V LDO to a ATTINY84 analog pin to be able to check for effects of supply voltage on capacity/NTC measurements. 

5 Answers

0 votes
by

Hi Paul,

I am very reluctant with allowing I2C using beyond "On Board" connections. Because you use a local controller it is relatively simple to implement a more robust "Phy" to communicate to the CPU of the meetjestad node. If the current consumption of your circuit is very low (order of milliamps) than I think it is possible to feed and communicate robust over two wires. You can feed the circuit from a 2.5V LDO, store some energy in an Elco and modulate the data  serially ( 9600 baud ?) over the supply. That is the same principle used by smart thermostats to communicate to the central heater.

We can keep it simple because you can simply transmit all data with a preamble to the node. One way communication is enough. A soft serial receiver can be added to all most IO pins. Hardware serial is also possible.

On the meetjestad node we can make a simple circuit that:

  • Switches the power to the probe on and off ( powersaving )
  • Protects the node from external disturbance ( ESD, RF interference etc. )
  • Makes the data communication more robust
  • This method can also be used for other low power consuming sensor topologies

by (120 points)
Just an idea. On the current PCB I made an 'analog' output, with 3 pins:
- F_OUT = the Oscillating signal from the Schmitt trigger
- GND
- V
Could we perhaps use this already to create a similar setup but then with 3 wires? Sensor is switched on and ATTINY pulls F_out low for delay(x) sends first level, delay(y), etc.. I'm asking because we might even implement it with the existing sensors in that case. Or is the oscillating signal on a long wire going to cause similar (noise) problems for the node?
0 votes
by
- For the oscillator I would either use 2 or 1 calibrated capacitors, but not a mix like is done now
- Could the mjs board be placed inside the soil moist sensor ?
- 74HC14 is not calibrated as oscillator, maybe a dedicated oscillator IC could be used
- maybe separate oscillators could be placed at 10,40,80,120 cm depth, each with a calibrated C and R. Each in turn would then be enabled and its frequency measured
- I believe that from the mjs board, the soil moisture sensor should be supplied from 3.3V and SW_GROUND (like the GPS). I didn't see a wiring diagram for that, but I believe that is already done so.
- preferably do not use connectors to connect the soil moisture sensor to the mjs board, but soldered connections instead
by (120 points)
Do uncalibrated oscillators tend to drift? We can correct the output with the data from the reference capacitor + circuit (k-value), but if there is drift over time that would be quite problematic.

Now the sensor GND is connected to SW_GND indeed.

We could explore making individual nodes. A question would then be which parts need to be completely free of moisture / vapour and which parts need to be accessed for maintenance (like batteries, USB port etc). We would save some trouble with cables and a separate micro controller, but maybe at the expense of connectivity.?
0 votes
by (0 points)
Probably a more accurate reference capacitor might help to improve the system. Is it an option to go for a more sophisticated IC? The https://www.ti.com/product/FDC1004 is quite complex, but takes care of some issues of the simple circuit. It has been tailored for this capacitance range and can be used as shown in some ti application notes.
by
edited
I totally agree.
It has a multiplexer and an I2C interface; it can replace 4 ICs used currently.
by (120 points)
Very nice pre-made sollution. I will order one so we can test with it!
by (0 points)
Maybe I have an evaluation board somewhere at the office. Might that be helpful for a first glance?
by
Yes that would be great atually
by
Can I bring it? And where should I go ? :)
0 votes
by
edited
About the electronic circuit:
The frequency of the oscillator in NC status is 12.5 kHz <-> (9.7 + 47) pF.
1 frequency measurement takes 10 s, so e.g. 125000 periods are counted in 1 measurement. A full 6-sensor measurement cycle takes 60 s.
I believe this measurement period can be shorted to e.g. 0.1 s each, still allowing for 0.08 % quantisation error at 12.5 kHz.
This will save battery current.
by
Yes currently it is very much on the safe side. But it would be great if you want to explore the error in relation to measurement time.

The code for the ATTINY84 makes it counts pulses within of a fixed 10.000 us interval
It takes 50 of these measurements and computes the average and this is what is send to the master.

There is also a 100.000 us switching delay, to allow the multiplexers to be set correctly
Hence 100.000+50x10.000 = 510.000 = 0.51 seconds + time needed to run the sketch (calculate and send over I2C)

So the 10 seconds allowed by the master can probably be reduced already quite a lot with this setup, but it is also interesting to see what the error does when changing the ATTINY settings. Perhaps we can already do something smarter than averaging to limit the error? median?

Here is a tutorial to program the ATTINY: https://www.instructables.com/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/

Basically it requires:
1. Connect the V, GND, C (SCK), D (MOSI), MI (MISO) and R(RESET) pins on the PCB to those of an an arduino uno / nano etc.
2. Program the Arduino uno / nano with the sketch Examples -> Arduino as ISP
3. Get the ATTINY board files and set the board to
ATTINY24/44/84,
processor ATiny84
 clock: Internal 8Mhz
4. Select programmer "Arduino as ISP"
5. For the uno you need to put at 10uF capacitor between reset and gnd, for nano I can do without.
6. Opload the ATTINY84_slave sketch from https://github.com/meetjestad/mjs_soil_moisture/tree/master/Firmware/Attiny84_slave
0 votes
by
edited

Resolution for temperature is now 1/4 degree C and I find that too rude.
E.g. this graph (https://meetjestad.net/static/graphs/bodem/plt/mjs_bodem_0756_t_04d.png):

In general, meetjestad is using 1/16 degree C.

Welcome to Meetjestad Q&A, where you can ask questions and receive answers from other members of the community.
...