Category Archives: Uncategorised

Sky+ HD HTPC/Media Centre Build PT 4

If you’ve not read the other parts, please look here: Part1 Part2 Part3

The boards arrived from OSH Park this morning. I’ve had a look and there may be an issue with the pads for the USB controller. It looks like a pad has ‘bled’ but there is a tiny bit of clearance so running a scalpel in there may fix it. Its also clear that the FT232RL was a bad choice, it is on a stupidly fine pitch and I can see it being problems. As it is it’s going to be a paste and relow oven job. Now I could be lazy and simply pick up the pads and use a TTL convertor however this means I need to either internally mout a USB socket or strip off the USB Plug. I wanted to keep this all professional looking so thats out.

The parts were ordered today so we should have something to build and flash tomorrow, here’s hoping.

Now, two considerations now. There were two bits of code that needed looking at, the power LED and power control. With the mock up the PIC now boots, grabs control of the serial line, sends commands to the display then goes back to the PC. There seem to be two issues though.

1) The panel ignores the PIC. I can only assume this may be a result of me using diodes rather than an OR (I didnt have one) and will be ok on the new boards. However looking at the timings I did notice that there is a definate difference between what my PC thinks is 19200 and what the PIC thinks it is. Theres a tiny amount of error in the PIC timings and its possible parasitic capacitances, bad routing etc on the breadboard is causing it. I havent scoped what is going up to the display so there may be other nasties there, the analyser just says on or off. The power LED was a nice extra but the machines do boot fast enough. I had intended to use the blue rings to indicate fault conditions but never mind.

2) The remote LED no longer works with the front panel buttons. Its not a problem but I’d like to know why. The thought is that the PC is replying before the PIC has finished processing and may be causing a funny with the serial routing selects.

Power control. This still isnt done but will get done tomorrow (or in a minute). This is simple. The board should power up and wait for ‘n’ seconds for the ATX 5V rail to come up. The board should automagically do this but I’ve noticed BioStar boards dont always. After this delay an ATX power on will be sent via the relay and it’ll wait again. All being well the 5V line will come up and off we go. If this doesnt happen the hope was to display two halves on the ring () flashing to say that something went wrong.

Once the system is up pressing the power button will send a sleep command via the driver to Windows. The syste, should then hibernate. Holding it down will force an ATX powerdown. When the PIC sees the ATX 5V line go low it’ll then wait for another power buttone press to pule the power switch OR for the 5V line to come up on its own signalling the machine was woken up.

I have to code this but with simple flags it wont take too long.

I’m also thinking about using a boot loader here too. There is a lot more I could add to the firmware but right now it just needs to work. A simple botloader would enable updates to the firmware when the driver application is updated. The micro does receive serial data from the panel, PC and the IR receiver and being a PIC16F870 theres a lot of room for things like timers, remote code and the aforementioned watchdog too.

Almost there….

OSS Rant AKA Its been a month since I last tried to make an OSS app work

Well those of you who know you will know that I live by the rule, right tool for the right job. Sometimes though it turns out the ‘tools’ arent exactly what you expect.

My expcectation of a application is simple

Install

Setup

Run & Use

Windows does this pretty well but sometimes Windows isnt the right tool, in this case I have a little ARM8 system I want to use. This means Linux. SO OS installed, RDC on there, X setup, all going well. Now todays challenge is Sat Nav. After some diggin it turns out I want Navit. Theres an Android APK for it so I decide to try it on my phone first. The reviews arent great and centre on UI issues, pretty typical of a lot of OSS apps is a poor GUI that makes sense to the Devs or was an afterthought. If this works I’ll be doing major overhauls on the GUI so I dont care too much. Download it and install it, so far so good. OK, it needs maps so off we go to get the built in downloader….oh dear

