So you have a Cambridge Audio Amplifier (or any other product with a serial port) and a null-modem cable and want to be able to control your amplifier from a Linux PC (a web page or CLI). Here's a quick HOW TO...
Say you've connected it to /dev/ttyS0.
Step 1 - allowing anonymous/apache/everyone to write to /dev/ttyS0
echo "/bin/chmod 666 /dev/ttyS0" >> /etc/rc.local
Step 2 - PHP function to start/stop the amplifier
function cambridge_pstate($w) {
$line="";
$fp=fopen("/dev/ttyS0","r+");
if($w=="ON") fputs($fp,"#1,11,1\r\n");
if($w=="OFF") fputs($fp,"#1,11,0\r\n");
while($line=fgets($fp,16)) if($line!="") break;
fclose($fp);
if(substr($line,0,2)=="#4") return true;
else return false;
}
Step 3 - Use the fonction in a PHP page
if(cambridge_pstate("ON")) echo "Starting the amplifier...";
else echo "Could not start the amplifier...";
... and obviously, the opposite :
if(cambridge_pstate("OFF")) echo "Stopping the amplifier...";
else echo "Could not start the amplifier...";
Saturday, May 7, 2011
[Home Automation] Turning ON/OFF your Cambridge Audio Azur 840A (Version 2)
Sunday, May 1, 2011
Friday, October 29, 2010
Rootzmap as seen on...
There's been quite some buzz around the rootzmap's pictures recently.
They've been featured on BBC4 and BBC Mundo websites and TV shows.
They also have been shown at the German Museum of Technology during an exhibition celebrating computer pioneer Konrad Zuse's 100th Birthday.
And finally in this book about Science.
...and at various small exhibitions in the UK and US.
Wednesday, February 17, 2010
Monday, December 28, 2009
Atom motherboard
Here is the board and its case.
The 1 GB CF is a bit too small, I'll get a bigger one soon.
Also, the holes for the 2.5" disk do not match my 44 pin cable length, so I'll create new holes for it.
Thursday, December 24, 2009
Robotic Crawler Video
Olivier made a video of his HSP Crawler first run, which I edited and put on dailymotion, so here it is :
Don't know how it will handle the 1kg Atom motherboard on top (we might break the weakest parts...), but looks promising...
Sunday, December 20, 2009
Unmanned Vehicle Project
With Philippe we have the project, since a very long time, to build an mobile camera, well, let's say a robot !There's a lot of robot projects around the net, but one of the main identified problem is their lack of "agility".
That's why, for our first tests, we have prefered to choose a well proven basis instead of an "university project", the HSP Crawler : http://www.hispeedmodel.com/product.asp?bianhao=94880
Here in it's original configuration as i have received it :
Saturday, July 18, 2009
JPEG and PNG thumbnailing
In need for a fast and good looking thumbnailing solution for PNG and JPEG bitmaps, I came across this interesting article about Python's PIL and its rivals (Epeg and Imagemagick), so I decided to bench these solutions myself (even more since the various possible resizing methods were not tested).
For my bench, the thumbnail size is 320x200, which is quite a big thumbnail, but why not... (time is in seconds)
I'm no Python fanboy, but it looks like Python Image Library (in Bicubic mode) offers the best ratio speed/quality when you need to create thumbnails from jpeg and png.
Saturday, February 21, 2009
Sunday, January 11, 2009
[Netlantis] New Server
I've just finished building a new server for Netlantis.
It has the following specs :
1 x Intel e8500 CPU
4 x 2 GB RAM PC6400 CL4
2 x Gigabyte iRAM 4 GB (in RAID 0)
2 x Seagate 250 GB HDD (in RAID 1)
1 x Seagate 250 GB spare HDD
Because of the size of the iRAM (and the bad design of this ASUS P5Q-Premium motherboard) I had to build some custom pieces (which was actually fun) and to use a 13 cm flexible PCI riser (bought on LinITX).
Here's what the server looks like :
If I were to build such a system now (I have my iRAM since 1 year now), I would choose an HyperDrive5 16GB drive... read more here. It has a disk (actually a compact flash) for backups (which is to me a better idea than a battery), has a better architecture, and is less expensive.
Saturday, November 22, 2008
[Thoughts] New controller for my X10 setup
While I was getting a special PCI riser for the new Netlantis server, I've decided to get a 8" LCD Touchscreen (from Linitx).
This product is really nice and easy to setup under Linux.
The idea for this screen is to replace my current X10 control, which only allows me to power on or off everything.
I created an image and a very simple script which calls heyu...
Here's the image.
And the screen, once installed and running.
Saturday, November 8, 2008
[Thoughts] The stradivarius of Headphones
Notice the capital H to Headphones here, we're talking about high quality (and price) audio.
The Beyerdynamic DT 770 ed. 2005 is not just another headphone, to me it's an experience (wow, that sounds like crappy oldschool marketing). Let me clarify...
With this headphones, even the worst piece of 128k MP3 sounds like your getting a personal visit from the artist and his band. An experience you can only experience with very expensive loudspeakers, like these :
Sonus Faber Stradivari Homage :
Monitor Audio Platinum PL300 :
Saturday, July 19, 2008
[SYSCTL] New Cyberabuse Whois 5.5 is out
This new version corrects a few minor bug and improves a few things.
As always, this new version is the best available, anyone using the cyberabuse whois should upgrade.
5.4 was released in 2006, so this is a long awaited release.
I'll detail the ChangeLog right here :
- fix Makefile for Win32
at least on the latest cygwin version, the current "make sqlite" didn't work, now it does
- gcc 2 compat issue
well, this one was introduced with the "make mta" thing
- get rid of that lame and big ascii art
- default TLDs libs have been updated
- TLD includes generator has been updated
- removed support for sqlite 2.x, upgrade to 3.x
- fixed a small bug in the ARIN cache system
honestly I don't remember what this bug was... it may have been fixed in 2006 or 2007
- fixed typo in INSTALL file for "make server"
- added better checks for netname and inetnum for KRNIC
- various improvement for LACNIC
- added "make mta" for those who use zcw to add abuse headers at the MTA level
that's not such a good idea... but I'll let people choose what they do with their mta
- added "make sqlite-spam" for those who use zcw to report spam
zcw was made to report abuse/security issues
this is probably the most awaited feature... I must say I'm not really a fan of this one and I don't know if it's going to be more efficient than the classic (sqlite) version...
- make strstr case insensitive when the searched string is lowercase
shouldn't change anything (email search), but who knows
I'm happy that this tool is still in use... it's now 5 years old !![]()
Saturday, July 12, 2008
[Thoughts] Hi-Fi upgrade
Big upgrade of my hi-fi system.
My Inter-M (Inkel) amplifier has been replaced by a Cambridge Audio 840A(v2).
Sound is really getting better, I don't miss the very dynamic sound of the Inter-M.
Long time listening of this system is now a much better pleasure and stereo image has been really boosted...
Tuesday, April 29, 2008
[SYSCTL] Lighttpd separate Error Log for 404's
You might have seen that my lighttpd conf doesn't include an access log... in fact I don't even load mod_accesslog.
Why would I want or even need to log access to my static content... you might need it, but I don't. Also, since I run multiple workers, even if I wanted to log server accesses, the log file would be broken (logs + multiple workers are not handled well at the moment).
However, if I don't care about 200s, I do need to get my 404 errors logged...
Apache logs 404s and > 400 in the error_log file, but Lighty doesn't (it uses access.log for that). However there's a nice feature called "server.error-handler-404" to bypass this issue.
This is how I use it... in the conf file :
server.error-handler-404 = "/errors/log_errors.x"
static-file.exclude-extensions = ( ".x" )
fastcgi.server = ( "/your_noatime_.../static/errors/log_errors.x" => ((
"bin-path" => "/usr/local/bin/log_errors.x",
"host" => "127.0.0.1",
"port" => 8200, # (why not...)
"min-procs" => 1,
"max-procs" => 1,
"check-local" => "disable"
))
)
touch /your_noatime_mounted_partition/static/errors/log_errors.x
Install FastCGI dev lib from :
http://www.fastcgi.com/dist/fcgi.tar.gz
Then edit log_errors.c :
#include <time.h>
#include <stdio.h>
#include "fcgi_config.h"
#include "fcgi_stdio.h"
#include <stdlib.h>
int main () {
FCGI_FILE *err = FCGI_fopen("/your/path/to/error.log","a");
if(!err) return 1;
while (FCGI_Accept() >= 0) {
time_t rawtime;
char buf [80];
time(&rawtime);
strftime(buf,80,"%Y-%m-%d %H:%M:%S",localtime(&(rawtime)));
char *uri = getenv("REQUEST_URI");
FCGI_fprintf(err,"[%s] 404 : %s\n",buf,uri);
// FCGI_fflush(err); - if low traffic and realtime logs desired
printf("Content-type: text/html\r\nRefresh: 0;url=/nice_message.html\r\n\r\n");
}
FCGI_fclose(err);
return 0;
}
// EOF
Then :
gcc -I/usr/local/include -L/usr/local/lib -Wall -O2 -o log_errors.x log_errors.c -lfcgi
mv log_errors.x /usr/local/bin/log_errors.x
And that's it...
Oh, this is not the most beautiful piece of code you can find... but it does the job.
I'll be happy to get better code if you write it...
Tuesday, April 15, 2008
[SYSCTL] Testing Lighttpd
In need for a server that would serve only static content (small files), but at the highest rate possible, I've tested Nginx, Lighty and Apache.
While Apache is clearly out of the game, Nginx wasn't that bad, however lighty 1.4.19 clearly achieved the best performance (even better than 1.5.0 with sendfile-aio) and was much better documented.
Since I thought I was really wasting my time testing different parameters (which many other probably already did) to achieve the best performance, I'm posting my config file here in hope it will be useful.
server.document-root = "/your_noatime_mounted_partition/static"
server.errorlog = "/your_noatime_.../logs/lighttpd.error.log"
server.event-handler = "linux-sysepoll"
server.network-backend = "linux-sendfile"
server.max-fds = 8192
server.max-connections = 4096
server.stat-cache-engine = "simple"
server.max-worker = 4 # (= number of CPU)
server.max-read-idle = 60
server.max-write-idle = 360
server.max-keep-alive-requests = 1024
server.max-keep-alive-idle = 16
server.bind = "127.0.0.1"
server.port = 80
dir-listing.activate = "disable"
etag.use-inode = "enable"
etag.use-mtime = "enable"
static-file.etags = "enable"
server.username = "your_favorite_anonymous_user"
server.groupname = "your_favorite_anonymous_group"
mimetype.assign = (
".swf" => "application/x-shockwave-flash",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png"
)
You can then use mod_mem_cache if you want even better performance...
Saturday, March 1, 2008
[Netlantis] From Netlantis to FRNOG Tools
Some of my BGP related projects will now exist under 2 different "brands" :
- Netlantis
- FRnOG Tools
Here's the logo :
This might be temporary and we can only hope for the Netlantis projet's revival in a few months (years).
[SYSCTL] FreeBSD 7.0
One of my (FreeBSD) servers has been up for more than 3 years without the need for a reboot...
# w
8:38AM up 1138 days, 7:05, 1 user, load averages: 1.05, 1.35, 1.37
This one is serving something like 100 GB of data per day, the box is from 2000, a dual P3 Xeon 500 Mhz with 384 MB RAM...
This makes you wonder why the trend for switching from Windows to *nix hasn't been faster :)
Though it's nice to see so many devices running a *nix (mostly Linux) around us everyday. When Linux Phones will come to the mass market, people will be surprised to have a stable smartphone again (I have to soft-reboot my Win Mobile 2005 at least every 2-3 weeks). Though I really can't see why companies still stick with Linux... since the license (GPL) is clearly not the most flexible, compared to the BSD one, for example.
The very new FreeBSD 7.0 is available for download since a few days and runs on ARM CPUs (those used in mobile devices). NetBSD runs on ARM since a few years... Strange to see how some so tactical/important decisions are made.
Even though I'm still a FreeBSD lover, I mostly install CentOS (RedHat Entreprise clone) in production environment, because to me, it's simply the most production-ready *nix available to date.
Thursday, February 7, 2008
[Netlantis] RANX beta
You can try RANX beta, HERE.
The RANX Graph feature is the one to be tested, the rest of the website is simple XHTML and should work on most modern browsers.
For this website, I've used several open-source libraries :
menus (which I've enhanced) : Dynamic Drive CSS Library,
RANX graph drawing library from Walter Zorn
(you may wonder why I've used a javascritp/DHTML lib to draw shapes dynamically... the answer is quite simple... I don't know Flash and I know several hardcore-GNUs who don't have it installed...),
the data for the RANX Graph are in AJAX/JSON format.
There's still a bit of work and optimization to do, but I must admit I like it already :) It's been really interesting working with these technologies that make 2.0 exist (namely, DHTML/CSS, XHTML, AJAX).
Don't hesitate to report bugs you can find.


