Archivo

Entradas Etiquetadas ‘sentilla’

Pervasive computing: Sentilla once again

Sábado, 6 de Febrero de 2010

Ya ha pasado un rato laaaargo desde que juegue con mis motes de Sentilla Lab. La última aplicación que escribí (AguaYFuego) requiere un poco de maquillaje (en aquel entonces lo hice con Swing y JFreeChart). Esta vez voy a probar una nueva dirección.

Ahora que tengo mi servidor Mac mini ocioso creo que es hora de poner a trabajar ese equipo. Por ahora me estoy bajando las actualizaciones para OSX y poniéndole las pilas a los sensores :)

java, programación , , ,

AguaYFuego; Se me trancó el Serrucho

Sábado, 18 de Octubre de 2008

No hay nada más fustrante (por no poder escribir la palabra que realmente describe mi estado de animo) que sentarse a trabajar en una idea y encontrarse conque las herramientas no funcionan.

En este caso estoy tratando de liberar código (ya probado un millón de veces) desde Sentilla Eclipse hacia el mote. Pero Eclipse se tira 3 peos:


5:31:03: serial@ftd/M4ASU2W5:115200: resynchronising

Use replacement opcodes
5:31:20: PacketHandler started.
5:31:20: MimeoConnectionListener starting
5:31:20: HostConnectionListener starting
5:31:20: HostCollectionThread started.
5:31:20: Creating CollectionProtocol Ack listener...
5:31:20: Server started.
5:31:20: Listening on: 127.0.0.1:9002
5:31:20: Listening on: 127.0.0.1:10004
5:39:23: Error linking: class file missing:
5:39:23: Failed to install app

