My first Plantoid project...  Mechaphytum Animus... 

 

I am a man of hobbies... I have been working many years on robotics, electronics, astronomy and photography as well as gardening and especially bonsais... From time to time I implemented projects that combine gardening and robotics such as automated irrigation of plants with Arduinos( http://www.instructables.com/id/Intelligent-watering-system-with-arduino/  ) and some automated greenhouse heating ...Can also be found at my page at Instructables site... This will be my first attempt for testing my robotic skills on Plantoids... 

As a robotics fan and botanical hobbyist I decided to work on Plantoids... the wonderful work of David Ultis and Greg Perry of  MyRobotLab.org  inspired me to work on this project... As a start, I made a datalogging setup for monitoring one of my plants, a Hoya Carnosa ( randomly selected among my hundreds of plants just for her closeness to my working environment)... the data is collected with many sensors, mainly environmental and plant signalling... I made a simple resistive sensor sticking EKG electrodes to both sides of a leaf and reading with Arduino. I had a soil humidity sensor and connected that to the pot too. A temp sensor reads the environmental temperature ( had all kinds of temp sensors but selected DS18B20 because it is digital, accurate and easy to use)... I have a RTC module, air humidity sensors and BMP85 barometric sensor too but will add them later... As a broke hobbyist I made a diy datalogger from one of my micro-sd card readers lying around. the setup can be seen from the below pic... while carrying out this datalogging I learned much about how the plant reacts to her environment... 

   Leaf electrode   datalogger on Arduino UNO    

Greg just reminded me of the ThingsSpeak service of  MRL and will be integrating that to my project soon... so anyone interested can monitor my plant's health remotely... Just in case anyone may be interested the software side, i am attaching here my datalogging Arduino sketch for reference...

/*Read DS18B20 Temp sensor for plant signal datalogging
* Dincer Hepguler 2013
* http://borsaci06.com
* DS18B20 code from: sheepdogguides.com/arduino/ar3ne1tt.htm
* Code lightly adapted from code from nuelectronics.com
*/
 
#include <SD.h>
// Pin definitions - attaches a variable to a pin.
// On the Ethernet Shield, CS is pin 4. Note that even if it's not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
const int chipSelect = 10;
const int LeafSensor = A2; // A2 pin is used to read the value of the Leaf Sensor
int LeafState;
const int SoilSensor = A0; // A0 pin used to read val of soil sensor
int SoilState;
int NumReadings = 20; //number of readings per avarage 
//float Deg;
#define TEMP_PIN  3 //D3 pin for ds18b20 signal line
 
void OneWireReset(int Pin);
void OneWireOutByte(int Pin, byte d);
byte OneWireInByte(int Pin);
 
void setup() {
    digitalWrite(TEMP_PIN, LOW);
    pinMode(TEMP_PIN, INPUT);      // sets the digital pin as input (logic 1)
    pinMode(LeafSensor, INPUT); //defines A2 pin as input
    pinMode(10, OUTPUT); //make sure the chip select pin10 is set to output
Serial.begin(9600);
    while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  Serial.print("Initializing SD card...");
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
    delay(100);
    Serial.print("Leaf:   Soil:   Temp:\n");
}
 
void loop(){
  // make a string for assembling the data to log:
  String dataString = "";
  LeafState = analogRead(LeafSensor);  // reads LeafSensor and stores to LeafState variable
  LeafState = map(LeafState, 0,1023,0,255);
  dataString += String(LeafState);
  dataString += "\t";
  SoilState = ReadSensorAvg();
  SoilState = map(SoilState, 0,1023,0,255);
  dataString += String(SoilState);
  dataString += "\t";
  
  int HighByte, LowByte, TReading, SignBit, Tc_100, Whole, Fract;
  
  OneWireReset(TEMP_PIN);
  OneWireOutByte(TEMP_PIN, 0xcc);
  OneWireOutByte(TEMP_PIN, 0x44); // perform temperature conversion, strong pullup for one sec
 
  OneWireReset(TEMP_PIN);
  OneWireOutByte(TEMP_PIN, 0xcc);
  OneWireOutByte(TEMP_PIN, 0xbe);
 
  LowByte = OneWireInByte(TEMP_PIN);
  HighByte = OneWireInByte(TEMP_PIN);
  TReading = (HighByte << 8) + LowByte;
  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25
 
  Whole = Tc_100 / 100;  // separate off the whole and fractional portions
  Fract = Tc_100 % 100;
  //float Deg = Tc_100 * 0.01;
  dataString += String(Whole);
  dataString += ",";
  dataString += String(Fract);
  if (SignBit) // If its negative
  {
     Serial.print("-");
  }
  //LeafState = analogRead(LeafSensor);  // reads LeafSensor and stores to LeafState variable
  //delay(1);
  
  //Serial.print(Whole);
  //Serial.print(".");
  //if (Fract < 10)
  //{
  //   Serial.print("0");
  //}
  //Serial.print("Temp:");
  //Serial.print(Fract);
  //Serial.print("\t");
  //Serial.print(Deg);
  //Serial.print("\t");
  //Serial.print("LeafState:");
  //Serial.print(LeafState);
  //Serial.print("\n");
  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("datalog.txt", FILE_WRITE);
 
  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:
    Serial.println(dataString);
  }  
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  } 
  delay(1000);      // 5 second datalog delay.  Adjust as necessary
}
 
