Jukebox Lights: Serial Comms Prototype

I’ve just finished a working prototype for the Jukebox lighting control, doesn’t look like much at the minute but with the right RGB LED driver in place (I’m thinking three logic level MOSFETs may do the job) then this project is only a wiring job and a glue gun away from installation!  The C# code sends RGB as a percentage along with a value for brightness, also a percentage.  So, to get the brightest red colour send redByte and brightness as 100 and the rest as 0.  Mix, match and repeat.

I played with the colour picker control, some conversion is required though I gave up on the idea as PC RGB and LED RGB don’t match up quite the same.  My method works and is good enough for me.  The Arduino code uses a switch case for the incoming command, colour changing is “101” and I’m planning on adding others along the road.  Maybe a default dimmer for when video is playing and so on…  Time will tell.

image IMAG0155

This is a combo of two programs, the code on the Arduino and a C# program sending control signals from the PC via serial.  Code snippets for both are below;

Arduino

//      Pin Assignments
int rPin = 9;
int gPin = 10;
int bPin = 11;
int potPin = 0;

//      Global Variables
float red = 0;
float green = 0;
float blue = 0;
float brightness = 0;
int command;

void setup()
{
pinMode(rPin, OUTPUT);
pinMode(gPin, OUTPUT);
pinMode(bPin, OUTPUT);
Serial.begin(9600);
}

void loop()
{
while (Serial.available() > 0)
{
command = Serial.read();
switch (command)      //  Planning ahead for multiple commands to be sent, add another case for others
{
case 101:
red = Serial.read();
green = Serial.read();
blue = Serial.read();
brightness = Serial.read();
//  Code for debugging Serial
Serial.print(“Colour – “);
Serial.print(“Red: “); Serial.print(red); Serial.println();
Serial.print(“Green: “); Serial.print(green); Serial.println();
Serial.print(“Blue: “); Serial.print(blue); Serial.println();
Serial.print(“Brightness: “); Serial.print(brightness); Serial.println();
Serial.println(red / 100);
red = (255 * (red / 100)) * (brightness / 100);
Serial.println(brightness / 100);
green = (255 * (green / 100)) * (brightness / 100);
blue = (255 * (blue / 100)) * (brightness / 100);
break;
}
}
analogWrite(rPin, red);
analogWrite(gPin, green);
analogWrite(bPin, blue);
delay(75);
}

 

C# Code (SendData and Print only)

private void SendData()
{
byte cmdByte, redByte, blueByte, greenByte, brightByte = 0;
byte[] command = new byte[5];

cmdByte = Convert.ToByte(101);
redByte = Convert.ToByte(nudRed.Value);
greenByte = Convert.ToByte(nudGreen.Value);
blueByte = Convert.ToByte(nudBlue.Value);
brightByte = Convert.ToByte(nudBrightness.Value);

command[0] = cmdByte;
command[1] = redByte;
command[2] = greenByte;
command[3] = blueByte;
command[4] = brightByte;

try
{
prtSerial.Write(command, 0, 5);
}
catch
{
MessageBox.Show(“He no work!”);
}
}

private void btnPrint_Click(object sender, EventArgs e)
{
lbInc.Items.Clear();
try
{
if (prtSerial.BytesToRead == 0)
lbInc.Items.Add(“No Data”);

while (prtSerial.BytesToRead > 0)
{
lbInc.Items.Add(prtSerial.ReadLine());
}
}
catch
{
// do nothing
}
}

I’m hoping to have the driver built next week and hopefully the lights installed this coming weekend.  With the weather as it is it all depends on when I get get the parts delivered.  Next up is the Media Centre add-in to control the lights.  Should be a matter of UI code though as C# is a supported language for MC SDK.

Keegan

New Years Projects

Last year my new years resolution was to never make a resolution again, they seem a counter productive to me.  If there is something you want to change about yourself you shouldn’t wait a year to do it.  To quote a friend of mine “life’s short, crack on”!  That said a new year is a good excuse to set yourself new targets for the year.  That’s right, I’m a hypocrite, deal with it.

