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.
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.
This thing has been pretty empty for a while; I feel I should probably write something more often.
On the 28th July 2008, I was diagnosed as type 1 diabetic. I had symptoms for a long time which I (mostly) ignored. This has already proved to be a particularly stupid decision.
I suspect that I had high blood sugar levels for almost 2 years before I was diagnosed. Every minute your blood sugar is outside the “normal” range causes damage to all of the small blood vessels in your body. Some of the main areas of damage are your kidneys and your eyes. When your kidneys are affected, it causes them to become less and less effective. As yet, I have no symptoms of this, but diabetes can eventually lead to kidney failure. My eyes are a different matter. High blood sugar levels damage the capillaries behind the retina. This causes them to weaken and bulge, to the point where they can burst, leaking blood into the eye. The result of this is “floaters” appearing in your field of vision, which look like small fuzzy spots that are virtually impossible to look at directly. A lot of people have some of these; having a couple of these is normal.
Once these blood vessels have burst, it reduces the blood flow to areas of the retina. This can cause parts of the retina to die, leading to black spots in your vision. If this continues for long enough, it can lead to being legally blind.
It can take many years for this sort of damage to begin, but it can also progress very very rapidly. At the moment, I have the initial signs of damage to my eyes – bulges in the blood vessels. This scares the **** out of me. At the moment my vision is unaffected, but some day it will probably start to go wrong. The worst part is that I have no idea of knowing when; it could be tomorrow.
The only way I have of stopping this is keeping as tight control on my blood sugar levels as possible. This involves many injections of insulin each day, and regularly checking my blood sugar. Since diagnosis, I have pricked my finger over 2600 times, and I have given myself over 1000 injections. Every day for the rest of my life I will have to give myself at least 2 injections, sometimes up to 7 or 8. Food no longer holds any joy for me. I have to calculate the carbohydrate in everything I eat; if it contains any more than the amount in a jaffa cake, I have to consider doing an injection for it.
Oh yeah, and if i calculate the injection wrong, I risk passing out due to low blood sugar, which would be really nasty. I’ve managed to avoid passing out so far, but I’ve come close (or felt like it) a couple of times. It starts off with a light headed feeling, with a weird feeling when moving limbs. Next, comes the shaking; at the point fine movements are very difficult (typing is a difficult; similar to being drunk). This quickly progresses to feeling incredibly faint with intense hunger and a strong sense of panic. This is as low as my blood sugar has been,and I hate it. Something as simple as walking 5 mins to sainsburys can bring this on, so I have to carry round a supply of sugar to bring my BG back up.
All of this (and more) is constantly in the back of my mind; I have only had a few occasions where I could totally forget about my diabetes without the constant worry of what my blood glucose (BG) level is doing, and it isn’t usually long before my mind drifts back to the thoughts of “What if my blood sugar is high? Is it going low? Do I need to test my BG? What exercise am I planning on doing? How much carbohydrate can I afford to have for my next meal”, as well as the million other diabetes related questions constantly swimming around my head.
This is what I have to deal with every day for the rest of my life, no matter what else is going on.
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.
Find a HOW-TO here:
EDIT: I no longer use this remote, I hope the guide remains accurate
Everyone should go have a look at FreeRice.com. It is a relatively new site that claims to donate rice to the World Food Program, who then distribute it to people who need it. The way they fund this, is by providing a simple (but entertaining) word game, with a small advert on each page (I didn’t actually notice the advert until it was pointed out to me). The game is a series of multiple choice questions, where you have to choose the most similar word to a given word from a list of 4. For each correct answer, they donate 20 grams of rice.
To make the game more interesting, each word has a “difficulty” associated with it between 1 and 50. It starts by asking a few random words to get an idea of what level you are at. Once it has determined a suitable level, it ask you questions from that level. If you get 3 questions right, you go up a level, and if you get a question wrong, you go down a level. This means that it adapts to your vocabulary to give you words you have a chance at getting, but not making it so easy that it is boring.
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.