To measure electrical resistance of plant tissue such as a leaf. Wemos XI/TTGO XI for very cheap board. Other boards likely to work fine. Linux and good bootloader and hardware serial. Avoiding STM32F103C8T6 due to bootloader issues in Linux with common USB-serial adapters, avoiding ATTINY85 due to no hardware serial. I recommend you add an ADS1…
Clone or download
Many changes have been made as of this date to accommodate future scalability.
BUT auto-adjust during run-time does not work yet except to initialize operation.
Also have lost indenting after possible wayward keystrokes.
   Changelog:  30 April 2018 :  Final inboard 10 bit operation and ADS1X15 operation has been achieved.  Future work on free version will be for 12 bit boards only
               04 May   2018 :  Some 12 bit tweaking so that TTGO/WeMos XI, SAM and SAMD architectures compile with inboard analog inputs to computed at 12 bit even though ANALOG_INPUT_BITS_OF_BOARD is set at default.
               18 May   2018 :  Anti-aliasing code
               29 May   2018 :  Differential use of ADS1x15 to allow LM334 temperature comp to negative inputs so LM334 can be used on positive inputs
               32 May   2018 :  Added skeleton preprocessor defines for user to compatibly code their own support for a few 24-bit ADCs
               05 June  2018 :  HX711 accommodated, you'll just have to balance the bridge manually
               08 June  2018 :  Bugfix for inboard analog inputs above the first one - they didn't print before this fix
               17 June  2018 :  Corrected pointer reinitialize of analogPinArray that disabled internal Analog Input pins.  Added "while( !Serial );" for Leonardo's native USB; starting to add framework for programmable potentiometers, changed defines to allow for a separate full-scale, lower res ADC and a high res ADC for normal viewing, etc,
               18 June  2018 :  Bug fixes relative to displaying multiple traces while one or more are from inboard analog pins
               13 July  2018 :  Modified plotter timing trace to notch horizontally at range min and max for signal traces when it crosses up and down.  Incorporated digi pot adjustings in debug mode. Enabled bypass of digi pot set in setup()
               14 July  2018 :  Improved horizontal timing trace notching - made it shorter and consistent between levels
               15 July  2018 :  Allow unique digipot initializing settingValue for each pot.  Discovered HX711 input Z is way too low for use without buffers.  Regrouping....
               16 July  2018 :  Removed disparaging comments toward TTGO XI/Wemo XI because we will make the plunge to employ the AD8244 buffer as standard, resulting in those boards being eligible as any other board
               20 July  2018 :  Improved plotting with INBOARDINPARALLELWITHHIGHESTSENSI and improved 24-bit plot values
               26 July  2018 :  Corrected conversion from twos complement differential readings to proper single ended plotting
               27 July  2018 :  Discovered HX711's common-mode level sweet spot for max sensitivity, made COMMON_MODE_LEVEL_FOR_MAX_GAIN_AS_READ_RAW_BY_INBOARD_ANALOG with default of half-scale
               28 July  2018 :  If using digipots with LM334s, sketch can now auto-balance during setup and target the most sensitive common-mode voltage of a selected outboard ADC...LATER REVISIONS BROKE AUTO_BRIDGE_BALANCING
               29 July  2018 :  With INBOARDINPARALLELWITHHIGHESTSENSI && AUTO_BRIDGE_BALANCING defined, plotspace now excludes the two inboard Analog Input traces, making maximum linespace available for the other more interesting traces
               30 July  2018 :  Now able continuously to run-time auto-balance at least with a single HX711 LATER REVISIONS BROKE AUTO_BRIDGE_BALANCING
               31 July  2018 :  I've noticed one sketch bug in the printing of the magnified traces in that they don't stay within bounds any more. Older sketch versions never had that problem. I'm not sure where it began, but it seems to be a memory management problem from my inital troubleshooting rather than any type of algorithm weakness. I'll work on that when I'm able...
               01 Aug   2018 :  Working on vertical positioning of the magnified traces
               23 Aug   2018 :  Fixed magnified traces in all respects; added functionality to display digipot calibration effects during calibration in setup(); started adding code to handle multiple digipot stacks that utilize dual 74VHC138/74LV138s.  Still no AUTO_BRIDGE_BALANCING
               23 Aug   2018 :  Magnification factor adjustable downward via a potentiometer if defined POT_WIPER_TO_THIS_ANALOG_INPUT_PIN_TO_ADJUST_MAGNIFICATION_FACTOR with the digital number of an inboard analog input pin.
               23 Aug   2018 :  added USING_DUAL_74LV138_DECODERS_FOR_DPOT_CS_LINES with possibly enough code (just needs testing). Allowed for any ratio of LSB pot step to MSB step with DPOT_RATIO
               11 Sep   2018 :  Back with new style of arrays useage to make bug-free coding more possible.
               20 Sep   2018 :  Auto adjust works, but only non-predictively so it is slow.  Added macro CONTINUE_PLOTTING_DURING_AUTO_BRIDGE_BALANCE thinking someone may not want display to pause during auto balance, but that is even painfully slower still.
               20 Sep   2018 :  Alpha chars added into output for future expansion beyond Arduino
               18 Oct   2018 :  Now allows dual digi pot devices: MCP42xxx by manipulating the DPotPin of the first DPot of pkg OR'ing it with 0x40 as the pin of the second DPot in the pkg
               16 Nov   2018 :  Scaleability changes.  DO NOT USE PREDATED VERSIONS TO ADVANCE DEVELOPMENT!!!!!!!  Many changes have been made as of this date to accommodate future scaleability
               NEXT          :  Predictive DPot setting by tracking +/- Inboard and Outboard  ADC bits per +LSB bit
               NEXT          :  Allow DigiPots without LM334: the direction of effect will be opposite.  New macro:
               NEXT          :  EEPROM storage of things like ADC sweet spot, initial digipot settings, etc.  Hardware configs like DPot types & ADC types & other upgradeable hardware version possiblities needs to be able to be set in the hat board rather than EEPROM
               NEXT          :  Accommodate ADS1232 &/or ADS1231
               NEXT          :  Detect hat config and version with 256 versions detection and warning to acquire more recent sketch version when versions > known are found

  TODO:  Arrange for run-time keyboard input to eliminate need to re-compile when changes are made or plotting adjustments are desired.  Will require non-Arduino IDE plotter
         Use dual digital potentiometers (MCP42XXX) for more lower parts count than when using single pot MCP41XXX
         Accommodate more 24-bit amps like ADS1231

   These planned enhancements will be reserved for NOT-FOR-FREE sketch versions in the future

  Should you examine the sketch code you will or may notice it is in a state of transition.  Variable names and useages may be inconsistent and so forth.  That is
  because I am upgrading it with longer-term goals in mind while at the same time adding intermediate features that are easily and quickly coded.

  Planned longer-term upgrades are as follows:
  - Am currently coding for use of less than 3 and more than 3 DPots/leg
  - Am currently coding for using DPots alone, without LM334, in the bridges
  - Am currently coding for using unbridged DPots, single leg only
  - Am currently coding for faster conductance range changes when DUT conductance goes out of range
  - Not coding for other ADC types yet, but will eventually first code for multiple HX711

  These goals necessitate many smaller changes that make an uninformed observer wonder why this or that is so convoluted.  The answer in many cases is
  that I've learned not to make so many changes at a time that the sketch can acquire failures/bugs in more than one or two places because troubleshooting
  would become harder by orders of magnitude.  So the many small modifications to support the longer term goals are being added incrementally without
  breaking the sketch along the way.  Thank you for your tolerance.

  Names are created according to the following conventions:

    variableNames (eachWordCapitalizedExceptFirst, words joined without delineators)
    OBJECTNAMES (ALLWORDSINALLCAPS, words joined without delineators)
    struct_names (no_capital_letters, words joined with delineators)
    GotoLabels(EachWordCapitalized, words joined without delineators)
