Sunday, September 14. 2008Build Indicator - Part 3 (The software)
This is part 3 of the Build Indicator series. In this part I describe the communications library and using this as part of a MSBuild task as well as the test harness.
Previous Parts :
License : Please use, copy and modify this code as you wish, all I ask is that you don’t take credit for the bits I wrote. You should ensure it’s fit for purpose before using it. The Arduino build indicator works via fairly simple RS232 communications so you can adapt your own build monitor (or other system) to use the indicator easily, or download the Arduino build indicator library and use/modify to suite your needs. You can also download the firmare for the Arduino from here. The library consists of 3 projects at this time :
All the software described here is written in C# and targets .NET 2.0 so it should be usable from any .Net 2.0+ project, you can add the AnalysisUK.BuildIndicators.Arduino.dll as a reference or include the project and reference that as part of the solution. In the download is a Arduino.sln Visual Studio 2005 solution file which includes the main communications project, the MSBuild task project and the Test Harness WinForms program. The Communications project :This project consists of four classes and one enumeration.
Using the controller : The below code is from the MSBuild task and shows how to use the command and controller. When the SendCommand method is called with the command this is sent to the Arduino which updates the output corresponding to the ProjectNumber to show the Status. Using MSBuild :Included in the download is a MSBuild task. This can be included in a MSBuild project and called to update the status. You can either copy the targets and task reference from the TestBuildStatusIndicator.proj MSBuild file or use the file directly. You will need to correct the AssemblyFile location. The ProjectNumber and CommPort should be updated to the Comm port the Arduino is on and the appropriate project number. To call the sample MSBuild tasks from a Visual Studio command line use : MSBuild TestBuildStatusIndicator.proj /t:IndicateBuildGood MSBuild TestBuildStatusIndicator.proj /t:IndicateBuilding MSBuild TestBuildStatusIndicator.proj /t:IndicateBuildFailed The MSBuild targets are defined as : Using the Test Harness :Also included in the project is a test harness, this is a simple WinForms application which again uses the main communications project and provides a simple UI to exercise the build indicator. ![]() Future parts :I'm currently working on including the Arduino build indicator into CCTray for use with CCNET so that will be available in a future posting. Thursday, August 28. 2008Dinner Timer Lite V1.1 Released – and it's Huge!
Literally, huge. Below is a photo of my 22” wide-screen monitor with Dinner Timer Lite running. As you can see it fills the screen nicely with a big font – now you can easily see Dinner Timer Lite from the other end of the kitchen or further.
![]() before you ask, yes you can make it smaller! Just in-case you are wondering, yes that is the snowman build indicator on the left and it's not lit up because the build machine wasn't running (saving a little electricity and reducing the heat in the office!). There are a few other cool additions to V1.1, these include : Added Twitter notifier – now notify your friends and family automatically when you start dinner, when it will be ready, tweet notifications when it's about to be ready, when it's ready and through Dinner Timer Lite's unique overrun timer tweet when the dinners burnt. Here's screen shot of setting up the Twitter notifier to send out a message when the timer has overrun : ![]() Here's a screen shot of my Twitter tweets. You can also follow me as BookSwapSteve on Twitter ![]() I've also improved bubble notifications – Bubble and twitter notifiers now support text template replacements. Include any of the following for them to be replaced with the appropriate values when run : {{RunMins}}, {{StartTime}}, {{EndTime}}, {{MinsRemaining}}, {{MinsOverrun}}. Additional sounds for the sound notifier including : Cow moo, Air horn, Alarm beep, Alarm clock beep, Alarm ring, All clear, Ambulance, Aooga horn, Boat air horn, Boing, Boing2, Boxing bell multi, Bullet ricochet, Buzzer, Buzzer 2, Buzzer 3, Buzzer 4, Buzzer 5, Buzzer heavy, Buzz through loud, Buzz thru and Chainsaw. The time options available in the drop down list is now user configurable and includes the ability to name the times. e.g. you can enter a timer called "Pizza" and have it set as a 12 minute timer, the list will then show Pizza which can be easily selected and when the timer is started it will run for 12 minutes. Here's a sample of modifying the time option to show pizza : ![]() ![]() The options boxes have been resized for the default Windows Vista font size. I've also added warnings for opacity settings where the timer may not be visible and a extra context menu item has been added to the notification area icon to reveal the timer if it is difficult to see. Both myself and a few others had managed to get Dinner Timer Lite to be so transparent that we couldn't find it to restore it. I've also changed the installer to be a single exe so no unzipping required and the binaries and installer are digitally signed so you know their genuinely from me (Analysis UK). Their are also various under-the-cover improvements to facilitate some new features in the next release, including the first stage of splitting out of the notifiers from the main application with the intention of allowing developers to create their own notifier plugins, but thats going to have to wait for a future version before it's fully implemented. Monday, August 25. 2008Moving from .NET 2.0 to .NET 3.5 on Plesk - welcome to Server Application Unavailable errors
I just uploaded a new version of DinnerTimer.com which moved from being a .net 2.0 site to a .net 3.5 site, the server has .net 3.5 installed and every thing went well until I navigated to DinnerTimer.com
I was greeted by : Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. The error message in the event log was : Exception: System.IO.FileLoadException Message: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied. This struck me as a little crazy as all my other sites on the server are .NET 2.0 and the previous site was .NET 2.0. After much searching on the net and trying a variety of things (including giving permission to the various IIS accounts to .net 3/3.5 folders in windows folder and setting up a dedicated 3.5 App pool for the site) I finally added IIS_WPG permissions on the "Web Sites" folder in IIS manager and the site magically appeared. Now I just have to wonder what the security implications are and if that broke any other sites. You have to love simple upgrades! I'm not sure if this is a general issue with IIS or because I'm running plesk which uses different security & user settings to a normal IIS setup. Friday, August 22. 2008Analysis UK email problems
Apologies to anybody that's tried to email me in the last week but my emails been broken.
It turns out that the email service I use as a front end had an old personal email address in their billing information for me, so when my annual subscription was due I didn't get a reminder because I no longer have the personal email address I used (I finally ditched Demon and sadly lost the email address I had with them since about 1998 – my advice is don't get an email address tied to your internet provider – better yet, get your own domain name and use that for email so you are not tied to any company – but be sure to remember to renew your domain name!). Having had lots of spam recently I through that the reduced level of emails was just because the spam was slowing down – the automated status emails from my web sites were still coming through because they went directly to the mail server and not via the front end thing, so it looked like I was still getting emails on that account, hence it wasn't until I sent my self an email from a separate account (I know – I need to get out more) and it bounced that I realised something was wrong. Hopefully all fixed now. The irony of the situation is that I signed up with the service so that I wouldn't loose emails if my email server went down. They provide 2 front end mail delivery servers that forward it onto the real mail server when it's running. I think I've lost more email because of it than I ever lost because my server was down. Vista 64 Blue Screen Hell
I recently updated my development box to a nice new quad core processor and with it stuck in 8Gigs of ram. I would have been more than happy to stick with Windows XP as I had on my old dev box but the 32 bit version is limited to 4G (more like 3.5G) of ram so all that extra goodness would have been wasted, hence I crazily decided to opt for Vista 64.
What a mistake! It's like using Windows ME all over again and we all know what a terrible product that was. So to start with the motherboard an Asus P5Q PRO for some reason doesn't support sleep which is a big thing with Vista, I would go off to have dinner and come back to find the PC rebooting because it had gone to sleep. Sadly I wasn't always that lucky – it would often corrupt the CMOS and loose the date/time. If I had one of my Arduino based projects such as the connected it would also be frozen at the Bios Legacy USB detect stage. I can't really blame Vista for what is a motherboard problem so I've disabled the sleep function and replaced it on the Start menu with Shutdown. When I wrote LazyLoad I didn't think it would be useful on Vista because of the improvements Microsoft made – It hasn't taken long for me to realise LazyLoad is still well worth running on Vista! So onto the real big problem I'm having, almost daily blue screen of death's. This appears to be caused by the ATI graphics card – a Radeon HD 3650, just great. I regularly get a blank screen followed by Vista telling me it's recovered from a stopped graphics driver. However almost daily the screens start blinking darkness and then when I've had enough time to glimpse at the work I'm about to loose it all goes blue claiming an ati driver failed. Just to really annoy me when the machine reboots Vista prompts with it's “Windows has recovered from an unexpected shutdown” and gives me a “Check for solution” option, it then appears to do something, followed by quietly hiding it's self never to be seen again, not a sorry we couldn't find anything, or a try the vendors web site for the latest drivers, or a yep we know another ati driver problem, nope, it just disappears as if it's embarrassed and wants to quietly leave the room having wet it's self. ![]() I've had ATI cards before and not liked them, I really should have known better. Whilst looking for the link for the 3650 on the ATI site the search summed ati up for me. I entered hd 3650 and hit enter to search, not realising I had to change the “Select Site:” drop down. I got a JavaScript box saying “Please select a site.” and they kindly cleared my search text so I had to enter it again (whilst not making the same mistake of hitting enter) and then select the ATI site. How could something so simple be so unfriendly? And what's with the improved TCP/IP stack in Vista. I though networking with Vista was supposed to be much improved. If I watch a movie that's on another machine one of two things happens, either the file explorer will freeze and show the green progress bar whilst trying to browse the folders or when I finally open the file my whole PC will freeze whilst Windows Media player opens the file. And if the other machine is busy doing something like a backup I really know about it on my Vista box (BTW – often the other machine is a Vista box!). I thought with 4 cores a gigabit network and an improved TCP stack Vista would still be usable whilst it tried to sort out connections with networked machines. My old XP box with it's single processor was is so much better for networking. As for the new “improved” windows explorer, I so hate it, I mean really hate it. If I'm trying to copy files or folders with Explorer in details view (which I prefer) from one location to another I regularly end up with them going into a sub folder of the destination because of the change in the way the hover selection works as it's really difficult to get exactly between the folders when dropping. As for default view (list view) that's just to annoying, You've got loads of extra column headings and if you have a long file name it's often obscured, it looks like you can resize the columns but that doesn't work – you have to change to details view to do that – it gets me EVERY time and annoys me intensely every time. Is it just me or has the audio stuff got worse, my last box (XP) pushed out the audio via the SP/DIF and headphones socket at the same time, I can't see how to do that in Vista, so if I want to switch from headphones to speakers I have to stop what I'm listening to, change the default or use something like WinAmp's settings to change the output (not easy to get to) then change to the RCA Digital output. What a pain in the ****, I want both outputs together – is that such a stupid requirement? I wonder if that's another Asus special. I'm so very glad FireFox remembers the pages I had open, all to often I've been part way through reading an article for the PC to blue screen on me and by the time I'm back up and running I've forgotten where I found the article. Fire up FireFox and restore - magic! I so wish IE did the same, especially as it's a lot less stable than FireFox and crashes it's self frequently. So in conclusion, it's really great so much effort has gone into the Aero to make Vista look nice whilst introducing whole new instability issues, revaming Windows Explorer to take annoying to a whole new level whilst totally defeating usability and that the TCP has been speeded up to the point that Vista to Vista networking freezes the machine and browsing a file share regularly messes up, that's on top of the slew of security measures which resulted in me being unable to browse my NAS without having to get into the depths of Vista settings. I appreciate most of the problems are actually hardware (MB/Graphics card) but it's still annoying to have seen so much effort go into making the thing look nice only to have it fall over, I've seen it all to often with various products where the manufacture has put lots of effort into making the thing look really nice but failed to make a usable product (more on that and my home automation problems latter). Take for example software products that have their window an unusual shape - I know instantly that I'm not going to be able to use it, all to often I've tried software where the products a funny shape and the functionality and usability of the product are just so poor – please please please lets get back to making usable products and get over our obsessive desire for things to look pretty whilst not worrying about being able to use them. Well the good news is in the hour it's taken me to write this the machines not blue screened! Monday, July 7. 2008Build Indicator – Part 2 (The firmware)
This is part 2 of the Build Indicator series. Part 1 – the construction of the hardware is here.
The firmware is written using the Arduino’s own programming language which is much like C/C++, using the IDE provided it’s easy to develop the code and push it down to the Arduino. I decided that as the Arduino has 13 IO pins it would be a shame not to make these available for 6 build indicators so 6 individual projects could be monitored. I’ve not used OO to implement the code so it’s a little messy with individual arrays for project status, red and green led pins which are indexed based on the project number. I think you can create classes but this has to be done in external C++ files so for a simple application like this I didn’t worry to add that extra complexity. Serial (RS232) communications is used to send a status message down to the Arduino build indicator to update the project status. The full Arduino build indicator code can be download here. License : Please use, copy and modify this code as you wish, all I ask is that you don’t take credit for the bits I wrote. You should ensure it’s fit for purpose before using it. Variable declaration : 1 /* 2 Build Indicator (c) Analysis UK Ltd 2008 3 * 4 Digital Pin Assignments: 5 0 - RX 6 1 - TX 7 2 - Project 6 - Green LED 8 3 - Project 6 - Red LED 9 4 - Project 5 - Green LED 10 5 - Project 5 - Red LED 11 6 - Project 4 - Green LED 12 7 - Project 4 - Red LED 13 8 - Project 3 - Green LED 14 9 - Project 3 - Red LED 15 10 - Project 2 - Green LED 16 11 - Project 2 - Red LED 17 12 - Project 1 - Green LED 18 13 - Project 1 - Red LED 19 */ 20 21 #define VERSION "1.0" 22 23 // Project not enabled of not connected. 24 int PROJECT_OFF = 0; 25 26 // Project build failed 27 int PROJECT_FAIL = 1; // 001 28 29 // Project build good 30 int PROJECT_GOOD = 2; // 010 31 32 // project building from a failed project. 33 int PROJECT_BUILDING_FAIL = 5; // 101 34 35 // project building from a good build. 36 int PROJECT_BUILDING_GOOD = 6; // 110 37 38 // Maximum number of projects. 39 int maxProjects = 6; 40 41 // Project status codes. Indexed by project. 42 int projectStatus[] = { 43 0, 0, 0, 0, 0, 0}; 44 45 // Pins for the Red LEDs. Indexed by project. 46 int redLEDPin[] = { 47 13, 11, 9, 7, 5, 3}; 48 49 // Pins for the Green LEDs. Indexed by project. 50 int greenLEDPin[] = { 51 12, 10, 8, 6, 4, 2}; // pins 0 and 1 reserverd for RS232. The arrays redLEDPin and greenLEDPin represent the pins to use for the red/green leds and are indexed on the project number (i.e. project 0's red led is on pin 13). The array projectStatus holds the status of the project and again is indexed by the project number. Setup: 54 // run once, when the sketch starts 55 void setup() 56 { 57 // Initialise the ports for output to drive the LEDs 58 for (int i=0; i<maxProjects; i++) { 59 pinMode(greenLEDPin[i], OUTPUT); // sets the digital pin as output for the green/blue part of the tri color LED 60 pinMode(redLEDPin[i], OUTPUT); // sets the digital pin as output for the red part of the tri color LED 61 } 62 63 // Setup Serial communications 64 Serial.begin(57600); 65 } The setup method iterates through all the projects setting up the pins designated as led’s for output and then sets up serial communications at a baud rate or 57,600. Fortunately the Arduino takes care of the difficult serial comms bits for us. Main Loop: 67 // Main loop, runs over and over again 68 void loop() 69 { 70 // Check and Read settings from PC 71 ReadCommands(); 72 73 // Update the LED's to indicate project status' 74 UpdateLEDs(); 75 76 // Idle. 77 Idle(); 78 } 79 The loop method is the main application loop that the Arduino will enter once setup is complete and will keep repeating. Within loop we call 3 basic methods, ReadCommands() which will check the serial port for commands from the host, UpdateLEDs() which will update the leds based on the project status and Idle() which just inserts a small delay but can be used for other background tasks. The comms protocol is a fairly simple one. All messages should start with a byte value of 2 and terminate with a byte value of 3 so the Arduino can easily know when a instruction has been received. To update a project status send the ascii string “@P[x]=y” with x being the project number 1-6 and y being the status (0, 1, 2, 5, 6). To query the version number of the firmware send ?V. I’ve stolen the comms protocol from another project I’m working on with the Arduino that has more commands and queries so I’ve based all commands where the Arduino has to do work on the @ character and all queries on the ? character to help separate out the commands and queries. RS232 Message handling: 86 // Read commands sent from the PC 87 void ReadCommands() 88 { 89 // Check if serial data available, if so then read this in 90 91 // Read all from the serial port until no more bytes available looking for the 92 // start byte (1) of a message. 93 while (Serial.available()) { 94 //read the incoming byte: 95 int incomingByte = Serial.read(); 96 97 // Start identifier. STX 98 if (incomingByte == 2) { 99 // Found start byte now read in until we get the end of message byte. 100 ReadSeialCommand(); 101 return; 102 } 103 } 104 } 105 106 // Read a command from the serial port. Read until the read byte 107 // is an end of message (new line) indicator. 108 void ReadSeialCommand() { 109 // Expect maximum of 25 bytes (normally 6) 110 byte buffer[25]; 111 int index=0; 112 113 while (true) { 114 if (Serial.available()) { 115 // read the incoming byte: 116 int incomingByte = Serial.read(); 117 118 // Terminating byte 119 // Wait for ETX (End of text - transmision) 120 if (incomingByte==3) { 121 ProcessRequest(buffer); 122 return; 123 } 124 else { 125 buffer[index] = incomingByte; 126 index++; 127 } 128 129 // Check for buffer overflow and give up if it has. 130 if (index>25) { 131 Serial.print("Error:Buffer Overflow.\n\r"); 132 return; 133 } 134 } 135 } 136 } 137 138 void ProcessRequest(byte request[]) { 139 140 boolean processed = false; 141 142 // Check for Query commands (? at the start) 143 if (request[0] == 63) { 144 // Query 145 processed = ProcessQuery(request); 146 } 147 else if (request[0] == 64) { 148 // Set (@P[x]=0) - Set Project x = status. 149 processed = ProcessSetValue(request); 150 } 151 152 if (!processed) { 153 Serial.print ("Error:Unknown Request.\n\r"); 154 } 155 } 156 157 boolean ProcessQuery(byte request[]) { 158 159 boolean processed = false; 160 161 switch (request[1]) { 162 case 86: // ?V - version 163 processed = SendVersion(); 164 default: 165 Serial.print ("Error:Unknown Query.\n\r"); 166 } 167 return processed; 168 } 169 170 boolean ProcessSetValue(byte request[]) { 171 172 boolean processed = false; 173 byte command = request[1]; 174 // Allow ascii version of the fan number. 175 //Position 2 should be [ 176 byte project = request[3] - 48; // 48 = 0 177 //position 4 should be ] 178 //position 5 should be = 179 //position 6 should be the raw value. 180 byte value = request[6]; 181 182 switch (command) { 183 case 80: //@P[x]=y Set project x status y. y is ascii version of the status (0-9). so subtract 48. 184 processed = SetProjectStatus((int)project, (int)value - 48); 185 break; 186 default: 187 Serial.print ("Error:Unknown set command."); 188 } 189 190 return processed; 191 } 192 193 boolean SendVersion() { 194 Serial.print ("Version="); 195 Serial.print (VERSION); 196 Serial.print ("\n\r"); 197 return true; 198 } 199 200 // Set the status for the project. 201 boolean SetProjectStatus(int project, int status) { 202 203 if (projectStatus[project-1] != status) { 204 projectStatus[project-1] = status; 205 206 // Build failed. Flash the red LED briefly to get attention. 207 if (status == 1) { 208 digitalWrite(greenLEDPin[project-1], LOW); 209 210 for (int i=0; i<6; i++) { 211 digitalWrite(redLEDPin[project-1], HIGH); 212 delay(100); 213 digitalWrite(redLEDPin[project-1], LOW); 214 delay(100); 215 } 216 } 217 } 218 219 return true; 220 } 221 The method ReadCommands() will read the input buffer until it receives the start byte then call ReadSerialCommand() which reads the rest of the command into a buffer until it received the end byte. I’ve limited the buffer to 25 bytes which should be plenty and if this overflows then we just abandon it. Their is no timeout between receiving the start and end bytes so this could cause a problem if the end byte is not received. Notice in the method SetProjectStatus() that the project index used is -1 from the project value sent. When sending commands the first project is project 1 however the Arduino uses 0 based arrays. In SetProjectStatus() if the project state changes to be failure (value 1) then the red led is flashed 6 times to draw attention to the indicator. Project State Indication: 222 boolean UpdateLEDs() { 223 224 for (int i=0; i<maxProjects; i++) { 225 int greenLEDStatus = LOW; 226 int redLEDStatus = LOW; 227 228 switch (projectStatus[i]) { 229 case 0: // NC 230 // No acton 231 break; 232 case 1: // Fail 233 redLEDStatus = HIGH; 234 break; 235 case 2: // Good 236 greenLEDStatus = HIGH; 237 break; 238 case 5: // Building from a Fail build 239 case 6: // Building from a good build 240 greenLEDStatus = HIGH; 241 redLEDStatus = HIGH; 242 break; 243 default: 244 redLEDStatus = HIGH; 245 break; 246 } 247 248 // Determine project LED pins and set them appropriatly. 249 digitalWrite(redLEDPin[i], redLEDStatus); 250 digitalWrite(greenLEDPin[i], greenLEDStatus); 251 } 252 } In the method UpdateLEDs() we update the led status based on the project status. If you are wondering what happened to status codes 3 & 4 I’ve used a bit based project status. 0001 (1) is fail, 0010 (2) is good, 01xx is building so 0101 (5) is building from a previously failed state and 0110 (6) is building from a good previous good state. If you want to use indicators other than leds for your project state then you can update the UpdateLEDs() method with another way to indicate the project status (maybe a LCD panel?). That’s basically the firmware, not much to it, the Arduino does most of the work for us which is the best bit! To program the Arduino connect it up, install the drivers (my Vista x64 and Vista x86 installs got the drivers from Windows Update without a problem and also installed the VCP virtual com port drivers). Open up the IDE, ensure the board and serial port are correct and load the build indicator firmware, then hit the upload to I/O board button. In the next entry I’ll talk about the PC application to drive the Arduino. Thursday, July 3. 2008Build Indicators revisited![]() Some time ago I posted about a USB Snowman build indicator, the problem with the first version was the USB IO board I used, its availability was limited and the output was designed as a current sink rather than source, so some modifications had to be made to the board, which isn’t really ideal. Recently I came across the Arduino project, an open source hardware solution and one of the little Diecimila boards provides a perfect base for revisiting the build indicator. The SnowMan is still in use at home and I wanted one for work as well so I figured Id make another build indicator based on the Arduino. ![]() The 13 IO pins can sink or source up to 40mA which is ideal for driving the tri-color led used by the build indicator. The led requires 2 current sources and has a common cathode. The Arduino has a USB interface that provides normal serial port communications to the host PC so interfacing is easy as well. This time instead of a snowman I decided to use a Xmas tree. They are very similar, basically a lump of plastic with a 5MM LED mounted inside. The Arduino provides multiple IO ports of which I’m using only two and the intention here is to provide some common functionality so that the device could be easily adapted to other forms of build indication (Switching relays, multiple project build indicators, other led’s, buzzers etc). ![]() Removing the base and replacing the led is a simple job, either use a flat screwdriver or use the cable exit to push off the base off. ![]() ![]() Pull out the led fitted into the tree using the cable. This is no longer needed. ![]() Now glue the base onto the top of the box the tree is to be mounted on. Previously I used a black ABS box but this time I’m using a ice blue box and this has worked out much better for aligning the parts and seeing the led’s on the Arduino board (RX/TX when programming), and also appeals to the inner geek a little more now that the workings can be seen. ![]() Drill a hole through the middle of the base so that it will line up with the middle of the x-mas tree. This is best done with the base stuck to the box as it holds it in place and ensures every thing lines up. The hole should be about 7-8mm so that the LED + resistors pass thought easily. ![]() Now we need to prepare the led. Using a standard Tri-Color led (I’ve used Red + Green) we need to fit a current limiting resistor to the supply legs. One for the red and one for the green component of the led. Using the datasheet for the led the voltage drop across the red Led is about 2V, this leaves a drop of 3V across the current limiting resistor as it’s driven from a 5V source. I’m going to drive the Led’s at 30mA, so we will need a 100R resistor for the red Led. The green led has a different voltage drop across it (3.4V) so we need to do the same calculation for that and again aim to drive it at 30mA which means we need a 53R resistor, as I only had a 56R resistor to hand I’ve used that which gives us about 29mA current flow. The data sheet gives luminous intensity for both red and green at 20mA and the green is much brighter than the red so we may wish at a latter date to play around with the drive current to get a better balance when both red and green are on. Trim the red and green legs of the led fairly short but leave enough to solder on the resistors and attach these. Next connect a cable to the other side of the resistors and to the common pin on the led. If you prefer you can attach the resistors to the Arduino connector and solder the cable directly to the led. ![]() I used 2 core screened cable as this happened to be what I had to hand and as it turns out by tinning the screen and soldering to the led common pin gives a good sturdy way to physically push the led into the socket in the tree (and pull it out again!). I also put a bit of heat shrinking around the connections to prevent them shorting out. ![]() Now we need the connection to the Arduino board, the led is connected to pins 12, 13 and GND. This is easy as they are all close together and as an added bonus the Arduino already uses an onboard led on pin 13 for status when starting up which means that the tree flashes when the Arduino is starting up, it’s easy to use other pins if you prefer. I’ve used a standard 0.1" Molex connector (The type used for 3 pin PC fans), the PCB version is ideal, but soldering the led connecting wire to the PCB side and plugging it into the header in the Arduino rather than mounting it on a PCB. ![]() ![]() Note that in the photo’s the red cable is actually for the green led and the blue one is for the red led. It doesn’t really matter a great deal which way round they go as long as you get the correct resistor matched up with the appropriate led. However the default in the firmware is that the red led is on pin 13 and green on pin 12. Next drill some holes in the base of the box and mount the Arduino. Note that one hole is smaller than the others so I ended up using only 2 mounting points due to my lack of any 2mm bolts. ![]() The advantage of using a translucent box is finding the place to drill a hole of the USB connector. I elected to use a cone drill and just have a circular cut out for the USB cable to go through, it doesn’t look all that professional but it was quick and it worked a treat! ![]() Next it’s just a matter of screwing everything together. ![]() ![]() I put 6 small feet on the base of the box as well. Why 6? With sticky feet one always falls off (especially with commercial products!) and then it rocks, with 6 you still have some stability to the device if one falls off. Now all that’s needed is a little firmware to run the Arduino and some software for the PC to put it to use but that’s going to have to be the subject of the next posting(s). Wednesday, June 4. 2008Recent Site Outages
Apologies for the recent outages on a number of the Analysis UK websites, these included BookSwap.ws, Dollars2Pounds, Pounds2Euro and all the other exchange rate sites as well as this blog.
On Saturday the hosting provider had an explosion and fire at one of it's data centers hosting one of servers. Initial estimates that were given made it look like it would be quicker to leave the sites (it was a Sunday and their usually quiet on Sundays) and wait for the host to get the power back on. Unfortunately it didn’t resolve that well, after many hours of delays some power was restored but floor 1 had even more damage than was anticipated and power was much slower at being restored, this unfortunately eat into most of Monday (UK time), however Monday evening all was back and well. I got home Tuesday tonight to find yet another apology from the company saying that this time the generator powering floor 1 had failed and they were sourcing a new one, this took a significant amount of time, especially given how much they like to state N+1 redundancy (i.e. a spare generator should have been to hand anyway). Updates were slow, uninformative, vague and at the point of being misleading – I’ve have yet to see any photo's of anything as well. Eventually power returned at about midnight UK time on Tuesday/Wednesday, so fingers crossed nothing else can go wrong in this world class N+1 redundancy data center! Sincere apologies to all those affected, this one is going firmly into the experience category and I’m extremely unhappy this has taken so long to resolve, I will look to do more to improve this and hopefully The Planet will learn and improve (if they have any customers left after this!). I read on GoDaddy some time ago about a problem they had and that they didn’t have geographical redundancy, if your running a serious e-commerce operation and have enough cash for some spare servers get them now and with a different host in a different [part of the] country. BTW - If you have .co.uk domain names with GoDaddy be sure to renew them extra early as they claim they have to renew them at least a month early, then before the 20th of that month (unless I was getting some BS from the customer support as to why they canceled 4 of my domains over 1 month before the renewal date!). Saturday, May 17. 2008Mid May Madness
Now the summers on its way I’m sure you want to be spending less time watching your computer start and more time enjoying the better weather.
So for a limited time I’ve reduced the price of LazyLoad from $29.99 to $9.99. Why not take the opportunity to purchase LazyLoad at the special price of $9.99 and reduce the amount of time your staring at a computer waiting for it to be usable. I’ve also introduced some extra purchasing options, for home users a family pack provides a great way to get LazyLoad on every machine in the house, for commercial users I’ve added some site license options. About 7 months ago I launched LazyLoad and at the time I intended to write a short blog post to talk about it. Well 7 Months latter I’m finally getting their, me and blogging just are not getting along. LazyLoad is designed to take the strain from you computer whilst it starts. Simple really! When you buy a new computer it’s always nice and quick, then years latter you’re reduced to sitting waiting for it to start up and become usable. One of the main culprits of the slow start is all the programs that start when Windows starts. Have a look at your notification area (bottom right of the screen), just how many programs have you got running in the background – lots? Chances are that each one of these starts when Windows starts. What happens when Windows Starts? Once you’ve logged in then all of the programs in your Startup folder get started along with those listed in a special part of the Windows registry. They all get started at about the same time, this becomes a problem as they all need to be loaded from disk, they all need processor time to run, they all need to be put somewhere into the system memory. One of the major problems with this becomes the hard disk, to load all the programs the head in the hard disk needs to move to the track the programs stored on and read the data. At the same time another application is asking for it’s data from a different area and so the head has to move again to the new location, possible not having completed the first request, so in the end the hard disk is shuffling the head back and forward over the disk to find what it needs. To reduce the strain on the hard disk and provide a smoother startup LazyLoad allows you to schedule the loading of your applications a specific time after your computer has started. By stopping all the applications from loading at once the system is able to concentrate on a few specific tasks and get these done quicker – the net result is your machine becomes usable much earlier. LazyLoad is free to try for 30 days so if you’ve not already tried it then download a copy. If you like it then purchase if license whilst it’s on special offer. Wednesday, February 27. 2008Earthquake – in the UK!
Minor tremors felt here in Cambridge, thought I was going crazy and fired up Twitter to see other reports, news starting to come through on sky news sometime after.
Turns out I wasn’t imagining things! Apparently 4.7 on the Richter scale. Unusual to get this in the UK. Only minor here in Cambridge, like a helicopter flying over the house and the only thing to shake was me and the study lamp! Just woken up and want to get your PC fired up quickly to check out Sky News, BBC News or Twitter? Waiting for lots of background applications starting that you don’t need and just want to fire up a browser quickly? Check out LazyLoad to delay the stuff you don’t need immediately so you can get started sooner. Tuesday, October 30. 2007Just for fun.
Sometimes you just have to join in the fun. I read that Stephen Colbert had announced his candidacy for president, and well I had a domain name that wasn't really doing much so I figured I'd join in the fun a little as well.
So to show my support,Steve 2 Win (http://www.Steve2Win.com) has been thrown together and released to the wild, just for fun you understand! BTW - No snowmen were hurt in the production of the website!. Monday, May 7. 2007Putting the SnowMan to work : Cruise Control .Net Build Status Monitor.
So X-Mas has long gone (well at least at the time of writing) and I’m left with two issues, first I want to monitor the status of my builds easily, secondly I have some left over USB SnowMen.
Their can be only one thing for it. Time to get the screw driver and glue out and turn the snow man into a build status indicator. Now idea’s like this are far from new, I’ve read of teams using Lava Lamps to indicate the status of their builds and the latest sources of CCTray show signs of X10 control, Jeff Atwood covered the subject using a BetaBrite LED sign, Mike Swanson used an Ambient Orb and Scott Quibell has used the Dell XPS Leds as a build monitor. So now for my addition to the world of varied build monitors, what else but a color changing snow man! A Good build and the snow man is green: ![]() Building the Application the snowman goes yellowish (Green+Red): ![]() Failing the build the snowman goes red (Don’t mess with an angry snowman!): ![]() This gives a nice feedback on the build status, doesn’t require the addition of mains electric (it’s USB powered), and doesn’t rely on X10 which I’ve found to be problematic in a work environment due to mains born noise and it’s a bit of a weird thing so always good as a conversation point. The parts required: A A USB Mini-Bee IO device or something similar that can source 2x 25mA outputs. (£25) A small box, A Red+Green 5mm TriColor LED (£0.25) Some cable and some glue. In the next blog posting I will describe construction (well modification really) of the hardware and the one after that the simple mods to CCTray to kick the snowman into life. Wednesday, April 18. 2007Pound breaks the 2 Dollar point.
Today the Pound has broken the 2 Dollar exchange rate, this is apparently a 15 year high for the Pound against the US Dollar.
Don’t forget if you want to check out the exchange rate on your mobile phone or other mobile devices you can browse to D2P.mobi, Dollars 2 Pounds for your mobile. Screen shot from Dollars2Pounds showing todays rate above the 2 dollar point: ![]() Tuesday, April 17. 2007Pound touches 14 year high against US Dollar
The BBC is reporting that the Pound reached a 14 year high against the US Dollar during Monday.
I don’t have 14 years worth of data in the Dollars2Pounds exchange rate database, but here’s a chart of what the last 5 years looks like. (Apologies for the Y axis label problem, Excel has decided not to allow me to show the full label – I have no idea why, I’ve tried allsorts). I'm currently working on adding charting to Dollars2Pounds.com, however this is in a big queue with lots of other things I need to be working on so isn’t happening as quickly as I would like – it’s also reliant on me finding a charting package that I like, and I’ve not had much luck so far. If you want to play with a chart in Excel your self you can use Dollars 2 Pounds exchange rate history page and Excel’s Web Query. From Excel select : Data -> Import External Data -> New Web Query In the Window that opens enter the Rates History URL. (http://www.dollars2pounds.com/RatesHistory.php?Base=USD&To=GBP&Days=60) Select the arrow pointing to the date title of the rates table, it should turn to a tick Click on Import, select where to import the data to in the Import Data window and wait whilst Excel gets the data. Your spreadsheet should now look something like: Now, if like me your in the UK, it’s a great time to buy software, components, domain names and the like from US sources as everything’s practically half price!. Please remember the actual exchange rates you receive from your credit card, money transfer or other currency conversion will differ from the rates published, please check the rate offered by the company converting your currency first and remember that conversions are an approximate indication only and cannot be guaranteed by Analysis UK. Implementing GTD SOP #2 with the help of Dinner Timer Lite.
Once again Bob has a fantastic suggestion to help us get things done on his ToDoOrElse.com blog, the basics of GTD SOP #2 are that you spend 48 minutes working with an allowance of 12 minutes slack time every hour (although I’m hoping this doesn’t apply to 24 hours a day – although it sure feels like it sometimes!). Every now and then I find another use for Dinner Timer Lite. Today is no exception, with some very simple modifications to the settings Dinner Timer Lite makes a great timer for GTD SOP #2 (IMHO!) - not to mention that the timer Bob recommends is out of stock at |