WordPress FB Plugin – That was an easy 2 minute job…NOT!
I’ve been asked to look into a tracking and dispatch system for a customer. Now those of you that know me/my company know that we’ve done this on a number of ocasions, the most recent version being Touchdown’s Mesopod system.
All of these units have used dedicated functional units to do each step, a GPRS Modem , A Firewall/router (The pod combines these), and a client device. Now for this one we are going to try something different…..Its all going in one unit.
The design breif we have pulls in a lot of old tech for us, GPS, 3/4G networking, Sensor systems, Chassis electrical interfaces, message passing and databse applications, in that lot there is no scary new ground. Its the client.
A typical system like the Mesopod uses a BSD/Linux based Firewall system. Off the shelf, free and pretty simple. We’ve not bothered ourselves too much with this, it’ll also look after the VPN back to base and in the past its almost always been an Atom based unit of some kind. The Client? Win XPe, the only version of XP tht we can still use. But it all works. We have a huge toolbox of apps for sharing GPS units, grabbing data from our boards, providing multiple serial streams and so much more. Theres only one big problem…We are going ARM on this one.
This means we have a problem, in fact, a very large probelem. SO what software in our toolbox to we have to use here…erm, stuff all. Thats right girls and boys we have NOTHING and worse, theres pretty much nothing off the shelf we can use either.
This isnt as bad as it seems to start off with. You see the first step is we will be using Debian Linux. Right off the bad I can talk to the display, anything I need to hang off of I2c, databases, the GPRS modem, touchscreens, GPS modules, ethernet etc so thats a HUGE swathe of work done. As a comparison the last time we used ARM we programmed it in assembler/C and just getting the touchscreen up took a few days. Here I had the target system up and browsing the net in 30 mins. So the first part of this adventure is wiring everything up and making it all talk, I can do that, I am good at that…
Now the trick is going to be more scheduling and priority, learning how to break other peoples code and ah yes, I do need to write a little of our own for the client too. I’ll be using Chassi s interface boards I already designed to find out whats going on with the veichle and to turn things on and off. I will need to write drivers for this and I’ll need to find another serial port as I’m going to be using the ones I have already, in fact I already have a board of FT232’s in my minds eye.
Its going to be a bit of a challange. The idea is to end up with a nice small box and a 7/10″ touchscreen that chatters away to the head office and can talk to GPSGate server niceley too and just tie up all the bits niceley. Its also going to be our first project with any amount of Linux coding involved so that will be fun too 🙂
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.
While talking with a Collegue yesterday the issue of their server came up. The IT guy has, and I cant fault the logic, gone with Linux and Samba to power what is essentially a Windows Network. This would be an ideal situation except for a small number of flies in the ointment. At the most basic Level, drivers, are the first hurdle. Te Windows drivers include support for all manner of offload engines, acceleration technologies etc. The Linux drivers mostly lag way behind the Windows ones, but they are out there as a rule. Just to get the bare server up and running to snuff can take a while. So starting from a bare server we have a TCO at this point of £0 for Linux and £450 for Server 2012. Now if we run on from here assuming you just install and go you’ll already be having problems. You’ll be seeing performance hits on Network and RAID hardware, easilly fixed with drivers however we are now talking a good hour or two fiddling and faffing with the Manufacturer Linux drivers (if they exist) Bar just running a CD under Server 2012. Say your time is worth £50 an hour and the drivers arent quite right and thus a build from scratch is needed, two hours, we stand at £100/£450. From experienc 4/5 hours is closer to reality as there will be missing things you dont find. On top of that we now have to get Samaba working on this server, Domain config with Samaba isnt fun and the documentation is poor, we can easilly have blown a day by now so thats 8 hours or £400 vs £450 TCO on the software side. Now heres the nasty bit. That Linux server could EASILLY take you up to a day to get working to a useable extent. The Windows server, from bare metal to running a domain, 2 hours tops. being far we will allow for that two hours so £400/£550. SO excellent you saved £100, probobly shaved a few days off your life too. Only its not done. As a rule AD and Windows *just* works at the basic level. You’ll now be looking at 5 mins per machine to connect the PCs. Samaba, prepare for permission and authentication hell, possibly on a per PC basis. In short unless you are a Samba God you wont get it right first time and file permissions are the usual cause. In short, the Windwos Side could be finished in 4/5 hours total from start to users loging in with Roaming profiles and you could Probobly have exchange going too in that time. With Samba you may end the day at ‘Almost works’ and I’ll fix the niggles tomorrow. This is a ‘bit of string’ situation but already there is a disparity here. The Windows server is done and working. I’ve gone home and am Reasonably happy about a productive day, the Samba installer is probobly not having such a good day.
Now lets look at he basics for what we might want to do with this server.
A small office I’m probobly going to want IIS for various tasks (It failry central to 2012 so not having it isnt an option TBH) SO I have a web server and a scripting engine out of the box. I have a pretty useable and simple to use user administrator and unless I install Server Core (and even then not neceserilly) I can manage users, groups, email routing, web setup, replication and indeed about 90% of basic office tasks and be done by the end of that first day.
Linux, well we’ve fixed Samba. I now have to Install Apache, almost certainly some flavour of PHP, probobly MySQL (We do on Windows anyway) and then start installing admin interfaces. Now most Distros do come with various bits and bobs there already, however you’ll find apps start asking for newer PHP versions, or extensions which need newewer (or older) versions, it can get knotty fast.
Its not unfair to say that the windows server would cost you about £800 and be done on day one. (I’m not factoring in Exchange cost, the reason being getting the same functionality for Linux is hell/impossible)
Linux wise we are at two days, so again £800 and will have a reduced level of functionality. Now theres another big trick there many miss. That extra day? Well theres your £400 but if this is a live or new setup you could be having to factor user downtime in there too so lets look at that.
Users cost less than consultants, how much yours cost is down to you but if we assume the following. You average user is on £25K There are about 250 working days per year, so thats anice easy £100 a day; for an 8 hour day thats £12.50 and hour. Think of a small office of 10 users (Yes I’m keeping the maths simple) so thats costing you £125 an hour to pay them, now its about to go wrong…
On Monday you’ve scheduled a server upgrade, you are doing it yourself and lets say its a complete refresh and start over. Your users have been told no PC use (its a little contrived but it DOES happen in small business). So for Windows we were down for a day, thats £1000 in lost time. You know where this is going so we have £2000 on the other time. Its interesting to note that the extra £1000 would purchase a low end Windows server!
Its not hard to see the Linux Admin over a day behind. If thats so its all gone wrong now as the free server has cost heading on for twice the paid one.
Its not all gravy though, troubleshooting MS products can be an issue, debugging and logging with MS products can be lousy and that can slow down finding some issues. There is a very twisty mindset required sometimes, that said. MS will help you if you call (within defined limits)
Its all up and running and now we need to think about day to day use. Adding a new printer and sharing it can be done quite feasably in a few minutes on a Windows server and this includes making sure users get to it with no work from them, dirver issues etc. The whole thing can certainly be comfortably wrapped up pretty fast. Linux offers no such mechanism and indeed its even possible that there are no native drivers for you printer, with a USB device this could mean a lot of work.
So to sum up, think long an hard about what you want to do. If you have plenty of time and it has not associated value (You need to look at the way you use your time!), want to use older hardware, maybe only want the absolute basics of a Windows network and have low blood pressure then go for it. There are situations it is exactly the right tool. If it *has* to work then it may be significntly cheaper to go Windows.
Now to stop the flames, we normally deploy both. In fact we often use Samba for slave/backup operations and most of our sites do have at least one dedicated Linux system. Some things *do* work much better, often the server will be providing a web backend or database services to Windows (Access can use MySQL). Right tools for the right job. I also know I’ve simplified a LOT in here, but the numbers do stack up if you sit down and work your project out on paper you’ll see similar results, at best the Linux option may well cost you as much and deployment methodology can make a big difference but its unlikeley the TCOs will ever be better than eaqal and the £0 TCO of Linux is a myth for business. Businesses rely on saving money as a rule, if Linux were a magic bullet Windows would have no market.
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
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.
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.
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)
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.
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.