Latest commit 0dfd5e6 Nov 16, 2018

GWAAM-Sea TPI (Greater Works Agronomy and Mountain Casting To Provoke Israel) Training Aid(TM)

    Alternate title: Telempathic Gardening Traing Aid
    Alternate title: Husbandry of the Fig Tree and John 14:12 Training Aid
    Alternate title: John 14:12 Agronomy - Promoting A Reviving Civility Training Aid

Click here to see what this title means

plans and Arduino sketch for the training aid

So why in the world would you want to observe a plant's electrical conductivity? Here's the fascinating story:

In the 1960's, a polygraph expert named Cleve Backster, perhaps in a moment of feeling impulsively experimental, attached polygraph electrodes to a plant in his office to see what polygraph results would come from watering the plant. Note that polygraph electrodes are used to measure electrical conductance of what they are attached to. Note also that electrical conductance is mathematically inversely related to electrical resistance, so resistance and conductance are two ways of referring to the exact same electrical property, which is examined by quantifying a resultant electrical current that an applied voltage produces. This is in stark contrast to using electrodes to measure or determine if a voltage (signal) [is] produced by a something-under-test or device-under-test ("DUT"; the plant, in this case), which would require voltmeter or EEG instrumentation. This project works according to polygraph and GSR (Galvanic Skin Response) principles.