There are a few technologies that have had me curious since a child, initially in science fiction and now becoming more commonplace.  This year I intend to learn more about them and hopefully build a few projects based on them all the while documenting my findings here.  The Jukebox has been an ongoing project for a while and as my RGB LEDs have finally arrived I hope to complete the first incarnation of the lighting circuits soon.

That said, I’ll outline what projects I have planned for this year;

  1. Finish the Jukebox
    Outstanding work to be completed on the Jukebox includes designing and implementing the lighting circuits and the software required to control them.  Initially the plan is for the colour of the LEDs to be controlled by a Media Centre addin that will also allow for dimming the lights when video is playing and leave only the red sections alight when recording only.  Later on I hope to spice things up by adding circuitry to turn the lights into a stereo VU meter when radio or music is playing.  It’s a stretch goal but one worth aiming for!
  2. Build a Mobile Robot Base
    After seeing Back to the Future and Short Circuit as a child I’ve always had a mild obsession with robotics and automata, I started studying Cybernetics at Reading University however found the course lacking in practical elements so switched to Computer Science.  I figured I could pick up robotics as a hobby later on and use my programming knowledge to better effect as electronics has always come easy to me.  To that end I intend to build some form of mobile robotics platform, likely tracked as a homage to Johnny 5!
  3. UAV
    I own a T-Rex 450 though I haven’t flown it for quite some time and though I remember in theory how to fly it I’m well out of practice.  To that end I intend to teach the helicopter to fly itself!  There is a Arduino based autopilot (Ardupilot) which is intended for gliders and planes, helicopters are considerably more complex beasts to control so I’ll look into a more simple drone first off.  I’m not expecting to have this one finished this year or even ready for first flight, I’m planning on learning more about coupling GPS and accelerometers to the Arduino, maybe as a data logger for my bike, time will tell.
  4. Renewable Energy
    Solar and wind power have always had me intrigued and this year I intend to sate that curiosity.  I intend to build a gadget charging station using a combination of the two, this will give me experience in these technologies so that in the future I’ll be able to scale them up.  It will force me to learn more about the mechanics involved as well as the circuitry required to charge a battery from a combination of sources.  I figure being able to charge my phone, mp3 player and cameras would be a good start and from there, who knows, maybe my future workshop/brewery will be off grid!

These aren’t listed in any particular order though I expect the Jukebox will be the first to complete as it’s already in progress.  I’m not setting a deadline on other than for most of them to be works in progress, the Jukebox I intend to finish shortly, and I see these as learning experiences and a basis for future work rather than projects in their own right.  Instructables are to be expected along the road as I intend to share what I learn.

2010 will be a good year, I intend to make it so.

Keegan

Creamy Mushroom and Tomato Pasta Thing

This is quite a tasty dish I’ve just thrown together, it will produce enough for one hungry person or two as part of a bigger meal.  You can probably add other stuff, I reckon a bit of beef mince or some diced bacon would have worked a treat.

Stuff You’ll Need;

  • Black cale
  • Four tomatoes
  • An onion
  • Handful of mushrooms
  • Handful of pasta
  • Vegetable stock
  • Other stuff to season

Stuff To Do;

  1. Boil a saucepan of water to blanche the tomatoes then to cook the pasta.  To blanche them make a cut in the skin of the tomato around the circumference then dunk them in the boiling water for a minute then dunk them in cold water.  Peel off the skins then dice the and use the already boiling water for the pasta.
  2. Chop up the cale (removing the stems), onions, mushrooms and throw the onions into a frying pan with a little olive oil.  Fry until they start to brown around the edge.
  3. Add the tomatoes to the onions and add a little water.  Cook for a few minutes then add everything else and crumble in the stock cube.
  4. Add whatever “stuff to season” you wish, I added some black pepper and cook for a while longer.
  5. Drain the pasta, remove the frying pan from the heat and mix it into the sauce.
  6. Eat!

