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

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Just want to share what I've been working on lately which, of course, involves the awesome Moteino. This is one of the projects that I am working on for my portfolio to get into grad school.

Basically, it is a soil moisture/temperature/humidity sensor system for indoor plants. All the characters are constructed with 2.9mm bamboo plywood and then laser cut. The battery operated nodes (Moteino) transfers the data via wirelessly to a base station (raspberry pi + moteino) and alerts you when the soil is dry via email/sms/blinking light. I have other features planned but there is still a lot of code to write and learn (I just starting playing with the Arduino UNO, learning about electronics and learning how to program in April of this year). If I have time, i'll might venture into writing an android/iphone app to talk to the plants.

This is a still a work in progress as I still need to figure out the raspberry pi <-> moteino, and raspberry pi backend part. But the design and all the nodes are sending and receiving data and working very well.

I wasted some $$ on other arduino clones that were too small, too big, or used too much power. Good thing the Moteino fits my needs perfectly. Ok, I am starting to sound like an annoying fanboi already. Here are some pics!


Dbot


Bunny


Bunny in action


Bunny guts


Dinosaur guts


Dinosaur


Base station light test


Moteino for the base station. The power board has a 3.3v regulator that feeds power to the base LED lights. 5v goes into the moteino and raspberry pi.


modified raspberry pi. USB header, RCA, audio headers removed to save space. SD card was cut in half to save space.
The raspberry pi site diagonally in the enclosure to maximize space.


Finished base station.


Base LED light test/


Base LED light test. I wanted the unit to have a "floating" effect.


Dbot, finished.


Dbot back. Note the humidity/temperature sensor.


Robot guts.


More robot guts.


Dbot with soil probe.


Dbot and his friends.


« Last Edit: July 02, 2014, 08:56:38 AM by Felix »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #1 on: July 22, 2013, 11:07:55 AM »
Aww thats so totally cool, Thanks so much for sharing! :D
Once you have these all working with the base you should post your project on HackADay!
If you don't have a blog or place to put all the details, you can just use this or a new thread and then tip them to this thread's link.
« Last Edit: July 22, 2013, 11:10:35 AM by Felix »

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #2 on: July 22, 2013, 03:33:13 PM »
Thanks Felix, i'll totally do that!

Dazza

  • NewMember
  • *
  • Posts: 5
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #3 on: July 24, 2013, 02:58:43 AM »
Impressive and great build quality!  Look forward to seeing you on Hackaday, don't let the Pi haters put you off.

Daryl

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #4 on: July 24, 2013, 11:46:05 AM »
Yeah, no kidding, there's some bad vibe posters on Hackaday that seem to dislike everything.

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #5 on: May 05, 2014, 09:01:03 PM »
Hi there!

I'm officially bringing this thread back from the dead. I actually finished this project last August 2013 but I have been sooooo busy. Now I finally had some time to write about it. I was also able to write an Android app for the whole system. :)

You can check out the project on my website : http://dicksonchow.com/plantfriends



Anyways, I did a small write up explaining how the whole thing works and included pictures of the process. I'll be sharing all my code on Github soon. :)



I also want to thank you Felix for making the Moteino and sharing your code. I learned so much working on this project!
« Last Edit: June 14, 2014, 12:40:45 AM by dickson »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #6 on: May 05, 2014, 09:56:40 PM »
How nice, I was checking this thread and saw the broken photo links so I thought here's another cool project that just kinda died away but I'm happy you were able to get back to it and finish it. Hoping your sources/code will be available soon!
Hey I tipped hackaday, maybe they pick this one up, and you should consider submitting this project for their go-to-space contest ;)

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #7 on: May 11, 2014, 03:58:48 PM »
Thanks Felix! I also posted this over at the Raspberry Pi forums. Moteino is mentioned. :)

SvendP

  • NewMember
  • *
  • Posts: 8
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #8 on: May 28, 2014, 05:37:11 PM »
Any chance of seeing your code on github soon, I'm very interested in seeing it. Since I don't have a chance in hell of making it my self. :-)

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Re: Plant Friends : Moteino + Raspberry Pi plant monitor system
« Reply #9 on: May 31, 2014, 09:42:32 AM »
@SvendP, yes i'll be posting all my source code soon. I've gotten few request and questions on how I built this system so I am going to write a 'how-to'. The idea is pretty simple so I think you can totally build one and even improve on it. :)

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Its been awhile since I last posted but I come back with good news!

During the midst of cleaning up my code for release, I ended up re-designing and re-writing everything including the Android app. The Plant Friends system is now expandable, adaptable and easy to build! The system looks completely different now but uses common parts. Of-course it still uses the Moteino. :)

I also wrote an extensive how-to-tutorial-instructable so beginners can have a stab at building a Plant Friends system of their own. I commented almost every line of code so there is a lot of information on how the system works.




Here is what it looks like:

The Sensor Node




The Base Station




The Plant Friends App






As you can see, the sensor node is basically a shield for the Moteino. haha. I am very happy with how this turned out. The sensor node runs on 4x AA rechargable batteries and I am able to get a little over 5 months of life out of it by taking a reading every hour and have the Moteino go to 'sleep' the rest of the time. I also added a battery meter too!

Some stuff is still really rough. Mainly the web interface to add sensor nodes into the database. The app looks nice but missing some functionality like scrolling through the list of nodes (lol) and the ability to edit sensor node information. I have other plans for the app like adding sensor nodes to the system and controlling ( an army?) of Moteinos so i'll be working on that. :)

The main python script that runs on the Pi and the sensor node / gateway Moteino code all works great.

Oh and all the enclosures are made out of bamboo! All the pieces snap together and doesn't require glue. Now I am going to experiment with finishing the bamboo with oils, staining, painting it etc. :)


The how-to tutorial instructable is here:
http://dicksonchow.com/plantfriends2



My source code is on GitHub:
https://github.com/dicksondickson/PlantFriends



If you like my Plant Friends enclosures, you can buy it from me here:
http://dickson.bigcartel.com/



This is an on going project for me so expect more fun stuff in the future.


@Felix, thanks for making this a sticky!


Comments, suggestions welcome!

« Last Edit: July 19, 2014, 05:06:37 PM by dickson »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Oh so cool, thanks again, it's really great to see nice writeups and nice pictures!
And I'm humbled that you still find Moteino a good candidate for your project.
By the way, you should REALLY consider entering this in the hackaday prize: http://hackaday.io/prize
I think you got a good shot at getting in top 10 if not better. I like the android eye candy app :)

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Thank you for the encouragement Felix! I just entered Plant Friends for the hackaday prize: http://hackaday.io/project/1982

I still have a lot of project ideas for the Moteino and I have a few that I am working on right now. I'll have more updates for Plant Friends soon.

PS Can't wait for the Moteino MEGA. :)

dickson

  • NewMember
  • *
  • Posts: 16
    • Website
Plant Friends made it on the front page of hackaday!

http://hackaday.com/2014/07/22/hey-there-little-plant-lets-be-friends/

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
I noticed, congrats!
See .. good things happen when you do quality :)

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?