Please note ALL of this information is now dated – the blog http://tech.scargill.net is now the place to see this and MUCH more tech info, thanks. The blog has thousands of followers and covers ESP8266, Raspberry Pi, reviews of many single board computers, Node-Red development and much, much more. Please visit the new blog.
This is my original blog – all of the material in here has been moved to the now very popular https://tech.scargill.net – you can find all the older material, some of it updated – and a whole load of new stuff – at https://tech.scargill.net
The PR26MF22NSZ and it’s larger cousin the PR39MF22NSZ are miniature 8-pin devices which look for all the world like any other 8-pin chip – but are able to switch mains power at up to 0.9amps – i.e. up to 200w. Seems unbelievable but that’s the claim – sensible you could certainly run a typical mains light.
Given the very small size of our ESP-01 boards and the equally small size of the mains power supplies I found earlier, these would appear to be an ideal companion. Right now they are marginally more expensive than the cheapest Chinese relays and even very slightly more expensive than some solid state relays – but the size has to make it all worthwhile?
Digikey have the larger one at 1.18 but the postage kills that option – you have to wonder what their marketing people are thinking about – 1.18 for the chip – 12.00 for postage – come on guys – it’ll fit in an envelope!!!
The best I’ve seen up to now is £1.97 with free postage here..
I’ve ordered one just to see what size it is – I’m hoping this surface mount version is the same size as the normal DIP… time will tell. If it is at works I could see a board coming on! Here is some more info and a diagram.
This is looking interesting – I just spotted Domiticz – and apparently it can talk to devices via MQTT.. and we have ESP devices running with MQTT… hmmmm I wonder how much work would be involved in getting the first ESP temperature sensor talking to Domoticz by MQTT..
You may recall I sent off a little while ago to China for some 3v3 power supplies to power the ESP8266 boards with (the link is in the blog). Well, they turned up this morning and while I’d never want it to be said that I didn’t think they were dangerous – they LOOK dangerous – on the other hand as long as everything is insulated and you’re not planning on touching anything – these are CHEAP and these worth checking out on Ebay. Shown over on the left next to an ESP-01 board, they are really small and would make for pretty good plug-in-the-wall gadgets along with the ESP-01 and a suitable relay?
Meanwhile the next gadget is a prototyping adaptor from FREETRONICS and I have to say it looks pretty good – notice the sizeable 3v3 regulator. I’ve plugged in an ESP-01 and underneath there is a decoupling cap. There is a level shifter, lots of links for options and basically you’re looking at an Arduino shield for testing out your ESP-01 boards – LOVELY!
Freetronics have a load of little boards like this and so it’s worth a trip to their site.
And with that once again I’m pretty much out of time until the weekend due to endless meetings.
07:20PM – This one is turning into a MONSTER of a blog entry – lots of new stuff.
This article describes the ESP-01, fitted with LUA firmware that is able to converse with a serial terminal in a high level language, store programs and data, turn things on and off in a package that costs almost nothing. The possibilities for ridiculously cheap remote temperature sensors and more are finally here. The software is new, the hardware is relatively new – and we need people working on software to make remote access easy. No guarantees here as I have only tested (and reported on) some of the features. Am important fix that made this practical to use only came through in the early hours of this morning – there will be bugs but at least it’s a starting point – all you have to lose is a little time.
Cheapest computer is of course a grandiose title, for sure and one one that would have been invalid as far back as, oh, yesterday, but I think its’ fair to say that as of this morning we have a stunning new development. That is not to detract from the many worthwhile firmware developments on-going for the ESP-01 and similar boards, but here I’m going to present you with all you need to get the cheapest computer in the world up and running.
What do I mean by a computer in this context? I mean a device capable of connecting to the outside world via WIFI and doing real things – like flashing a light or reading a sensor – and having a human interface installed…. I’m stretching this a little, but essentially right now as I write this I have in front of me a computer capable of responding to commands in a terminal window – for £2 – does that have your interest?
So now we have probably the world’s cheapest WIFI computer.
The ESP-01 has been around for a little while now- what you are looking at top left is a processor with built-in WIFI radio, a memory chip, a PCB aerial and a few passives. It has a 0.1” spacing (therefore easy to use) connector and that is about it. It comes with some firmware which will have you tearing your hair out if you have any – but that’s no the point – the firmware is easilty replaceable and that has not been lost on the community out there. One of the developments I’ve been following VERY closely over the past few days is that of the LUA firmware for ESP8266. That is, given the starting point of our £2 ESP-01 boards (if they cost a LOT more than that you are being ripped off) and some firmware for it that actually works. We’ve had problems with the indigenous firmware (but those problems are slowly going away, I hope) and there are a couple of alternative firmware sets floating about – and I have NO doubt they will find their place and I will be using them and blogging about them. Compiling the firmware to make your own amendments is a PAIN IN THE BACKSIDE and assumes you love using Linux – which I don’t and the compilation process churns out hundreds of miles of messages (well, quite a few anyway). But the purpose of THIS entry is to sweep away all of that and to detail this one fabulous attempt to make the ESP-01 not only act as it should, as a WIFI board- but to do it STAND-ALONE without understanding compilers or Linux or having to stick another processor on to make it work (though you CAN of course do that and some of us almost definitely will, sometimes).
LUA is a high level language – and I’ll be honest despite knowing DOZENS of computer languages I’d never come across until last week and I am so glad I now DO know a little something about it. So before delving into explanations, lets cut the bull and see what we can expect for £2.
Take one £2 board + FTDI. i.e. a USB to serial interface, cheap – like… a fiver – if you’re into Arduino programming you probably already have one) and very common in the Arduino world – feed that into a PC with a suitable terminal program and VOILA. See the picture on the left. Does THAT get your interest up? You are looking at the BEST free serial terminal software I’ve found this week – having wasted a good day of my life with the absolutely horrible REALTERM – this free package could not be better suited to this application IF IT TRIED.
So what we’re looking at on the right is the output from the little ESP-01 board, loaded up with the LUA firmware (this morning’s version). I’ve installed a couple of routines I put together and I’m talking to the board on my Windows PC, via Coolterm at 9600 baud. In this example I’ve given you the world-famous “Hello world” but there is so much more that you can do already. I envisage testing something like this – then lifting the EPS-01 off onto it’s own motherboard (yet to come into existence, we’re looking at this right now) and controlling something via WIFI.
What you see on the right is the board, connected to a 3v3 supply (should be able to handle maybe 250ma minimum so NOT the very tiniest of regulators) and the FTDI which gives it access to serial commands from my computer using this great Coolterm package.
To follow…. far more information and the high level software to get this far. I figured you’d want to set up a board, get the firmware and grab the terminal software. Refresh this page to see the latest version. I’ll show you examples of coding. If you want more information see my previous blog entries. You will be able to write to the WIFI board directly from the terminal and even “dump” in a while set of instructions or a “file”. In my example, wifi-sta-getap(listap) is a built-in function that is calling a user function which was loaded in by me and stored in the non-volatile storage of the board. In time, examples of functions you can save permanently on the board will appear – all of this with nothing more than a text editor and free terminal program. Hell, you could do all of this from a tablet – on holiday, on the beach (if you know any beaches with WIFI or you have a MIFI unit, for example).
01:53PM – So, the basic LUA interpreter requires a start-up function and that start up function can initialise variables and make the connection to your WIFI router – it’s all interpreted, it all sits in FLASH and hence can be remembered when the power is cycled. Actually creating a product out of this is beyond the scope of this article but the good thing is that armed with the terminal software you can experiment, often the easiest way to learn. You need to get the software which has some instructions and an API guide. Also grab online a beginners guide to LUA – it really is easy if you’re used to C or similar languages and you’ll find yourself as you’re reading the guide thinking “oh THAT’s a good idea”.
You should be looking to learn about LUA 5.1 – not 5.0 and apparently not 5.2 – and beware the implementation of LUA used in the ESP8266 is not right now a full one – it does not (unless I missed something) handle floating point. But what is in there is support for things you’d never imagine in such a low-cost board – the writer has implemented (I’ve not tested these yet) i2C and some analog functions – he’s also implemented PWM on pins (ok so you’ve only got a maximum of 4 pins and only 2 if you want serial comms to play interactively… but think about it – port extender on those two pins!!! To get there in the first place you’ll need one of the means of programming the firmware into the boards – I suggest checking previous blog items here as I’ve already mentioned this. I’m using for this firmware the simple esp8266_flasher.exe on my Windows based PC.
As you will see in the documentation, for this “computer” you will need to define a start-up routine. That is, something that runs when you power up the kit so that it is connected to your broadband. Now, once it’s been set up and has an IP address, actually you don’t need this as it will remember the address of the router and hook up automatically, but that is new and you might want to give that a good test rather than take my word for it.
Now, you may be wondering – can I get LUA for Windows so I can have a play? Well yes but remember this will be more feature-rich than the one we have for the little board. You can get LUA for Windows here. Don’t ask me questions though – I know nothing about it except to say it is a command-line version of the interpreter.
But what if, like me you hate command line stuff and want the usual graphical IDE? Well you’re in luck as the ZeroBrane IDE will let you have a tinker without getting your hands too dirty. If on a Windows PC grab the LUA code and install, grab the ZeroBrane and install and (well in my case) within minutes without any effort other than to learn to press F6 – I had my first test program running – see the window on the right. What fun. I repeat this is for learning only – you won’t get any of the graphical examples running on the little ESP-01 – but at least you get to play with variables and functions etc. and quickly get to know how to use LUA which the new firmware is based on (based on version 5.1).
As I referred to earlier, in order to do anything sensible you need a start-up routine. I cannot get into LUA programming here but I’m going to show you a “file” I’m playing with – which works.
Couple of things you need to know about LUA for this to make sense You can surround strings by single quotes, or double quotes or 2 opening and 2 closing brackets. The advantage of the latter is you can freely mix quotes inside there – neat, huh! There is an operator for concatenating strings – 2 dots, like this. ..
So given that you have the firmware in place and given that the Serial terminal is running at 9600 (and if you want to send several lines pasted into the window I suggest setting a 300ms interval in between each line)… here is my code.
file.writeline([[print(“Pete’s LUA module 0.1”)]])
file.writeline([[tmr.alarm(4000, 0, function() dofile(“thelot.lua”) end )]])
file.writeline([[connecttoap = function (ssid,pw)]])
Functions can be stored in the board by typing them in – but you lose them on power up – another way is to add “files” to the board which do NOT get wiped at power up – and “DOING” the files – it running the contents therein. Best to ERASE (remove) an old file before putting a new one in – just to be safe. So as you’ll see above I am wiping an old file called “init.lua” and replacing it with a new one – that’s the startup routine – I’m then writing another file which contains functions I may want to call. In the start-up routine there is a timer that mean that after the start-up routine has all done, a few seconds later the second file will be run – putting various routines in place, connecting to my router (put your own details in there) and saying OK.
If this does not make sense please don’t shower me with questions – I’m only one step ahead of you. It’s all pretty much explained in the files that come with the LUA firmware – print them out and study. PLEASE NOTE at the time of writing there are still bugs in the interpreter, not the least being the stack runs out almost immediately when for example trying to run a simple web server. The author is aware of this.
Mo Hasan has pointed out an Indiagogo campaign for another board here – though they don’t seem to be getting too far at the time of writing – and you might also be interested in a more expensive board here. One thing is for sure, we’re soon going to have WIFI boards popping out of our ears. That sparks off TWO new conversations… 1) Security and 2) I wonder how many gadgets your average cheap home router will handle before croaking!
There are of course a number of variations on these boards as well as the ESP-01.
The ESP-09 seems interesting in that it has no aerial on-board and the pins are solderable underneath. More’s the point – there are 19 of them – now THAT could be useful – especially with the LUA software which can support other IO pins than GP00 and GP02
Then there is the ESP-02 – this does not have an internal aerial but this one just seems to have the normal number of pins so unless you really need that extra range, not sure of the point.
And here we see the ESP-08 which seems to have neither an internal aerial NOR an external aerial socket. Wierd. That has a few more pins.
In case you are interested (well, you would be or your would not be reading this article) I found this and updated from Chinglish into English – (I hope – you might want to check and not take my word for it)
Different type of ESP8266 Serial boards have their own features:
2. ESP-02: Surface Mount Device, longer distance, antenna can be attached to the shell by using an IPX header
3. ESP-03: Surface Mount Device, Built-in ceramic antenna , all IO available
5. ESP-05: Surface Mount Device, compatible with external antenna – sorry even I could not translate the rest
6. ESP-06: Bottom SMT technology, all IO available, with metal shielding case
7. ESP-07: Semi hole SMT technology, all IO available, with metal shielding case,supports external IPX antenna as well as internal ceramic antenna.
8. ESP-08: Semi hole SMT technology, all IO available, with metal shielding case, type of antenna can be defined by customers (what does THAT mean?)
9. ESP-09: Ultra small packaging 10*10mm. 4 layer technology, 1M byte (must be a bigger FLASH – but how would you use THAT?)
10. ESP-10: Patch Interface, narrow body design, 10mm width, suitable for LED Controller.
11. ESP-11:Patch Interface, ceramic antenna, small body design.
More information generally including many links here.
08:31PM – Note: The Telnet example does not work – crashed immediately on use for two of us on two installations – reported.
If you come up with some interesting ideas for code – or thoughts as to how this amazing little device might be used in this context, please DO write in here – we’re all on a learning curve. If you want to know more about me (can’t imagine why) – there’s an about page in here – see menu at the top – links off that.
It’s upgrade time again, though this time nothing major. Apple have put out a fix (ios 4.3.2) which solves an issue with Facetime (their video conferencing software which unlike Skype is designed for the larger screen – it is about time Skype got their finger out). The release also fixes some 3G issues but even at this late date does not seem to address the tablet’s utter inability to pick out the best WIFI signal from a range of available access points.
Anyway, the update takes (on my 5 meg connection) around 10-12 minutes to download and just a few minutes to do the upgrade with no user work involved – just sit back and watch. The upgrade runs smoothly just as the last one did.
Many years ago one of the first of the modern “photo printers” I bought was the Canon S600. This was before they starting putting daft things like chips in the cartridges and so despite Canon’s high cartridge pricing, in practice you could get cartridges as cheap as a couple of quid… and I did. This printer did some heavy duty printing but was eventually replaced by one of the IP series – and then onto HP etc etc… but the S600 still sat there in a corner until one day my wife needed a printer and so she had the thing for maybe a year or so – again putting the cheapest ink we could get into it.
After it had laid around for several more months gathering dust, when we first decided to buy a place in Spain I decided to give it a go – heads looked shot but a quick deep clean and it was back on it’s feet.
The printer has now been in Spain for 2 years more or less… and suffered last winter with incredible damp. Well, we’re now on top of that having cleaned up furniture that was affected – all’s well.
Today I fired up the printer to find it was out of ink – I replaced the ink with a couple of cartridges that have been here since we got the place… the yellow remains low… these were cheap imitation ink cartridges as usual. I’ve just run the deep clean and the magenta as a couple of missing lines.. I need to get some yellow before giving it another clean – but other than that, the good old S600 is BACK IN ACTION – would you believe it…. I wonder how more modern printers would fare…. I’ve some research on bar codes to do while I’m here so the printer is essential…. talk about good value for money!
And yes, Windows 7 64-bit loads the drivers automatically, no need to go searching!
Capturing bits of screen and storing them temporarily seem to be tools of the trade for me – I could not imagine NOT having these facilities. I tend to use pictures a lot when explaining stuff as “a picture is worth 1000 words” as they say. For some time now I’ve been using a product called Clipmate (version 7) which is nice and easy to use, you hit a key combination, select the area on the screen you want to save and Bob’s your uncle – it’s stored in a clipboard – or rather in a database – and you can easily store multiple items and get them back readily.
Today I took it off my computer. Quite often, products start with the right intentions and then someone loses the plot. In this case it’s the database – no matter what I did, every power up of the PC, Clip
mate would start up and archive it’s database – wasting precious time – it’s a screen grabber for heaven’s sake.
The other problem I’ve always had with this program is grabbing images or web pages that are larger than the screen. It’s a real pain grabbing multiple images and putting them back together into one.
Anyway, gripe over, I’m here to tell you about two other products I’m now using – one is free, the other is around £26. Together they do the job nicely.
The first is called CLIPBOARDS and is simply a program that allows you to CUT or COPY to multiple clipboards instead of one.
As you can see, you have 9 clip-boards to play with – it’s THAT simple. Simply select which clipboard you want to use by pressing ALT1-9 and go ahead.
So now you can keep bits of graphics floating about for re-use at the touch of button. Clipboards is free from the site above. They also have some other useful utilities which I’ve not had time to check.
In order to make use of this you need something to clip bits of screen of course and my requirements include any arbitrary part of the screen, the whole screen and something that might be LONGER than the whole screen – like a web page for example.
There’s a 30 day trial – I just bought it (I was that convinced, I bought the program) and it is wonderful. As you can see, it captures any arbitrary area – it can also capture any arbitrary SHAPE – AND can manually, semi-automatically or automatically capture any WINDOW – and if that window has a scroll bar, it will run down the scroll bar and put together an image in the clipboard of the entire area even though it may exceed screen size. What can I say – marvellous. Check out both of these programs if you write manuals or have a need to manipulate parts of the screen.
I should perhaps in passing say that for most of my simple image processing – ie stuff where just a bit of colour change is needed, perhaps a crop and re-size, I don’t think you can beat FastStone Image viewer but I’ll leave you to investigate that.
I don’t normally go out of my way to review software or point people do it but there are a couple of programs that are just SO useful – I thought I’d let you in on them.
The first is UNLOCKER – it has no interface and you may think it’s a waste of time – but I love it. How often have you been messing around with EXPLORE, deleting stuff when all of a sudden you get “cannot delete file” – or “another program is using this file” or similar- and you end up having to reboot just to get rid of the file? No more – this program solves the problem without any fuss.
Slightly more visible is FASTSTONE image viewer. This is a simple image viewer on the surface of it – it’s fast, WAY better than that daft Microsoft viewer and under the hood does a LOT more. I’ve always been an admirer of IRFANVIEW and for years stuck with that for viewing images – until I came across Faststone. The difference? Right-clicking the image not only gives you a load of info on the image – but there’s an edit option which allows you to simple change the contrast, resize etc VERY easily. This then is my viewer of choice.
Am I using CHROME? No. at this point (September 2008) I don’t even think it’s in the same league as Firefox 3. The add-ons available for Firefox in my opinion put it in a league of it’s own. HAVING SAID THAT… the only problem I’ve had up to now with Firefox is loadup speed. It can take ages – but now there’s a fix… I just downloaded FIREFOX PRELOADER from Sourceforge and it has sorted the problem!