Mr. Backster hooks up his electrodes to his plant and then experiments farther, going so far as eventually to wonder how the plant might respond to getting burnt from a match. He then notices that the polygraph machine indicated that the electrical conductance of his office plant deviated in response to his mere intention of harming the plant. You read that correctly. The plant seemed to be aware of Mr. Backster's very intentions to do something to the plant that would substantively affect its well-being, because it responded BEFORE Backster's intended action was ever performed. Mr. Backster pursued the experiment to see if the results consistently indicated the plant was aware of those intentions, and they very much were! At the time, there was no known scientific basis for such a phenomenon as plant awareness to ANY extent, much less to the extent of being super-humanly aware of a person's very thoughts as Mr. Backster observed. Today, quantum physics may offer a scientific explanation for what is happening...and then again, it may not.

Fast-forward to 2006 when Mythbusters television program decided they would investigate the validity of Mr. Backster's observations (Title: Deadly Straw; Season number: 4; Episode number: 22; Air date: September 6, 2006). When Mythbusters used a polygraph machine as Mr. Backster had, their results confirmed the phenomenon, albeit against their will and against their willingness to document its existence. So in order to find a halfway-plausible excuse to keep Episode 22 from disrupting their entertainment-business-as-usual, they switched from using a polygraph machine to using an EEG machine, which measures voltage signals produced by neuron bundles instead of measuring the property of resistance.

To understand how Mythbusters erred in their experiment, you need to realize that measuring a property of something requires the person performing the measurement to produce their own signal and measure the results from applying that signal to the device-under-test. That is what a polygraph machine does. An EEG machine, on the other hand, produces no signal of its own - it measures a device-produced signal and is specifically designed to measure the specific type of signal that is produced by a central nervous system neuron bundle that is not found in plants but found in higher organisms. Plants have no neurons, silly Mythbusters - they don't produce voltage signals that an EEG machine can detect. Mythbusters ignored their observations obtained from the polygraph machine but thankfully did broadcast the recorded video of their efforts while presenting a deceptive narrative about the positive results so as to try to distract viewers from noticing that they had just proven the existance of "primary perception", as Mr. Backster thought to call his newly-discovered phenomenon.


I am forced by the reality of all the development complexities to strongly suggest that until this sketch has been bug-free at the latest revision level for at least three to four weeks after I claim it to be bug-free, all potential users just hold off unless you are prepared to fix my sketch bugs. Sorry for not being perfect.

In the sketch source code of this project, you'll find some self-explanatorily-named constants near the top that you'll need to set for your preferences and configuration. Find and adjust these:

  • HIGHEST_SENSI_ADDON_ADC_TYPE (at this time only HX711 is supported)
  • look for others in the same source code vicinity (i.e., near the very top of the sketch) that get added as I enhance the code over time

The specific purpose of this project is to monitor electrical conductance changes of plant tissue, such as a leaf, in vivo. Tested with Uno, Leonardo, and Wemos XI/TTGO XI. The TTGO/WeMos board will require either an ADS device or a unity gain buffer (AD8244) to use the TTGO's ADC. Mac and Windows are assumed to work as well as Linux. Avoiding STM32F103C8T6 due to bootloader issues in Linux with common USB-serial adapters, avoiding ATTINY85 due to no hardware serial. Other boards having at least one analog input can be used, or add the very inexpensive ADS1115 or HX711 for best resolution. IMPORTANT: When selecting a board you'll use for this project, make sure it has a USB port or that you are otherwise able to fashion serial communications. The output from the Arduino is formatted for input into the Arduino IDE serial plotter rather than the serial monitor. Also, I am well aware of the possibility that the electrical property being monitored may not precisely be conductance but rather the appearance of conductance due to something akin to dynamic polarization, electrically speaking, of plant tissues. This could be a vitally important factor to consider in electrode "placement-ology", if you will.