void OneWireReset(int Pin) // reset.  Should improve to act as a presence pulse
{
     digitalWrite(Pin, LOW);
     pinMode(Pin, OUTPUT); // bring low for 500 us
     delayMicroseconds(500);
     pinMode(Pin, INPUT);
     delayMicroseconds(500);
}
 
void OneWireOutByte(int Pin, byte d) // output byte d (least sig bit first).
{
   byte n;
 
   for(n=8; n!=0; n--)
   {
      if ((d & 0x01) == 1)  // test least sig bit
      {
         digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(5);
         pinMode(Pin, INPUT);
         delayMicroseconds(60);
      }
      else
      {
         digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(60);
         pinMode(Pin, INPUT);
      }
 
      d=d>>1; // now the next bit is in the least sig bit position.
   }
 
}
 
byte OneWireInByte(int Pin) // read byte, least sig byte first
{
    byte d, n, b;
 
    for (n=0; n<8; n++)
    {
        digitalWrite(Pin, LOW);
        pinMode(Pin, OUTPUT);
        delayMicroseconds(5);
        pinMode(Pin, INPUT);
        delayMicroseconds(5);
        b = digitalRead(Pin);
        delayMicroseconds(50);
        d = (d >> 1) | (b<<7); // shift d to right and insert b in most sig bit position
    }
    return(d);
}
int ReadSensorAvg(){   //subroutine for reading sensor n times and avarage
  int i=0;
  int SoilState=0;
  for (i=0; i < NumReadings; i++){
    SoilState = SoilState + analogRead(SoilSensor);  //read sensor n times 
  delay(10);         //delay between reads for more stability
  }
  SoilState = SoilState / NumReadings;            //avarage
  return SoilState;
}  
Update on 10.Dec.2013    Still datalogging....

datalogging  

Wanted to share with you part of tonight's datalogging results... its very cold outside here at minus degrees and its snowing outside. my Hoya is near the terrace door and a little cold surrounding... after few hrs of datalogging i saw that green led on soil sensor is lit, indicating that the soil is dry... so i watered the plant while datalogging and saw some changes in the log window.

then i tried to increase the surrounding temp blowing with a hot air hair dryer for a while. then stopped the torture on the plant and graphed the log file to post here... you can see the part of the log below with some explanations...

  Update on 13.Dec.2013: 

Still working on datalogging and better plant response tracking... Trying to create a good interface between the plant and the robot, i need a reliable and usable sensor setup between them... actually the datalogging process taught me a lot in the last few days but i have to improve sensor and data quality... As you can see from the below datalog session that the plant is giving realtime responses to environmental changes but the sensor data from the resistive sensor attached to the plant leaf is not reliable... the relative plant response can be read clearly but the data structure is not consistent enough to be used in a software... The sensor displays a different scale everytime its powered on, values decaying for a while to stabilize in the end...

So I decided to carry on with a new approach to improve data reliability... I know that plants are good conductives and receptors as living tissue... In order to read in-plant activity I made a different sensor reading in a new way... it is a simple antenna signal meter consisting of a small coil, a Germanium diode and a trimer, small enough to attach to the plant stem... So it now reads the signals more reliable via the same Arduino analog port... will display my results in the next few days...

Capacitive stem sensor 

Update on 20.Dec.2013 :

Sometimes the solutions come from simplest approaches... One night when making some tests on MRL and data sharing over the internet, Greg told me that a simple wire connected to an Arduino port is the simplest sensor... I just removed all the electronics from the plant and connected a simple wire to the stem with the wounded coil seen on the above photo and saw that sensor readings were good and stable, so I decided to use that as capacitive sensor... so now I have a capacitive sensor on the stem and a galvanic response resistive sensor on the leaf... I also changed the Dallas temp sensor with the DHT11 which I had on hand... so I am now reading both environmental temperature and humidity data flowing from the plant... I also disconnected the datalogger and reading directly to PC with a terminal program and plot on Excel on realtime...

The sensor values vary with environmental conditions such as temp, humidity and soil moisture, also light and human activity around the plant... The peaks on the graph show times when I approached the plant and touched her, closest the touch, higher the sensor value peaks... The amplitude of the plant signal also increases with stress and unfavorable conditions such as temp& moisture changes... The amplitude of the signal dampens with more stable conditions... A happy plant... 

Of course the interface Arduino script has also been changed...  New script also has a mood lamp which I made with a multi-legged rgb led which is showing the plant's health state with color... the color is changing by the sensor values, this way I can have an idea about the plant's state with a glance to the lamp color... Redder means plant is in distress and yellowish-green means a happy plant... This is especially convenient when plantoid is not on usb connection and not plotting data on PC...