En vez de escribir código ahora estoy soportando el entorno de desarollo :(

Curiosamente me conseguí con un error en la bitacora del servidor, un error de arranque:

Parece un problema de arranque del servidor de Sentilla en OSX:


auyan:SentillaWork-1.1.01 josevnz$ tail -f log/hostserver.log
6:34:42: serial@ftd/M4ASU2W5:115200: resynchronising

serial@ftd/M4ASU2W5:115200: resynchronising
Use replacement opcodes
6:34:59: PacketHandler started.
6:34:59: MimeoConnectionListener starting
6:34:59: HostConnectionListener starting
6:34:59: HostCollectionThread started.
6:34:59: Creating CollectionProtocol Ack listener...
6:34:59: Server started.
6:34:59: Listening on: 127.0.0.1:9002
6:34:59: Listening on: 127.0.0.1:10004
java.io.FileNotFoundException: com.sentilla.mote.clientservices.ClientServices.oos (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at com.sentilla.virtual.ImageEnvironment$Image.init(ImageEnvironment.java:179)
at com.sentilla.virtual.ImageEnvironment$Image.(ImageEnvironment.java:206)
at com.sentilla.virtual.ImageEnvironment.addImage(ImageEnvironment.java:317)
at com.sentilla.virtual.HostService$MimeoSync.completed(HostService.java:204)
at com.sentilla.net.mimeo.ProxyImage.completed(ProxyImage.java:164)
at com.sentilla.net.mimeo.ProxyImage$Slingshot.completed(ProxyImage.java:114)
at com.sentilla.net.mimeo.MimeoImage.writePage(MimeoImage.java:55)
at com.sentilla.net.mimeo.ProxyImage$Slingshot.writePage(ProxyImage.java:107)
at com.sentilla.net.mimeo.Mimeo.process_outputs(Mimeo.java:501)
at com.sentilla.net.mimeo.Mimeo.run(Mimeo.java:790)
at java.lang.Thread.run(Thread.java:613)
6:35:22: mimeoImageComplet: 600949431; {binHashId=600949431, user=josevnz, mimeoSlot=1, imageData=com.sentilla.net.mimeo.ProxyImage$Slingshot@7d51a6, host=auyan.local, binary=com.sentilla.net.mimeo.ProxyImage$Slingshot@7d51a6, size=2450, date=Sat Oct 18 06:15:51 EDT 2008, name=com.sentilla.mote.clientservices.ClientServices}

Curiosamante esto comenzó a ocurrir después de un parche de seguridad liberado por Apple hace poco. Sin emnargo no puedo probar que esten relacionados. Voy a probar desde Windows.

Buscar en otros sitios:

Blogalaxia:, ,
Technorati:, ,
To2blogs:, ,
Del.icio.us:, ,

Sin categoría , ,

AguaYFuego: Sitio de Source Forge está listo

Lunes, 13 de Octubre de 2008

Bueno, lo prometido es deuda, el código ya está disponible en CVS. Las instrucciones de como obtener el código de CVS están aquí.

Buscar en otros sitios:

Blogalaxia:, , ,
Technorati:, , ,
To2blogs:, , ,
Del.icio.us:, , ,

java, kodegeek , ,

AguaYFuego: Es oficial

Domingo, 12 de Octubre de 2008

AguaYfuego
AguayFuego, concepto inicial

Si, es oficial. AguaYFuego ahora tiene un hogar en Sentilla Labs. Pienso colocar el código fuente completo bajo la licencia Apache en Source Forge usando CVS (más adelante migraré a subversion pero estoy más interesado en echar código que en aprender otra herramienta para controlarlo).

Esten pendientes, estoy esperando que me aprueben la página del proyecto en Source Forge.

Enlaces:

NOTA: Si quiere colaborar en el proyecto ponganse en contacto conmigo. La idea es divertirse y aprender haciendo :)

Buscar en otros sitios:

Blogalaxia:, , ,
Technorati:, , ,
To2blogs:, , ,
Del.icio.us:, , ,

java, kodegeek , ,

Sentilla: Agua y fuego

Domingo, 5 de Octubre de 2008

Estoy escribiendo una pequeña aplicación para Sentilla Labs. Comencé primero escribiendo una pequeña aplicación para calibrar el sensor (algo que no habia resuelto muy bien hace tiempo atrás). Lo cierto es que primero usted debe averiguar la temperatura del sitio del cual piensa sacar las medidas, usando quizas el termostato de su casa y luego corre esto desde Sentilla Works (el ide de Eclipse):

 1 package com.kodegeek.app.aguayfuego; 2 3 import static javax.measure.unit.SI.CELSIUS; 4 5 import javax.measure.quantity.Temperature; 6 7 import com.sentilla.system.Leds; 8 import com.sentilla.system.LedsDriver; 9 import com.sentilla.system.PropertyDriver;10 import com.sentilla.system.Sensor;11 import com.sentilla.system.SensorDriver;1213 /**14  * Calibrate the sensor using a known value15  * @author josevnz@kodegeek.com - http://kodegeek.com16  */17 public final class SensorCalibration {18 19  /**20   * Persist the calibration temperature tobe used by all the applications21   * @throws InterruptedException22   */23  public static void motemain() throws InterruptedException {24   Sensor <Temperature>tempSensor =SensorDriver.create("temp", Temperature.class);25   Leds leds = LedsDriver.create();26   float calibratedTemp = 25.0f; //Put here your known temperature27   leds.toggle(1);28      double delta = calibratedTemp -tempSensor.read().doubleValue(CELSIUS);29   PropertyDriver.create("aguayfuego_temp_init", 8).writeDouble(delta);30      leds.toggle(0);31  }32 }

Guardamos el valor en la lína 49. Una vez que usted corra este programa (solamente hace falta si sospecha que la temperatura de su cuarto ha cambiado mucho) entonces puede comenzar a capturar las temperaturas de nuevo. Fijense en el detalle de como se envia la temperatura, más el “delta” el cual contiene el ajuste:

 1 package com.kodegeek.app.aguayfuego; 2 3 import static javax.measure.unit.SI.CELSIUS; 4 import javax.measure.quantity.Temperature; 5 import com.sentilla.net.Mac64Address; 6 import com.sentilla.net.Sender; 7 import com.sentilla.net.SenderDriver; 8 import com.sentilla.system.Leds; 9 import com.sentilla.system.LedsDriver;10 import com.sentilla.system.PropertyDriver;11 import com.sentilla.system.Sensor;12 import com.sentilla.system.SensorDriver;1314 /**15  * Simple class to capture temperature usingSentilla JMote16  * @author josevnz@kodegeek.com - http://kodegeek.com17  */1819 public final class TemperatureCapture {20  public static final int WAIT_TIME = 1000;2122  /**23   * Get the temperature reading24   * @throws InterruptedException25   */26  public static void motemain() throws InterruptedException {27   Sensor <Temperature>tempSensor =28    SensorDriver.create("temp", Temperature.class);29   Leds leds = LedsDriver.create();30   long id = Mac64Address.getLocalAddress().longValue();31   Sender sender = SenderDriver.create("local");32   short count = 0;33      TempMessage datamsg = new TempMessage();34      datamsg.moteId = id;35      leds.toggle(0);36      double delta = PropertyDriver.open("aguayfuego_temp_init").readDouble();37   while(true) {38    count++;39    datamsg.count = count;40    datamsg.tempCelcius = tempSensor.read().doubleValue(CELSIUS) + delta;41    leds.toggle(1); // Show the user the sensor is alive42    sender.send(datamsg);43    Thread.sleep(WAIT_TIME);44   }45  }46 }

La línea 36 lee el delta y la 40 lee la temperatura con la corrección. Después la transmitimos en la linea 42.

Finalmente el cliente que lee los valores de los sensores (Esta es una aplicación común y silvestre de Java):

 1 package com.kodegeek.app.aguayfuego; 2 3 import java.io.IOException; 4 import java.util.Map; 5 import java.util.concurrent.ConcurrentHashMap; 6 import java.util.logging.Level; 7 import java.util.logging.Logger; 8 import com.sentilla.host.client.HostClient; 9 import com.sentilla.net.Receiver;10 import com.sentilla.net.ReceiverDriver;1112 /**13  * Simple command line client that collectsthe temperature readings of14  * all the motes in the wireless network.15  * @author josevnz@kodegeek.com - http://kodegeek.com16  */17 public final class TemperatureClient {1819  private TemperatureClient() {};2021  private static final Logger log =Logger.getLogger(TemperatureClient.class.getName());2223  static {24   log.setLevel(Level.INFO);25  }2627  private static final int MOTE_WAIT = 3000;2829  /**30   * Helper class that captures the temperaturecomming from the sensor31   * @author josevnz32   */33  class TemperatureCaptureHelper {34   public final Map <Long, TempMessage>sensorMap;35  36   /**37    * Parametric constructor38    * @param sensorMap Map to store all the captured temperatures39    */40   public TemperatureCaptureHelper(Map <Long, TempMessage>sensorMap) {41    this.sensorMap = sensorMap;42   }43  44   public void capture() {4546    // Connect to the Sentilla server47    HostClient client = new HostClient();48    try {49     client.connect();50     log.log(Level.INFO,String.format("Connected to sensor gateway at %s,capturing temperatures",client.getHost()));51     Receiver receiver =ReceiverDriver.create(TempMessage.class);52     while(true) {53      receiver.setReceive().submit().block(MOTE_WAIT);54      if (receiver.isDone()) {55       TempMessage tmsg= receiver.getData();56       sensorMap.put(tmsg.moteId, tmsg);57       log.log(Level.INFO, String.format("Update from sensor id: %s, %.3f",tmsg.moteId, tmsg.tempCelcius));58      } else {59       log.log(Level.INFO, "No update");60      }61     }62    } catch (IOException ioExp) {63     log.log(Level.SEVERE, "Severe error, response will be dropped", ioExp);64    } finally {65     try {66      if (client != null)67       client.disconnect();68     } catch (IOException ioExp) {69      log.log(Level.SEVERE,"Error while closing sensor connection", ioExp);70     }71    }72   }73  }74 75  /**76   * Collect the statistics from all the motes77   * @param args Unused78   */79  public static void main(String[] args) throws Throwable {80   log.log(Level.INFO, "Starting TemperatureService");81   final TemperatureClient instance = new TemperatureClient(); 82   try {83    final Map <Long, TempMessage>temperatures= new ConcurrentHashMap<Long, TempMessage>();  84    TemperatureCaptureHelper helper = instance.new TemperatureCaptureHelper(temperatures);85    helper.capture();  86   } catch (Throwable throwbl) {87    log.log(Level.SEVERE, "Fatal error, no recover possible", throwbl);88    throw throwbl;89   }90  }91 }

Una vez resuelto esto puedo comenzar con la nueva aplicación. El código no está disponible en CVS, en algún momento colocaré todo para que se lo bajen. Mientras tanto les dejo esto para que se entretengan :)

Buscar en otros sitios:

Blogalaxia:, , , ,
Technorati:, , , ,
To2blogs:, , , ,
Del.icio.us:, , , ,

java, kodegeek , , , ,

Sentilla Perk: La experiencia Mac OSX

Viernes, 5 de Septiembre de 2008

Perk from Sentilla
Al fin, puedo programar mi Perk desde OSX

Esta semana me decidí a instalar OSX Leopard en la Laptop de mi esposa Veronica y en mi computadora de escritorio; La experiencia fué simplemente indolora (no recuerdo que ninguna actualización de Windows o Linux halla ido tan bien). La razón de la actualización tuvo más que ver con el hecho de que necesito utilizar Java 6 es OSX y no tengo tiempo para jugar con OpenJDK.

Con este cambio ahora puedo bajarme también el Kit Perk de Sentilla para OSX, el cual fué liberado recientemente (Agosto 22).

¿Las instrucciones de instalación? Sencillas:

Mac OS X Distribution of Sentilla Work
———————————–

Version: 1.1.1 for Mac OS X

Tested on Mac OS X 10.4.11 and 10.5.4. Please see the release notes in SentillaWork/docs for more complete installation instructions and limitations.

Prerequisites:
- Mac OS X Tiger or Leopard
- Java 1.5 or higher

To install:
1. Install prerequisites.
2. Untar the archive
3. cd into the resulting directory.
4. Run “sudo ./install.sh”.

To run the Sentilla Host Server:
1. Run the hostserver with “./sentilla-hostserver”.
2. The server can be shut down using it’s PID: kill -9 `cat log/hostserver.pid`

To run the SentillaWork IDE:
1. Run the IDE with “./sentilla-work”.

To uninstall:
1. Run “sudo ./uninstall.sh”.
2. Delete the Sentilla directory and tar file.

This is NOT free software. Please see the included LICENSE.txt file for
licensing information.

Aunque por otro lado, hubiera sido mucho mejor hacer un paquete (.app), ¿no es así?. Dejando esa queja de un lado, me decidí a revisar el instalador (install.sh), buscando la parte en la cual instalan un manejador de dispositivos USB compatible con el Gateway:

if [ -e /System/Library/Extensions/FTDIUSBSerialDriver.kext ]; then
echo “FTDI VCP driver found; moving to /System/Library/Extensions.disabled”
if [ ! -e /System/Library/Extensions.disabled ]; then mkdir /System/Library/Extensions.disabled; fi
mv /System/Library/Extensions/FTDIUSBSerialDriver.kext /System/Library/Extensions.disabled/
echo “Please restart your system and run install.sh again.”
exit 1
fi

Ajá, aquí esta la vaina. Se ve sencillo, así que puedo dejar que el script haga el daño. Sin embargo (y en un acto de precaución raro en mi) me decidí también leerme la documentación en PDF especifica para OSX.

Ahh, bueno, resulta que la versión de Mac tiene cosas que no funcionan como en la versión de Windows, sin embargo no son tan importantes. Pero me molesto que cuando traté de instalar una aplicación desde Sentilla Eclipse, me dió el siguiente error:

5:31:25: Exception at node 00:12:75:00:11:e4:2d:75: BIN num: abd13878CLASS num: 54
at : BIN num: abd13878; methodNum: 292; pc: 665
at : BIN num: abd13878; methodNum: 172; pc: 34
at : BIN num: 722bd3fd; methodNum: 671; pc: 18
at : BIN num: 722bd3fd; methodNum: 839; pc: 48
at : BIN num: 722bd3fd; methodNum: 664; pc: 41

La versión de OS X pareciera hecha a los trancazos; El programa que se usa para correr el servidor de sentilla es super sencillo, sin embargo no tiene manera de matar al demonio (lo tiene que hacer usted con ‘kill’).

No estoy muy impresionado, vamos a ver que tan lejos llego el el foro de soporte de Sentilla.

Buscar en otros sitios:

Blogalaxia:, , ,
Technorati:, , ,
To2blogs:, , ,
Del.icio.us:, , ,

Sin categoría , , ,

Generando gráficos de temperatura en Swing

Sábado, 28 de Junio de 2008

Sentilla Swing temperature display - Time Series
Ahora usted puede saber la temperatura de la sala de mi casa :)

Bueno, seguí jugando con Sentilla Perk y Swing; Esta vez terminé de acomodar al cliente gráfico que muestra los datos en una tabla, al mismo tiempo que genera gráficos de temperatura capturados por cada sensor (código fuente aquí).

Aún tengo un par de problemas:

  • No he calibrado los sensores, uno de ellos siempre mide en el rango de las 20 grados Celcius mientras que el otro está en los 30.
  • JFreeChart me tiene confundido con la gráfica, tengo un problema extraño de refrescamiento de pantalla.

Sentilla Swing temperature display - raw data in table
No es perfecto, pero los resultados son interesantes

Sin embargo no me tomó mucho tiempo montar esto, y cada vez se pone más divertido. Voy a preguntar a otros desarrolladores más expertos en el foro de Sentilla a ver que tal :)

Buscar en otros sitios:

Blogalaxia:, , , ,
Technorati:, , , ,
To2blogs:, , , ,
Del.icio.us:, , , ,

kodegeek , , , ,

Midiendo la temperatura con Sentilla: Un cliente gráfico

Miércoles, 11 de Junio de 2008

Bueno, no tengo mucho tiempo para escribir estos días (la semana ha estado muy movida en el área de finanzas), así que les traigo una pequeña pieza de código en la cual capturo la temperatura de los sensores de Sentilla (sí, código viejo) para ponerla de inmediato en un cliente escrito en Swing, el cual utiliza un TableModel el cual dispara las actualizaciones usando un Thread que corre en paralelo.

Sin embargo la noticia principal es que este blog se va de vacaciones, por dos meses. Así es, se me ha presentado una oportunidad para la cual tengo que enfocar todos mis esfuerzos si quiero salga bien.

Si, cero Facebook, cero Google reader con mis RSS, cero blog, cero distracciones. Como dicen por acá “do or die” :)

Así que no se desesperen, comenten mucho y escriban correos (yo les prometo responder) y sobre todo, no se preocupen por el blog, este no va a desaparecer ;)

Se despide por los momentos,

- José, “KodeGeek”

Buscar en otros sitios:

Blogalaxia:, , ,
Technorati:, , ,
To2blogs:, , ,
Del.icio.us:, , ,

java, kodegeek , , ,

Sentilla tiene soporte para OSX y Linux Ubuntu

Viernes, 6 de Junio de 2008

Ya sacaron el beta. Del foro oficial de Sentilla:

NEW! Sentilla Work (Beta) for Mac and Linux

Downloads of the Beta release of Sentilla Work for both Mac OS X and Ubuntu Linux are now available for current Perk customers at the following URLs:

  • Sentilla Work (Beta) for Linux
  • Sentilla Work (Beta) for Mac OS X

Go to the URL for your OS of choice and login as

XXXXXX

and use the password

ZZZZZZZZ

After you download the release to your computer and expand the files, refer to the Release Notes included with the builds for installation instructions (page 10) and important notices. You do not need to reinstall mote firmware for this release; your current Perk firmware will work on both the Mac OS X and Linux platforms.

Note that you cannot install firmware with the Mac OS X release.

Christine at Sentilla

Los instalaré en algún momento el fin de semana, vamos a ver que tal se porta.

Buscar en otros sitios:

Blogalaxia:, , , ,
Technorati:, , , ,
To2blogs:, , , ,
Del.icio.us:, , , ,

kodegeek , , , ,

KodeGeek @ Sentilla Blog

Lunes, 26 de Mayo de 2008

Wow, the Sentilla folks noticed my video on YouTube with the mote and they wrote a nice summary about it.

I promise to write more posts in English on the near future :)

Other links of interest:

Blogalaxia:, ,
Technorati:, ,
To2blogs:, ,
Del.icio.us:, ,

kodegeek , ,