|
After finishing my original moodlamp project I started thinking about improving the design. The new design had to include the following features:
|
The fnordlicht project
Especially the last two points are already well implemented by the fnordlicht project over at lochraster.org.
Among other things this project features:
-
a 16bit PWM to drive the LEDs which is a major improvement over the simple 8bit PWM used by my previous project
-
a basic scripting language which allows simple composition of effects
As the fnordlicht firmware is way more advanced than my old code I
don't use it anymore.
Instead I grabbed revision 59 from the fnordlicht-ng repository and
based
my firmware on it.
The public fnordlicht code has only a minimalistic support for IR
remotes. This is where most of the new code went.
The fnordlicht firmware supports a simple scripting language. These
scripts are located inside the scripts.h header file. You can add new
scripts to this file. If you do so please put them online somewhere or
send them to me, so everyone can enjoy them. The syntax is simple and
quite straight forward.
New Features
A list of the new features: (from the README file)
- Dimming the lamp.
- Powering down the lamp and resuming at the same state.
- Storing default values in the internal eeprom, which are used at startup.
- Selection of the running script.
- Pausing the running script.
- Adjusting the speed of the script running.
- A sleep timer which dims the lamp over a period of time to zero brightness.
- The RGB value can be directly modified by the remote. If this is used while the lamp is paused, any color can be selected.
The original fnordlicht firmware has support for I2C and RS485 and
also uses a boot loader. These parts are still included in the source
but are not in
use in this design.
The remote control
You can in principle use any remote control that uses RC5 (a Phillips code). I used a programmable "universal" remote from the local electronics shop. When used with the setting "VCR1" it sends the RC5 address '6'. If your remote doesn't send this address or has not all buttons used by the firmware have a look at the rc5_handler.h and rc5.h header files.
rc5.h contains contains the codes my remote uses for its buttons.
You can
change them here according to your needs.
rc5_handler.h contains the definitions which link a button to a
specific function. Use this file to change the key bindings.
The address of the remote can be changed her too. If you don't know the address of you remote just set the RC5_USEANY macro and the address will be ignored and any RC5 remote will be recognized.
The standard key bindings:
| Key | RC5 code | Function |
|---|---|---|
| VCR1 | --- |
Select the moodlamp |
| Power | RC5_POWER | Power |
| 1 |
RC5_1 | Soft green flash |
| 2 |
RC5_2 | Hard RGB color change |
| 3 |
RC5_3 | Soft RGB color change |
| 4 |
RC5_4 | Soft red-blue color change |
| 5 |
RC5_5 | Green flash |
| 6 |
RC5_6 | Dual blue flash(police style) |
| Chan up | RC5_CHAN_UP | Max. brightness |
| Chan down | RC5_CHAN_DOWN | Min. brightness |
| Vol up | RC5_VOL_UP | Faster |
| Vol down | RC5_VOL_DOWN | Slower |
| Rec |
RC5_RECORD | Store the current state in the internal memory.
These settings are loaded at startup. (works also in power down) |
| Memo | RC5_MEMO | Sleep mode. The lamp dims slowly down and
enters standby. |
| Pause | RC5_PAUSE | Pause the current script |
| Red |
RC5_RED | Select red |
| Green | RC5_GREEN | Select green |
| Blue | RC5_BLUE | Select blue |
| Contrast up |
RC5_CONTRAST_UP | Set selected color to full brightness |
| Contrast down |
RC5_CONTRAST_DOWN | Set selected color to zero brightness |
| Color up | RC5_COLOR_UP | Increment the selected color. |
| Color down | RC5_COLOR_DOWN | Decrement the selected color. |
Building the firmware
Just use 'make' to build the firmware.
'make fuses' programs the correct fuses for an ATMega8 with an
external 16MHz crystal. Please calculate your own fuses if you use
another chip. Make sure to include the brown out detection to
prevent damage to the EEPROM when the power supply fails.
'make program' uses avrdude with the programmer selected(by default
avrisp910) in the
makefile to program the flash and the eeprom.
The hardware
This time the PCBs got manufactured by haka-lp.de.
The layout remained mostly unchanged. It is now truly dual sided and
uses cheap n-channel MOSFETs.
The layout is essentially the same. The IR receive uses the same
pins as the old remote control box of version 1.
The IR receiver is a TSOP1736 which is the standard IC if you want
to receive infrared signals. It is placed at the end of a short cable
so it can be put into a nice place where it gets the best view to the
remote. It so sensitive that even a wall reflecting to light of the
remote gives a good enough signal.
You can also place it inside the lamp, but the sensitivity drops a
little bit and you'll probably see a shadow.
The LED used is still the Prolight Power LED from led1.de.
This time the version with the common anode is used.
Please make sure that you use an adequate heat sink for this LED.
Inside the lamp the air flow is limited and most heat sinks have to be
mounted upside down, eliminating most of the usable surface.
The power supply used is this
ac adapter from Pollin.
Including the lamp from IKEA the whole stuff comes to about 40 Euro.
Pictures
The IR receiver sits at the end of a short cable so it can receive a good signal and leaves no shadow inside the lamp.
The top side of the PCB. The big capacitor is optional(Depends on
your power supply. Mine runs well without one)
The bottom side. The resistors are still bent into the lamp. If you
don't put the lamp on a heat sensitive surface you can leave them on
the PCB.
Files:
- Schematic and layout as eagle files and pictures
- The
firmware rev16
To Do
- Connect several lamps to a PC and control/program them.