With the rudimentary (periodic improvements are to be expected to this project) sketch I publish here for you, you can observe for yourself that plants actually can know your sentiments as they relate to the plant's well-being. You'll also need to fashion the electrode system and attach it. I suggest you not get so wrapped up in being scientifically credible that you miss the point of all this. The point is that the electrical conductance of a plant does respond to someone's intent to substantively affect its well-being. The point is NOT that any particular readings can be precisely replicated. With that caveat and because of it, I suggest a very primitive electrode system that does not involve the salinated agar-on-cotton gauze-on-stainless steel system that Mr. Backster thought he had to use for scientific credibility. Until I am satisfied with successful proof-of-concept of this project, I am suggesting using the more bio-compatible elements of mud inside a coarse-knit pouch made of non-dyed, non-bleached plant-derived fabric like burlap, linen, cotton, and/or hemp. I suggest for each pouch/electrode used that you fashion a sling to bear the weight of the pouch using a matching strip of fabric. What bothers me about stainless electrodes is that metals produce galvanic voltage from their very contact with dissimilar materials. I suspect a galvanic potential could also be generated by contact with some other element of this apparatus also. The significant chromium content of stainless is another concern I have.

Poke the electrode wires into the pouches (or maybe one into a pouch and one into the soil?), but keep the metal of the wires from direct contact with any plant tissue, since metals are foreign to living organism tissues and so may produce an unaccounted for reaction. To ensure an acceptable quality contact between the mud and electrode wires, I attach electric motor brushes (made from near biologically inert and oxidatively stable graphite) to the ends of the electrode wires and insert the the brush into the pouch. I prefer using mud instead of salt as an electrolyte for my confidence achieving maximum biocompatibility. Ensure the mud is adequately liquified and the brush is fully inserted into the mud and the muddied pouch is in intimate and stable contact with the leaf or other plant tissue. You also may want to learn the difference between hypostomatous and hyperstomatous leaves relative to the plant you use if you care to avoid blocking the gas-exchange stomata. Blocking the stoma with the electrode apparatus may generate yet another source of stress for the plant, thus I recommend stoma-blocking be minimized in terms of time and surface area. Nearby flourescent lighting and other high-harmonic and/or heavy electric loads may produce unwanted artifacting, so they are best kept away from.

You'll have to rig some sort of pouch-holding device of your own design. Maybe a large non-conductive (plastic/wooden) easel could be used to support the fabric sling. Unless your plant has large leaves, you may find it difficult to place opposite electrodes on a single leaf without one pouch shorting across to the opposing pouch, so I suggest trying to put each electrode-pouch on its own leaf. The weight of the mud-filled pouch on the top side of the leaf will be enough force to maintain a solid electrical contact. This configuration is for hypostomatous, the most common type leaves you'll be using.

Note that you'll be best served by understanding the electrical circuit being formed by your electrode placements. As long as you do so, multiple electrodes of each polarity might be of benefit, but I really think you're better off avoiding any circuit more complex than you understand.

Note that the electrode circuit must also consist of a resistive component attached by you between the power supply rail and the analog input pin of the signal electrode. That resistor is located locally to the board so does not require a third length of wire. The electrode wire not going to the analog input pin goes to signal ground and will be referred to as the reference electrode. All mention of LM334 in this project refers to replacing that resistor with an LM334 and a few support components. Signal ground is determined by you as a ground pin of the active device that contains the ADC, preferably a pin provided for the precise purpose of being signal ground. For best practice, avoid attaching the reference electrode to any point on circuit board ground that connects to a component other than the ADC device before connecting to the ADC. Ideally, the value of resistance of the above mentioned resistive component will be as equal as practical to the resistance of the plant tissue under test. The resistance of the plant tissue between the electrodes can be decreased or increased by adjustment of the surface area in contact with the electrode pouches - more contact area gives less resistance as well as a better signal-to-noise ratio but also probably produces greater undesirable measurement effect. At this stage, end-users are on their own to learn about how to avoid electrical current leakage paths. As far as avoiding radiated electrical noise, maintain adequate distance from fluorescent and neon lighting and any other source of noise you discover, understanding that your computer and cell phone are definite noise sources.

