Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uberbus:moodlamp [2011/02/13 10:03] – udev rules 2001:a60:10ff:c401:4eed:deff:fe2d:4546uberbus:moodlamp [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-To use moodlamps with the IPv6 enabled uberbus you have to follow the steps outlined on this page. 
  
-====== Preparations ====== 
-After building a moodlmap the controller is (curently) flashed with a MLD compatible firmware. 
- 
-To use the lamp with the uberbus a new firmware has to be flashed. To build your new firmware follow these steps on a Debian based Linux computer: 
- 
-<code> 
-apt-get install gcc-avr avr-libc avrdude make subversion 
-svn co https://brezn.muc.ccc.de/svn/uberbus/ 
-cd uberbus/trunk/fimrware/moodlamp-rf 
-make 
-</code> 
- 
-If your lamp has an USB connector you can now flash your lamp using the bootloader. 
- 
-Unplug your lamp and execute the following command: 
-<code> 
-make bootload 
-</code> 
-Now connect your lamp to the computer. It will be automatically updated with the new firmware. 
- 
-If your lamp has no USB connection but only a RS485 or RF option you have to flash your lamp using a programming adapter. 
-Configure the defaults in your /etc/avrdude/avrdude.conf according to your programmer and run: 
-<code> 
-make program 
-</code> 
- 
-If your lamp has a RF chip you have to set the jumper JP1 on the 6 pin connector on the bottom of the lamp to enable it. See the following picture: 
- 
-TODO: insert picture 
- 
-====== Software ====== 
-The uberbus uses an IPv6 based communication protocol. If you want to set up your moodlamp(s) to be controlled with uberbus compatible programs you 
-have two options: 
-    - If you have only one lamp connected to the USB or want all your lamps to to the same you can use the simplelamp server. 
-    - If you have more than one lamp and want them to perform different tasks you need to set up the uberbus daemon(ubd). This is a substantively more complex task than to set up a simplelamp server but provides more flexibility 
- 
-===== simplelamp server ===== 
-The simplelamp server connects to a single moodlamp connected via USB to a host computer. It opens TCP and UDP sockets on this computer to access the lamp. 
- 
-The server is written in Python. It requires a python version with IPv6 enabled. Most Python version shipped with desktop Linux distributions have this enabled but Python supplied by OpenWRT or other small distributions may have this option disabled. In this case try using ubd. 
- 
-To start the server get the project from the subversion repository as described in section preparations. Connect your lamp and perform the following steps: 
- 
-<code> 
-cd uberbus/trunk/software/simplelamp 
-./simplelamp.py /dev/ttyUSB0 
-</code> 
- 
-The simplelamp server resets your lamp and puts it into the bridge mode. It now transmits on its RS485 and wireless(if enabled) interfaces.  
- 
-==== TCP ==== 
-Commands transmitted to the server via TCP will be forwarded to the lamp attached to the USB. They are acknowledged by the simplelamp server when arriving at the lamp. Currently no data from the lamp will be sent back through the TCP connection. This means no information about the version, voltage or other 
-parameters of the lamp can be queried by scripts trying to access the lamp. 
- 
-==== UDP ==== 
-Commands transmitted to the server via UDP will also be sent to the lamp attached at the USB. They are forwarded to other lamps connected via RS485 
-or in range of the wireless transmitter. They are not acknowledged by the server and are not guaranteed to arrive at all lamps. 
- 
-Keep this in mind when sending single commands to other lamps. Some might not get the command and won't respond. 
-If this is critical to your application try sending the same command multiple times or use ubd to transmit the command to every lamp separately. 
- 
-==== Surviving A Suspend==== 
-If you use your moodlamp with an desktop computer or a laptop you might be using the suspend or hibernate feature of your 
-linux distribution. The simplelamp server always tries to open the serial port specified in its command line. But with the 
-computer resuming the path to the device might change. To prevent this a udev rule has to be set up which always creates the 
-device under the same path. 
- 
-First you have to find the unique serial number of the USB chip on your moodlamp. 
- 
-Execute the following with your lamp attached to the computer: 
-<code> 
-udevadm info -a -p `udevadm info -q path -n /dev/ttyUSB0` | grep ATTRS\{serial 
-</code> 
-The first line returned contains the serial number. 
- 
-Now execute the following line an insert the serial number of your device: 
-<code> 
-echo ATTRS{serial}=="<serial number from above>", SYMLINK="moodlamp", GROUP="tty", MODE="0660" | sudo tee /etc/udev/rules.d/23-moodlamp.rules 
-</code> 
- 
-Now the moodlamp will always be created as /dev/moodlamp. You can use this path with the simplelamp server. 
- 
-===== ubd ===== 
-When running an installation using ubd have a look at its wiki page for instructions. 
- 
-====== Clients ====== 
-All clients work with a full blown ubd installation as well with a simplelamp server. They all use the packet format specified by the uberbus.(See the uberbus page to learn more about the format) 
- 
-Currently there are two folders with example scripts for lamps attached to the uberbus: 
-===== Python clients ===== 
-Under uberbus/trunk/software/pythonlib a small library to access the uberbus and lamps attached to the ueberbus is provided. 
- 
-See the Readme file included in this directory on how to use those scripts. TODO: create Readme file 
- 
-A simple example to fade a lamp to a specified color in a specified time is fade.py. You can use it the following way: 
-<code> 
-uberbus/trunk/software/pythonlib/fade.py <IPv6 address of lamp> <Red value> <Green value> <Blue value> <Time in seconds> 
-</code> 
- 
-The fadeexample script fades a lamp in a loop by sending fade commands to an IPv6 address associated with a lamp. 
-<code> 
-uberbus/trunk/software/bashscripts/fadeexample <IPv6 address of lamp> <Time in seconds> 
-</code> 
- 
-When using the simplelamp server the IPv6 address of the lamp any IPv6 address of the host computer and only the lamp attached via USB 
-will start to fade. 
- 
-The color values and the time are specified in decimal notation(0...255) 
- 
-===== bash clients ===== 
-Under uberbus/trunk/software/bashscripts some examples using bash and netcat are provided. 
- 
-The blink script blinks a lamp by sending color commands via UDP to an IPv6 address associated with a lamp. 
- 
-<code> 
-uberbus/trunk/software/bashscripts/blink <IPv6 address of lamp> 
-</code> 
- 
-When using this script with the simplelamp server all lamps connected via RS485 or in reach of the wireless transmitter will start to fade if 
-they receive the commands. 
  • uberbus/moodlamp.1297591426.txt.gz
  • Last modified: 2021/04/18 12:33
  • (external edit)