Author Topic: Plant Friends : Moteino + Raspberry Pi plant monitor system [awesome!]  (Read 44074 times)

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Thank you!

I second that notion. :)

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system [awesome!]
« Reply #16 on: August 04, 2014, 11:14:56 PM »
Look! I made a Moteino shield. :)
This is my custom PCB for the Plant Friends sensor nodes. The layout is based on the protoboard layout. The Moteino sits in the socket.



I'm planning to deploy a bunch of sensor nodes for my other plants and making my custom board will make that task easier.

I also made a custom soil probe. Fearing that the eBay soil probes might contain lead, I had to design my own. Also, the eBay probes are corroding pretty badly after 6 months of use.

Here is my custom soil probe:




Here is a side by side comparison of my soil probe and the eBay one. You can see the eBay one looks pretty bad.




The gold plating should provide much more corrosion resistance. only time will tell :)

« Last Edit: August 04, 2014, 11:25:42 PM by dickson »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system [awesome!]
« Reply #17 on: August 05, 2014, 08:04:09 AM »
Very nice sir, the gold plating is very thin. Did the ebay probe had a solder layer (HASL) or was it bare copper?

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system [awesome!]
« Reply #18 on: August 05, 2014, 01:31:32 PM »
Yes, the eBay one did have a solder layer. I asked 3 eBay sellers selling the same probes about the HASL used on the probes and one told me it was lead-free, another told me it was NOT lead-free and one said they don't know. I'll be using the probes for my basil plants so I don't want to risk poisoning myself. :)

As for the gold plating, I opted for the flash gold instead of the ENIG because it was cheaper. I'm using my new soil probes right now so I'll see how they look in a month.

Bielefeldt

  • NewMember
  • *
  • Posts: 4
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system [awesome!]
« Reply #19 on: October 17, 2014, 02:46:55 PM »
Dear Dickson

Great respect for this great project. There's a lot of innovation and a lot of good details.

It provides plenty of inspiration for new projects based on ideas and solutions from your project.

I have studied your project description and I'm impressed with how thorough it is. However, I miss the tutorial you refer to about the building of Plants Friends app, which is an important part of the project. The provided link does not work and it has not been possible for me to find the article you refer to: https://processing.org/learning/android/

Hope you can help with a solution.

Kind regards
Sune Bielefeldt

Link: http://dicksonchow.com/plantfriends2/6


dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system [awesome!]
« Reply #20 on: October 17, 2014, 09:17:11 PM »
Thank you for the compliments!

As for the android-processing app portion of the tutorial, it seems processing moved some of their docs around. here is the link that https://github.com/processing/processing-android/wiki

Bielefeldt

  • NewMember
  • *
  • Posts: 4
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system [awesome!]
« Reply #21 on: October 18, 2014, 07:10:21 AM »
Thank Dickson

It was just what I needed. Looking forward to reading more about the concept and get it under my skin.

I am now a plant friend  8)

Sincerely,
Sune Bielefeldt

indylead

  • NewMember
  • *
  • Posts: 3
Hi Dickson, great project!  I've just completed and have working a base station with three sensor nodes.  Had one or two issues that I managed to Google my way through.

One question...I'm using the default values for the sleep time
int sleepCycledefault = 450; // Sleep cycle 450*8 seconds = 1 hour. DEFAULT 450

However  the nodes are all sending data about once every 7 to 9 minutes, and not once per hour.

Am I missing a setting somewhere to slow things down?

 

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Am I missing a setting somewhere to slow things down?
Are you sure you are sleeping your node 8 seconds at 1 time and only sending a reading every 450 sleep cycles?

indylead

  • NewMember
  • *
  • Posts: 3
Felix, thanks for the reply. - That sounds like it would be the issue, but how would I check?  From what I can tell of the code, it is sleeping for 450 cycles.

The timing seems that a sleep cycle is only 1 second as you say (there is also a random delay added, hence the variation).   

I can't see from Dickson's code where you define the length of one cycle - the comment implies it is 8 seconds, but I can't see how that is defined.  Is it from the Sleep.h library?