To say is demented is not doing the full horror justice. On the surface it *seems* ok. Scroll down, Select UK and off it goes. Its a big file so I decide to do something else so the phone doesnt sleep, big mistake. The second I try and drage the status bar down the download aborts. and then wont restart. I try the England maps and try again, Menu key this time..blam, download abourts, wont restart just saying theres an error. Off I potter to the maps folder and remove the temp files. Its happy again I start the download again (350Mb) and go back to doing what I was doing. Blam, it dies again, this time because of a wifi glitch. Once again I have to clean out the folder and try again. in fact 8 times it took to get the map and then I had to do it again. Select a dowloaded map, touch the screen and it removes it, no confirmation dialog or warning it’ll do this!!! FFS Guys!

Map is downloaded and supposedly installed, excellent, only nothing happens. In fact the app does sweet FA untill the phone gets a fix. It doesnt tell you this, just shows a white screen with half the icons missing until you tell it to look or find an address (I wont start with the search function!)

Once its up and running it does look like what I need. however there is this complete lask of finesse. You dont have to look far to find this elsewhere. Two big ones, Apache and Samba, ok text based setup but high Voodoo can make more sense for some tasks. The config interfaces are inconsistant leaving mines for newcomers to step on for no reason.

Here’s someone else’s explaination of Apache…hate_apache

There is a lot of OSS stuff that *just* works. Its sadly outweighed by the crud. I say crud but in my experience if you can make these apps work they normally do what they say on the tin and do it very well.  It seems there are a few routes to trouble.

1) I need to do X, I made it work, now to share it with the world!
This seems to result in software thats way too closeley tied to the dev’s hardware, often has no docs or what is there is poor and MAN is it easy to break. If I’m going to throw something open to the world I *always* make a point of putting a good amount of testing/error checking in there and at the very least make sure it runs on something else other than my desktop.

2) Feeping Creatureism
This is an easy one to fall to and anyone that writes software has seen it and done it. You start with an app to draw an OSD on a screen. Just a bit of green text at the bottom is all you need. Halfway through you realise you could put it anywhere so you code in that, then you think about graphics, so in that goes, then you could allow color changes so in that goes. The basic requirement at thi point doesnt actually work and often ends up being a rush to make it all work just well enough and projuces code rife with odd bugs, kludges and spaghetti code. Your simple program is now many Mb ond requres a degree in quantum mechanics for anyone else to follow.

3) Boredom
You’ve written your app now you want to play. Maybe you did the right thing, made the basic app work avoiding 2) and you want to go add bits, thats great. However you’ve not documented anything and the UI makes sense to you and no-one else. You’ll go through 4 or five versions and then you’ll get bored and stop working on it. These tend to be the apps that people find and start jumping for joy because someone else is trying to solve that exact problem. This normally ends up with the app being impossible to configure/use or works so very nearly bar a tiny bug. Because the dev got bored that bug was never fixed and because they didnt document anything, no one else knows how to.

There are many, many more causes however a lot of this is mitigated under Windows and this does Linux a lot of damage. If I write two apps to do the same thing, the windows one will take a fraction of the time, it has a GUI, I rarely need to think about dependancies as *most* Windows systems are equal (I use Delphi so none of the DLL dependancy rubbish of VB/VC apps which *still* isnt resolved). Unless I’m hooked into something like a driver my code will run as it. The workflow in creating a Windows app makes it harder to produce an App with a useless GUI too. Under Linux I have to think about so much more, so many more steps. I need to think about depanancies and unless I’m mad and have forever Binaries arent going to work because every install is different. I could compile for Distro X version n but the next fork/version/update will likeley be different and will break it. This means testing becomes all but impossible too. I can test on Win XP/7/8/10/Server 2008/2012 inside of 15 minutes. They are all here as VMs and for most cases I can safeley assume that if it behaves with 8 and Server 2012 I’m going to be golden.

For Linux and OSS to be seen as a serious alternative this all needs to be addressed. Through design Android has *almost* solved the issue, if it wernt such a pain thats where I’d be going as a business for our embedded stuff (and we still may do)

 

Not just Computers

