Just a quick update to point out that Sparkfun is now stocking these: http://www.sparkfun.com/products/11182 which should make it easier if you need to splice your own LED strips.
Archive for the 'Uncategorized' Category
This is part 2 of this post
I have decided to write this up as a seperate post, due to length.
There are 2 pieces of software required to get an Ambilight working; The program to run on the arduino and Boblight.
The code that runs on the Arduino was found here: https://github.com/michaelficarra/ambilight/blob/master/ambilight.ino
It can be run pretty much as-is, with one minor modification. To run with more than 32 LEDs, or faster than 30fps, the line
#define serialRate 38400
should be changed to
#define serialRate 115200
Here are the instructions on how to set up the required library (assuming you have the Arduino environment already installed)
$ SKETCHBOOK_PATH=$(grep ^sketchbook.path ~/.arduino/preferences.txt | cut -d = -f 2)
$ mkdir -p "$SKETCHBOOK_PATH/libraries"
$ cd /tmp
$ git clone git://github.com/arduino/Arduino.git arduino
$ mv arduino/libraries/SPI "$SKETCHBOOK_PATH/libraries"
$ rm -rf arduino
$ cd "$SKETCHBOOK_PATH/libraries"
$ git clone git://github.com/adafruit/WS2801-Library.git WS2801
This should install the SPI and WS2801 libraries required for the arduino code to run.
The boblight project page can be found here: http://code.google.com/p/boblight/
And the instructions for installation are as follows (taken from the Compiling guide on google code)
$ sudo apt-get install libx11-dev libgl1-mesa-dev libxrender-dev libxext-dev portaudio19-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev
$ cd ~
$ svn checkout http://boblight.googlecode.com/svn/trunk/ boblight-read-only
$ cd boblight-read-only
$ sudo make install
This should be all the software that is required to get an ambilight clone functioning. Boblight is made up of two components; The boblightd server which communicates with the Arduino and boblight clients which actually provide the colour data.
Boblightd requires a config file at /etc/boblight.conf and I have uploaded mine here
This defines which IP address and port boblightd listens on for clients.
prefix 55 AA 55 AA 55 AA 55 AA
#arduino bootloader runs when opening the serial port for the first time
#delay transmission one second after opening so we don't send shit to the bootloader
- name is a unique name for this boblight device
- output is the where the Arduino connection can be found
- channels is the number of LEDs * number of colours. In my case this is 64 * 3
- type is the protocol used to communicate colour data, and should be left as ‘momo’
- interval is how often updates are sent to the Arduino (in uS). 16600 is ~60 fps
- rate is the number of bits per second to send over the link to the Arduino. This must match the #define serialRate set in the arduino code.
- prefix is a string of bits sent between each frame of data
- allowsync enables real-time updating of the colour data. This means a quicker response time of the LEDs but will also lead to the LEDs being out of sync if the data rate to the Arduino isn’t high enough
Next, the colours of the LEDs are defined:
‘name’ and ‘rgb’ are fairly self-explanatory. ‘adjust’ is a value between 0.0 and 1.0 which allows the intensity of each colour to be calibrated. ‘blacklevel’ is the minimum brightness to be displayed on this channel; if the incoming colour is darker than this then display this brightness.
color red arduino 1
color green arduino 2
color blue arduino 3
vscan 94 100
hscan 94 100
This defines which area of the screen is assigned to which LED. The name is a unique name for each LED. The three colour lines define which colours the LED can display, which device the LED is attached to and the order of each colour component in the chain.
vscan and hscan define which area of the screen to average for that LED. 100% for the vscan is the bottom of the screen, and 100% for hscan is the right of the screen. In this case, the LED is matching the bottom right corner of the screen.
Testing it out
At this point, it should be possible to test out the ambilight system! The first test is displaying constant colours, using the boblight-constant client, which takes one argument. This is a hex string representing the RGB colour value to display.
First, start the boblight server
$ boblightd &
Then try each of these commands in turn (ctrl+c to quit)
$ boblight-constant FF0000
$ boblight-constant 00FF00
$ boblight-constant 0000FF
If you run these commands in order the LED strip should turn red, then blue, then green. Lastly
$ boblight-constant FFFFFF
should be pure white. If all of these work, it is time to test the screen-following client. This is called boblight-x11. A test command line is:
$ DISPLAY=:0.0 boblight-x11 -i v1 -o value=1.5 -o speed=100
If you’ve done everything correctly (and the planets are aligned just right), the LED lights should be following the edges of the screen. You can play with the config options to see what looks best for you (speed controls how long the averaging window the client uses is, value is a brightness multiplier, and adding -o saturation=x makes the colours more vivid).
I use VDPAU with MythTV and found that I needed to start it up with the environment variable VDPAU_NVIDIA_NO_OVERLAY=1 set. This makes boblight work with MythTV but sadly causes quite a bit of tearing. If anyone knows of a solution to this problem, I would be very grateful.
A little more control
This basic system works well when just watching TV, but I felt that there were a few improvements to be made. For instance, when you pause the TV and the screen goes blank, you lose the lights. Often you pause the TV because you want to get up and do something so leaving you in the dark isn’t ideal. To get around this problem, I wrote some software which allowed me to control which boblight client was running by echoing values to a file. This allowed central process management to keep track of which client is running and make it easy for various applications to interact with it.
The source for this system can be found here and it is compiled with the command
$ gcc boblight_notify.c -o boblight_notify
To run it, move the executable to a directory that allows the current user to create new files then run the executable. For example:
$ mkdir ~/boblight_manager
$ mv boblight_notify ~/boblight_manager
$ cd boblight_manager
$ DISPLAY=:0.0 ./boblight_notify &
To test that this is working, open a new terminal and run
$ echo 95 > ~/boblight_manager/tv
This should start screen-follow mode, with the speed set to 95. The other commands that should work with your current setup are:
$ echo [hex RGB colour] >~/boblight_manager/static
$ echo 1 > ~/boblight_manager/lock Forces the lights to stay in the current mode
$ echo 0 > ~/boblight_manager/lock Allows the lights to change mode again
$ echo off > ~/boblight_manager/off Kills all clients currently running
$ echo [text] > ~/boblight_manager/warn Makes the lights flash brightly 5 times while displaying text on the screen with notify-send (this seems to be buggy right now – I’ll try to fix it)
The other commands supported in the source file work with a client that I wrote, which I hope to be able to release the source for shortly.
I have used this control system with MythTV’s system events, so that whenever playback is started, stopped, paused or unpaused the appropriate command is executed to either start tv mode, or display a static white colour. I have also developed a web interface to allow control of the lights remotely. This requires a working apache+PHP install, and the source can be found here
Ambilight “ generates light effects around the TV that correspond to the video content”. It was developed by Phillips around 2002. Simply put, the system takes the colours at the edge of the TV screen, and re-projects the colours on the wall behind.
(not my TV/picture)
Previously I had found that watching television in a dark room could cause some eye strain due to the contrast between the bright television and the almost black wall behind it. My first solution to this was to place a desk lamp behind the TV, pointing at the wall behind it. This improved the eye strain, but wasn’t always best suited to the content being displayed on the TV. First, it was at a constant brightness. While the TV may have been displaying a very dark scene the back lighting would drown out the image. Secondly, it was a fixed warm-white colour, which didn’t really match what was playing unless the program was set outside in the daytime with good weather .
As a solution to this, I decided to build an Ambilight clone. This allows the back-lighting to match the content displayed on the TV in both colour and brightness, reducing eye strain and improving immersion (at least, that is what I hoped). As the majority of the content I play on the TV comes from my MythTV frontend and intercepting and decoding a HDMI signal is non-trivial, I decided to look for a method that would allow me to grab the framebuffer from the frontend and send data from that to the LED lights.
The hardware requirements for the system I built are relatively modest. Due to the ease of setup/lack of wiring required, I decided to use a WS2801-based LED strip, which allows the colour of each RGB LED in the strip to be independently set using only two wires from an arduino. The strips I went with were these:
(available from here in the US)
I ordered two strips (2m, 64 RGB LED clusters), which came with enough connectors to join them together and to wire up to the Arduino / power without any soldering required. 2m is about the perfect length to cover the sides and top of a 42″ TV, and 64 RGB LEDs is starting to approach the limit for how quickly you can pipe data to the Arduino @ 60 fps. These strips can be cut every 10cm or so to allow for smaller dimensions, although this requires some soldering ability, a sharp knife and some extra wiring and/or connectors.
The LED strips I used required about 1.8A/m @ 5V (so 3.6A total). I ordered this power supply to power the LED strips (the Arduino pulls power from the USB connection).
Putting it together
- Attaching the strips to the TV. I found that for my size of TV (42″), 2m of LED strips almost exactly fills 3 sides of the screen (I didn’t place any LEDs along the bottom because they would be hidden by the stand). Luckily, the strips are flexible enough that I could bend them through 90° so that each strip covers one side and half of the top of the screen. Make note of the direction of the arrows on the strip, and place the start of the arrow closest to where the Arduino will be placed. The strips do have a sticky backing, but I decided not to use this and use sellotape instead, to allow for easier repositioning of the strips if required.
- Connecting the strips to the Arduino. As the power for the strips is coming from a different source than the power to the Arduino, I connected the ground (black) wire from the 4-pin connector on the strip to the ground on the Arduino to tie the two together. I attached the red lead from the cable to pin 2 of the Arduino, and the green lead to pin 4. I did not connect the +5v (blue) wire to anything.
- Power to the strip. This is done via the 2-pin connector. You can safely power 2m of strips without having to re-inject power at the start of the second strip, but it may be necessary to investigate more power wiring for longer strips.
- Connect the Arduino to the MythTV frontend via USB.
The total cost of these components was somewhere in the region of £120 (not including delivery). I did by some crimps/longer wiring in anticipation of having to splice strips together and make my own cables, but a couple of spare connectors were provided in the box which were all I needed to connect everything together.
A word of warning – the PSU I chose doesn’t guard the live mains power connections particularly well. While it shouldn’t be possible to give yourself an electric shock without a small amount of fiddling/poking (there is a plastic cover over the mains wire connection), it would be advisable to find an alternative housing for the project if there is any chance of pets/children getting anywhere near it. Any suggestions for a project housing which would require minimal/no cutting or drilling would be appreciated.
Written up here
The finished product
I have an early video of my Ambilight clone, just after it was initially set up. At this stage there was a bug in the setup which meant there was a lag in updating the RGB lights. I also hadn’t finished implementing all of the modes in my boblight client, and the saturation / brightness were set higher than I have them today. Another thing to note is that cameras do not cope well with the dynamic range required of them to take video of bright LEDs in a dark room; the lighting is more subtle in-person.
To the people behind the ARG: Please don’t take the following in the wrong way. I think you did a very very good job – the amount of effort that went in to this must have been incredible and I really do appreciate it.
Over the last week (or thereabouts) I have been participating in the Ubuntu-Advertising team’s ARG – http://www.thisisthecountdown.com
On the whole, the game was entertaining, puzzles were interesting and there seemed to be a good storyline. There seemed to be a relatively constant flow of puzzles to work on and progress was driven by the players (who were definitely fun to work with)
Sadly, there have been a few aspects of the game which have made it hard to enjoy properly. For the last few days, puzzles have lead to information, but were a dead end. We got the information which drove the storyline slightly – but no new obvious clues. This leads to people generating more and more fantastic ideas about what the information we found actually means, whether a typo in a file is a clue or a typo, whether an overlay on a video is an anagram, a code, or just the name of the camera the video was supposedly taken on. And given long enough without any new information and once the obvious things to speculate about haven’t turned up anything people start ‘seeing’ clues in the tiniest of details, which don’t actually lead anywhere. Instead, we are all waiting for the person running the game to flip another switch on the server to give us the next puzzle and the wait for a new puzzle is both jarring and frustrating. Which brings me to the next issue with the game.
Timezones. All of the puzzles in the game seem to have been released after 11PM UK time (after midnight in most of Europe). This means that people in Europe need to either stay up until 5am to help contribute to problems being solved (as I did on saturday night/sunday morning), or go to sleep to be able to function at work the next day and wake up to find the puzzle has been solved and you didn’t get a chance to contribute. This game seems to be targeted almost exclusively at players in the US, which is a little unfair given the global nature of the Ubuntu community. The preferable solution would be a constant stream of puzzles, where each new discovery gave a clue to the next (which would eliminate both the timezone issue and the problem of looking for clues where there are none). Another possible solution, if waiting for the GM to flip a switch is unavoidable, is to have the new content released evenly across 3 time periods; 6-8pm in each of the US, Asia and Europe. It may not be possible for one person to work on all of the puzzles if they are released like this, but then at least that way everyone will have a chance at getting the first shot at part of the storyline.
One of the characters in the game particularly annoyed me: The security guard which was presented as the ‘face’ of WSASec. Up until that point, WSASec had been (quite effectively) portrayed as an intelligent and slightly menacing organisation. When Pinwake changed to WSASec in IRC I was expecting something quite special, an adversary. Instead, we got a bumbling security guard who didn’t know anything about computers and was more interested in arguing about who is the best with computers, us or his computer scientist friend, rather than advancing the storyline. This original interaction took place around 8pm UK time. To make matters worse he then left, saying he’ll be back when his shift finished at 10pm Ohio time. Yup, thats right, 3am UK time. At which point a new puzzle was released. Why couldn’t the 3am conversation have happened at 8pm? As far as I can tell, the 7 hour gap didn’t really add anything, just left people twiddling their thumbs for that much longer. All the security guard really did was to hide the main countdown for a few hours by “breaking” the computer, but there wasn’t any change in how long it took.
Which brings me to the next issue. Countdowns. There are two problems with countdowns in ARGs. One is when the players can’t really do anything to change it. They could be super clever and solve all of the puzzles really quickly, and then get left doing nothing while the countdown finishes. If the countdown is an integral part of the storyline, players should be able to have an impact on it. If we do well, it should speed up / end early so we actually feel like we made a difference, rather than just being distant spectators. I realise that companies use ARGs to launch their products, and they like to know when they will be launching them, but I believe that if a company chooses to use this route for marketing, they should be willing to incorporate some uncertainty about the release date to make the game that much more engaging. The Valve ARG for Portal 2 was the same. Yes, Portal 2 was released early (about 10 hours early) – right in the middle of a planned party, complete with big shiny red button to launch the game. The players never really had any impact, it was always going to be released then, and the realisation that your actions, no matter how hard you worked, never _changed_ anything is quite deflationary.
The other problem with countdowns is when they don’t have anything exciting at the end. One of the most annoying things possible is to be sat there waiting for a countdown to end, after you’ve had days of excitement building up to it to see….another countdown. It starts to get like Sony’s announcements that they will be posting an announcement about posting an announcement about holding a press conference about the PSVita – each time you get to the end of a period of waiting like that to just get presented with another countdown sucks that much more interest out of the game.
The above is probably more ranty than it should be and casts more of a negative light on the ARG than perhaps it should. The puzzles (when I’ve managed to work on them) have been interesting, challenging and rewarding, and I really do thank the people who have put the time and effort in to designing/writing and running this game, you have done a very very good job. Which is what makes the above points all the more frustrating – they are all that stands between “very very good” and “absolutely mind-blowingly amazing”.
One feature seemingly missing from the iPhone mail client is the ability to send messages from an alias identity on a mail account. Suppose you have firstname.lastname@example.org, but all mailing list emails are sent to email@example.com, which is an alias for firstname.lastname@example.org. If you want to send an email from email@example.com, you would have to set up a second account, which would duplicate the firstname.lastname@example.org account emails (which is messy, in my opinion).
Now, Apple seem to have (perhaps inadvertantly) managed to enable a way of having proper aliases in iPhone OS 3.0. Essentially you need to create a list of email aliases seperated by commas in the “Address” field of the IMAP Account Information. This must be done after the account has been created with the 1 main email address, or it complains about being an invalid address. Once the account has been set up with the main email address, create a new note. In this note, type out the list of email aliases you want, starting with a comma:
highlight and copy this text to the clipboard.
Then go to “Settings > Mail, Contacts, Calendars” then choose your email account. In the address field, paste the copied text after the existing main address and save the changes. Now when you compose an email, if you click on the “From:” field, you should have an option of your main address, or any of the aliases you created.
Number 1 - My blog being added to random planets without me being asked.
It would seem that the entirety of the ubuntu-uk.org planet userlist has been duplicated by MooDoo for his own planet, as he doesn’t like the “members only” policy. I believe that the correct thing to do in this case is at least ask people if they wish to be added to his planet.
*Edit* As a planet like the one set up by MooDoo already exists, he has now redirected the domain to point to the existing planet, which doesn’t add people without them asking *Edit*
© cjo20.net | Chris Oattes. All Rights Reserved.
A friend just sent me this link. The instructions make it much easier to read email discussions with many levels of quotes.
Note: Using ubuntu, the user preferences are in ~/.mozilla-thunderbird, not ~/.thunderbird. You will need to create the “chrome” subdirectory and the file “userContent.css” yourself.
I have to say that this is quite possibly the coolest theme for wordpress EVER!
It can be downloaded here
As a student, I am able to get free copies of various Microsoft products to help me with my course. One of these products is Vista Business edition. I have heard quite a few bad things about Vista over the past few months, and I decided that rather than just jumping on the bandwagon and proclaiming “Vista is rubbish”, I would give it a go and form my own opinions.
First of all, the installation was sloooooow. It took well over an hour to get from first inserting the disk to getting a usable system. The longest part was copying the data from CD to the HDD, and as it is spread over 5CDs (4 too many in my opinion), you did have to sit there and swap the disks over fairly regularly. The number of dialog boxes you have to fill in seems to have been reduced, and there is a graphical partition manager, so it is easier to set up than XP was.
When Vista first boots up, you get the impression that they spent a lot of time making it look “better”. Sadly, this seems to be the only thing they have spent time on. Vista runs slowly with the autodetected settings, which gives me the impression that it is tuned to run as much as possible rather than sacrificing a couple of effects for better performance. The problem is, the graphical effects just aren’t that impressive. OS X has had similar effects for a long time, and Beryl on Linux does a much better job than Vista. The effects in Vista seem to mainly be transparency on some parts of the window, and an improved window switcher animation. After using Beryl for a couple of months, this just doesn’t impress me.
A major annoyance is the pop-up box which appears whenever you choose an option on the control panel, and several times during the installation of each program. I know that Microsoft were meant to be making Vista more secure, but there must be a better way than this. I don’t want to be asked if I really want to change the font size. There is the option to disable these pop-ups, but this causes the Security Center to complain and prompt you to re-enable it. If this is the way that Vista hopes to combat spyware, I suspect it will be totally ineffective. Users will still just click through the pop-ups if there is a spyware-laden application that they wish to install.
The new start menu is just completely inconvenient. It is like a small file system explorer, which takes a long time to navigate if the link you want is nested inside more than 1 or 2 folders. I think that Vista would have been better off just keeping the old menu.
I also keep getting reports that “Windows Vista does not support NVIDIA(R) nForce(TM) Audio Codec Interface”, which seems to result in the inability to play certain tracks on my computer – Windows Media Player just refuses to start playing songs. As I almost always listen to music while I am on the computer, I will either have to spend some time trying to fix the problem, or it will seriously impact on any time I spend on Vista.