What’s this about?
This is the UK website for Peter and Maureen Scargill. We live in the Northeast of England and also on occasion in Andalucia in Spain.

Read through the blog entries, menu-accessible pages and archives if you're interested! Welcome to Peter and Maureen's website.

Want to view this on your mobile? - go ahead - there's a special version just for you. Same address.

Get in touch via Facebook My Facebook Page
You should follow me on Twitter Follow me on Twitter
Join me on  Google+ Join me on Google+
Join my LinkedIn network Join my LinkedIn network
My Pinterest Pinterest

Pete's Online CV

Sound and Light at Grand Place

That’s my international travelling done for the year, another couple of local meetings and that’s me done until the new year, giving me time to get down to some solid research as well as checking out the first lot of PCBs from China.

I just spent the last couple of days in Brussels as Vice-Chairman of the ICT development group for the EU ESCO project. We’ve been working on skill definitions and putting together some standards to help ourselves and other groups.

Meanwhile of course our evenings are free and so I spent both nights at Grand Place where, at this time of year they have the most stunning visual and audio treats. A picture is worth a thousand works so here are some pictures… Also check out the video.. and go easy, I’m still getting used to the new EOS-M.


Grand Place


Print Friendly

ESP8266 LUA editing tool

This one is definitely only for a very narrow selection of techies – and is also featured in my tech blog – the only reason it is in here as I’ve had lots of help from a Chinese manufacturer and they were interested in the blog – but the great firewall of China seems to have blocked it – so I thought it only reasonable to put it somewhere they could access the entry.

This blog refers to the ESP8266, which is a small, inexpensive board for embedded processing. It offers cheap WIFI to add to an embedded microprocessor project. Indeed with a little work it’s useful on it’s own.  Early days and entering information into the thing is not ideal, especially for Windows programmers – so I wrote a little serial terminal to do the job.

Need a serial terminal to help program the ESP8266 in LUA?

Well, I certainly did as even the rather nice Coolterm was driving me nuts. As of the latest version, we have the basics of an excellent programming tool in the Lua Interpreter for the ESP8266 boards. All you have to do is use a file like FLASH DOWNLOAD TOOL to blow the LUA interpreter onto the board then it’s a matter of sending information via serial to the board and watching the responses.

Except for some peculiarities – the board is chronically short of RAM and sending functions directly eats up more of it… one way to get around this and also to ensure that your functions are set in the board “permanently” – ie stored in FLASH, is to write them as files. But that can get a little messy. It is sometimes better to store functions in “files” – these are then activated by the “dofile” command. For more on that see the LUA documentation.

One particular file you will NEED is the “init.lua” file – because whatever is in there will be run when the board powers up! If you want a little remote light controller you are going to need the board to power up, connect to your router and start some code ALL ON IT’S OWN.

In my case the code is simple..