For those who have to ask the cost of the electronics parts (I happen to be in that category myself) you will be interested to know that I bought the TTGO XI (WeMos XI) for about $1.65 US (free shipping) and the ADS1115 for about $1.73 US (free shipping). I realize you have to do some soldering or spring loading the contacts that way, but it saved me over $15 US not having to buy an Arduino Due to obtain better resolution than 10 bits. The added benefit is that I now have 16 bit resolution...well, 15 bit in reality, because of the difference between advertised resolution for balanced/double-ended configurations vs. real resolution of single-ended configurations. The HX711 can be found for $0.75 US (free shipping). Note that I bought the parts through AliExpress and had to wait 30 days of shipping b/c I was not willing to pay extra for expedited shipping. Don't forget the USB cable, interconnect wires, and perfboard/breadboard you'll need. Note that the inboard 12-bit ADC integrated in the TTGO XI/WeMos XI is worthless unless you want to accept the hassle of designing and constructing your own analog buffering (perhaps with an LM328-based circuit). This is b/c that board's analog inputs inexplicitely pathetically contain engineered-in unremoveable pull-up conductance.

Note: According to Mr. Backster, the plant under test must have already become "acclimated" to the person performing the primary perception procedures for the phenomenon to be observable. Take that to mean what you will. I believe it means you'll need to spend some time initially watering the plant or otherwise caring for it before you can expect significant results from this project. Until I'm shown wrong, I'm fairly certain that hostile or hurtful sentiments toward the plant are counter-productive to sustained acclimation, Mythbusters! If you can video record your success with this phenomenon, I will be very interested in including your resultant YouTube video in my playlist here: Note that I am quite UNinterested in videos that express negative sentiments, so I may not link to them. Instead of exercising your negative power over plants, please try to show us results from POSITIVE sentiments...and thank you for that!

You may be interested to read some of the Biblical justification for this project. See the document entitled on that subject listed among the documents of this project.

For those who have any regard to NDEs, you would be interested to research Howard Storm's NDE relative to world lifestyle of the future.

Submit an "Issue" or post in the "Wiki" (tabs above) to have me add your Youtube video to the official playlist for this project.

As of 30 April 2018, this sketch is functional, only requiring low-noise construction techniques of the connections and circuitry. However, until further notice, THIS .INO FILE IS UPDATED OFTEN FOR IMPROVEMENTS AND BUGFIXES.

If you are using the ADS1015 or ADS1115, using a AD8244 is recommended and be sure to install the supporting library Adafruit_ADS1015 since this sketch depends on it. Thank you, Adafruit! If you're using the HX711, using a AD8244 is required and install the .cpp and .h files located here: (thank you to bogde) Consideration is being given to adapting a fork of this project to the Raspberry Pi-ish ARM single board computers. This sketch version is FREE so that anyone can enjoy it. For those of you who can afford to support my work on this project, I will offer a "not-free" sketch version when the parts arrive that has the following enhancements:

  • Arrange for adjustments of various kinds during run time based on keyboard inputs. The current plotter included with the Arduino IDE does not accommodate this, so this feature will have to be coded with a different language and run by software other than the IDE.
  • Use an LM334 or two to prevent power supply noise from plotting (i.e., convert from monitoring resistance to monitoring conductance, which means that power supply noise is eliminated!). A toroid-based noise suppression coil in series with the LM334 might be needed as one of the supporting components. Since the part includes a temperature coefficient, a second one is also needed for offset for stable balance with temperature drift.
  • Use digital potentiometer (MCP41XX2 or MCP42XX2) for more automated balancing of the two serial resistances.

Add-on ADCs, especially the more affordable ones, tend to have inputs that are of such low-impedance that they don't work unbuffered in this project where the plant is high impedance (high resistance). That problem might be able to be partially overcome by increasing the leaf surface contact area of the electrodes, but the more reliable and proper way is to buffer the electrodes with an AD8244 when using an outboard ADC (or when using the inboard Analog Inputs if using the TTGO XI/Wemos XI board). Two challenges with that are the added cost would justify using a more espensive, high input impedance ADC. I don't know which one[s] would so work because input impedance is not usually specified in ADC datasheets. The other challenge is the extremely tiny package (MSOP) of the AD8244, not to mention the additional failure risks whenever the complexity and parts count of any electronics device is increased. With the tiny package, the part is very difficult solder and even just keep track of in a hand-constructed is too easily dropped and not easily found afterward. The 'M' in MSOP could just as well mean "microscopic". That said, in the interest of simply moving forward with the project, I'm using the AD8244 in my own development environment, benefiting from the flexibility I gain from using that part to drive whatever ADC I want to develop for. My most recent source buying the AD8244.