Happy plant... DHT11

Update on 15.Jan.2014:

Previous legs turned out to be a little small to carry a big potted plantoid so I decided to use bigger legs... I found a different leg design on the web by Dominique Struder and tried to implement his design... I designed the parts in 3D and had them CNC cutted from 3mm laminated MDF... Design files in 3D and 2D DXF can be found here:

-- 3D DXF  and 2D DXF vector files in zip format 

ModJansenLegs

 As you can see, new legs are significantly bigger and stronger. I used twin MDF parts for rigidity and placed rubber tips for increased traction.. Still has some rework to do because gears are slipping and axis placement is not perfect at the moment...

 

Update on 22.Jan.2014: NIRcam studies...

I prepared a NIRcam for non-contact monitoring of the plant health by the help of infrared imaging... For this purpose I modified an old digital camera by removing the IR blocking filter over the CMOS imaging sensor and recalibrated the lens... Many articles can be found on internet about the  "how to" of this procedure...  Now the camera can take images on NearInfraredRegion of the spectrum... The plant is imaged with this NIRcam and the image is then post-processed in a image processing software such as Photoshop to replace the red composite with this new IR image and recompositing the image in NGB instead of RGB... Further filters can be applied to this image to show the plant's health (photosynthesis levels)... Actually a Superblue filter must be replaced with the IR blocking filter of the camera while modifying and best results are achieved with this Superblue filter but at this time I don't have such a filter at hand... More detailed info about NIRcam imaging can be found on PublicLab website,  which is devoted to plant studies...  Below are some of the example pics which I prepared during my tests...

initial image taken with NIRcam...

NIRcam and custom made IR led array... NIRcam with IR leds

 Left is the pic taken by the NIRcam... As you can see the image is different looking from the ones taken in visual light... the red hue is due to IR light caught by the sensor... by the use of a superblue filter this image would have a more brownish hue due to absorption of the red light and thus emphasising more of IR effect on the image...
NGB image after post processing... After post processing, this NGB image is constructed by removing the red composite and replacing the IR image instead. green and blue composites are also generated from the initial image and emphasised. As you can see, now the leaves look brighter showing plant health (photosynthesis levels)...
image after HSB and HSL filters applied... In this pic some software filters are applied to above image to emphasise the IR effect and show the leaves in a more green color... The lack of superblue filter can be seen on the image, otherwise leaves would look more natural green... 

 

Some more pics from NIRcam studies... These are obtained from low-res MyRobotLab realtime OpenCV imaging under IR light in total darkness with various filters... First without any filter, second with HSV and third with NOT filter...

Low-res realtime image of the plant under IR light... low-res realtime image with HSV filter... low-res realtime image with NOT filter...

Update on 1.Feb.2014: Sun Tracking...

I want my plantoid to have sun tracking for light maximization. This can easily be done by the controller but I did not  want to waste ports and program space for that purpose. So I made a simple sun tracking circuit using few components. The circuit is based on an op-amp, a H-bridge and 2 LDRs... The circuit is simple so I implemented by hand soldering directly on a perfboard. 2 LDRs are positioned with 45deg angles viewing the sun. The h-bridge drives a motor in both directions so as to maximize the light on the plantoid by tracking the sun. The 2 pots are there to adjust balance of the LDRs and the motor response to both directions, but I never had to make that adjustment, just setting the pots to mid points provided good tracking...  The circuit is placed towards the window side and a geared motor slowly rotates the Plantoid's turntable accordingly... 

sun tracker schematic Left pic shows the schematic for the circuit... Right pic is the implementation of the tracker on perfboard with my sloppy work... :) But it works perfectly... Nice thing is that, at night when the sun is not present, it tracks the brightest light source, so it can be used with artificial lighting... sun tracker on perfboard

Update on 7.Feb.2014:  Retirement for Hoya Carnosa...

My Hoya Carnosa served well through my Plantoid experiments and it is time to retire her... My new candidate plantoid plant is a Kalanchoe, which is smaller in size but has bigger leaves. She is the new brain of   Mechaphytum Animus now. After transferring the receptor electrodes to the new plant, I made a datalogging and impulse reaction session with her today. She has good responses. Here are the results... 

Although a Kalanchoe is much smaller than my Hoya, she has big and wide succulent leaves which are very suitable for electrode placement... I placed a surface electrode for galvanic response and implanted another into a leaf stem for capacitive response...

Update on April,2015:

Mechaphytum Animus is interacting with web... Thanks to ESP8266 webserver sensor nodes, Mechaphytum Animus can send sensor data, send tweets and can send e-mail when an event is triggered...

Mechaphytum Animus Screenshots
Thingspeak Screenshot Twitter screenshot

 

 

 

 


                                                                                                                                                                                                                                      back to robotics page


  •  

  • please email me at: dhepguler@hotmail.com                                                                                                                                              

  •