Its not just PCs here. In fact as time goes on the life expectancy of the PC market is getting shorter and shorter. When I started this lark after I left school we were an electronics and comms company and PCs were an afterthought (They wernt common either). As the market changes we’ve been going back to our roots and doing more and more custom kit, it helps differentiate us from all the other businesses in our sector and we get some interesting jobs.

In this case I had to design and build a 12V charger system to provide power for a Suction unit and Patient Monitor along with a standard car charger output. Simple job, simple solid contruction with as little to fail as possible. Thinking about it now I should have put a high output USB socket on there too but hey. Also we had to provide 240V to the Patient monitor and/or Infusion pumps, incubators or whatever. Also mounting them all and the suction unit and to finish fit a solid shelf for the Monitor which required making all manner of bracketry.

Its not just computers...
Its not just computers…

Happy with how it all came out really 🙂

Now, Given I’ve been pretty much out of circulation all week due to illness I have 9 Laptops to diagnose and fix tomorrow.

Sky+ HD HTPC/Media Centre Build PT 3

If you’ve not already read the other parts, you should : Part 1 Part 2

As already mentioned we need to do something about power. There are two issues here.

Firstly it seems the BIOS power on AC loss setting isnt quite right with the board I’ve chosen. For some reason the board doesnt always power up, this may be related to the aformentioned hardware issue with the board but it’d be nice to be able to do away with this setting. So first up we have a relay across the ATX power pins. When the board powers up it checks the state of the +5 rail to the board, if its not there after a short delay the atx power input is pulsed to start the board up. We’ll also as mentioned earlier, go play with the standby LED too.

Now the second issue is the power button. Depending on what is going on it needs to do different things. For example if the board is shut down it needs to send an ATX power up and bring the board up. If the board is powered then it needs to send a command to the driver to start the hibernation process. A simple state machine should do this with a flag set to notify the keypad routines that the power button is special.

One final idea, MCE and wondows do ocasionally deadlock. So the thinking is that I may add a ‘watchdog’ The panel controller pings the driver which pings back, if more than X pings go astray in a fixed period of time we will send a hard ATX power down.

Anyway, thats where we are at the moment. The boards were ordered today from OSH Park so we should have more to play with in a couple of weeks.

 

Sky+ HD HTPC/Media Centre Build PT 2

So if you’ve not looked already, go look at Part 1.

At this point I’v discovered that my mainboard is screwed, it wont reboot cleanly and after a lot of playing the board is at fault. Its a brand new board so thats off to the suppliers. In the mean time more fiddling with the front panel.

An hour with a multimeter, pen and paper and I have the matrix mapped out, a bit of experimentation with LEDs and I’ve confirmed the wiring. Time to break out the breadboard.

I chose to use a fairly high end PIC, the 16F870. Totally over the top for this BUT it leaves space for other things to go in there and importantly, unlike the 14 pin PICs I can use the ICD facility and I have at least two 8 bit ports. So the matrix is wired up to port b and we statr scanning. The code is pretty simple, it scans contantly in 1ms steps and looks for changes. If there is one the port is read yeilding the first 4 bits with the row being scanned and the lower 4 with the column thats active. Its crude but I just blast these out the serial port as raw scancodes rather than formatting. This does mean that if another keypad were used its just a software tweak in the driver to make it work (I may make the key vals customisable).

Now back to that power LED. Once the driver app runs it turns on the red standby LED and then wait for Media Centre to respond. When it does it switches the LED off and turns the green one on. Thats fine and dandy BUT if the machine is hibernating, if the driver crashes or something interrupts the boot you have no indication the box is doing anything. So we want that RED power LED on at power up and not needing to rely on the board booting. On top of that I’ve found the board doesnt always auto start AND the standby/power button needs handling.

First up I’ve thrown a handful of AND gates into the serial lines, this means I can now steer where the PIC’s serial goes. This means the first thing the PIC does is connect itself to the panel and turn that damn LED on. It then wires itself back to the serial from the PC and is hapy again at the same time making sure the inboud serial is shunted back to the front panel. The PIC can listen to this stream too but at the moment I have no use for that (It may get used for a watchdog) The driver now turns on both red and green LEDs giving an orange LED as the driver waits for MCE to start.

