Monthly Archives: June 2016

ESP8285 in the Flesh

ESP8285[6]ESP8285Well, here it is – one of our readers kindly sent me chips to play with. So first things first – unless you have incredibly small hands there is no way to “play” with these with a soldering iron – but a reflow oven well that’s another matter.

For anyone wondering what this chip is – it is the ESP8266 with 1Mbyte of FLASH embedded in the chip.

So it remains to be seen what to do with this tiny chip and marvellous opportunity – clearly we need a board. Readers have kindly sent links to boards – and that’s great – except the board + postage generally seems to be more than the cost of a full, all singing, all dancing Raspberry Pi – or at least a FriendlyArm M1 + WIFI adaptor.  So what’s the point?

I have some thoughts and while I ship these chips back to Aidan in the UK to ponder  a board layout, I’ll air my thoughts here.

So to make a small board it would make sense to reduce the reset/program thing to 1 button – adding an FTDI chip would just jack the price up – so my thoughts would be the normal FTDI connection – that is a 0.1” 6-way connection with GND, N/C, 5v, RX,TD,DTR

It is quite easy in, say, Eclipse to manipulate DTR on the FTDI (a simple Python script does that and it is trivial to add it to the makefile). Other languages would do just as well. So the usual trick is to have a button you can ground, which if done quickly, will merely reset the board…. if held for a while, will force GPIO0 to ground until AFTER the reset returns to normal. IMPORTANTLY this should not affect GPIO0 after reset!! now, I like to use GPIO0 as an input AFTER power up – so it becomes a multi-purpose pin. Held low before power-up you can go into programming mode, after power up you can use it to put the unit into terminal mode.

FOR THAT reason I’m going to suggest that we forget clever reset/programming hardware  - a combined reset and GPIO0 button is not a good idea – and indeed, how often are the boards programmed?  My suggestion then is for FORGET the reset button  -and just have the GPIO0 button (shorts to ground – with a pull-up) – this gets rid of a few components – and when the GPIO0 button is not pressed – there is no connection to GPIO0 which frees it to be used for whatever purpose.

Clearly you need a regulator – feeding 5v into the unit. That needs a reg and couple of passives.

