Skip to content

Assembling and programming your own eclo

David Sciamma edited this page Apr 16, 2014 · 2 revisions

NB: this tutorial is a work in progress. Some pieces are still TBC, and some of the external links are not definitive.

Assembling the Greenhouse

TODO

Arduino

This program comes from kartben/mihini-greenhouse-demo.

  • Download the arduino IDE and launch it
  • Open the file tutorial-arduino/SimpleModbusSlaveExample.ino
  • Download the SimpleModbusSlave library, and install it.
  • Connect your Arduino in USB and flash it

Raspberry Pi

  • Follow the Raspberry Pi's quick start guide and choose a Raspbian in the NOOBS screen
  • Once you are logged onto your Raspbian, download and install Mihini (choose the "armhf" architecture, and the "deb" package type)
  • check the airvantage server url, in /opt/mihini/lua/agent/defaultconfig.lua, line 27
  • find the deviceId:
$ grep deviceId /var/log/syslog

=> you should find something like 0000000072eb5051

Mihini's application

This program cames from the Mihini samples from Eclipse’s git repository, in greenhouse-m3da/mihini-greenhouse-m3da-demo/src/

Using Lua Development Tools

  • On your Desktop computer, download and launch LDT

  • Install the Mihini Development Tools

    • Help -> Install new software
    • Work with: http://download.eclipse.org/koneki/updates-nightly
    • Select the "Mihini Development Tools for Lua"
    • Restart Eclipse if it's recommended
  • Configure the connection to your Raspberry Pi

    • Open the perspective "Remote System explorer"
    • "Define a connection to remote system" -> "Mihini Device"
    • Fill the "Host name" with your Raspberry Pi's IP address, and "Finish"
    • Right clic on "Applications", then "Connect…", and fill your credential (user: pi & password: raspberry)
  • Create a the Eclipse's Project

    • Get back to the Lua Perspective
    • File -> New -> LUA Project
    • Name it, with only ASCII letters, digits and "_"
    • "Create project at existing location (from existing source)" -> select the tutorial-mihini folder
  • Install your Project on you Raspberry Pi

    • Right-click on your application Export -> Mihini -> Lua Application Package
    • give it a Version
  • Checks the log on your Raspbian

$ tail -f /var/log/syslog

For more details, see the official LDT's User guide

OR Using the telnet lua console

  • On your Raspberry Pi, download the application:
$ cd
$ sudo apt-get install git
$ git clone https://github.com/nim65s/tutorial-eclo.git
  • write the launcher for this app (an executable called run, in ~/tutorial-eclo/tutorial-mihini):
#!/bin/sh
lua main.lua
  • Install the application
$ telnet localhost 2000
> appcon = require "agent.appcon"
> = appcon.install("eclo", "/home/pi/tutorial-eclo/tutorial-mihini", true)
  • check the logs
$ tail -f /var/log/syslog

AirVantage

  • Zip the tutorial-airvantage/model.app
$ cd tutorial-airvantage
$ zip model.app.zip model.app
  • Create an AirVantage account
  • Once you are logged in AirVantage, create a new application and publish it
    • Develop -> My Apps
    • Release -> Select a File -> model.app.zip -> Start
    • Refresh -> Select "My Application" -> Publish -> Publish
  • Then you can add a your Raspberry Pi as a system in your AirVantage's fleet
    • Inventory -> Systems -> Create
    • Give it a name
    • Create a gateway with the deviceId as the Serial Number
    • Don't add any subscription
    • Add the Application you just created
    • Let the Password field empty
    • Create
  • Select your new system and activate it
  • Check that Mihini is successfully connected to AirVantage
    • Monitor -> Systems
    • Select your system -> Details
    • History