Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

yieldbuddy v1.17a Released

edited May 2013 in Announcements

*Switched everything from MySQL to SQLite3
*Uses nginx instead of Apache 
*Python script much more reliable, and now with event logging
*void main() in the arduino sketch has a section for restoring defaults (just uncomment, run, then comment out again)
*Updated look of web interface, fixed up some code.
*Updates database only when values change now, increasing performance of the script by a lot
*Warning: Shuts down anything accessing database when it starts
*Data points are taken at regular time intervals now. Default: 90 seconds (960 points / day)
*Switched graphs from High Charts to Google Charts (uses Flash instead of Java)
*Added log to 'System' page
*More error handling
*Some minor interface changes in the Python Script, also lists Interface IP Addresses
*Changed all paths to reference Server Root, so everything can be run in a different location (not just /var/www). This was so you can run yieldbuddy on a USB flash drive and save your SD card from too many read/writes
*Activated analog read of TDS1, TDS2, and CO2 sensors (see sensor functions in Arduino sketch to change the formulas to match that of your equipment [datasheets]) 
*Updated install script - let me know how it goes on the forum, as I manually installed so this should work



  • edited May 2013
    Remember:  It uses SQLite and not MySQL - so no server is used, just the database file in ...../www/sql/yieldbuddy.sqlite3

    ie.  No server address, username, password settings....
  • edited May 2013
    If you want to use a usb flash drive (recommended) then you will have to do the following things:

    The service script '/etc/init.d/yieldbuddy' contains a line 'sudo mount /dev/sda1/ /mnt/usb'   change this to match your usb flash drive  (probably going to be sda1 anyways)...  Use 'ls /dev/s*' to find your path.

    Copy the directories (and thier contents) from /var/www/yieldbuddy and /var/www/SQLiteManager to /mnt/usb/ to get /mnt/usb/yieldbuddy and /mnt/usb/SQLiteManager.

    Now 'sudo nano /home/pi/scripts/' and edit this script to match the new path.

    Next, edit /etc/nginx/sites-enabled/default and change 'root /var/www' to 'root /mnt/usb'

    Reboot the pi, and nginx and yieldbuddy should both now be configured for /mnt/usb instead.  :)
    --> or sudo fuser -k 80/tcp then sudo service nginx restart
  • For /mnt/usb as the server root:

    My /etc/init.d/yieldbuddy script now looks like this: 

    case "$1" in
    echo "Starting yieldbuddy daemon..."
    sudo mount /dev/sda1/ /mnt/usb
    sudo chmod -R /mnt/usb
    cd /home/pi/scripts/
    sudo ./ > /dev/null 2>&1 &
    echo "Started."
    echo "Stopping yieldbuddy daemon..."

    and my looks like this:

    #Test to see if yieldbuddy is running
    PROCESS_NUM=$(ps -ef | grep "yieldbuddy" | grep -v "grep" | wc -l)
    if [ $PROCESS_NUM -gt 0 ];
    echo "Running."
    echo "Not Running. Attemping to restart..."
    cd /mnt/usb/yieldbuddy
    sudo nice -n 15 sudo ./
  • if you get 'Access Denied'  this message is from nginx.  I ran out of space really quick due to large error files in /var/log/nginx.  I removed the log files and the site ran fine again.
  • edited May 2013

    I've just joined and must commend you on this great project your working on. I have been trying to work on something similar using the arduino mega  but just found linking everything with setpoints and web interfaces way too challenging.

    I am having trouble understanding the connection between an SD card and a usb flash drive. 
    Do I place the yield_buddy image onto an SD card or the usb flash drive and why is the image file so large? Wheezy takes up less that 2GB and your image in just under 8GB? I am confused as to whether I can use the existing wheazy installation I have on my 4GB SD card or I need to go out and get an 8GB card? Essentially what i'm asking is what goes on the SD card and what goes on the USB flash drive, together with the recommended size SD and USB? Does it matter whether the SD card is class 4 or class 10 in terms of performance for the camera, etc?

  • edited May 2013
    Hey Damo, 

    I was wondering if the 8GB image might be a problem, it's mostly free space - I ran out of room while playing around and decided to expand the file system, I haven't tried, and don't have any 4GB cards around anymore, but I think dd (on linux) or Win32DiskImager (windows) should be able to put the image on a card less than 8GB since the end is free space, but that's not for sure.   Maybe I'll resize, and make an image again.  The SD card is used just for the operating system (wheezy + preinstalled configs)

    The USB flash drive is used as the server root for the web page.   So the only thing I have on the root of my USB flash drive is the 'yieldbuddy' folder (with script and everything [not just the 'www' folder] )  and I also have the folder 'SQLiteManager' on the root of the USB flash drive as well.  Because there are a lot of writes, the USB flash drive seems to be a better choice than SD as far as corruption goes.

    The performance of your SD card shouldn't matter, but I do buy the speedier SDHC ones.

    If you're on linux [on your dekstop machine] I use this command with dd:
    dd if=/path/to/image/file.img of=/dev/sXX

    For a progress bar I use (but you need pv installed):
    pv -tpreb /path/to/img/file.img | sudo dd of=/dev/sXX bs=1M

    And on windows I've only used Win32DiskImager.

    Hope this helps, I'll try and resize the partition and make a new image soon.
  • Thanks that explains where everything goes.

    I went out and bought an 8GB SDHC and realised that after formatting your image is still too big to fit on the 8GB card. Please load up a different image slightly smaller than 7GB or better yet perhaps the actual size of the image, that way we can reclaim remaining space afterwards. Or are you able to tell me how to shrink the size of the image, i.e. remove some of the empty space?

  • Uploading a 2.9GB image right now - use the same link as before on the Downloads page.
  • edited May 2013
    I had also a 8GB sdhc class10, they had enough space for the image, works good. Using the Win32DiskImager for writing the image to sd card. Other way use the manual install.

    I use a usb drive and at the moment chmod dont take affect for my usb, i can do what i want so i tried
    "sudo mount -o umask=000 /dev/sda1/ /mnt/usb". With the umask i dont get the message in the log "unable to open .... Command" because he set the rights to 777. Later i will mount it with the UUID and the fstab.

    So at the moment testing:

    LightSensor   -->  works
    Temperatur and Humidity Sensor  --> works
    Webcam (Logitech)  --> works
    4 channel Relay Module  --> works
    1130 ph/ORP Adapter  --> works
    Conductivity Electrode --> not tested (got this yesterday)
    Email Alert --> got an email (PH), but i cant change the status or delete

    What do you think about calibration and an temperatur sensor for the ph adapter ?

    In this new version are so many improvements, so going on . Awesome work ! ^:)^


  • edited May 2013

    There are a lot of improvements and it's much more reliable now :)  I forgot to mention that my USB flash drive was reformatted to one big ext4 partition.  So chmod works okay for me.  If you have problems with mounting check the /etc/init.d/yieldbuddy script because I left my mount command for my usb key (yeah, I could use fstab -but it was good for debugging)

    Oh, and the download link has changed - 2.9GB image now in the Downloads section (with a couple improvements as well - cpu,memory, disk statistics on system page and some other changes)
  • I downloaded the 1.17a img and then connected to yieldbuddy/www/system.php then tried to change the camera address and email info. but it is not being saved / updated to the new info. Suggestions?

  • Yieldbuddy the python scripts seems much smoother, thank you. Sometimes it seems like I am not able to communicate with the arduino. After a reboot of raspberry pi then all is well again. Has anyone had problems with this? Could it be a problem with powering the arduino from the raspberry pi? 

  • Truntunz, not sure...  Maybe check your folder permissions.

    catwan, thanks...  I have big problems if I'm not using a powersupply with 5V and over 1A.  I actually have to change mine out now - I was using a cheap apple clone (the little white cube) but 1A just doesn't seem to cut it...  Also, connect the Arduino directly to the powersupply instead of through the Raspberrry Pi header.
  • So yieldbuddy you said I should connect arduino to separate power supply? Then how do I connect serial connection from raspberry to arduino? Do you have circuit showing how to interface the 3.3v to the 5v?
  • edited May 2013
    Hey, sorry for the late reply, I actually moved across the country for the mean time and I'll be touch-and-go for the next couple months, but to answer your question:

    You can use one powersupply, (I used a two row header and connected all the pins on each seperate row together - one row for negative and one row for positive) then I'm I was able connect anything that required power up to this header (relays, raspberry pi, arduino...)  You can use a logic converter (that'll work with 3.3v and 5v) for serial communication.  For this you can use the 3.3v header on the Pi, the transmit/receive on both arduino and raspberry pi and the 5v from the two header I mentioned ^^^.  (and of course ground - which you can connect all grounds together - ie connecting ground from pi to the two row header and the ground from the arduino to the two row header as well)  [common ground]

    I'm on a dial-up connection right now - yeah, it still exists...  But I think in the "Hardware Schematics" topic on this forum there's a diagram for the logic converter.
  • I am getting the following message "(2013/06/11 06:23:35) Now: 1370946215  Last Data Point: 1370946174   Next Data Point [sec]: 41.0/49.0/90"


    In this section of the python script looks like it is not reading from serial port and the TX light stays lit on the mega board. Does this mean serial port on raspberry is not reading?


  • edited June 2013
    FYI, i used script

    1) nginx would not start due to error from "nginx.conf" in the yieldbuddy package

    nginx: [emerg] open() "/etc/nginx/logs/" failed (2: No such file or directory)
    nginx: configuration file /etc/nginx/nginx.conf test failed

    ==> i just edited the nginx.conf and change this log to /var/log/nginx/ instead

    2) also, suggest to change in the ...
    cp ./config/nginx/* /etc/nginx
        >>>>>cp: omitting directory `./config/nginx/sites-enabled'  --Error ....not setup nginx with the right file
    change to  "cp ./config/nginx/*/* /etc/nginx"

    3) I also edit the /etc/nginx/site_enable/default  (src from #2) above
    add in " index index.php index.html index.htm;" instead of "index index.php" , this get rid of the Forbiden Error 403 -- unable to locate index.html file  when browse start folder as follow "http://pi_ip/yieldbuddy"

    4) is it just me or there is ^M char in all over the file ? (from the zip download)

    I unzip folder , cd in yieldbudy folder, and run this scripts to removed all the ^M from all the file

    "for file in $(find /path/to/dir/of/yieldbuddy -type f); do    tr -d '\r' <$file >temp.$$ && mv temp.$$ $file; done"

    5) Install script called Installing SQlite3, but the syntax is "sudo apt-get -y install sqlite" , I think it should be "sudo apt-get -y install sqlite3" instead

    >>>>>>>>>>>UPDATE... I compared the zip file for the install image using manual  vs the Pi boot image ==> they are NOT the same, a lot of the files in the yieldbuddy folder are not the same between the Pi Image and manual script install, some example showed above ...

    I believed the Manual install image is installing copy an older version of yieldbuddy folder  ... and won't work

  • Have anyone use the methods that passed login ? where is this sql address file, i only see a key file in this folder... Help ?

    I am stuck at this line ... in the index.php after login ...yupUnable to open file! 1
    Can someone check your image, /var/www/yieldbuddy/www/settings/sql --> to see what file is there ?

    echo "yup";
                            //Load SQL Settings
                                      $file_address = fopen("settings/sql/address", "r") or exit("Unable to open file! 1");

  • Hi, in his folder /var/www/yieldbuddy/www/settings/sql, there is only a key file. I dont use the install method because i use the image.I think you should try the image, dont forget sudo apt-get update and sudo apt-get upgrade after the first boot up ;)
  • Thanks Maskal.. Pi image worked, but manual does not.. i will try to notes diff ... just in case other may need or correct on next release by Yieldbuddy
  • I'm working on getting this installed as well with the manual method.  I've got a little bit of time here so I'll help out with fixing the manual install.  I would personally prefer to be able to install this on whatever flavor of *nix I'm running on my Pi.
  • Wow.  Didn't realize how messed up the manual install is at this point.  Just like atd_999 mentions above, totally different from the image version.  Any chance of putting this in a central location for development purposes?  
  • I have a question regarding AMA0 on the raspberry pi to arduino mega. I have noticed that after a while, not sure how long, but the stops running if I monitor it with TOP command. If I restart then everything is fine. The doesn't seem to be restarting the

    Any ideas?


  • What did you see in the log, when you connect with your browser to yieldbuddy under system. Are there any errors ?
    a part of my log:
    2013/07/01 22:11:18: Started yieldbuddy. Priority 15.
    2013/07/01 22:12:56: Added a data point to the sensor values log.
    2013/07/01 22:14:30: Added a data point to the sensor values log.

  • The log stops and doesn't show any new information. I just enter sudo nice -n 15 sudo /var/www/yieldbuddy/ in putty and it starts running and logging again.
  • Did you use a usb flash drive, when not try it. But dont forget to make the changes, yieldbuddy wrote it in the 3 post.
  • So try the usb memory instead of the SD card you are saying?
  • edited July 2013
    The sd card is always needed !
    I mean take a usb flash drive, copy the yieldbuddy and sqlite folder from sd card to the usb flash drive. Make the changes and i hope everything is fine ;)

  • Understood, I will try that. What would using the usb flash drive do to prevent from running?
  • I don't know that's the solution for you, only an idea. Because i use a usb and the runs since 2 weeks without problems.
Sign In or Register to comment.