Monday, December 15, 2014

A web configurable Xively logger, build on AVR ATmega328

Xively (formerly Cosm and before that Pachube) is a platform devoted to simplifying the interconnection of devices and data with applications on the Internet of Things. It is an on-line database service allowing developers to connect sensor-derived data (e.g. energy and environment data from objects, devices & buildings) to the Web and to build their own applications based on that data.



This embedded platform is a modular and configurable Xively data logger, built on an ATmega328 micro, usefull to send datapoints to your xively feed.


It has a network interface, so you can configure it using any browser, just pointing to the device address.
Network can be configured in two way:
  • Static IP, Gateway, NET Mask
  • DHCP
The Xively API Key and feed id can also be modified though the network interface.
Those parameters can be usefull if you want to build many devices with same sensors, and then connect it over different xively feed, without compiling and uploading a new hex.


Every sensor module can add one or more configuration parameter, you can implement it in the configuration modules files.

To make this platform easly expandable, the portion of code that gets data from sensor has been divided from the other code.
Every sensor module must "implements" (we are not using class here, but i'm using a object oriented term) some functions. Every sensor module, must be registered it in the checkdata.c file.
Every module must implements a set of function with strongly name rules, every function name must ends with a terminal string, depending on what the function implements. Of course even function parameters must comply with the one expected by checkdata.c file:
  • _init(void): called at startup to initize the sensor
  • _mstick(void): called every 1ms
  • _update(void): called every cycle to update the sensor data
  • _reset(void): called to reset the module
  • _xivelygetdata(char *): get the string data that will be posted to xively
  • _xivelypostret(enum checkdata_xivelypostretE): called after the data is posted to xively
  • _eeprominit(void): called if eeprom was never initialized
  • _eepromread(void): called on every starup to read sensor module eeprom parameter
  • _eepromwrite(void): called after data is saved
  • _wwwform(uint8_t[], uint16_t): get the html data that will be shown on the sensor network configuration
  • _wwwformret(char *): called on save of the sensor network configuration
As example, take a look at the checkdata_module01.c and checkdata_module01.h files, and their registration point on checkdata.c. Use the one provided as a startup point to create your own function module.

Other configuration parameters are available on main.h file.
The network sensor configuration page, can be enabled or disabled. Even the entire nework configuration can be enabled or disabled.

The hardware used is an ATmega328, running at 16Mhz.
The network board used is a cheap EC28J60 one.
Sample schematics is proposed above:



A PCB has been developed on top of the use of the Arduino Pro Mini board, to speed up the deploy of logger boards.
The full file are provided as dowload.


I'm actually using it from 2 years (it was previously named cosm logger), logging different things: air quality, solar water heating system. Mine is the one you can see below:



So i've written modules for many sensor:
  • temperature
  • AC current
  • luminosity
  • and many other

Code

Notes
  • read risk disclaimer
  • excuse my bad english

Friday, December 5, 2014

osCommerce to Amazon items synchronization

--ref 2012

osc2amazon is an osCommerce contribution which allow the synchronization from your osCommerce shop to your Amazon shop.
This contribution is completely web-based, it uses the amazon API to synchronize items.
It's released as an open source package under GPL license.


Download

Notes
  • read risk disclaimer
  • excuse my bad english