Any suggestions, feel free to add a comment.

Keegan

Recipes

Those who have been here before know I like to make things, unsurprisingly this also includes food!  Just thought I’d give fair warning before random recipes start to appear on here…

By the way, if you are as lazy as I am and terrible at remembering to buy veg try and find a local veg box scheme.  I’ve been aware of Riverford for a while and figured that I can get them to deliver to work so it works out well all around!

www.riverford.co.uk

Plus I don’t have a choice in what the deliver so I have to find recipes to cook stuff I wouldn’t otherwise buy.  Win. 🙂

Keegan

Home Server Rebuild

My Home Server has served me well however the aging 1.2GHz VIA board that was in it has long since peaked.  Time for an upgrade…

I decided to go for the POV MB330-1 which has 4xSATA on board along with a eSATA and a dual core 1.6GHz Atom processor.  I also decided to add an internal 2.5” drive to act as the system disc to make hot swapping drives in my Chenbro case far easier.  I’m not going to bother documenting the build in too much detail, for the most part I simply put all the bit in a case so it shouldn’t be too taxing if you RTFM.  I installed the system using a USB key, details can be found on We Got Served.

IMAG0143 IMAG0142

Picture on the left shows the laptop hard disk hidden away in the lesser known internal slot in the Chenbro case, on the right we see the PCI SATA card to add the extra port for the system disc.  All four bays are on the mainboards SATA ports, I’ve no idea if this is best practice but it seemed to make sense that they be adjacent on the system to reduce a potential bottleneck at PCI.  It may also simply be my OCD…

One thing that had me baffled (and still does) is the extra SATA port situated near the eSATA port.  I tried plugging a disk into it and nothing happened, whatever it is I’m sorry to say it is not a SATA port.  Maybe it will be enable in a future bios update but for now its purpose remains unclear.

One piece of advice I cannot stress enough it to get the latest drivers from Realtek for the LAN.  I am not certain of the exact chipset used but these drivers worked for me.  Network throughput went through the roof after this and the connection became a lot more stable too.

Hope this helps someone, any questions feel free to ask in the comments.

Keegan

Ps.  No, I don’t work for Mini-ITX.com or get commission (a shame!) but I’ve been using them for years and they’ve been helpful with any questions I’ve had.

UPDATE:  If you randomly get bluescreens or messages saying "You system has recovered from a serious error" try uninstalling IPv6.  My server was crashing a few times a day and after a kind soul at work reviewed the memory dumps it was IPv6 making the network driver crap out.

Windows Home Server and Windows 7 Network Throughput

I’ve a gigabit network at home and my transfer rates sucked, considering I frequently watch HD content from my Home Server this was less than ideal.  Having a chat with a few of my colleagues at work and after performing a simple tweak on my Home Server, throughput went from 30Mbps peak (that’s mega bits not mega bytes before anyone gets shirty) to a fairly stable 80~90Mbps.  A hefty improvement considering it involved the creation of a registry key and a restart!

Essential it involves enabling Compound TCP and I followed the steps to create the DWORD on this page.  If your Home Server is up to date then you don’t need to install the hotfix, only create the registry entry.

Mstsc to your Home Server and open regedit, don’t forget to backup your registry blah blah blah, and find the following key;

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersTCPCongestionControl

If it isn’t present, create a DWORD of the name TCPCongestionControl and set it the value of 1, reboot and you should be good to go.

UPDATE:  This hasn’t been a permanent fix for me, if anyone has any other tips feel free to add them as a comment.
UPDATE UPDATE:  Inbox Realtek drivers suck ass, www.realtek.com.tw is your friend…

Enjoy,
Keegan

Jukebox Cooling Update

Previously I mentioned that the Jukebox was running a little warm when fanless, 80 degrees C in fact which is 5 degrees short of the thermal specs!  A fan was added (fan noise = evil) as a temporary solution and brought the temperature down to a more respectable 40 degrees.

