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
Last revisionBoth sides next revision
uberbus:moodlamp [2011/02/10 22:34] 2001:a60:10ff:c401:4eed:deff:fe2d:4546uberbus:moodlamp [2015/12/02 20:32] – [Preparations] 9r
Line 1: Line 1:
-To use moodlamps with the IPv6 enabled uberbus you have to follow the steps outlined on this page.+To use moodlamps with the IPv6 enabled [[start|uberbus]] you have to follow the steps outlined on this page.
  
 ====== Preparations ====== ====== Preparations ======
Line 5: Line 5:
  
 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: 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:
 +
 +:!: Note: There seems to be an obscure issue with current versions (tested with 4.9.2 and 5.2.0) of gcc that results in non-functional firmware even though the build process finishes successfully. Working firmware can be build using gcc 4.5.3 included in e.g. ubuntu precise.
  
 <code> <code>
-apt-get install gcc-avr avr-libc avrdude make subversion +apt-get install gcc-avr avr-libc avrdude make git 
-svn co https://brezn.muc.ccc.de/svn/uberbus/ +git clone git://github.com/muccc/uberbus.git 
-cd uberbus/trunk/fimrware/moodlamp-rf+cd uberbus/fimrware/moodlamp-rf
 make make
 </code> </code>
Line 29: Line 31:
 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: 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:
  
-TODOinsert picture+{{:uberbus:moodlamp_rf-jumper.jpg?250}}
  
 ====== Software ====== ====== Software ======
Line 45: Line 47:
  
 <code> <code>
-cd uberbus/trunk/software/simplelamp+cd uberbus/software/simplelamp
 ./simplelamp.py /dev/ttyUSB0 ./simplelamp.py /dev/ttyUSB0
 </code> </code>
  
-The simplelamp server resets your lamp and put it into the bridge mode. It now transmits on its RS485 and wireless(if enabled) interfaces.+The simplelamp server resets your lamp and puts it into the bridge mode. It now transmits on its RS485 and wireless(if enabled) interfaces. 
  
-Commands transmitted to 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+==== 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. parameters of the lamp can be queried by scripts trying to access the lamp.
  
-Commands transmitted to the server via UDP will also be sent to the lamp attached at the USB. They are also forwarded to other lamps connected via RS485+==== 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. 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. 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. 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 ===== ===== ubd =====
-When running installation using ubd have a look at its wiki page for instructions.+When running an installation using ubd have a look at its [[uberbus:ubd|wiki page]] for instructions.
  
 ====== Clients ====== ====== 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 ubd page to learn more about the format)+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: Currently there are two folders with example scripts for lamps attached to the uberbus:
 ===== Python clients ===== ===== Python clients =====
-Under uberbus/trunk/software/pythonlib a small library to access the uberbus and lamps attached to the ueberbus is provided.+Under uberbus/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 See the Readme file included in this directory on how to use those scripts. TODO: create Readme file
Line 74: Line 99:
 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: 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> <code>
-uberbus/trunk/software/pythonlib/fade.py <IPv6 address of lamp> <Red value> <Green value> <Blue value> <Time in seconds>+uberbus/software/pythonlib/fade.py <IPv6 address of lamp> <Red value> <Green value> <Blue value> <Time in seconds>
 </code> </code>
  
 The fadeexample script fades a lamp in a loop by sending fade commands to an IPv6 address associated with a lamp. The fadeexample script fades a lamp in a loop by sending fade commands to an IPv6 address associated with a lamp.
 <code> <code>
-uberbus/trunk/software/bashscripts/fadeexample <IPv6 address of lamp> <Time in seconds>+uberbus/software/bashscripts/fadeexample <IPv6 address of lamp> <Time in seconds>
 </code> </code>
  
Line 88: Line 113:
  
 ===== bash clients ===== ===== bash clients =====
-Under uberbus/trunk/software/bashscripts some examples using bash and netcat are provided.+Under uberbus/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. The blink script blinks a lamp by sending color commands via UDP to an IPv6 address associated with a lamp.
  
 <code> <code>
-uberbus/trunk/software/bashscripts/blink <IPv6 address of lamp>+uberbus/software/bashscripts/blink <IPv6 address of lamp>
 </code> </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 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. they receive the commands.