Water Elf

From Open Source Ecology
Revision as of 00:13, 10 November 2015 by Marcin (talk | contribs)
Jump to navigation Jump to search

OK, I used Ubuntu 14.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 https://www.arduino.cc/en/Main/Software and click through to download the linux 64 bit software. 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 terminalinto search box, click on it's icon).
  4. Type the following three commands into the terminal:
  5. cd <directory where extracted>/arduino-1.6.6 - e.g. cd Downloads/arduino-1.6.6
  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. In the Additional Board Manager URLs field put http://arduino.esp8266.com/staging/package_esp8266com_index.json and click OK.
  11. Open the Tools, Board: "Arduino/Genuine Uno", Boards Manager
  12. 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.
  13. Now you can select Tools, Board - Choose the Adafruit HUZZAH ESP8266 board.
  14. 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/trusty universe multiverse"
  4. sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/trusty-updates universe multiverse"
  5. echo -e "deb https://apt.dockerproject.org/repo ubuntu-trusty 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 (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.