print “Pete’s LUA module 0.4”
tmr.alarm(4000,0,function() dofile(“thelot.lua”) dofile(“mylistener.lua”) end

WHAT?? What on EARTH was that all about???

Well, on powerup I want the interpreter to say “Pete’s LUA module 0.4” – I then want it to wait for 4 seconds… and call a stored function (one I stored) called “thelot.lua”. That function will check to see if the board connected is actually talking to my router – and if not – will run code to make that happen. It will then call another stored function I wrote called “myslistener.lua” which will go off and listen for commands coming in front the Internet.

AND THAT’S FINE, I’ll not detail those functions here, that’s for another place… BUT you have to get this information and the other functions (which are a lot bigger than this one)  INTO the Lua interpreter via the serial port.  Using Coolterm you could do this by pasting in the code from, say, NOTEPAD.. but there’s a problem – that stuff will run there and then – it won’t wait till powerup!!

SO to delay the inevitable, you make it a FILE by wrapping your code inside file commands.. You firstly ensure the file does not exist by erasing it.


If it does not already exist, no problem. Then you create the file.


Easy enough, when you’re done you close it.


Also easy.. but the bit in the middle – my code above needs wrapping in “file.writeline([[“ and “]])” and that gets messy. See the final code you need to enter into the LUA interpreter.

file.writeline([[print("Pete’s LUA module 0.3")]])
file.writeline([[tmr.alarm(4000, 0, function() dofile("thelot.lua") dofile("mylistener.lua") end )]])  

In this example it’s not too bad… but it makes the code harder to read. What would be nice would be if Coolterm could spot that you’re in a file and add that info for you. Also what about comments

–this is a comment

or blank lines.. here’s what you might have

– My startup file – this needs loading into LUA

    file.writeline([[print("Pete’s LUA module 0.3")]])
    file.writeline([[tmr.alarm(4000, 0, function() dofile("thelot.lua") dofile("mylistener.lua") end )]])  

– All done.

So here we are, after struggling for weeks, we now have a nice interpreter for our little boards and we can start to get ambitious – but the tools for sending this to the board arent’ really up to the job and if you’re a Windows person you don’t want to go messing with command line stuff.

SO I wrote this little serial terminal specially for the job – to make life easier for myself. It started off simple enough but like all things I got ambitious. The terminal will now take your code, strip out leading and trailing spaces, strip out comments, it will add delays between each line to make sure the LUA interpreter doesn’t get overloaded, it will spot that you planned to send stuff as files and will add the relevant code.

So this is what you send.

– My startup file – this needs loading into LUA

    print("Pete’s LUA module 0.3")
    tmr.alarm(4000, 0, function() dofile("thelot.lua") dofile("mylistener.lua") end

– All done.

That’s a bit neater.. and this is what will actually appear in the window showing feedback from the board.

> file.open("init.lua","w")
> file.writeline([[print "Pete’s LUA module 0.4"]])
> file.writeline([[tmr.alarm(4000, 0, function() dofile("thelot.lua") dofile("mylistener.lua") end )]])
> file.close()

And that, is that. The installation files are below, no source code, no support and no I’m not spying on you… I wrote this for me and will develop it as the need to do so arises. Works on Windows 7 and 8 is all I can tell you.

Here’s a screenshot

Esp8266 Lua Terminal

And here is a link to the zip file – unzip somewhere – run install . Enjoy. Note this will NOT work on XP as apparently said operating system does not support .NET 4.5 – sorry.

Incidentally you RUN files – i.e. make the Interpreter load up the code with the “dofile” function. For example dofile(“init.lua”) – in the case of this particular file you don’t have to worry as it will automatically be loaded on power up). All of this is detailed with the LUA interpreter.

Of course, you don’t need to be using LUA to enjoy this – you could be using the AT demo… or something else – but I wrote it to help with LUA programming.  Did I miss some really neat, simple feature?

Update – I’ve added tooltips, turned the format on by default, replaced the original simple automcomplete with a new version with most of the AT commands and some Lua commands all in there and put a check in for opening a dead port. Also added Arduino mode (to reset Arduinos as does their internal IDE serial monitor) and more.

Print Friendly

Photo Editing

Pete - alteredMorning all. For those of you who like to play with photo manipulation, you may well have come across Gimp. If you haven’t, that might be because you can afford Photoshop and it’s updates and that’s fine – but if not I suggest you take a look. I suggest you go straight to the site rather than searching for gimp which could return some surprising results.

I’ve used Gimp for years and it is very powerful but updates seem to be few and far between so I was delighted this morning while perusing Google+ to come across this link for G’MIC which is trivial to install and adds a whole boatload of filters to Gimp. I did note that the 3D options killed Gimp but the rest seem fine and there are SO MANY options, enough to keep the budding artist busy for hours if not days.

Print Friendly

Why the NHS needs Reform

We’re constantly told about being more efficient – and minimising un-necessary use of fossil fuels, yes?

Well, with that in mind, many weeks ago – I think in September I made an appointment to have a small bump removed from my finger – apparently something caused by bone wear and tear – not painful but REALLY awkward, embarrassing and prone to catching on things. I went to see my doctor who gave me a date a few days later – I agreed and she booked me into the local hospital. I went there a few days later and was checked out, given an MRSA test, photographed and X-rayed – and a few days after that, the bump was removed. How efficient is that?

No, just kidding. My doctor told me I’d have to wait until November (which was a while off at the time) for the local hospital but kindly offered to speed the job up by sending me to Washington (the UK version) hospital.  I agreed for the sake of getting it out of the way.

A 72 mile round trip, I headed off a week or so later to the hospital and saw the doctor – who arranged for an instant X-ray and told me he could not operate until November – completely defeating the object of travelling all the way to Washington. I cooperated as it was now too late to mess them about.

On the way out they said I’d have to come back in to have a photo of my finger taken… but not now!

Another 73 miles round trip a guy took a photo of my finger in ordinary light with an ordinary camera – the kind of thing I could have done at home with my mobile phone and emailed – or indeed the doctor or better yet the X-ray technician could have done that on my first trip while in the X-ray room!!

As the operation was nearing,  I got a call to say I could NOT come in for the operation before I’d had a test for MRSA. More time passed and another 72 miles round trip and that was over – and MAYBE they would have the results in time for my mid-day surgery that week, if not I would have to wait around for a while (not that anyone asked if this affected my job).

You just don’t GET any less efficient than this – nearly 300 miles of fossil fuels and the most convoluted business practice you can imagine! This is how the NHS operates today. Nothing wrong with the skills of the people I’ve met OR the politeness OR the hospital – but their organisation skills STINK. You don’t SEE the cost to the UK because the NHS will only record THEIR costs. By the time I was finished, I’d used 9 gallons or so of petrol and lost what, 2 days of productive hours? – all this for a tiny operation.

Now I will end this on a positive note, the service other than the efficiency was excellent, the people friendly, the operation done well. I arrived for my 1.10pm appointment a few minutes early and was seen almost immediately. An hour later I was out of the door with a bandage on my finger after something like 40 minutes of hacking or whatever the doctor did (I didn’t watch). Good people, good kit, good service but someone needs to sit down and consider the overall costs, not just theirs – that could have been handled in 2 visits.

Days later the finger is still bandaged to let the stitching heal, feels good, no surprises, I reckon the weekend will see the bandage off. Lovely.

Print Friendly