Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Mihini/EclipseCon2013 Tutorial"

(Introduction to Koneki tools for Mihini)
(Get SDcard image used during the tutorial)
(30 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Tutorial =
+
= Tutorial =
EclipseCon 2013 Tutorial plan.
+
  
Tutorial material is hosted at https://github.com/SierraWireless/eclipsecon2013-m2m-tutorial
+
This tutorial "'''Develop a complete M2M application with Koneki and Mihini'''" occurred at EclipseCon 2013 on 2013-03-25.
  
== Goals ==
+
== Tutorial material ==
  
=== Show Mihini ===
+
Tutorial material is hosted at https://github.com/SierraWireless/eclipsecon2013-m2m-tutorial
* show key APIs such as logging, sched, airvantage, devicetree, (sms?)...
+
* show how it's easy to do I/O manipulation and wireless communication
+
  
=== Koneki for Mihini ===
+
How to get it:
* show how Lua is easy to edit thanks to LDT tooling
+
* show EE and remote development for Mihini
+
  
=== FUN!!!!!! ===
+
*Clone git repository
 +
    git clone https://github.com/SierraWireless/eclipsecon2013-m2m-tutorial.git
 +
    # to get the beautiful and correct look&feel for the slides
 +
    git submodule update --init
  
== Key steps ==
+
*download zip file:
  
=== Introduction to the greenhouse demo ===
+
https://github.com/SierraWireless/eclipsecon2013-m2m-tutorial/archive/master.zip
  
{{Note|TODO| slides: Benjamin}}
+
Once you've got the repo locally, you can browse tutorial material:  
  
=== Introduction to Mihini ===
+
Especially:
  
{{Note|TODO| slides: Benjamin}}
+
*'''slides''':&nbsp;at the root of the repo <br>index.html&nbsp;
  
==== Features ====
+
*'''Code Solution''':<br>lab/mihini-tutorial-step3/
  
{{Note|TODO| slides ?}}
+
(That's a Koneki project, so can import it directly in your IDE)
  
==== Overall architecture ====
+
<br>
  
{{Note|TODO| slides: Laurent}}
+
== Goals  ==
  
=== Introduction to Koneki tools for Mihini ===
+
=== Show Mihini ===
  
{{Note|TODO| slides: Benjamin}}
+
*show key APIs such as logging, sched, airvantage, devicetree, (sms?)...
 +
*show how it's easy to do I/O manipulation and wireless communication
  
=== Installation of Lua Development Tools (all-in-one bundle) ===
+
=== Koneki for Mihini  ===
  
Note: Koneki doc for remote system [http://wiki.eclipse.org/Koneki/LDT/Developer_Area/User_Guides/User_Guide_0.9#Remote_session http://wiki.eclipse.org/Koneki/LDT/Developer_Area/User_Guides/User_Guide_0.9#Remote_session]
+
*show how Lua is easy to edit thanks to LDT tooling
 +
*show EE and remote development for Mihini
  
{{Note|TODO| instructions ?}}
+
=== FUN!!!!!!  ===
  
==== Write and run a local LUA example ====
 
  
{{Note|TODO| instructions ?}}
 
  
==== Configure remote system ====
+
== Hardware  ==
  
{{Note|TODO| instructions ?}}
+
The main hardware will be a Raspberry Pi (running Mihini) connected to an Arduino&nbsp;; the Arduino itself being connected to several sensors/actuators.
  
==== Remote launch the previous example ====
+
==== Bill of materials  ====
  
{{Note|TODO| instructions ?}}
+
This is the minimal list of materials to reproduce the demo:
  
=== Local communication ===
+
{| border="1" cellspacing="0"
 +
|-
 +
! Item
 +
! Qty
 +
|-
 +
| Raspberry Pi
 +
| 1x
 +
|-
 +
| Arduino Uno
 +
| 1x
 +
|-
 +
| Grove kit or equivalent
 +
| 1x
 +
|-
 +
| Micro USB cable
 +
| 1x
 +
|-
 +
| 4GB SD card
 +
| 1x
 +
|-
 +
| USB 1A power supply
 +
| 1x
 +
|-
 +
| USB A-B cable
 +
| 1x
 +
|-
 +
| Wifi dongle (Netgear WNA1000M-100FRS)*
 +
| 1x
 +
|-
 +
| Breadboard
 +
| 1x
 +
|-
 +
| Temperature Sensor (LM35DZ)
 +
| 1x
 +
|-
 +
| Luminosity Sensor (CdS Photoconductive Photocell, like PDV-P8001)
 +
| 1x
 +
|-
 +
| LED
 +
| 1x
 +
|-
 +
| Resistor 1k
 +
| 1x
 +
|-
 +
| Resistor 10k
 +
| 1x
 +
|}
  
{{Note|TODO| slides ?}}
+
<br> You can ordering (almost) everything from Adafruit:
  
==== Modbus API ====
+
*Raspberry Pi: https://www.adafruit.com/products/998 - 39.95USD
 +
*Starter pack for Arduino: https://www.adafruit.com/products/68 - 65.00USD
 +
*Sensors (the ones provided in the budget pack)
 +
*SD card: https://www.adafruit.com/products/102 - 7.95USD
 +
*Power supply: https://www.adafruit.com/products/501 - 5.95USD
 +
*USB A-Micro: https://www.adafruit.com/products/592 - 3.95USD
 +
*USB A-B (the one provided in the budget pack)
 +
*WiFi dongle: https://www.adafruit.com/products/814 - 11.95USD
 +
*TOTAL: 135USD
  
{{Note|TODO| slides ?}}
+
=== Schematics ===
  
=== Greenhouse tutorial ===
+
[[Image:Mihini EclipseCon2013 Arduino Schematics bb.png]]
  
{{Note|TODO| slides ?}}
 
  
==== Read/write some values with modbus ====
 
  
{{Note|TODO| instructions ?}}
+
== Software parts to reproduce the tutorial  ==
  
==== Install execution environment ====  
+
=== Running Mihini on RaspberryPi  ===
  
{{Note|TODO| instructions ?}}
+
==== Get SDcard image used during the tutorial  ====
  
==== Create new Mihini project ====
+
!!!!!Work in progress!!!!!
  
{{Note|TODO| instructions ?}}
+
Get the image here:
  
=== Introduction to push data ===
+
    https://www.dropbox.com/s/ftrqfshi62h078t/eclipsecon-raspi-img.tgz
  
{{Note|TODO| slides: Benjamin}}
+
Follow the instructions there:
  
==== M3DA protocol ====
+
    http://elinux.org/RPi_Easy_SD_Card_Setup
  
{{Note|TODO| slides : Julien}}
+
Mihini version used:
 +
  commit b660318d51a113d58c1e7b7a1ffdac210f5e3352
  
==== push data API ====
+
==== Compile and run Mihini manually  ====
  
{{Note|TODO| slides: Laurent}}
+
Available instructions [[Mihini/Run Mihini on an Open Hardware platform|here]]
  
=== Add server communication to the code ===
+
<br>
  
{{Note|TODO| instructions ?}}
+
=== Installation of Lua Development Tools (all-in-one bundle)  ===
  
==== push data ====
+
Home of Koneki Lua Development Tools:
 +
http://eclipse.org/koneki/ldt/
  
{{Note|TODO| instructions ?}}
+
Default version of Koneki doesn't come with Remote Target Management feature (that enables, for this tutorial, to connect to RaspberryPi system, send your application to it etc).
  
==== m2m.eclipse.org ====
+
To create the all-in-one bundle that was provided during the tutorial, you have to:
 +
TBD
  
{{Note|TODO| instructions/slides ?}}
 
  
==== JSon API for displaying data ====
+
=== Setting up the Arduino  ===
  
{{Note|TODO| instructions/slides ?}}
+
Arduino code used for the tutorial is --&gt;
  
=== Go further ===
+
https://github.com/kartben/mihini-greenhouse-demo/tree/master/SimpleModbusSlaveExample
  
{{Note|TODO| slides ?}}
 
  
==== App con ====
+
=== M3DA Server  ===
  
{{Note|TODO| slides: Laurent}}
+
An instance of M3DA server is running on Eclipse M2M machine.
  
==== End user android application ====
+
To contact it with Mihini agent, you must use this address:
 +
    tcp://m2m.eclipse.org:44900
  
{{Note|TODO| slides ?}}
+
Run you own M3DA server instance:
  
=== Installation of Lua Development Tools ===
+
Everything you need for that is there (How to build, to run, interact with):
 +
    https://github.com/SierraWireless/m3da-server
  
Download Lua Development Tools product (or get it from an USB stick provided to the participants), install the Remote Lua Development feature.
 
  
{{Note|TODO|Retrieve and put LDT archives on USB stick}}
+
=== End user Android application ===
 
+
{{Note|TODO|Put LDT p2 repo on the USB stick too}}
+
 
+
 
+
==== Hello World ====
+
 
+
* Write a first simple Lua application ("Hello World").
+
* Get familiar with the notion of Execution Environment, learn how to use Lua.
+
* Launch the application using the embedded JNLua VM
+
* Learn how to use the debugger
+
 
+
=== Installation of Mihini ===
+
 
+
Participants will compile and install Mihini on the Raspberry Pi based on the instructions available [[Mihini/Run_Mihini_on_an_Open_Hardware_platform|here]]
+
 
+
==== Compile Mihini source code ====
+
 
+
* Copy (git clone?) the sources of Mihini on the Raspberry Pi
+
 
+
{{Note|TODO|Provide a copy of the git repo on the USB stick???}}
+
 
+
* Compile Mihini (and its Lua VM)
+
* Brief presentation of the defaultconfig ; tweak the few settings that will simplify development
+
 
+
==== First Mihini launch ====
+
 
+
* Start Mihini on the target
+
* Open a telnet connection on port 2000 to play with the agent's shell
+
** a = 1
+
** print(a)
+
** :agent.config.get('shell')
+
 
+
==== Hello World REMOTE ====
+
 
+
* Configure a new Remote System corresponding to the Raspberry Pi inside LDT
+
* Launch the previously written Hello World using a remote launch conf
+
* Do a remote debug
+
 
+
=== Setting up the Arduino ===
+
 
+
* First step will be to setup the arduino with a blinking LED
+
 
+
{{Note|TODO|Prepare Arduino IDE archives (mac, linux, win) for the USB stick}}
+
 
+
{{Note|TODO|Fritzing schematic of the blinking LED setup?}}
+
 
+
 
+
* Next is the instalation of the Modbus stack --> https://github.com/kartben/mihini-greenhouse-demo/tree/master/SimpleModbusSlaveExample
+
 
+
=== Remote run/debug ===
+
Log hello on the module.
+
 
+
 
+
 
+
=== Wireless code ===
+
Upload first data on internet using MQTT and AirVantage
+
 
+
=== Install application ===
+
Show how to install an application using mihini (and airVantage)
+
 
+
== Hardware ==
+
 
+
The main hardware will be a Raspberry Pi (running Mihini) connected to an Arduino ; the Arduino itself being connected to several sensors/actuators.
+
 
+
=== Bill of materials ===
+
 
+
{| border="1" cellspacing="0"
+
! Item        !! Qty
+
|-
+
| Raspberry Pi                                                          || 1x
+
|-
+
| Arduino Uno                                                          || 1x
+
|-
+
| Grove kit or equivalent                                                || 1x
+
|-
+
| Micro USB cable                                                || 1x
+
|-
+
| 4GB SD card                                                || 1x
+
|-
+
| USB 1A power supply                                                || 1x
+
|-
+
| USB A-B cable                                                || 1x
+
|-
+
| Wifi dongle (Netgear WNA1000M-100FRS)*                                                || 1x
+
|}
+
  
* this might not be the best option for the US market (sounds look it is way more expensive than in Europe?)
+
Get it there:
 +
http://git.eclipse.org/c/mihini/org.eclipse.mihini.samples.git/tree/greenhouse/corona-greenhouse-demo
  
 +
== Develop the Lua Application ==
  
Ordering everything from Adafruit would be:
+
See the slides and code solution in [[#Tutorial material]]!!
* Raspberry Pi: https://www.adafruit.com/products/998 - 39.95USD
+
* Starter pack for Arduino: https://www.adafruit.com/products/68 - 65.00USD
+
* Sensors (the ones provided in the budget pack)
+
* SD card: https://www.adafruit.com/products/102 - 7.95USD
+
* Power supply: https://www.adafruit.com/products/501 - 5.95USD
+
* USB A-Micro: https://www.adafruit.com/products/592 - 3.95USD
+
* USB A-B (the one provided in the budget pack)
+
* WiFi dongle: https://www.adafruit.com/products/814 - 11.95USD
+
* TOTAL: 135USD
+

Revision as of 12:42, 3 April 2013

Tutorial

This tutorial "Develop a complete M2M application with Koneki and Mihini" occurred at EclipseCon 2013 on 2013-03-25.

Tutorial material

Tutorial material is hosted at https://github.com/SierraWireless/eclipsecon2013-m2m-tutorial

How to get it:

  • Clone git repository
   git clone https://github.com/SierraWireless/eclipsecon2013-m2m-tutorial.git
   # to get the beautiful and correct look&feel for the slides
   git submodule update --init
  • download zip file:
https://github.com/SierraWireless/eclipsecon2013-m2m-tutorial/archive/master.zip

Once you've got the repo locally, you can browse tutorial material:

Especially:

  • slides: at the root of the repo
    index.html 
  • Code Solution:
    lab/mihini-tutorial-step3/

(That's a Koneki project, so can import it directly in your IDE)


Goals

Show Mihini

  • show key APIs such as logging, sched, airvantage, devicetree, (sms?)...
  • show how it's easy to do I/O manipulation and wireless communication

Koneki for Mihini

  • show how Lua is easy to edit thanks to LDT tooling
  • show EE and remote development for Mihini

FUN!!!!!!

Hardware

The main hardware will be a Raspberry Pi (running Mihini) connected to an Arduino ; the Arduino itself being connected to several sensors/actuators.

Bill of materials

This is the minimal list of materials to reproduce the demo:

Item Qty
Raspberry Pi 1x
Arduino Uno 1x
Grove kit or equivalent 1x
Micro USB cable 1x
4GB SD card 1x
USB 1A power supply 1x
USB A-B cable 1x
Wifi dongle (Netgear WNA1000M-100FRS)* 1x
Breadboard 1x
Temperature Sensor (LM35DZ) 1x
Luminosity Sensor (CdS Photoconductive Photocell, like PDV-P8001) 1x
LED 1x
Resistor 1k 1x
Resistor 10k 1x


You can ordering (almost) everything from Adafruit:

Schematics

Mihini EclipseCon2013 Arduino Schematics bb.png


Software parts to reproduce the tutorial

Running Mihini on RaspberryPi

Get SDcard image used during the tutorial

!!!!!Work in progress!!!!!

Get the image here:

    https://www.dropbox.com/s/ftrqfshi62h078t/eclipsecon-raspi-img.tgz

Follow the instructions there:

    http://elinux.org/RPi_Easy_SD_Card_Setup

Mihini version used:

 commit b660318d51a113d58c1e7b7a1ffdac210f5e3352

Compile and run Mihini manually

Available instructions here


Installation of Lua Development Tools (all-in-one bundle)

Home of Koneki Lua Development Tools: http://eclipse.org/koneki/ldt/

Default version of Koneki doesn't come with Remote Target Management feature (that enables, for this tutorial, to connect to RaspberryPi system, send your application to it etc).

To create the all-in-one bundle that was provided during the tutorial, you have to: TBD


Setting up the Arduino

Arduino code used for the tutorial is -->

https://github.com/kartben/mihini-greenhouse-demo/tree/master/SimpleModbusSlaveExample


M3DA Server

An instance of M3DA server is running on Eclipse M2M machine.

To contact it with Mihini agent, you must use this address:

    tcp://m2m.eclipse.org:44900 

Run you own M3DA server instance:

Everything you need for that is there (How to build, to run, interact with):

   https://github.com/SierraWireless/m3da-server


End user Android application

Get it there: http://git.eclipse.org/c/mihini/org.eclipse.mihini.samples.git/tree/greenhouse/corona-greenhouse-demo

Develop the Lua Application

See the slides and code solution in #Tutorial material!!

Copyright © Eclipse Foundation, Inc. All Rights Reserved.