The PCB
The PCB
How it all connects up
How it all connects up

Next the power button and powering up the board….

 

Sky+ HD HTPC/Media Centre Build

Our Sky+ HD box had been getting more and more flakey over the last few months so we decided it was time to replace it. We dont actually have an HD subscription and we’ve been a long term customer so we phoned up and moved stuff about and managed to blag a free replacement box. So it arrives, is plugged in and ye-olde-faithful Samsung box is finally retired.

The thing then sat at the end of my desk for a week being used as a step-stool for Kevin and generally getting in the way. I opened it up out of curiosity and liberated the HD, this turned out to be royally screwed (ok I could have just changed the HD). There was an ungodly amount of dust in there and not really much else of use. So the question turned to what to do with it.

Knowing how locked down these are there was little point in trying to hack it, I’m not overly interested in breaking into it although its in theory possible to get a custom linux firmware in there (been done on older boxes) so its time to go in the in. However at this point I realised a standard micro ATX board would go in, with space to spare. It would make a nice replacement for the NEC PC that lives with our AV kit running Windows Media Centre. Three hours later its all running and does indeed fit perfectly. So some metal working and I have a Pentium G2030 in there, 64Gb SSD, 4GB of ram and a GF210 (I wanted this for HDMI out). We stream everything off a server so the small drive worked niceley. A quick visit to ebay and a 1U server PSU and PCI-E extender finished it all off.

This is a mix of pics from the first and second machine. Both are more or less the same excpet the lower scart hole has gone on the second and there is no GFX card in it. I also spent a lot more time on the rear panel as its for a friend. Mine was wiped with degreaser and sprayed with two coats of hammerite where as the second was sanded, filled, primered, sandeed… well you get the point.

My first unit running and the new one in progress...
My first unit running and the new one in progress…
Empty case, back off ready for the cutter...
Empty case, back off ready for the cutter…
Filling holes...
Filling holes…
Mock up rear panel for a customer version.
Mock up rear panel for a customer version.
Checking board fitting
Checking board fitting
PSU Test Fitting
PSU Test Fitting
Test fitting the PSU, SSD mounted.
Test fitting the PSU, SSD mounted.
All jammed in there...
All jammed in there…
Riunning and the top on...
Running and the top on…

 

Now I’m not the first to do this, you can find similar here: http://forums.bit-tech.net/showthread.php?t=220767 but its not quite ‘there’ in my eyes. The hardware and aproach is a little different, I wanted this to behave exactly as a Sky box in terms of lights, cabling etc so that I could give this box to anyone and it’ll work as if it was meant to be thi way. I do have the knowledge and ability to do the same and make new boards for the front panel but it seemed a waste. Now theres a micro on that front board and I have a logic analyser. So the box was partialy reassembled and the poking started. Hoping to find I2C or similar I was surprised to find the fron panel board speaks plain old RS232 at 19200 baud. A bit of poking, some quick software bashed up in Delphi and I have full control over the panel. Ace, and the board handles things like the sequencing of the LED ring so loads of work to make these behave now no longer needs doing. As its the Sky firmware doing it, it looks right. The buttons were sadly another story, they are a 4×4 matrix, a pain as it would be nice to use plain serial for both but hey, its still useful.

So I wrote some more code to listen to events generated by VMCController and then dispatch the apropriate serial commands. I was then the owner of a front panel that worked with MCE exactly the way the Sky one does on a real box, more or less. The power LED is an issue but that will come later.

Running...
Running…

So time for some custom electronics…

About Time

Well I’ve been meaning to do this for ages. I have a lot of bits of random Info I keep meaning to post up and share, projects etc. Although Facebook is handy for some of it, it’s toally the wrong place. Especially when its a solution to a problem I know many have been looking for or something of interest to the world in general rather than my imediate friends. So here it is.

Expect copious amounts of garbage interspersed with ocasionally useful information. This is quite literaly destimed to become my mental dumping ground 🙂