Clearly you also may wish to DRIVE something – but we don’t want a massive board on the off-chance – you may wish to drive a relay OR you may wish to power 12v RGB LEDs so my initial thoughts are – 3 MOSFETS on the underside of the board (which can be left off – and they can be hand-fitted after the board has been put together in an oven (for the chip). That way if you chose to use a relay  - put the diode across the relay and you have a choice of using a 5v coil or a 12v coil etc.

A led INDICATOR is always a good idea – but because you might have the board in WIFI AP mode or it may be waiting to connect to MQTT, a normal LED may end up having to do too complicated a flashing setup – my thoughts there would be to have the option to fit EITHER a LED and resistor OR an RGB LED – the latter can be any colour and dimmed as needed without any external components.

Ceramic antenna or PCB trace? My own experience is that the ESP-12 with it’s trace antenna is VERY good – and so much as I’d rather save board space – I think I’d put the trace at one end of the board.

This board then could end up not too different to the old ESP-01 in looks.

Pin use would work with our existing software of course – so GPIO13 would be the LED indicator, GPIO2 would be ideal for DHT22 etc. and a pull-up would be fitted on-board.

25mm square perhaps??

Comments? Thoughts?


Christmas at Bedrock

Well it certainly feels like Christmas here at Bedrock (while I’m here, check out this unrelated item – the Ameba – looks interesting).

I got up this morning to a large bag of post – including a new battery for Maureen’s Samsung laptop (though why I mention that in the context of Christmas I don’t know as it is me that has to put it together!!). It’s our 31st anniversary today, incidentally!!

Anyway, there was a parcel for me from Bob Elmour.  He’s been working with ESP8266 boards and like Aidan and myself, making his own boards up. We had a chat a while ago and he said he would send me some samples to play with and write-up.

WELL, I’m very excited – so this morning the package turned up and inside were these VERY professionally packaged and assembled boards as well as some spare parts etc. They are called IoTBear and you’ll be seeing them on EBay and elsewhere soon. I urge you to take a closer look.


These (at least this version) are brand spanking new. There are two boards here – firstly the little IoTBear board with in this case an ESP-12F board – but as you can see they’ll handle everything from ESP-07 upwards.

Essentially the boards have little more than an ESP-12 with a regulator, a reset/programming circuit (on one button, short press to reset, long press to program),, a connector for an FTDI at the end (exactly the same as we would do – why waste putting a USB chip on the board) – and all the pins brought out at convenience 0.1” centres. On the underside, the relevant pin names are printed and there is a cut-able link to disable the one-button programming.

undersideThe other board is similar but with a micro-USB connector for power – and a nice prototyping area – AND though not using the USB pins other than power, he’s brought them out onto 0.1” holes – now THAT’s handy for experimenting.

So this is not a slick commercial operation, just a private individual as far as I’m aware who like use started doing this stuff for fun – his website is not up yet but I’m putting it here for future reference. You will find Rob on EBay as user Majikthi5e and if you are interested in any of this stuff I suggest you contact him from there. I’ll not put his email address in here but he’s welcome to share it if he wants in the comments. It is my understanding that he plans make everything from bare boards upwards available. There is some stuff on EBay already.

with FTDII’ve a fair experience of the ESPs and issues with boards and the 3v3 regulator he has used is a good one and the SMT parts are a reasonable size for hand-soldering (with a fine bit – none of yer gas soldering irons please). The only thing that would worry me assembling myself is that micro-USB adaptor but then my eyes are getting old.

The prototyping are is GREAT for all sorts – sticking displays on, relays – all sorts. From what I gather the cost will be reasonable so you could have a bunch of these lying around.

As you might imagine, the very first thing I did was to get out the soldering iron, solder up the 6-way connectors for FTDI programming and program up the boards. I held the little button down and flashed my software into them – no problem first time. I’m looking forward to doing some prototyping with the larger one in the coming days.

OH and there’s a nice 4-sided documentation comes with these board, simple and well presented.

My only gripe so far is that the board is relying on DTR and RTS for programming without pressing a button. TWO issues with that. DTR is fastened straight to GPIO0 – and that leaves me to wonder, what if someone is using GPIO0 as an output – conflicts?  Also – it is assuming two things – that you have control over RTS – and that RTS is available on your FTDI – and that leads to two things – firstly RTS is NOT available on all FTDIs and indeed many – on that matching 6 way connector, bring out CTS – which is an input – not an output. Indeed ALL the FTDIs that I’m aware out have CTS next to the ground pin.  For these reasons – I think I’ll be experimenting with these boards using the programming button and GND/VCC/TX and TX only connected to the board.

Anyway, over to you – if you’re interested get in touch with Rob.


Coming up..

Coming up in the next couple of weeks – the FriendlyArm M2 – how does it compare with the M1? ESP8285 – first look…. and the new Itead plug-in-the-wall WIFI switch.

Meanwhile I’ve decided that if I keep trying to figure out why my FTDI won’t work properly in a Raspberry Pi I may end up injuring myself so I’ve a couple of dissimilar models coming to try those.


Cheap Pi Screen

LCD[6]I have a Raspberry Pi 3 and recently bought a 5” screen from here at sub-£20:

While the instructions on Ebay totally miss talking about the touch screen which does not work by default, this blog entry -  is absolutely bang on – the screen instructions are more precise than the Ebay ones AND you get the touch screen working – note the calibration information.

Here is the setup.. in boot/config.txt. I didn't bother uncommenting the existing ones - I just added this lot in - then rebooted.

hdmi_cvt 800 480 60 6 0 0 0
For touch, add the below additional lines to the configuration file (in /boot/config.txt when Raspbian is running):
The writer goes on to say... It is worth noting that the values in the sample suggested file are approximate – your pen will NOT be accurate – when you run the calibration program (in a terminal – which then triggers a graphical desktop program) you will see as a result in the terminal – the correct values – you have to update that file by hand otherwise next time you power up you’re back to square one.
So when you plug the screen into the Pi, it works – but the screen size is not right – the Ebay article gives you some of the picture – the blog entry gives you more.  Then you need SPI turned on on the Pi and the rest of that blog gets you up and running with the touch screen. You do NOT need a USB lead in the display. Just the HDMI adaptor and of course the display plugged into the Pi.
The calibration instructions gave me some grief (and there are other instructions out there that are just WRONG) until I realised the so called file “99-calibration” is actually “99-calibration.conf” – and make sure there are no special characters in there (backwards quotes etc).

Once I got that far and rebooted – the screen registration was SPOT ON. The TERMINAL I found too large but you can resize that – there’s a lot of stuff out there about changing it’s size in the config file – well, alI can say is that in RPI3 at least it does not make a bit of difference.  I think it’s fair to say that 480px is a little on the low side so I don’t think that detracts too much from the value. A solution turned out to be simple – in the /boot/config.txt file

# uncomment to force a console size. By default it will be display's size minus
# overscan.

This made for a rather small font but solved the problem. I’m sure a little tweaking would make it even better.


Useless Pi Browser and Firefox


Why oh WHY do they keep that utterly USELESS Web browser in Raspbian?  I powered up my new Raspberry Pi today on my new 5” LCD display and tried loading up Node-Red on the browser.

That went well until I tried to edit a function – blank white window. I figured it was the LCD – so I tried it in TightVNC instead – still a white window.

I remembered that on my non-Pi machines they install Iceweasel – so off I went to get Iceweasel instead.

Surprised to say the LEAST when I installed the latter it also came with FIREFOX!!  Now I’m a Chrome man but there’s nothing wrong with Firefox and so I was delighted to see that. I tried Node-Red on it and LO – worked a treat. So I’ve taken off the horrible default browser from my Pi3 and put Firefox up there instead. Looks lovely on the top.

While I was on, having learned from the experience with the NanoPis – I installed WICD while I was on – nice visual setup for WIFI.

And there it is – my sparkly Pi3 home screen.


But here’s the BIG thing – NOW all the BBC’s videos work all of a sudden – gone are the “you need Flash” messages – even BBC videos work (mind you – they won’t work on the little 5” LCD – back to “you need to install Flash” – which then doesn’t work. I’ll put that down to the LCD and have griped to my Ebay supplier. More on the touch screen later – it’s a winner.


A Brighter Node Red

Just today  – an upgrade notice for Node-Red appeared in my in-box. Upgrade details are here.

What is Node-Red?  Details here – if you’re not using it or at least investigating it – you may be missing out.

Now, the support guys (Google groups here) are VERY clear about required versions of NPN etc. so I suggest you read that update page carefully.  Because I had 2 identical machines (NanoPi M1 as it happens) I thought I’d go for broke. Don’t copy me unless you have a reliable, easy to get to backup – it may well go wrong (mine didn’t) and you’ll be on your own for not precisely following the instructions.

sudo npm cache clean
sudo npm update -g --unsafe-perm node-red

I had already installed the latest (previous Node-Red – maybe a couple of weeks old) – not the default Raspberry Pi version but a manually installed version – along with NPM and the latest NODE and that is NOT what they recommend. I turned Node-Red off (node-red-stop) and used the above commands as PI user (I know, not on a Raspberry Pi but to make my life easy I always make a PI user who belongs to all the PI groups including SUDO)  - I then turned Node-Red on (node-red-start).

Voila. It worked first time.  0.14.0

Now – so what’s special – well, one of my issues with Node-Red has been initialisation of variables – sometimes a global variable can get used before it has been defined!!

The team told me a while ago that the LEFT-MOST tab gets run first – of course that’s no good if your inits are not in the left most tab (I have a tab called “init”). Well now it is because you can SLIDE the tab order about with the mouse – how neat is that!

The DEBUG panel now lets you see message from all over – or just the current tab – which is nice and there are some new nodes and other improvements – I’ll let you read all about them here. The big one that stands out is the LINK node. I HATE making large tabs that are really complicated – but to split them up involves passing messages between tabs – and until now that had to be done the hard way – by global variables (not ideal as you have to poll them) or MQTT or similar. Well now there is a node for THAT as well.

Then I spotted a bug – the exec function would no longer take numbers as arguments – only strings (which is what you’d expect but it had always accepted numbers).  I reported this early evening. Meanwhile someone reported an issue with MQTT…  so the guys amazingly quickly fixed all this.

sudo npm cache clean
sudo npm update -g --unsafe-perm node-red

Erm, no – this time no messages, just accepted my commands but no update.  It was a bit late to expect answers out of anyone… so KNOWING I HAD A BACKUP and stopping Node-Red first then restarting afterwards…

sudo npm cache clean
sudo npm install -g --unsafe-perm node-red

Worked a TREAT – I’m now sitting on version 0.14.3 with all my flows intact. The exec issue has gone away and here we are the next morning, after a few more checks I’ll progress with updating my other installations.

The team are to be congratulated on the work they’ve done on this tool – it costs us nothing but opens up entirely new possibilities to both beginners and seasoned programmers.  Very different image of IBM to the one I had when I was a kid (huge buildings, everyone talking in abbreviations, obscenely expensive leased servers) – at least that’s what I remember  - probably wrong Smile



Cheap IOT Solution and the M1

FriendlyArm NanoPi M1Recently I blogged about an update to pricing for the Sonoff mains control units – now down to £3.50 ($4.85) and our readers even reminded us of some potentially great software for those units (as well as my own but then mine is more of a kitchen sink approach and the Sonoffs have only 1Meg of Flash so you lose OTA). Lots of comments – all good.

Updates at the end – slowly cracking the GPIO – got some I/O working!

Meanwhile, you’ll have noted elsewhere on the blog that I’ve found a fabulous, hassle-free battery backup solution in the Ravpower units.

Much MORE Cheapness: And now…. a possible CHEAP alternative to Raspberry Pi for a central controller.

I know – heard it all before… so have I but read on…

As some of you know, I’ve pretty much settled on Debian as the base for a central controller using Node-Red, SQLITE, Mosquitto MQTT and Apache/PHP (to run the likes of PHPLiteAdmin) and I’ve done that based on a Raspberry Pi2/3 for a number of reasons – including working 3.5mm audio, speed, ease of use, support, hardwired network (I think the central controller should be hardwired as it has to be rock-solid), less to learn and… well you can read all my reasons elsewhere.

Well, I’ve been experimenting with the latest FriendlyArm units and one of them stands out a mile as a possible contender for cheapest central controller (Pi Zero is out as it does not have an Ethernet connector, audio connector etc and by the time you add in connectors and the other stuff it is no longer cheap).. How about a Pi lookalike that is SMALLER than a Pi, for well under £10 + post – hence when put together forming what HAS to be the cheapest overall IOT setup on the planet??

Check out the FriendlyArm NanoPi-M1 – a small, square ARM-based unit with the following Spec (you can read the full spec on their site – these are just the important bits)

  • Allwinner H3, quad-core Cortex A7 running in this case – JESSIE
  • Mali 300 graphic chip
  • 512MB RAM (1Gig available)
  • 10/100 Ethernet
  • 3.5mm or HDMI audio
  • Mic
  • IR Receiver
  • USB * 3
  • HDMI out
  • Camera interface
  • Debug serial and GPIO

They are the important details – what IS equally important for me is that it works with my installation script – hence the whole setup as described above can be done easily in maybe a couple of hours. – you should be familiar with running scripts before tacking this – this one was meant for the Pi – not the M1 – and you absolutely must read the comments as the script is general in nature – for the M1 you need to create the Pi user and groups manually (easy –underside of NanoPi M1 commented in the script just to keep everything in one place) and set up the hostname (2 files ) to whatever you want – then copy the script over and give it the extra permission before running.   I’ve just got it working and can confirm that SQLITE and PHPLITEADMIN work (hence Apache and PHP), Node-Red, Webmin and Mosquitto all work and in Node-Red I can access THREE UARTS – the first one of four is for debug so you can’t rssily get to that but it beats having to disable it as on the Pi.  I can access Node-Red as nanopim1:2880

Not touched GPIO but that’s an issue for most non-Pi boards… hopefully someone can tackle that and make the GPIO available within Node-Red.  This is looking REALLY good.

Audio works – but (and I had this on the Orange Pi PC) there is a very short burst of sound on the end of the IVONA recording – it has to be some kind of special character getting through – it is most definitely NOT the MP3 playback and when Ivona processes the file name it adds nothing on…. anyway, something for the weekend as they say along with polishing this blog up – for now – it seems like it might be possible to make a minimal IOT solution with a central processor and some mains controllers for under 20 quid!!!!! Stunning.

As I was writing this, and as the Debian image available with the M1 is only 4GB long – I was awaiting info from FriendlyArm as to how to expand as you might find with a Raspberry Pi to the full size of the SD. There are solutions out there and if you’re going to live forever there’s plenty of time to understand most of them.

FriendlyArm came back to me this morning with a simple solution. My 8GB card was sitting with half of it’s space unavailable. Support sent me some instructions for sending data over the serial debug port – but it turned out this was just exactly the same as I could achieve with a terminal.

I typed:

sudo fs_resize

it was suggested I reboot – and lo – the full size of the SD became available to me – 8GB. I wondered if I could push my luck – so I used Win232DiskManager to make a copy of the 8GB disk…. and then copied that image to a 16GB SD. I installed the 16GB SD into the M1 – powered up and tried the same again.

sudo fs_resize

I have to say I was not expecting miracles – but the results were the same and after a reboot I had my normal 16GB SD setup, no problem.

You could of course install Armbian for the M1 which automatically resizes to fit the SD but I’ve not yet tried this to make sure my stuff works so you’re on you’re own there – I did install it and it does work as a desktop complete with Libre Office etc. if that’s your thing.

Lovely – and so here is a cheap way to get Node-Red and other tools running pretty much as if you were on a Raspberry Pi – except of course for GPIO. None of the usual Pi tools are available  - I’ve have settled for the command line PIGPIO or similar as you can call that from a node – but no – there still remains a pretty uncomfortable learning exercise perhaps with some compiling to get control over the GPIO. In this instance I don’t need GPIO so its not a problem but I do with the designers of these systems would recognise that Raspberry Pi has set the pace.

I have tested taking their MATRIX examples of C code – and loading them into the M1 and compiling using the GEANY editor that comes with the Debian setup – almost – and by copying all of the C files into one and adjusting include paths, I HAVE compiled some GPIO control that a ROOT user can use – but I just don’t know enough about the MAKE files to alter the path to do this properly.

Still – the point here is – the board seems to work well and is a CHEAP solution.  When I think of the hassle I had trying to get an Orange Pi to do this….

Benchmarks: So I guess what might be on your mind is… and so this cheap board – how does it compare to the Raspberry Pi 2 and 3?  I only had a 2 handy for testing and some tests too longer, some less, overall the M1 was MARGINALLY faster than  the Pi2 – I would go so far as to say they are comparable.

The test I’m running incidentally is a simple one – so you know..

To install (as root): apt-get install sysbench

To run (as root): sysbench --test=cpu --cpu-max-prime=20000 run

The M1 as an infra-red input which I’ve not tested – it would be nice if someone got that working with Node-Red.

GPIO Update: I was looking for stuff on GPIO on the M1 when I spotted in a forum the chap who developed Armbian talking – and he mentioned that the hardware in the M1 is the same as the Orange Pi One. Well, off I went in search of GPIO for THAT board.

I found this.

Now –  it still needs ROOT access which is a pain in the bum… but… I followed the instructions – as ROOT user – but in my /home/pi directory I’d created…. I went to the examples – and ran the one called – nothing – I tried every pin on the connector.  I figured nothing gained, nothing lost – so I change the port (led=port.X) to PA9 – LO – a flashing LED – PA19 (purely at random) – LO – another flashing light.

So a lookup table is needed to get the ports to match those on the M1 – and there has to be a way to avoid ROOT access as I want to call this stuff in Node-Red – but GPIO – works.  I’m sure there will be other stuff for the Orange Pi One by now – worth checking. I guess what is needed is some kind of daemon running as root user that an exe file running as a normal user can fire parameters at.  I’m sure someone cleverer than I could adapt PIGPIO or similar.

Anyway – there you go – just about everything a Pi2 does – and 3 fully usable UARTS and now – some GPIO. All for a fraction of the cost of a Pi2.  Got to be worth investigating.

and THEN I discovered THIS…..

I typed as per the link:  

modprobe gpio-sunxi

The prompt returned as if nothing had happened – but then…. I noted on refresh that/sys/class/gpio_sw directory had magically appeared.

echo 1 > /sys/class/gpio_sw/normal_led/data

That’s one of the examples in that link – erm… NOPE it didn’t work…. no such thing.

So I gave this a try

echo 1 > /sys/class/gpio_sw/PA9/data

YUP – GPIOA9 on the connector lit up.

Sadly again – this stuff would not work for user PI but by the morning I’d pieced together that you need that “data” to have write permissions for other than the OWNER!

As ROOT – this works.

modprobe gpio-sunxi
/bin/chmod -R 0666 /sys/class/gpio_sw/*/data

So I put that into the /etc/rc.local file just before “exit 0”, saved and rebooted. LO and behold – it all works as user Pi !!! I can now at least do simple GPIO output from Node-Red using an EXEC node. Well, it’s a start!

I’ve tested the Pxx items available in /sys/class/gpio_sw and the ones that seem to work AND are on the connector include: PA0,PA1,PA6,PA7,PA8,PA9,PA21,PG6,PG7,PG8,PG9. I have avoided touching the UART pins as I think I’d rather have the UARTS available.

Of course at this point I’ve no idea how to READ one of those pins.

WiringPi and GPIO: I did originally try the adaptation of WIRINGPI here and hence the GPIO command line utility – which didn’t seem to object to any commands – but on the other hand didn’t do a THING with them.

Then armed with my successes above, I ran

gpio readall

This produced a list of states of pins with no resemblance to what I was using – but as I toggled PA9 on and off I noted a change from the readall command on GPIO.23.

Could it be:

gpio write 23 1

YES – it turned on PA9.

gpio read 23

YES, it returned the value.

gpio mode 23 in

The light went out and I realised that floating the pin would return 1, grounding the pin would return 0.

I looked for more info on WiringPi and found this -

With my pin set as an input – the pullup modes worked too.

gpio mode 23 up/down/tri

It turns out that what I was calling PA6 is called GPIO.7 in the WiringPi setup – and this is a PWM pin – could I be so lucky?

No. No matter what pin number I tried – setting PWM mode was not having it. Still – input and output – that’s a step up!! It also turns out that the second part of my rc.local work is NOT needed for WiringPi – just the first line (ie. the modprobe bit).

  • Pin 40 GPIOA14 gpio write 16 on
  • Pin 38 GPIOA15  gpio nothing default on
  • Pin 36 GPIOA13  gpio write 15 on
  • Pin 32 GPIOA7  gpio write 26 on
  • Pin 28 GPIOA18  gpio write 21 on
  • Pin 26 GPIOA17  nothing default off
  • Pin 24 GPIOC3  gpio write 10 on
  • Pin 22 GPIOA1  gpio write 0 on
  • Pin 18 GPIOG9  gpio write 27 on
  • Pin 16 GPIOG8 gpio write 26 on
  • Pin 12 GPIOA6 gpio write 7 on  (also PWM test pin see further down)
  • Pin 10 GPIOG7  gpio write 29 on
  • Pin 8 GPIOG6 gpio write 28 on
  • Pin 7 GPIOG11  nothing default on
  • Pin 11 GPIOA0  gpio write 2 on
  • Pin 13 GPIOA2  gpio write 6 on
  • Pin 15 GPIOA3  gpio write 3 on
  • Pin 19 GPIOC0  gpio write 12 on
  • Pin 21 GPIOC1  gpio write 13 on
  • Pin 23 GPIOC2  gpio write 14 on
  • Pin 27 GPIA19  gpio write 30 on
  • Pin 29 GPIA20  gpio write 25 on
  • Pin 31 GPIOA21  gpio write 11 on
  • Pin 33 GPIOA8  gpio write 22 on
  • Pin 35 GPIOA16 nothing default on
  • Pin 37 GPIOA9  gpio write 23 on

SO – then after all of this – one of our readers pointed me to a C program (see link below), easily compiled on the M1 or any other similar program that in this case simply runs PWM – of course – for a particular pin – but that’s not a problem – you could easily pass parameters – and one WILL.

NOW – that’s all fine and good but it will only run as user ROOT which if you are running node-red – is about as much use as a chocolate fireguard. Until I read THIS (for me game-changing) example about changing the user… so assuming our compiled program is called PWM and is run as ./PWM except it won’t as user PI for example…

Take your C program and

gcc -o pwm pwm.c -l wiringPi

sudo chown root:root pwm
sudo chmod 4755 pwm

I have to tell you I am WELL chuffed about THIS discovery because essentially it means I can make my OWN command line program… and customise it for different boards!!!!  AND it will run as user Pi on Node-Red using the EXEC node. Our friend might call the C program a very simple one – but that and the conversion to run as Pi or similar user – makes a BIG difference to a lot of us!!

I HAVE tried this and it DOES PWM modulate that pin – which means getting other pins to work should be a breeze.

THE ONLY PROBLEM is that this is software PWM – because despite the fact that the pin corresponding to 7 is in fact a PWM pin – if you try the wiringPi command for proper PWM – the system objects – and throws a message out – clearly the pins that can be set as PWM are predefined for another board… does anyone out there understand the Wiring Pi code sufficiently to modify it? If PWM won’t work properly – maybe the likes of I2c etc will suffer a similar fate.

But here’s the problem – though WiringOp just happens to work for GPIO on both the M1 and the NEO, and compiled WiringOp programs can be made to work as user Pi,  as the company’s Matrix software which DOES give you access to I2c etc. seems to have some issues with any other than ROOT access - and FriendlyArm do not currently know how to get around that.   The manual for the Matrix software is even now in Chinese only!


Cheapest IOT on the Planet

You’ve seen me writing about SONOFF before, several times – and you’ll see it again – but today I’m writing about one thing (for now) – “MUCH CHEAPNESS” to quote a last-century holiday advert. I would be very much surprised if the Sonoff WIFI is NOT the cheapest WIFI mains controller on the planet.

This started as a simple article about the Sonoff and the new pricing but it is RAPIDLY developing – one of our readers (see comments) has alerted us to some MQTT software I’d forgotten all about and which is coming along in LEAPS AND BOUNDS for the Sonoffs – meanwhile I’m having a measure of success right now, setting up a REALLY cheap possible Raspberry Pi alternative – but more of that later – if all of this comes together you really COULD be looking at a complete IOT setup that is the world’s cheapest…  For now – let’s concentrate on the Sonoff. Later today I’ll know if my other experiment has succeeded and I’ll update the blog.  

Incidentally if you’re finding this interesting you are not alone – this blog entry is already getting record levels of viewing!!

sonoffLet’s start off for new readers by describing what the Sonoff IS and what it is NOT.  Itead Studio are based in Shenzen, China and I’ve been following their antics for quiet some time now. You’ll see reviews in here of their products  including Sonoff and the Nextion displays. They’ve certainly had a great effect on my IOT experience.  I’ve been building mains control stuff since the last century – and part of my drive has been cost. Off the shelf devices were just too much so I built my own. Then, all of a sudden these guys started producing stuff that was so cheap, it was not even worth the effort of building from scratch.

I’m an ESP8266 enthusiast as it was obvious from the start that this wonderful WIFI controller was going to be a game changer and the Sonoff device basically puts together an ESP8266 chip, a mains power supply and a relay – for a no-nonsense simple mains controller.

Sonoff has it’s own CLOUD service so that off the shelf you can start controlling your home from your mobile phone – but I’ve never been interested in that, for me the exciting thing was to use my own software in the devices so they could be part of my Raspberry Pi controlled home. I have them all over the place – and soon, thanks to some pricing changes I’ll have even more.

What Sonoff is not: It is not for everyone. They use a 10 amp relay but many of us have concerns what that means – I certainly would not wire a 10amp heating element to these devices. On the other hand (no responsibility accepted here) I HAVE had a 700w heating element attached to one of them for some time without issue – and I have LOTS of lights attached to others. So Sonoff is NOT a super high power controller. In this incarnation discussed here it does not have all sorts of fancy inputs like infra-red, Bluetooth etc. It merely takes commands over WIFI to turn on and off a relay. At a pinch you could connect a temperature sensor to it but you might have to get the soldering iron out for that.  It is not an OTA (over-the-air) programmable device before presumably for very tight cost control issues, they’ve chosen a small FLASH which hasn’t enough spare room for that.

What Sonoff is: The cheapest IOT mains controller on the planet, probably. It is small, reasonably well put-together, reliable, looks fine stuck on the wall and importantly – you can with a little effort re-program the device with my software – or other software. The choice is yours – use as-is, out of the box or put the effort in to re-program – either way you have rock-solid, DIRT cheap mains control over WIFI.

What has changed: The price – Sonoff was dirt cheap before but thanks to reader Kris – I just discovered they are selling the units for $4.85 – that is under £3.50 in English – you just SURELY cannot beat that!!

Here’s the link. Enjoy and don’t blame me if it isn’t what you need.

On that link you’ll find sizes, prices, information, schematics and much more. If you want more information on Sonoff – using it, reprogramming it  - you could do worse than doing a search through my blog (search in the right of the page) – it’s all there including the experiences of myself and others.

ALSO reader BOB has reminded me that there is some software for Arduino-types (well the Arduino environment for the ESP8266) that CAN handle OTA as it is smaller and more focussed than my software which could be better described as “kitchen sink”.   Here’s the link – no guarantees as I’ve not used it – though if I get time this week I could well update one of my Sonoffs.

There is possibly more around the corner… keep checking in – right now I’m off to CHURROS in the local market.


Gear S2 Classic and Home Control

For a change from processor boards, let me tell you about my new WATCH.

Scargill watchFor a long time I’ve been a faithful Pebble user, the watch has a week’s battery life, a display you can read in sunlight and a host of applications.  I had one of the very originals which sadly did not survive a swimming expedition in a saltwater hotel pool and the guys at Pebble replaced it without question. However things move on and I was sitting with a neighbour perhaps 3 weeks ago now and I notice his wrist hovering as if to say “you need this, Peter”.

He flicked his wrist and the most wonderful Tag Heuer display popped up.  a beer later and he showed me the watch again – this time with a Gucci watch face. I could bear it no longer.

So, several days later my Gear S2 Classic turned up. It is a work of art, to put it mildly.  I’ll get the bad bit out of the way first – the battery lasts 2-3 days – but the good part of that is the proximity charger, another work of art you just drape the watch over with no connection to charge – in VERY little time, less than an hour and it’s ready to go.

This alone with the pictures should be enough to make you get your wallet out – but then I remembered I have TASKER on my mobile phone (HTC ONE M8) – and that talks to MQTT. Could I be so lucky?

YES – there’s an APP for that. A small add-on APP for the watch lets me scroll through all my Tasker tasks and run them at a touch. If you’ve used tasker – you’ll know you can do just about anything with it – including (with an add-on) send MQTT messages.

If you, like me, have no artistic skills then you can create your own watch-face in no time at all like the one I’ve shown on the right – done right in Mr Time Maker’s web page – but if you have a little skill you can make a DAMNED good emulation of just about any watch on the planet.

Just as an aide the watch has technology underneath to do your pulse rate and there is also the usual health stuff like how many steps you’ve taken, weather locally, news, alerts etc.. the list is endless and growing by the minute.

So now not only do I have a black-leather-strapped work of art attached to my wrist (you really DO have to see the display – which, depending on watch face (and there are many hundreds of them thanks to Mr Time Maker app) can be seen in reasonably bright (Spanish) sunshine, but also I can control all my household gadgets in comfort.

The links in the above article should help you. Enjoy. If interested do check pricing though for the watch. It varies dramatically.


Ravpower the ultimate Pi UPS?

RavPowerAnd now including -  the MONSTER version. Just a short while ago, I just bought this 16750maH USB battery unit (charger) with no prior knowledge of the company - on the recommendation of my pal Aidan who does our PCBs for Esp8266.

I have a specific requirement – which many of you will recognise.

1. I don’t want to have to tpush buttons to turn it on

2. I need it to work WHILE the unit itself is being charged

3. I need lots of POWER.

Some time ago I used a similar looking cheap USB charger to power a Raspberry Pi2 and it worked well but I noted it would not really charge any higher than it already was when deployed, while running the Pi. Despite this it would not lose charge either and is still doing sterling service as a UPS for one of my older PIs.

When I wrote that original article, several people wrote in to say that many such devices will NOT simultaneously charge and discharge – and true enough – there are problems with most of the alternatives I’ve tried – some work but need a button pressing to turn them on. And that means if they run out of power due to a long outage – when the power comes back on you’ll be getting nothing!!  On the web you’ll find all sorts of contraptions as alternatives for use as UPS systems – from the big monster mains uninterruptables to 12v batteries with chargers and switched down-convertors – all very, well, MESSY. And of course today the Raspberry Pi 3 for example needs peak power higher than ever before, so at least 2 amp capability per output is needed.

And so it was that I got quite excited when Aidan said he’d found an ideal candidate for the job, a heavy duty USB power pack with no less than 5 cells in it, capable of outputting up to 4 amps (one output has a maximum of 2.4amps – the other 2.1amps!!  I went to Amazon and sure enough £20 inc postage – what a bargain. But I’m in Spain and so I tried

Sure enough – there was no free postage on this in Spain but the OVERALL price inc. postage came out to be the same as the UK overall price – around £20. Bargain.

I ordered one and amazingly it turned up the next day here in rural Spain. And… it works! When I received the unit, I took my flat phone out with me for coffee into the village along with my sparkly new supply which came with 2 short USB leads (short is GOOD). By mid-morning (despite having just taken the unit out of the box and not charged it) my phone was full and the charger was still registering 3/4 full.

When I got back I plugged my PI3 into the unit – and waited for it to boot up - rock solid red light (which on the Pi3 indicates good power).  I tried putting the charge lead for the Ravpower unit in and out repeatedly – no  problem. Aidan had already tested this running a Pi until the pack was flat (more than a day!!!) and then plugging a charger into the pack. The PI came back up reliably.

The unit looks good – NICE finish – and has two outputs as indicated above. The button on the top allows for a gimmick white LED – and for turning on the power level indicator LEDs – there is NO on or off and the indicators go off on their own after a while. Lovely.

In short, there appears to be no downside to this unit – it is reasonably priced – costs WAY less than other alternatives and looks rock-solid. Reading the instructions it SPECIFICALLY states that the unit will give consistent output while charging – as well as short circuit and over-current protection. What more could you want!

Here is the Amazon UK link….  I’m sure you can find other pricing where you are.  Clearly you need to keep this thing charged with something able to provide what you need and more – but if it cannot handle peaks – matters not as this unit will take care of that. All-round winner it seems to me.

Summary:  The RavPower 16750MaH battery unit is working just fine – over a week down the line it is happily running a pair of Raspberry Pi2 devices and I’m confident that in the event of a power cut – it will keep them going for quite some time.

Meanwhile I got in touch with the American office of SunValleyTech to see if they’d like me to write about any of their other units. They were enthusiastic but (and I’m cutting a very long story short) when I supplied my details they could not ship to Spain – and hence they put me onto their Spanish department – and this morning, despite SEUR delivery leaving the thing in the village PUB !!! I opened up a sizeable box to find…

RavPower Monster unitAnd NOW, the 26 Ampere-hour Monster:  Yes, seriously, this is not a joke like the one you’ll see me refer to lower down in the blog – but a full 26,800MaH unit – a little too big for your pocket but it would sit nicely on a car dashboard, with 3 outputs EACH of which is capable of well over 2 amps output for a total output of over 5.5 amps and capable of being charged at 2 amps. A true MONSTER. This has no gimmicky light – no on/off button just a little test button to show the battery level. When it came out of the box it was fully charged. When you plug anything in – the light comes on momentarily to show you the state of charge and then goes out! Well done!

The unit comes in a pretty box with a nice, very short USB lead and another, longer one – maybe half a metre. Quite substantial.

When I started updating this review, I plugged my HTC ONE M8 into the new unit as the phone was just about flat. It is now 80% charged and a quick check of the lights indicated it has not made a DENT in the charger’s capacity.

I can see this larger unit sitting in a corner of my office powering two of my Raspberry Pis 24/7 – a shame to hide it away but this is going to give me some SERIOUS protection against power cuts! If it works out – you’re looking at 2 Raspberry Pi units lasting maybe a day depending on what they are doing – without no mains.  The smaller unit is going to sit in my car for taking to hotels etc., – I’m always running out of phone or tablet power. Just bear in mind the charging power input limit however.

Here’s the UK Amazon link. If anyone can do better  - do let us know in here.

The Chinese alternative: After I wrote the first part  I got into a conversation in Google+ on the subject and a couple of people mentioned solar powered boards which look like the picture on the left below. I’ve covered these before and the general consensus was that they are a con to the very last one. Here’s a comment I made on Google+

solar charging - notThis is typical of the solar panel adverts - I don't know if Amazon simply don't check advert specs, don't understand them or are deliberately trying to deceive customers..but they are all at it - the specs are absolutely meant to trap people who can't do maths and it is not the worst by any means:

So look at the spec – this has a 20,000MAH rating (the unit IS big enough to handle 7 batteries – there are many ads claiming this and the units are just NOT big enough). That is 20 amps for one hour. That's at 5v so given that the 3v6 -4.2v cells need switching up at maybe 90% efficiency that requires 27AH capacity. If a Lithium battery does 3.5amps - that's 7 of them being generous. My new and large unit has 5 of them in there - I doubt very much if the others you see on the market have 7 batteries of that capacity.
So then there is efficiency in charging. Lets be generous and assume 100% efficiency. So assuming those units that claim 20,000MAH are real (they are not, they are a con generally but lets give them the benefit as I've not tested every one) - you need 27 amps for one hour, or 1 amp for 27 hours or any combination, to fully charge them.

Let's take a look at the CLAIMED power of that Amazon solar unit - 1.2w they claim. If we're needing 27AH at 5v that's 135WH, so you would need 112 hours of good, direct sunlight - even here in Spain who's sunlight DWARFS the UK, that is 11 DAYS to charge the battery. In the UK it would be more like several weeks.

You could argue my math either way but not by THAT much - it's a con.

So - take the unit I first blogged about above...16750mah - I'm going to call that 15AH being conservative... so VERY roughly we need to charge at 1.5amps at 5v for 10 hours. I CANNOT find powerful 6v solar panels - so assume an efficient switcher and a panel for 12v.... what.... 700ma at 12+v ??
That's 37cm by 25cm of solar panel.

And as for the phrase “Please do not place SolarJuice on or over-heated place for continuous charging.” – HELLO!!! – don’t put a solar charger in a hot place for continuous charging. Perhaps the designers don’t get out much but usually when you have decent sunshine – it’s hot! Here in Spain I can’t touch my solar panels, they are that hot.


Coming up this week

T3Coming up, reviews of FriendlyArm’s latest offerings – the NanoPC-T3 and the little M1. I’ll cover both of these later in the week with testing etc.. but for now a taster of the more powerful unit.

You may recall I have the older NanoPC-T2 running Debian as user PI – with pretty much everything running as it would on a Pi except for IO and that’s because I’m too thick to figure out how to use their drivers – I have pointed out that Raspberry Pi makes GPIO so easy, others should keep up and make compatible drivers. I also have a unit running Debian on their cheap touch LCD module – running Imperihome on my desk to monitor and control house functions. It’s marvelous but not a lot between that and a Pi.

The new T3 is a monster, more expensive than a Raspberry Pi at $60 but with Ghz Ethernet, WIFI, Bluetooth, 64 bit Octal processor from Samsung etc. At least on paper it is very impressive.

A53 Octa-core soc, 1.4Ghz dynamic frequency scaling, 8GB eMMC internally (or a full size SD), 1Gbps Ethernet, WIFI, Bluetooth, 4 UARTS, microphone, headphone socket, HDMI, 2 USB and another pair on connectors, RTC battery connector, 1GB RAM (I need to confirm that – may be 2GB), 2 camera interfaces and more.

All of this is nice of course – but that’s on paper. I wsa impressed by the last model – this time I’m expecting more.  Keep eyes open – I’m off on a hunt for materials for a new pergola today but tomorrow I should be back at my desk and I’ll go into these units in detail.



Just a quick note folks for anyone new looking in.  I've had some emails in recently which were generally just links with no explanation - and usually the word anonymous or similar was in the email address.  For the sake of clarity, I have to approve all new incoming emails (once approved, folk can of course post freely). If I see emails like this I'm afraid I simply bin them as spam - it would not be fair to readers who bother to put in legitimate information to send them off on a wild goose-chase.

So of course this blog welcomes all manner of feedback, please use a legit email and if you are sending links let us know in the post what they are about.