I decided that more air flow meant less heat, convection currents work pretty well in nature so why not my Media Centre?  Before and after shots are below,

Before

After

IMAG0134 IMAG0138
Simple and hopefully effective too, half an hour into some HD content that is nailing both CPU and GPU the temperature is only 60 degrees C.  Not exactly a cool runner though a lot cooler than before and enough for my liking.  A little extra heat is a low price to pay for no fans.
Keegan

Jukebox HD: Some Cooling Required

I’ve been running in the Jukebox for a few months now and from a usability stand point it is still running a treat.  From a mechanical point of view however all is not well as it runs a little hot.  In a normal case this may be fine however in a case such as mine made out of thermally absorbent wood it gets a little toasty.

Using CPUID Hardware Monitor (free to download, Bing it) I discovered that the CPU and GPU both run at around 70~75 degrees C at idle or while watching TV and movies.  The fact that there is little difference between idle and loaded temperatures is a testament to good design of the board however I digress.  I added a spare 80mm Papst fan to blow some air into the case as a quick and dirty test and the temperatures dropped to 30~35 degrees C, an impressive drop from a simple change.  It also shows I can slow the fan to make it quieter and still have a big impact.

Considering the maximum thermal spec of the board is 85 degrees C I think I need to work fast.  Current ideas are to use a Nidec Gamma at low speeds which would still move a lot of air though I’m also going to test having a bigger hole for heat to exhaust more efficiently.  It seems the few little holes I put in before are woefully inadequate.

Keegan

Fix: Macbook, Windows 7 and Black Screens

I was recently given an old Macbook (late 2006) and after upgrading it with 2GB of RAM and a 250GB hard disc I Boot Camped the crap out of it and installed Windows 7.  As expected pretty much everything worked after installation, something  I have come to expect of Windows 7, however any time I closed the lid of the machine or returned from sleep and hibernation the screen was black though the computer otherwise responsive.

It was only by chance I stumbled upon a now obvious solution to this, look at your screen under sunlight; under certain conditions you will see a picture still as the backlight is switched off.  Press the brightness buttons (fn and f1 or f2) and you will likely get your screen back, this even works at logon.  As for closing the lid, in power options set “Close lid” to “do nothing” and it will not switch off the screen.  Seems to work for me and hopefully will help anyone reading this blog in the same predicament.

Good luck.
Keegan

Logitech X-540 5.1 Surround Speakers

As my audio/video needs are being satisfied by an Zotac ION and now the case is finished I figured it was time to sort out the audio.  Until now I’ve be using an old set of Creative 5.1 speakers that has it’s own decoder and connect using SPDIF.  This sounds good, pardon the pun, but led to some peculiar issues with lipsync and had no remote.  Enter, the Logitech X-540s.

These are quite cheap (I got mine for £70 from Novatech) but the sound quality is superb, even from a basic source.  Watching Freeview with “Matrix Mode” on does some funky processing and gives a pretty good surround sound effect.  The bass can rattle the windows or switch it off completely, as I live in a flat (apartment to any passing Americans) and don’t like to piss off my neighbours too much switching it off is a fantastic feature.  For that reason alone I can recommend it to anyone in a shared block or house with thin walls.

These speakers are quite dumb, other than Matrix Mode they do no processing, and require outputs from the machine itself.  From my perspective this is great as it gets around the issue mentioned above with SPDIF.  The motherboard does a fantastic job in decoding audio from Bluray films and sounds great.  Watching Black Sheep I’ll admit to jumping when a sheep bleated in my ear…

The only issue I have with these, as mentioned in every other review for these, is the length of the speaker cables.  For use in a living room they are too short, for bedroom or study use they may be fine.  Thankfully Logitech have used RCA connectors rather than some proprietary nonsense which means buying or creating extensions for them would be a breeze.  I’m planning on wall mounting the rears so an extra 5 meters will be very handy.

In conclusion, for £70 you can’t go wrong.  Just make sure your sound card has 5.1 analog outputs.

Keegan