Edited to add: I've upped the 450 to 3600 to compensate, but it would be good to know why it's not working as expected!
« Last Edit: May 03, 2015, 06:31:05 AM by indylead »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
I can only comment on how my mote examples are sleeping.
This is found in the MotionMote example.
Look for this line:
Code: [Select]
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

indylead

  • NewMember
  • *
  • Posts: 3
Got it!

Code is using:
Code: [Select]
LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF); //sleep duration is 8 seconds multiply by the sleep cycle variable.

Cheers, Felix - it's easy when you know what to look for :)


romoe

  • NewMember
  • *
  • Posts: 1
Thank you so much for all the code and the great tutorial Dickson!

Just finished my version of it https://translate.google.se/translate?sl=sv&tl=en&js=y&prev=_t&hl=sv&ie=UTF-8&u=http%3A%2F%2Fwww.sweclockers.com%2Fgalleri%2F13225-tradgarn-odlingsautomation-med-raspberry-pi&edit-text=&act=url (Sorry about the swedish). Did change the design a little, hope you dont mind

So far only one problem... The moisture sensor seems not very reliable, ended up with over 12 liters of water on my neighbours balcony :)

tva164

  • NewMember
  • *
  • Posts: 18
  • Country: gb

I have a couple of R4's lying around and was looking to do something similar but just with a temperature sensor for now (I have used a TMP36).  Came across your project and was extremely pleased as it was everything I wanted to do and more - so thank you Dickson. 

I now have the setup all done, the node and gateway all connected - but there is no data coming into the gateway.  I can see the node is sending data - doesn't seem to be a problem there.  For reference I have included the sketches for both the Node and the Gateway.  Any help hugely appreciated - thanks.

NODE SKETCH
-----------------
Code: [Select]
#include <LowPower.h> // low power library. Get Felix's version: https://github.com/LowPowerLab/LowPower
#include <RFM69.h> // RFM69 library. Get it here: https://www.github.com/lowpowerlab/rfm69
#include <SPI.h>
#include <avr/sleep.h> // sleep library
#include <stdlib.h> // library for maths

// For temperature
#define aref_voltage 3.3         // we tie 3.3V to ARef and measure it with a multimeter!
 

// RADIO SETTINGS
// You will need to initialize the radio by telling it what ID it has and what network it's on
// The NodeID takes values from 1-127, 0 is reserved for sending broadcast messages (send to all nodes)
// The Network ID takes values from 0-255
#define NODEID       23  // The ID of this node. Has to be unique. 1 is reserved for the gateway!
#define NETWORKID    20  //the network ID we are on
#define GATEWAYID     1  //the gateway Moteino ID (default is 1)
#define ACK_TIME     2800  // # of ms to wait for an ack
#define FREQUENCY     RF69_433MHZ
RFM69 radio;
bool requestACK=true;

// Power Management Sleep cycles
int sleepCycledefault = 1; // Sleep cycle 450*8 seconds = 1 hour. DEFAULT 450

String senseDATA; // sensor data STRING

//TMP36 Pin Variables
int tempPin = 1;        //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures
int tempReading;        // the analog reading from the sensor
 
