Water Elf: Difference between revisions

From Open Source Ecology
Jump to navigation Jump to search
(changed first line to reflect 12.04)
(typo and library detail)
Line 7: Line 7:
#Open up a terminal (click on ubuntu icon (top left), type terminal into search box, click on it's icon).
#Open up a terminal (click on ubuntu icon (top left), type terminal into search box, click on it's icon).
#Type the following three commands into the terminal:
#Type the following three commands into the terminal:
#cd <directory where extracted>/arduino-1.6.6 - e.g. 'cd Downloads/arduino-1.6.5-r5
#cd <directory where extracted>/arduino-1.6.5-r5 - e.g. 'cd Downloads/arduino-1.6.5-r5
#sudo chmod +x install.sh
#sudo chmod +x install.sh
#./install.sh
#./install.sh
#Now you should be able to find arduino IDE program from the ubuntu icon - click on it to run the arduino IDE.
#Now you should be able to find arduino IDE program from the ubuntu icon - click on it to run the arduino IDE.
#Open File, then Preferences.
#Open File, then Preferences.
#Set sketch folder to be /home/ubuntu/fishy-wifi/ardesp/Arduino (change ubuntu to match your username)
#In the Additional Board Manager URLs field put http://arduino.esp8266.com/staging/package_esp8266com_index.json and click OK.
#In the Additional Board Manager URLs field put http://arduino.esp8266.com/staging/package_esp8266com_index.json and click OK.
#Open the Tools, Board: "Arduino/Genuine Uno", Boards Manager
#Open the Tools, Board: "Arduino/Genuine Uno", Boards Manager

Revision as of 00:22, 10 November 2015

OK, instructions are for ubuntu 12.04, (note - docker requires 64 bit), and timed how long each stage took on my 5 year old laptop.

First stage gets the arduino IDE installed to program the ESP8266 chip.

  1. Visit http://www.arduino.cc/download.php?f=/arduino-1.6.5-r5-linux64.tar.xz. 90 MB download - takes a few minutes.
  2. Click on the downloaded file and extract it somewhere.
  3. Open up a terminal (click on ubuntu icon (top left), type terminal into search box, click on it's icon).
  4. Type the following three commands into the terminal:
  5. cd <directory where extracted>/arduino-1.6.5-r5 - e.g. 'cd Downloads/arduino-1.6.5-r5
  6. sudo chmod +x install.sh
  7. ./install.sh
  8. Now you should be able to find arduino IDE program from the ubuntu icon - click on it to run the arduino IDE.
  9. Open File, then Preferences.
  10. Set sketch folder to be /home/ubuntu/fishy-wifi/ardesp/Arduino (change ubuntu to match your username)
  11. In the Additional Board Manager URLs field put http://arduino.esp8266.com/staging/package_esp8266com_index.json and click OK.
  12. Open the Tools, Board: "Arduino/Genuine Uno", Boards Manager
  13. In the search box at the top right type "ESP" and then select the esp8266 by ESP8266 Community item and click install. 34MB download - takes 5 minutes.
  14. Now you can select Tools, Board - Choose the Adafruit HUZZAH ESP8266 board.
  15. When you plug in the board via the UART/FTDI thingy, you should see the port (Tools, Port) selected automatically.

Second stage, get couchdb and associated app installed.

  1. In the terminal type the following:
  2. cd ~
  3. sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/precise universe multiverse"
  4. sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/precise-updates universe multiverse"
  5. echo -e "deb https://apt.dockerproject.org/repo ubuntu-precise main" | sudo tee -a /etc/apt/sources.list.d/docker.list
  6. sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
  7. sudo apt-get update && sudo apt-get install -y git python-dev python-pip docker-engine linux-image-generic-lts-trusty linux-headers-generic-lts-trusty xserver-xorg-lts-trusty libgl1-mesa-glx-lts-trusty(takes a couple of min)
  8. git clone https://github.com/hamishcunningham/fishy-wifi.git (this takes a few min)
  9. cd fishy-wifi/ardesp/wegrow
  10. sudo pip install -U docker-compose (takes a minute)
  11. DOCKER_HOST=localhost sudo docker-compose up (65MB takes a couple of min the first time)

Now the database should be up and running. Leave this terminal open but open another tab with control-shift-t. Type the following commands to get the app running.

  1. cd ~/fishy-wifi/ardesp/wegrow/
  2. sudo pip install couchapp
  3. cd fishyapp
  4. couchapp push fishydata

the app reports a URL to load e.g. http://127.0.0.1:5984/fishydata/_design/fishyapp/index.html open browser and load the URL given.

To actually program the waterelf sketch, open the fishy-wifi/ardesp/waterelf/waterelf.ino sketch with the arduino IDE, connect the device, hold the mode button (left one) whilst pressing and releasing the reset (right). In upload mode the red led glows dimly. Once in this mode, click on upload icon or from Sketch menu choose Upload.