en:pymlab
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | en:pymlab [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
+ | ====== Universal communication library pymlab ====== | ||
+ | |||
+ | It is software package wich allows creation of sensor network based on RS232, I²C, Ethernet and USB interfaces. It is the first experimental implementation of [[en: | ||
+ | |||
+ | The function principle is based on definig of the network structure and addresses of each network node. Whole configuration is described in configuration file of the control software which is usually writen in Python. | ||
+ | Physical routing between I2C bus segments which contains sesnors with the same i2c addersses, is realised by [[cs: | ||
+ | Source files of the library and use examples you can found in [[https:// | ||
+ | |||
+ | The result is a opportunity | ||
+ | |||
+ | ===== Installation ===== | ||
+ | |||
+ | If you use Python package version of pymplam you should execute this command. | ||
+ | |||
+ | sudo easy_install pymlab | ||
+ | | ||
+ | or | ||
+ | sudo pip install pymlab | ||
+ | |||
+ | Both commands are equivalent and uses the [[https:// | ||
+ | |||
+ | sudo apt-get install libudev-dev libusb-1.0-0-dev libhidapi-dev python-setuptools python-smbus cython | ||
+ | |||
+ | If you need to use USB as connetion interface for the device you should use the [[en: | ||
+ | |||
+ | |||
+ | ==== Development version ==== | ||
+ | |||
+ | Up to date version of pymlab library is on gitbub. We should install it in the system in order of the library development. | ||
+ | |||
+ | git clone https:// | ||
+ | git checkout dev | ||
+ | sudo python setup.py develop | ||
+ | |||
+ | User usualy needs permissions to access the I²C and USB bus. Therefore user must be added to i2c group by: | ||
+ | sudo adduser kaklik i2c | ||
+ | |||
+ | The change will take effect on a next user login. | ||
+ | ===== TODO ===== | ||
+ | |||
+ | ==== Graphical interface ==== | ||
+ | Graphical interface to the pymlab library will be usefull for defining of network topology and ploting of graphs from sensors connected to network. One possible software which could be used is [[http:// | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ===== ARM STM32 Python interpreter ==== | ||
+ | |||
+ | The latest version of Pymlab is compatible with the [[https:// | ||
+ | |||
+ | === Example === | ||
+ | |||
+ | <file python main.py> | ||
+ | import pymlab.config | ||
+ | |||
+ | cfg = pymlab.config.Config(i2c={" | ||
+ | | ||
+ | {" | ||
+ | {" | ||
+ | cfg.initialize() | ||
+ | |||
+ | altimet = cfg.get_device(" | ||
+ | altimet.route() | ||
+ | light = cfg.get_device(" | ||
+ | light.config(0x0000) | ||
+ | sht = cfg.get_device(" | ||
+ | sht.soft_reset() | ||
+ | |||
+ | t1, p = altimet.get_tp() | ||
+ | l = light.get_lux() | ||
+ | t2, h = sht.get_TempHum() | ||
+ | </ | ||
+ | |||
+ | === Tips & Tricks === | ||
+ | |||
+ | Resources (Flash and RAM) embedded systems are typically quite limited, the whole pymlab module does not fit to the flash memory available on the [[http:// | ||
+ | |||
+ | Fortunately MicroPython provides cross compiler that allows us to compile the source code to bytecode and therefore reduce the RAM and flash usage. | ||
+ | |||
+ | Version of the cross compiler must match the version of MicroPython running on your board. If in doubt just compile and flash your board with firmware compiled from the same branch of the [[https:// | ||
+ | |||
+ | <code sh> | ||
+ | $ git clone https:// | ||
+ | $ cd micropython | ||
+ | $ git checkout UPY_VERSION # This is very important! | ||
+ | $ # Optional compiling and flashing of the firmware | ||
+ | $ cd mpy-cross | ||
+ | $ make | ||
+ | </ | ||
+ | |||
+ | In Makefile at [[https:// | ||
+ | |||
+ | make deploy | ||
+ | |||
+ | and you are good to go. |
en/pymlab.txt · Last modified: 2017/12/14 23:43 (external edit) · Currently locked by: 65.108.99.55