PLANT FRIENDS MKII
The Plant Friends app is a native Android app written in Processing (processing.org). The app requests data from the base station and displays it accordingly.
Download and setup Processing for Android development. Processing.org already have a great tutorial to setup the Processing IDE and the Android environment: https://github.com/processing/processing-android/wiki
Once you have Processing properly setup, load the plant_friends.pde sketch from my source. Change the IP address to your Raspi's IP address. Double check to make sure the sketch has permission to access the Internet in Android mode.
Click on Android > Sketch permissions > INTERNET. Compile the sketch for your phone and test it out! Make sure your phone / tablet is on WIFI. Alternatively, you can run the sketch in regular Java mode.
To access the Plant Friends system via the app over the Internet, you will need to open a port in your router and point it to the Raspi IP as well as getting a dynamic DNS like no-ip or Dyn.
The Plant Friends app icon looks like this:
When you load up the app, you will be greeted with the splash screen. It is loading data in the background while the animation is going on.
This is the node menu, it shows all the sensor nodes currently in the database. Tapping the “<” will reload all the data from the base station. The 4 tiny bars on the right hand side of each node shows the sensor values as a bar graph. The values are taken from the last entry for the current day.
Green: Soil moisture level. Values are mapped to 0 – 600 ADC value (because over 600 you are drowing your plants!)
Blue: Humidity level. Values are mapped to 0 – 90%.
Red orange: Temperature. Values are mapped to 0 – 46c.
Grey: Battery voltage. Values are mapped to 3.3 to 6 volts.
Tapping on a node brings you the details for the respective node.
A lot of the stuff here is pretty self explanatory. Tapping the arrows beside the dates cycles through the sensor values for the respective day. The “right now” selection shows the latest data entry for that node, for that day. The data history goes back 5 days. Tapping on the temperature will toggle between Celsius and Fahrenheit.
On the bottom of the screen is a pretty chart that shows the latest data entry and traces back 5 days. Tapping on the “<” will bring you back to the node menu screen.
Whenever the app is launched, it contacts the base station to get a list of all the sensor nodes in the database. After that, it loops through each node and requests the historical data. All of this data is stored in two multi-dimensional arrays: One for the index of sensor nodes and one for the historical data.
After the data loading process is complete, the menus and associated screens and graphs are generated for each node. Play around with the app and read through the comments in the code as there is a lot going on and the comments provides further explanation on what the code is doing.
7. The Mobile App