Monthly Archives: November 2016

The Mighty T3

FriendlyArm NanoPC T3Some time ago, I wrote about the FriendlyArm NanoPi M1, a simple, low cost board which seems to hold it’s own against the Raspberry Pi2 in all but GPIO control – that’s not to say there is anything wrong with the GPIO but you have to write your own stuff for it as there is (so it would seem) nothing remotely like PIGPIO for these or similar machines. PLEASE prove me wrong.

See updates to this article at the end….

So that’s all fine but what if you need something more meaty? The FriendlyArm NanoPC T3 is a 64 bit octa-core board of similar size to the Pi and where the M1 scored a benchmark similar to the Pi2, the T3 is nearly twice as fast and has a lot more going for it – but then, it is also more expensive. When I say TWICE as fast – that’s doing the same benchmark – if the benchmark made use of all eight cores then the difference could be considerably greater. I've also reviewed the NanoPC T2 but my recent conclusions on that, at least for Android were not too good, certainly not for media consumption. In fact, as of now, I would say NOT to use the T2 as a media centre. See later comments in here.

Like the M1 I’ve managed to get Debian with all my usual tools running on it, really without any great problems. So what’s so special about this one?

It has an A53 Octacore processor, running at 1.4Ghz, with 8Gb of eMMC internally and of course you can use an SD. Unlike most other boards it has 1Gbps Ethernet along with WiFi 802.11b/g/n and Bluetooth 3 dual mode.

Along with that we have 1GB RAM, the facility to handle one of the company’s inexpensive LCD touch display boards, serial debug, RTC interface, 4 USB ports, camera interface, HDMI and supports Android 5.1 (yes with Playstore, unlike the M1 which for some inexplicable reason also support a much earlier Android but with no Playstore – so I just ignored that option - pretty useless really), Debian and Ubuntu.

I set mine up with Debian as usual, used my script to put all my usual stuff on and left it happily sitting in a corner running Node-Red for days - worked a treat.

On the GPIO front – there is some C code available and accessing the ports is fairly straight-forward but it requires root access and we really do need a better way.

Incidentally the unit I have, has a heatsink. Recommended.

There is a microphone input as well – and audio output can go to hdmi or the 3.5mm stereo jack. I already have a T2 model sitting running Android and ImperiHome as a kind of desktop status display – this one may end up doing something just a little more processor-intensive (read on). NOT cheap however so you might want to check total cost including postage.

WiCDAbout the only thing I really did not like about the Debian setup for the T3 was wpa_gui which not only looks naff – but also fails to report the status of WIFI.  It would connect no problem but then still say “connect” – which is a worry.

Now, as it happens I have one of the FriendlyArm M1s again running Debian and that has wiCD Net work manager which does work. So I figured, in for a penny, in for a pound.

sudo apt-get install wicd

I had to tell it about the connection at first as it didn’t have my wifi details stored… and then

sudo apt-get remove wpagui

Problem solved. Now – getting the GPIO to work – it’s not an H3 so I can’t use WiringOp…. out of ideas on that one for now.

One issue with the T3 – is the eMMC itself. All of the above was done using eMMC and in an attempt to copy that to SD, I blew the lot. Why was I doing that? Because I can find no simple way to back up and restore the internal eMMC. I can't actually see much use for 8GB of EMMC especially as it is a pain to back up.

I spent ages getting onto the Baidu site trying to get an SD version of the software as the Google Drive link on FriendlyArm’s website just would not work. I don’t know if you know but if you don’t read Chinese – getting a Baidu account can be a treat. Anyway I finally got one.

Update: I contacted FriendlyArm at least twice about this as their Google Drive link does not work – I don’t know what BAIDU is like inside China but it is ATROCIOUS outside of it. This is my third attempt took well over an hour… I would normally get such a small file in a matter of minutes at most.

Baidu SLOW

When I eventually got the file – I realised I could get it to run – but I could not expand it – I tried various approaches including with support from FriendlyArm and the SD simple would not expand – I wanted to use an 64GB SD yet could access only a tiny amount of available storage – which seems awfully silly.  With Android up and running the first thing I tried was a media player – but because there is no information on the infrared remote control, I thought I’d try WIFI control by my phone – but THAT requires root access and the Android provided is not rooted – worse – Kingroot simply will not root it.

Meantime, FriendlyArm sent me some information on expanding the board - info that they had previously put out on the web and it simple would not work - I've now checked and there is nothing out there on this - HOWEVER - their solution works - they just missed out some important info.

When you blow their image onto SD - BEFORE you start playing with Android AT ALL, stick the SD into a Linux PC or a Raspberry Pi or similar (or a Debian machine on one of their boards) - and do the following exactly... firstly check that SDA is available (/dev/) and if not - maybe it is SDB??

So to recap, flash the Android SD - put it straight into a Linux computer - and run the commands below - do not "try it out" in the T3 first or you will fail.