void setup(void)
{
  // We'll send debugging information via the Serial monitor
  Serial.begin(9600);   
 
  // If you want to set the aref to something other than 5v
  analogReference(EXTERNAL);
 
  // Initialize the radio
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  #ifdef IS_RFM69HW
    radio.setHighPower(); //uncomment only for RFM69HW!
  #endif
}
 
 
void loop()
{
 
  int sleepCYCLE = sleepCycledefault; // Sleep cycle reset

  // read temperature
  tempReading = analogRead(tempPin); 
  // converting that reading to voltage, which is based off the reference voltage
  float voltage = tempReading * aref_voltage;
  voltage /= 1024.0;
  float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((volatge - 500mV) times 100)

// PREPARE READINGS FOR TRANSMISSION
  char VoltagebufTemp[10];
  char voltagebufvolts[10];
  senseDATA = String(NODEID);
  senseDATA += ":";
  senseDATA += "0"; //ErrorLvl;
  senseDATA += ":";
  senseDATA += "0"; //String(moistREADavg);
  senseDATA += ":";
  senseDATA += dtostrf(temperatureC,5,2,VoltagebufTemp); // convert float Temperature to string
  senseDATA += ":";
  senseDATA += "0"; //String(dhthumid);
  senseDATA += ":";
  senseDATA += dtostrf(voltage,4,2,voltagebufvolts);
 
  byte sendSize = senseDATA.length();
  sendSize = sendSize + 1;
  char sendBuf[sendSize];
  senseDATA.toCharArray(sendBuf, sendSize); // convert string to char array for transmission

  Serial.print(sendBuf);
  Serial.print(sendSize);

 //Transmit the data
  radio.send(GATEWAYID, sendBuf, sendSize, requestACK); // send the data
  if (requestACK)
  {
    //wait for ack
    if (waitForAck()) {
      //ack recieved
    } else {
        //ack not recieved
        sleepCYCLE = sleepCYCLE / 2; // since we didnt recieve ack, halve sleep cycle
      }
  }
 
  // Randomize sleep cycle a little to prevent collisions with other nodes
  sleepCYCLE = sleepCYCLE + random(8);
 
  // POWER MANAGEMENT DEEP SLEEP
  // after everything is done, go into deep sleep to save power
  for ( int sleepTIME = 0; sleepTIME < sleepCYCLE; sleepTIME++ ) {
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); //sleep duration is 8 seconds multiply by the sleep cycle variable.
  }
 
}

// Radio ACK recieve/send function
// wait a few milliseconds for proper ACK, return true if received
static bool waitForAck() {
  long now = millis();
  while (millis() - now <= ACK_TIME)
    if (radio.ACKReceived(GATEWAYID))
      return true;
  return false;
}


GATEWAY SKETCH
---------------------

Code: [Select]
#include <LowPower.h> // low power library. Get Felix's version: https://github.com/LowPowerLab/LowPower
#include <RFM69.h> // RFM69 library. Get it here: https://www.github.com/lowpowerlab/rfm69
#include <SPI.h>
#include <avr/sleep.h> // sleep library
#include <stdlib.h> // library for maths


#define NODEID  1  // Node ID used for this unit. 1 is reserved for gateway
#define NETWORKID  20  //the network ID we are on
#define FREQUENCY     RF69_433MHZ
RFM69 radio;


#define SERIAL_BAUD 115200 // define serial port speed

void setup() {
 
  Serial.print("Starting..."); //debugging
  Serial.println(); //debugging
  // open serial port
  Serial.begin(SERIAL_BAUD);
  Serial.print("Port is open"); //debugging
  Serial.println(); //debugging
 
  // Initialize the radio
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  #ifdef IS_RFM69HW
    radio.setHighPower(); //uncomment only for RFM69HW!
    Serial.print("RFM69HW true"); //debugging
  #endif
}


void loop() {
 
  int datalen;
  char charbuf;
 
  if (radio.receiveDone()) // radio finishes recieving data
  {
      Serial.print("Something received..."); //debugging
      // get length
      for (byte i = 0; i < radio.DATALEN; i++)
     
      // dumps data to the serial port
      Serial.print((char)radio.DATA[i]);
      Serial.println();

      // sends ack to sensor node
      if (radio.ACKRequested())
      {
        radio.sendACK();
        Serial.print(" - ACK sent"); //debugging
      }
  }
  Serial.print("Waiting..."); //debugging
  Serial.println(); //debugging
}

Tony Weil

  • Jr. Member
  • **
  • Posts: 60
  • Country: us
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system [awesome!]
« Reply #29 on: January 05, 2018, 06:16:52 PM »
Nice project! I may make a few and stop killing my plants.

I don't quite understand how the soil probe circuit works. It seems like when you swap polarities and then average the two readings you will always get an ADC value more or less in the middle of the range (512) because you are alternately measuring the voltage across each of the two resistors in the voltage divider (assuming you ignore the 100 ohm tiny resistor).  What am I missing?

Also, what is the purpose of the 100 ohm resistor? What types of values are you getting for soil resistance?