Replacing SDA with SDB etc if  necessary (I've done several installations and not had to change this)...

sudo parted /dev/sda unit % resizepart 4 100% resizepart 7 100% unit MB print
sudo resize2fs -f /dev/sda

Now This isn't EXACTLY what Friendlyarm said in their instructions - but then their exact instruction didn't work - this does. Once done, take the SD out - stick it in your T3, hold the BOOT button, turn the power on and after a few seconds release the BOOT button. Might take a minute or so for Android to come up - originally I was getting a 4GB Android which is about as much use as an ashtray on a motorbike - now  I have one set up with 32Gb and another with 64GB of internal memory - no problem. All of this this will work in a NanoPC T2 but overall I found that to be sluggish.

From there I've put KODI and several other programs in there and it all works very well - the hardware Ethernet being a boon if you're streaming TV shows etc. and the video runs smoothly.

Now all I have to do is figure out how to get the board to boot into Android on SD without having to press the button... I did try just holding the button down and that works so worst case I could see a link coming on.

Update November 29th 2016:  As you’ll see elsewhere I’ve been playing with the Nanopi M3 – a great little board with a nice heatsink and fan that makes for a good media centre… the only issue is – the noise of the fan. It is something one can deal with but it was enough to have me do one last test of the T3. There is now an image for the T3 that will boot up and let you have your choice in a menu of Ubuntu, Debian or Android 5.1.1  - now, I have commented in the blog that I am not stunningly impressed by either Debian or Ubuntu on these devices – at least not the FriendlyArm version and I really would like to see an up to date Android available – however – I thought I’d try this all in one SD image – which lets you easily blow code to the EMMC.

Well I have to say – M3 on SD – or T3 on EMMC – the results are quite clear – the T3 is FASTER.  Running Kodi I noticed that videos play smoothly on the M3 until you pop up the menus – and running the video with all that guff overlaid onto it makes for a very SLIGHTLY jerky movement – but enough to notice it. Not so on the T3 which runs, to use a local phrase, as smooth as a baby’s bottom!  Also Android is one hell of a lot easier to tackle for overscan and resolution changes than the other options and I was soon able to turn the mighty T3 into quiet a reasonable stick-on-the-back-of-the-TV media centre and I am more than happy with the results!

Facebooktwittergoogle_pluspinterestlinkedin

NanoPi M3

Nanopi M3This morning in the post I received a FriendlyArm NanoPi M3 board with heatsink. Smaller than a Pi3 but with a boatload of facilities, the board includes:

  • A3 Octa-Core processor (handy for multimedia) S5P6818
  • 1GB Ram
  • 3.5mm audio jack
  • 1GBPS Ethernet port
  • WIFI
  • Bluetooth
  • MicroUSB for power
  • 2 USB host ports and an additional two on the board connectors
  • LCD interface
  • Camera interface
  • I2s
  • HDMI
  • Debug UART
  • TFT socket
  • Built-in WIFI and antennae

You get to choose between Ubuntu, Armbian and an old (5.1) Android from Friendlyarm (why are people still using this – we’re up to version 7 now – I do note that the LeMaker HiKey comes with Android 6). Also though I’m pleased to see that Debian automatically resizes the SD on install – the Android installation does not – you have to do that “on your PC” and once again they make the assumption that we all have Linux PCs – which could not be further from the truth.

Anyway I grabbed the Android file from their site, put it into an SD and banged that into a USB port adaptor on my Raspberry Pi to follow the (simple) procedure to resize Android. Before long I had a full Android 5.1 running complete with Bluetooth (to clarify – a Bluetooth keyboard worked perfectly, a Bluetooth mouse appeared to connect but no pointer movement). And from what I’ve seen that’s more than we can currently expect from a Raspberry Pi because all the videos I’ve seen which say you CAN put Android on the Raspberry Pi, end quietly, usually along the lines of “videos are jittery right now”.  That could all change in the future of course.

THEN I read about enabling developer mode and using a tool on a PC called ADB which allows for changing overscan and screen resolution WITHOUT rooting Android – I ran that and adjusted the screen size to get rid of the overscan – no problem. The result? With Kodi, a very nice setup for a media centre indeed– quite fast compared to other boards I’ve tried – and no jitter when watching video. The only issue being I’d started off with an 8GB SD card for testing – daft idea. So – I started again this time with a 64GB card. By the time I’d finished I had around 56GB left – that should keep me going for a while.

I tried running with the fan off but the heatsink gets just a tad too warm for comfort (as against “cool” with the fan on.  There is a tiny amount of noise with the fan on so I’d recommend putting the unit on soft pads in a box somewhere. (Update, one of the two units I had, came with a 0.21amp fan, the other with a much quieter 0.15amp fan - so I replaced the more powerful one (only a quid from China) and it now runs quietly.

I’ve been running this now checking out radio stations, watching TV stations and local videos – all without any issues. But check out my blog entry on the T3 for a surprise! http://tech.scargill.net/the-mighty-t3/

All in all – up to now one of the better boards  I’ve come across recently. I then grabbed their Debian offering and installed that. After some updating (as it was ancient) I set up the WIFI. This was not trivial I have to say but the end result seems to be rock-solid WIFI - I've had 2 of these boards now sitting for the best part of a week. I've had trouble with the WIFI with my ALEXA unit saying it is having trouble connecting - so I've had to yank the access point out of the wall a few times... throughout all of this - both units remain connected no problem at all. More than can be said for a lot of WIFI setups!! On Debian these units run luke-warm with the fans on.

Facebooktwittergoogle_pluspinterestlinkedin

A Little Dashboard Something

tmp11D3Something for the weekend sir? How about a simple means to get visual and tactile feedback from node-red-dashboard buttons?

Or rather than large buttons – icons you may create or obtain yourself in a node-red-dashboard template.

To backtrack: For my own home control endeavours, I’ve been using a number of visual interfaces over time as some of you know – we’ve discussed in here – Imperihome and Blynk for example.

Recently I’ve been taking a look at Node-Red-Dashboard. Originally called Node-Red-Contrib-UI this has come a long way in recent months and I think is worth more investigation because of it’s ultimate flexibility.

I needed a set of controls for my thermostats – you’ll see an example in the image on the right. As well as turning heating up and down (and I have two separate systems for my office and home) – I have for some two years now had Node-Red handling 5 time-zones during the week and 5 at the weekend as well as frost fallback and holdoff controls (so we can turn the heating to frost setting if we pop out for the day (or for 6 months in one case)). Also as one of our properties is holiday rental, on the odd week it is not in use, it is handy to be able to stop down the heating for a few days, secure in the knowledge it will automatically turn back up when the time interval is done.

At the user end, I’ve used Imperihome for this and Blynk – and neither are ideal as I need so many controls.  Blynk controls are just too big and the slider values are not separately programmable – that is I can’t get them to show hours and minutes. Imperihome has controls for every imaginable device – but very few “generic” controls.

setup windowsThe Node-Red-Dashboard template has always been my favourite option but in the past seemed complicated and control over I/O was limited. Not any more. As you can see, it came to the rescue with a little coding. The standard  numeric up-down control in the dashboard is BORING with an awful pair of up-down arrows with no kind of feedback. History.

The controls you see here are my own effort – all in one template – and hence I have more control over the vertical spacing without which this would take several pages.

So – for any given control you are looking at programme time, temperature for that programme, up and down controls for the programme time and temperature. A feature of the template control (un-tick both arrows in the setup window) separates inputs from outputs – so you can fire information into the node and use that for display only – and buttons can fire values back out – but the standard buttons were WAY too big – so – I used images. Each section here is nothing more than a standard DIV with 3 spans – the final span holding four images.

<div layout="row" layout-align="space-between" style="padding:0px; text-align: left; margin:2px; border:2px solid black;">
<span style="width:28%;padding-top:5px;padding-left:5px;">{{"P1: "+ msg.payload.p1}}</span>
<span style="width:28%;padding-top:5px;padding-left:5px;">{{"T1: "+ msg.payload.t1 + "c"}}</span>
<span style="width:44%; padding-top:3px;">
    <img class="lightup" src="http://xx/icons/timed.png" ng-click="send({payload: 'p1dn' })" height="24px"/>&nbsp;
    <img class="lightup" src="http://xx/icons/timeu.png" ng-click="send({payload: 'p1up' })" height="24px"/>&nbsp;
    <img class="lightup" src="http://xx/icons/tempd.png" ng-click="send({payload: 't1dn' })" height="24px"/>&nbsp;
    <img class="lightup" src="http://xx/icons/tempu.png" ng-click="send({payload: 't1up' })" height="24px"/>
</span>
</div>

I’ve shortened the URL for the images (any old publically available place) to fit onscreen. I put them on my website in a folder called “icons”- but that’s arbitrary.

So – you’ll see the “moustaches” {{}} surrounding incoming information – my first ignorant thought when using one of these templates was that you were limited to msg.payload – but no you are not – you can send an entire object in there.  Hence the page is a series of the above DIVs. Each image (used as a button) sends out a unique message and a simple lookup table decides what to do with them.

template

So above, the blue template is the page you see up at the top – the output is passed to a function in which you can use a case statement to decide what you want to do with each button press.  The second function is triggered every couple of seconds and formats your various settings into an object for injecting into the function (in case these values are altered elsewhere, you want to see changes appear on your phone display). The output from the first function ALSO feeds that function so any changes you make with the buttons – once processed – show immediate changes in the values you see in the topmost image.

So – all very nice – press the anti-clockwise time or clockwise green images – the times change (in my case in 15 minute intervals but they are actually stored in minutes – hence the second function does a bit of formatting).

But it is all very boring – you get no visual feedback from the images – and no tactile feedback from the phone. Well, let me say that I’ve spent several hours going down blind alleys – and learned a lot today. The end result – visual “brightup” icons when you press them – AND full tactile “vibrate” feedback on mobile devices.

<script>
function restore_icon() {
        $(this).attr('src',$(this).attr('src').replace("_b.png",".png"));
    };

$('.lightup').on('mousedown', function() {
    $(this).attr('src',$(this).attr('src').replace(".png","_b.png"));  
    setTimeout(restore_icon.bind(this),500);
    navigator.vibrate(100);
    });
</script>

And it is SO easy once you know how.

It turns out you can use jQuery inside the templates – which is awfully handy – and a modern line to control the buzzer.

When you create or use a (.png) (transparent) image you want as a button – make another with a suffix “_b” for bright. The code below on press replaces the image with the bright version and shortly thereafter with the original.  At the same time the excruciatingly simple vibrate line makes the phone vibrate briefly.  You have no idea where I’ve been with this – but note it is a recent addition but modern phones and tablets should handle it.

Note the class=”lightup” in the above img definitions. Stick this code at the top of the template and all will work magically..

The second part of this code changes the image to the bright version and starts off a short vibrate – while setting a timer at the end of which – the original image is replaced. It is that simple. Because I don’t refer to the actual image – you can have several different images which will operate in the same way.

I’m no CSS expert but with a little care and reading up you can make a pretty control page all in one template completely under your control – and of course – making the alternative image brighter was just my idea – you may chose another path. “Blynk”-type controls should be a doddle.

Have a nice weekend.

 

Enjoy.

Facebooktwittergoogle_pluspinterestlinkedin

Dazzling LED ESP8266

Itead LED controller

So… the other day, a parcel turned up for me – some samples from Itead. One of the boxes contained 4 strips of LEDS and a controller. The strips are maybe 20mm wide aluminium with staggered SMT LEDs on them – first a warm LED, then a COLD LED then.. etc.  Each strip is 500mm long and very thin.

The controller takes in 120-240v and gives out – wait for it…96-140v.

Itead LED controlller

I must’ve stared at them for 20 minutes wondering why an EARTH anyone would want to have a set of lights working at such high DC voltages (I still remember as a VERY small child having one of the first battery power valve radios which had a pair of 90v batteries. I also remember being stretched out on the floor in front of the fire, having a great time playing with this new toy until I stuck my fingers across the battery connector, putting 180v DC straight across my chest – not nice).

Itead LED controller

Then there was the fact that the wires to the mains needed to be soldered to the board rather than screw fittings – and I put the thing to one side until one of our readers wrote in to say that he had figured out that the ESP8266-based controller had one LED on GPIO12 and the other on GPIO14. Well, I really could not be bothered to figure out how the default software on this WIFI-controlled lighting controller works) – so I made a change to my house control ESP software to allow GPIO14 to be an output (it’s on the source code and the OTA update elsewhere in the blog). I could do PWM but that is for another day, for now I simply added on-off control – and when testing I realised there’s a green indicator light in the unit which operates like a SONOFF – ie +v is OFF – my “sonoff:1” command makes that flash the right way.

Itead LED controllerSo all well and good but I was still wondering what is wrong with ordinary LED STRIP. As this is serial you need a terminating connection at the far end taking the two ends from the lights to ground. I just used a blob of solder as somehow mine was missing out of the pack.

Over on the right you see the little stand-up processor board with the reset button and 4 way programming connector (3v3, serial and ground) – don’t try this at home with the mains plugged in!!

Itead LED controllerIt was not until I turned the unit on complete with LED strips that I realised the point of the high voltage! BOY is that bright – and in the example you see above, only the COLD lights are on as I screwed up somewhere and the WARM lights are not on  - I’ll fix that in daylight tomorrow. With both on, you could perform surgery there is so much light.  In short – if you need overall lighting for a shed or small office – this absolutely does the job. They have screw holes all along the strip length – but I simply stuck double sided adhesive on the 4 lengths of strip and they’re holding onto the ceiling along with the controller, just fine.

If I could just convince Itead to use 32Mb (4MB) FLASH parts on all their products…

Facebooktwittergoogle_pluspinterestlinkedin

Amazon and the UK

I thought you might like to see a communication with Amazon and my responses.. I am pretty annoyed as it is not the first time an American company has launch stuff around the world – keen to get sales going but not so keen to provide international customers with the tools they need.

So - I’ve spent some time working on the Amazon Echo product and had some issues along the way. Here’s one reason – I wonder if American companies are even remotely aware of how ANNOYING this is? And all of it would have been so easy to avoid just by better communications.

Amazon: Thank you for contacting us. I understand that you have a couple questions. First that you're being referred to the Alexa skills store to find a particular Alexa skill, but it cannot be found. Additionally, you're having some trouble testing your own flash briefing skill. I can certainly help look into both of these issues today.

1. AnyMote Skill

It sounds like the skill you may be referring to is "AnyMote Smart Remote" made by AB Mobile. If that's the case, then yes it is currently only available in the US Alexa skills store, which would explain why you may be unable to find it if you're located in the UK, and thus signed into the UK Alexa skills store.

Peter: Thank you for this - in the meantime I've heard from Anymote - they claim they put in the Skill for the UK Amazon ages ago and were less than excited by the time it Is taking Amazon to process this - you might want to investigate - when something exciting is launched the LAST thing you presumably want to do is cheese off developers adding value to your product!

Amazon:  2. Flash Briefing Skill

Similarly, flash briefing skills are only available in the "English (U.S.)" language, which as far as Alexa is concerned, is a separate language from "English (U.K.)". In order for a skill be accessible on a given device, that device must be in the same language as the skill, and available in the country you're physically located in.

In this case then, your own flash briefing skill is inaccessible on your Echo device because the Echo device in question is signed into the English UK marketplace, and using the English UK language, whereas the flash briefing skill is in English US, which is currently the only available option for flash briefing skills.

Peter: So why are you doing this? Deliberately (so it would appear) disadvantaging British users and developers? In both cases what you seem to be saying is - had we been American we'd be fine. WHY don't you have a British Flash briefing skill? The link you have provided explains what you've told me - thank you - but it does not explain why we are being disadvantaged in the UK?

And if I cannot develop and test a Skill because it won't work in the UK, why on EARTH does Amazon let me go through the WHOLE process of putting the skill into the forms on Amazon UK when you know fine well it won't work?

I really would appreciate some feedback here - I write a blog and am recommending people to use Echo - having developed a general skill here which does work but which causes issues because of Amazon's absolute insistence on using port 443 for SSL ... http://tech.scargill.net/alexa-enlightenment/

Should I be telling British followers to wait for the Google unit because Amazon are not interested in the UK at this time?

Amazon: For more information on international skill distribution and availability, please see the help article below:

https://forums.developer.amazon.com/articles/45355/international-skill-distribution.html

Facebooktwittergoogle_pluspinterestlinkedin

New This Weekend

Over the weekend I have added a new MENU item to the blog – COMMENTS – thanks to MrShark for that idea.  Menu top right. The page shows the last 100 comments which will hopefully be useful.

I’ve also added an experimental e-newsletter (again on request, several people said they’d like a weekly summary) for those who like to be informed of new items – the plan being to send out an email maybe once a week or less with simply a list of new entries and short description.  On the RIGHT side of the blog – you’ll see a new form needing only name and email – if you want this newsletter – simply sign it  - you’ll get a confirmation email. No this info won’t go out to anyone else and the emails have an unsubscribe link at the bottom.  This email will ONLY go to those who subscribe.

Much as I like my own software, it is always nice to look and see what others are doing – accordingly, over the weekend I’ve been playing with this software with my Sonoff products - https://github.com/arendst/Sonoff-MQTT-OTA-Arduino  - and providing feedback to the author AND getting suggestions based on my own experiences, implemented pretty quickly.

If you like programming with Arduino/ESP environment and want software for Sonoff TH10/16, Sonoff DUAL and Sonoff POW, this might be one way to go!  Right now a Sonoff DUAL with this software (MQTT communication of course) is running one of my heaters. Not seeing any issues yet.

Hope you’re all having a nice weekend.

Pete.

Facebooktwittergoogle_pluspinterestlinkedin

How Not To Do PCBs

tmp21AEMy usual stance is to be nice to Itead, I’ve been dealing with them for some time and although I have absolutely no commercial or personal tie up with them, they do send product samples from time to time as do many others - and I usually end up writing decent reports about their products – especially Sonoff controllers which I think are miraculous given the price.

Well, there’s always an exception (but see the new note at the end)

Yesterday I received this neat little board and accompanying radio handset.

tmpA51So over on the top right you see the board, a really neat little 4-relay WIFI-and-radio controlled board complete with spring aerial and on-board test buttons.

This is the kind of board that could end up all over a hobbyists house, turning lights and other devices on and off. And that’s what worries me as hobbyists aren’t necessarily experts in electronics and mains power use.

So – why would I have a problem with this.

tmp4468

Ok, take a look at the underside – which is clearly left-right reversed from the upper view. The clearances around the relays are fine for mains voltages and they’ve made up for track width with some heavy soldering – not pretty but functional. But here’s the rub – look at the two vertical tracks on the bottom right of the photo – that’s mains power coming in from the connector – to the little power supply.A close inspection at the power supply end shows that the gaps between pins are close – but in practice ok.. but here’s the rub… notice the light green nature of the bottom half of the board – that is ground plane flooding – most commendable – keeps electrical noise down – BUT – what the HELL is it doing right up next to the mains wires??

Those of you from the states might think this is bad but hey, not too bad.. but in countries using up to 250v (we have 250v here) – that is downright dangerous – the slightest damp or circuit board fault or solder beading and BANG.  I am not one of these perfectionists – far from it – I could not tell you how many times I’ve electrocuted myself over my many years messing with electronics (around 50 years amazingly) – but I’m not going near that with 250v mains! So – apart from the fire risk there is also a risk of electrocution from messing with the on-board buttons.

Now – to be VERY fair, I did immediately contact Itead about this (as did Peter Oakes as he has one) and in very strong terms told them my views on this given the high quality of their other stuff. Well, it turns out that in fact that this product is a third party board simply using their little cute power supply left middle) – and they are going to contact the manufacturer.  If you see these boards – I would check that you get a revised version – OR un-solder that power supply – swap the leftmost connector to the spare holes and feed it with 5v instead.

All this REALLY needs is the ground flooding removed from the area around those two tracks – maybe leaving 3mm all round.. and I’d be inclined not to solder the unused middle connector (but that’s just me). Clearly these are early production or even prototypes by the hand soldering – I’m hoping our comments will mean the final production will be useful, SAFE products.

As for the board ITSELF – there are 4 buttons for on and off – and a neat feature – a button to select one of several non-volatile modes – so, for example, the 4 buttons/remote/WIFI might turn individual outputs on or off, or allow only one of 4 to be on at any time, or monostable mode where delays close momentarily only etc. Very good!

Update December 2016: Now, I have to tell you that following on from comments that Peter Oakes and I passed back to Itead, they have, I believe, dropped this product and are working on their own version. I have to say, HATS OFF!

Facebooktwittergoogle_pluspinterestlinkedin

Size Matters… Neo AIR

tmp897DWhen it comes to size, this one is as good as any… the FriendlyArm Nano Pi Neo Air.

You’ve probably read my blog about the Nano Pi Neo, a device I can only describe as “cute” because of it’s really small size - but powerful non-the-less. Well, the AIR version takes things a stage further. No video, no USB (well, no connector anyway) and no Ethernet connector which makes it EXCEEDINGLY THIN.  But it DOES have Bluetooth and WIFI including a socket for an optional external antenna (it also has on-board antenna).

tmp39E7So – H3 Cortex A7 Quad-Core processor – which means that a variety of alternative operating systems to the default Ubuntu will work (just as well as I for one have no interest in Ubuntu). The board is 40mm square and the highest point on the board before you (optionally) fit the (provided) connectors, is the micro-USB connector, which could make for a MIGHTY small controller!

The Neo AIR comes complete with 8GB of on-board  eMMC loaded with Ubuntu. I really don’t see the point of this as it is so hard to fully make a copy as against just replicating SD cards. Aside from anything else – all these boards call themselves or refer to PI – and the PI comes with Debian – not Ubuntu!  However – reporting this for the record. Idling power (depending on operating system as little as 1 watt (i.e. 200ma at 5v). Headers for 3  USB 2.0 ports (but no connectors) 512MB RAM and finally a DVP camera interface. Connectors include UART, SPI, I2C, GPIO, IR, SPDIF and I2S (though actually making use of these will be down to software support!)

Here’s a handy pinout:

tmp4E0F

The whole thing weighs less that 10gms.  I’m thinking this could well make a minimal system for talking to Alexa DOT – perhaps with some IO all in one tiny box!!

tmp23CAA heatsink was provided but no box – but then again any box would probably be of a height to accommodate connectors and I’d really like to see this in a super thin box – or even on the back of a Nextion display.

I note that another blog has covered the use of the board with the Ubuntu operation system so I won’t get into that here.

Note the micro SD connector bottom left in this photo and the power connector/ OTG port top right. There is also a separate 4-way connector for serial debugging.

I tried to use one of my NEO SDs with DIETPI but the software worked – but without WIFI – I could not see a way to fix that and have written to the  DIETPI site in case their software can be updated. That would be good.

Meanwhile I’ve just tried the latest ARMBIAN – blew the SD – popped it in – it works – (serial monitor) – went into NMTUI (command line WIFI etc. etc.) – works a treat. How there is NO mention of Bluetooth in that setup but as I don’t need that right now I’m not too bothered. One of our readers has already commented “No Bluetooth” so I’m guessing that remains off the table for now. I could of course use FriendlyArm’s image but that means re-jigging my script with umpteen installs which probably would not work. Erm, no.

Right now I’m in the middle of running my script from the serial terminal. WinSCP works with an IP address (it would be so much better if Samba were installed from the start so that the domain name worked) and I have noticed that when bringing up a terminal, it is SLOW – I suspect that is down to the WIFI signal – I noted when using Armbian in the past that the WIFI was not that hot on other boards – using DIETPI on he NEO it was marvellous – but that’s not working for the AIR so far.

I did note earlier that the TIME was wrong on the unit (no doubt an issue with Armbian) as it said the last log-in was November 1st – it is November 7th and I’ve only just installed Armbian.

Accordingly my script has been sitting here in a loop complaining that “binding.gyp has a modification time 180293 in the future” and it looked like it was going to sit there and wait that long! As I write this I’ve used the DATE command and all came along nicely if slightly more slowly than normal. First time I’ve ever had that date issue.

And while all of this was going on – the board was only just warm, certainly not warm enough to warrant a heatsink.

HOWEVER – initial impressions – once my script was done.. WINSCP – slow as a DOG. Not remotely in the same league as a typical Raspberry Pi – or even the NEO - HOWEVER - According to TKAISER of Armbian this is because the board needs an external aerial – which begs the question – why didn’t that come with the board!! On close inspection there is no internal aerial… dohhh…..

Update Nov 08, 2016: Ok, aerials on the way – I’m using it with a GPS aerial which is hardly ideal and the WIFI seems solid enough. I hope the proper aerials are small!! I read elsewhere that the chip used is the Ampak AP6212 as used on  Raspberry Pi 3 and there’s a link to more info on that… https://github.com/seemoo-lab/bcm-rpi3 (https://github.com/seemoo-lab/bcm-rpi3). Still running cool enough to NOT need a heatsink.

Update Nov 11, 2016: While waiting for the aerials – and in another blog, TKaiser of Armbian just happened to mention they have a utility to copy an SD setup to eMMC.  It is part of the standard installation and is:

/usr/lib/nand-sata-install/nand-sata-install.sh

So I ran it in a terminal and after a while – it told me to reboot without the SD. I did that and LO – not only a working AIR but a much faster AIR. I took the SD, inserted it into the other board, booted up – repeated the operation – and lO – TWO working AIRS– a quick change of name of one of them and Bob’s your uncle! Well impressed!

Update Dec 20, 2016: Here's a thing. After not using the Neo for a little while, last night I decided to do an apt-get update/upgrade. The update failed due to inability to contact some sources. I tried 3 or 4 times - no joy. I decided that either the WIFI was in trouble or a source was offline and to leave it until this morning.  I got up this morning and the update was fine.. but when it came to the upgrade, I got a message to say the disk was full.  8GB of eMMC - i was sure I'd only used half of that.  Anyway I went off searching - and discovered several large LOG files - deleted the larger onces and now all is well - I've recovered over 2GB of log space. Hmm.

Facebooktwittergoogle_pluspinterestlinkedin

SD CARD Backup

I read about the most convoluted ways to back up SBC systems…. some back up only data, some use arcane commands to do the job – few if any are a single click job for a complete backup that can even handle larger or smaller SDs.

Except for Raspberry Pi SD Backup.

SD Card BACKUP

I don’t know how many of you are familiar with this but I have a number of Raspberry Pi 2 and 3 units and as well as liking to keep regular backups, I like to have snapshots before I try something new – one of my main machines is in Spain, currently a long way away and the other is in the house, away from my office.

In Raspbian from the GUI you simply go to accessories, SD card backup and press a button to back everything up to an SD card that has enough room to store everything. This card can be put in another Pi and will run – every single time I’ve done this it has worked with no data loss even though the Pis are actually running as I’m backing things up.

So two things for any budding wizards out there…

1. I cannot find a way to schedule this from the command line – it seems it only runs in the GUI

2. Why can’t other systems do this – for example Armbian?  Now, The so called Raspbian for the Orange Pi has the same feature but it DOES NOT WORK – I doubt anyone uses their software anyway because Armbian is better by some way… but really – simple backups means more experimenting means greater innovation, fewer heart attacks. PLEASE someone tell me I’ve missed something that does the job (and please don’t mention DD and other convoluted data only or multi-part solutions – I’m talking about a single command that makes a duplicate SD even if it is larger or smaller – that works without issue…

If Raspberry Pi people can do it – why can’t others, I wonder?

Facebooktwittergoogle_pluspinterestlinkedin

I2C Expansion for Pi and ESP8266

Pi ExpansionWant 64 GPIO pins on your ESP8266 or Raspberry Pi? Read on.

If like me you are not THAT familiar with I2c, you might find the results of my  experiments interesting and perhaps even useful.

If like me you are not THAT familiar with I2c, you might find the results of my  experiments interesting and perhaps even useful.

PCF8574TSo I bought a couple of these i2c port expanders from China – mainly because I wanted something simple to mess with i2c on the ESP8266. It occurred to me that if I could get these working on a Pi, so I was sure of the addresses and commands etc., then on the ESP, I’d then get the confidence to do something more dramatic on the ESP8266 with i2c.

So ignoring for a minute the interrupt capability, these are pretty basic devices – using up 2 port bits (SDA and SCL) on your Pi or ESP, send an i2c start to them followed by an address then a byte to them – and the outputs light up accordingly. Set the outputs to 255 and read back a byte and you get the state of the pins as inputs. It doesn’t get any easier.

Well, not unless you completely mis-interpret the addressing as I did and spend ages chattering away to the wrong address. Anyway, let’s not dwell on that.

I noted that the outputs are HIGH by default.  Also note that in my experiments I have set the 3 DIP switches to ON (NOT as in the photo above).

Armed with the latest version of Raspbian Jessie on a pi2 or Pi3, connect ground on the device to ground on the Pi, VCC to 3v3 on the Pi, SDA to SDA (blue) on the Pi, SCL to SCL on the Pi. Simples. The boards have built-in pull-up resistors for i2c (which could pose an issue if you parallel a bunch of them up of course) so that’s it – no other new components needed other than a LED for testing. I used a 470r resistor in series with the LED.

Open a terminal on the Pi and type:

sudo pigpiod

That starts the new GPIO library daemon running in the background.

Now here is a short file that will set all the outputs to 0 – running Python…

import pigpio

pi1 = pigpio.pi()
pi1.write(18, 0)

b=pi1.i2c_open(1,39)
pi1.i2c_write_byte(b,0)
pi1.i2c_close(5)

Nice but then my pal Peter Oakes pointed out to me that I’d end up loading the entire Python environment  every time I wanted to change an output.. so I started experimenting with C code… just turning GPIO18 (on the Pi) on and off for starters…. see the line that says gpioWrite(18,0);  that turns the port off. Substitute a “1” to get the opposite effect.   All of this worked a treat.. “b” here ends up containing a handle.

#include <pigpio.h>
#include <stdio.h>

void main()
{
if (gpioInitialise() < 0)
{
puts("erm no"); // pigpio initialisation failed.
}
else
{
gpioSetMode(18, PI_OUTPUT);
// pigpio initialised okay.
gpioWrite(18, 0);
}
}

The code above once compiled failed the first time – I realised you must NOT have the daemon running when using this. so a quick reboot later and I was in business.

Oh, here’s how to compile a simple C program like that – make sure it’s a text file, say in your /home/pi directory.

gcc -Wall -pthread -o prog prog.c -lpigpiod_if2 –lrt

See where it says “prog” – change that to the name of your program. Takes seconds.

Anyway, I was just about to set everything up in C for i2c etc. when I discovered… PIGS

sudo pigpiod
pigs w 18 0
pigs w 18 1

Note – no sudo needed for the commands and presumably one would run that daemon (pigpiod) at startup. This looked like a nice simple route – dead easy for Node-Red as you can just issue the commands in an EXEC function and pass the parameters in the payload – so next would be to try i2c….

pigs i2co 1 39 0
pigs i2cwb 0 0 0
pigs i2cwb 0 0 255
pigs i2cwb 0 0 1
pigs i2cwb 0 0 2
pigs i2cc 0

The first command visually returned 0 – hence my use of 0 later in the code as the “handle”. I order, I set the expander to all off, all on, then the first bit only on – then the second bit only on and finally I closed the handle.

Something to note is that I2c lines need pull-up resistors – and this board has them already built in – unfortunately they are 1k pullups – fine if you only have one board, not a lot of use if you want to put several in parallel. After discussion we think that possibly the two relevant resistors might be replaced by 10k in which case you could then run several in parallel (with different addresses) but we’ve not tested that.

Oh, making that daemon permanent… I did that with a command line edit “sudo nano /etc/rc.local” -  and added the line “sudo /usr/bin/pigpiod” – and rebooted…. no problem.

Update November 9, 2016

The final stage of this experiment gives my ESP8266 software the ability to achieve the same thing, losing 2 wires to get 64 new ones (YES, 64), a net benefit of 62 I/O lines, could be worthwhile as the ESP8266 isn’t exactly brimming with IO lines.

I2C

Above you see (blue) our ESP-12 board, fastened to an FTDI for power, and wired by jumper to one of the PCF8574T boards - clearly you'd need 8 of them to get 64 lines and I'd be wary as they have pullup resistors on the data lines. I'd remove them on all but one.

With a typical Chinese PCF8574T board which includes pullups, I’ve added new commands to the ESP8266 Home Control software as of my software version 1.6.52 – the xport command.

Example:

{xport:0,1}

sets the lowest bit of the first (address 39) expander high (the 0 is a mandatory argument above – see future blogs) whereas:

{xport:0}

returns the state of the first (LSB) bit of the first of up to 64 bits.

On power up these devices are HIGH - and the software defaults to high on power up. If you mess with a port bit, you need to set a bit high before you can use it as an input. Here is the datasheet for this chip – and here is a typical Chinese expansion board.  With GPIO4 on our little boards hooked to SCL and GPIO5 hooked to SDA – the new commands work a treat.

In the above photo – address 39 equates to all DIP switches set to ON (that’s high or 7). If you set number 3 to off – that is address 38 (bits 8-15) etc. (simple binary selections – you can make the device work as anything from 32 (all switches OFF) to 39 (all switches ON) but before you go connecting eight of them up – bear in mind the comments about pull-ups above.

I’ve been doing a little more on these as you’ll see in other parts of the blog – but the upshot is – you have to ask yourself if these are worth the money. In my original blog I pointed to an Ebay price of £2.35  - but in fact from AliExpress they are only £1.20 and so I’ve amended the link in the blog accordingly.  However as you’ll see in other blog items – as I’ve learned I’ve realised they are not necessarily the best bet. I’ve now made a simple “Nano i2c peripheral” from a Nano board – and they cost just a few pence more – but you can make  NOT only an 8-bit expander but also get some A/D, some PWM and some A/D thrown in – hell I’m even putting an LCD display driver in just for the sake of it – and I’ll call it the kitchen sink peripheral.

However if you do like the look of these chips, you’ll note they say they work on 100Khz I2c. That of course is true and I’ve not experimented with anything other than close up – lets say less than 250mm away – but I’m currently running them a HELL of a lot faster than that. I’ve only speeded up the clock for writes and reads – note the wide bits around the edges but still – quite nippy.

faster I2c

Hope you found the above useful. For more information on the ESP software – go to the relevant page on the blog. There is of course the main Home Control 2016 page.

Facebooktwittergoogle_pluspinterestlinkedin