Playing with WIO

We’ve had a very busy weekend – a friend of mine, Jonathan who’s another gadget guy stopped over and while the girls went shopping we spent the weekend been buried away in the man-cave experimenting. Firstly – a link for you – if you have an LG TV – here’s how to control it from the command line – and hence if you like, from Node-Red.  

Jonathan brought some kit over including a Seeed Studio WIO board and a couple of peripherals.

For beginners: Seeed do a series of products under the name of WIOLINK – one larger board and one tiny one with ESP8266 WiFi controllers, together with various peripherals. Together they make a nice playground with a very clever cloud-oriented setup whereby you can use a mobile phone to set up the board and peripherals are set up via the cloud. Once in place you can call an API to do your own control.

Grove LCDFor example – you need a controller for an RGB LCD Display? Dial up the display from their list of covered products (their own – usually small peripherals with a common 4-way connector) – press go – and the software on the board is updated to handle the new peripheral – which you can now access via an http POST. In the case of their larger board with several connectors, the APP even tells you which connector to plug the peripheral into!

Now this cloud-based approach is all very nice but originally this was based in China… my first thoughts were that I would not put it past the Chinese government to have a back door to such systems – imagine if millions of us were controlling our homes using their servers – what a powerful tool for disruption that could be – well, they now have a server in the USA and I believe you can do your own at home if you want but I’ll leave you to look up their info on that subject. For me this is just something new to play with and get ideas from.

NOT for beginners: Armed with an original WIOLINK board and a couple of peripherals, we set about this weekend to see how well this worked.  The phone APP all works well, their hardware seems to work well but when it comes to using the API once you’re all set up, the only Node-Red node we found has not been updated in a while and does not seem to work well.

So this is aimed at people who don’t want to get the soldering iron out and would prefer not to program either. And that’s fine.

But we wanted to see how this worked and see what we could do with it – and importantly what others who read this blog might want to do – so we took a bog-standard ESP-12 module, programmed it up with the Seeed code and… well, read on…

So you have a standard ESP-12 module, preferably with prototyping pins – and you want to make your own WIOLINK board – firstly if you don’t have it, you may wish to get the Espressif flasher. Then you need: Assorted binaries, and two bin files user1.bin and user2.bin.

Put them all in a directory somewhere, maybe called \wio.

Flash the software as such:

tmpE429

And that’s it  – you have all you need to get started.  Grab the WIO app for the phone and get a free account.

If using an ESP-12 module instead of a genuine WIO board, where Seeed refer to using UART, then RX on the ESP8266 is D1 on their boards which is the outer connection opposite ground and TX is the inner connector next to RX – of their standard 4-wire connector. Vcc is 3v3 except in the case of their RGB LCD which needs 5v (that will be to keep the LEDs happy). Make sure you don’t use 5v on other peripherals.

If using their I2c port – SCL is GPIO5 and SDA is GPIO4 (some boards may be reversed on some ESP-12 boards).

 

DIY WIO

We tried this out using the excellent Grove LCD RGB Backlight (which I’ve since managed to get running on my own ESP8266 code as it is very pretty), magnificent if only because you can make the backlight any colour you like!!  Everything just worked once we figured out the pins. YES you can get alternatives to this board for less money – but until I can get my hands on one – I can’t tell you if they are compatible. In particular, you can set the backlight on this board to any colour your heart desires, using RGB values. Want a light purple or an ice-green, or pink etc. – no problem. This actually transforms an otherwise utterly boring 16 character by 2 line display into something far more useful.

To set these up, Attach a LED+resistor to GPIO2 as an indicator with the other end grounded. The programming pin is GPIO0 – equivalent to the setup button on the real WIO device. Hold this to ground for a few seconds to go into setup mode – which is shown by a softly undulating light on GPIO2. Note that all my general purpose ESP8266 boards have 1k pull-ups on GPIO0 and GPIO2 to 3v3.  In this case you might want to consider adding similar pull-ups to GPIO4 and 5 as if you are using I2c then you do need pull-ups. Some peripherals have them, some don’t – a bit of a mess really as you really should just have the one set of pull-ups.

So basically you end up with an API call to their server with a unique code and some parameters – which control your board. There are a variety of ways to use this – and in the case of Node-Red there is even a set of nodes to do the job – but when we tested them we came up with various issues and the code looks like it has not been updated for a while – so you might be on your own there.

And so, taking the above into account it is quite easy then to try out the various Grove peripherals – at least those supported by WIO. The App itself makes it easy for you to fire out commands.

Facebooktwittergoogle_pluspinterestlinkedin

Grove LCD RGB Backlight

tmpD3E6Now, before anyone says anything – no I’m not advertising Seeed or their Grove stuff. It just so happens that over the weekend my pal brought some of their stuff over to have a play with and I was particularly taken by the LCD display. This is a typical Hitachi-style 16-character by 2 line LCD of the type that have been floating around since last century but which still are popular today I guess because of price. Anyway, this one marked “Grove-LCD RGB Backlight v1.0” is not particularly cheap but it has an RGB LED background and runs off I2c.

We tested it using the Seeed Studio WIO boards (more on that later). Lovely – want a pink background, or how about aqua, or mint –  well, you have full control over the RGB background with values 0-255 for each colour. It occurred to me that this really transforms the otherwise boring LCD display as you can use colour to indicate alerts etc.  For example on a thermostat display you could use orange for on, green for “reached set temperature” and blue for standby.

tmp52FBAnyway, as the WIO modules are little more than an ESP12 I thought it might be more useful to incorporate a driver for this display into my own ESP8266 code. Those of you familiar with the home control project will know that I keep updating the code for the Home Control 2016 project. So – I took a look at the Grove driver for this display – sadly it is in Arduino C++ format so I ended up doing quite a bit of changing to make it do what I wanted and in C – but ultimately it is in there and works a treat. Here are the new commands you can fire out in MQTT to the board with the new software on, using as usual GPIO4 and 5 for I2c.

{rgb_lcd_setup}

{rgb-lcd_clear}

{rgb_lcd_cursor:X,Y}

{rgb_lcd_background:RED,GREEN,BLUE}  // values 0-255 in each case

{rgb_lcd_write:”Your text”}

And that’s all there is to it. A nice addition to the code. I could add more if needed but I figured this minimal set of commands will do for most purposes.

I’m sure there will be other, compatible boards out there – if you know of them – do let us know.

So on the subject of the Seeed WIO boards, I’ve made a separate blog to follow on that – turns out that if you want to have a play, you can blow their code into an ESP-12 – but read the article coming soon.

Facebooktwittergoogle_pluspinterestlinkedin

Weekend fun

One of the toys I’ve been playing with this weekend is the Amazon Dash – contributed by visiting read JAY when he popped over to see me last week.

Oh, before I start – anyone using the SOURCE of my ESP code – (not Arduino IDE) – if you fancy having a go at getting the NAME to show up on your router (as against ESP_xxxxx) and achieve success – PLEASE let me know – the library function that is supposed to do this simply won’t work for me).

SonoffAnd on the subject of ESP – if you’re using Sonoffs – take a look at this – https://github.com/arendst/Sonoff-MQTT-OTA-Arduino – This was good software for Sonoffs BEFORE I started putting in requests – but now – it has at my request DUAL ESSDs (so you can move from one place to another) – and at someone else’s and my requests –ECHO support – all in a good job and his code still fits into the standard FLASH – you’ll need the Arduino ESP8266 IDE setup – but that’s easy enough. Worth a look.

And on the subject of SONOFFS – I noted this on Banggood.. £4.80 inc delivery to the UK!

http://www.banggood.com/DIY-Wi-Fi-Wireless-Switch-For-Smart-Home-With-ABS-Shell-p-1019971.html?rmmds=category

Anyway…

Amazon DashThe Amazon Dash (full breakdown here for those interested) is a small device designed, like everything Amazon do – to get you to buy more Amazon products.  £4.99 for the privilege of having a button next to your washing machine to help you buy more washing powder (though to be fair apparently you get the money back on your first purchase). The unit is obviously meant for householders who like to waste money – as it is ultrasonically sealed so long after you lose interest in it, it packs in for good.

But of course we technical types are never stopped by such things – you can prise the thing open and replace the battery.  So now all that is needed is to think of a use for it.

Well, it just so happens that this is how it works – when you press the button, it turns on – transmits a signal (while flashing a light) then turns off. The signal is WIFI and a little Amazon SHOPPING APP on your phone lets you set it up to your WIFI.

So, you don’t after all have to order something with it – you could tie it into your home control system – there is a node for that in Node-Red but I didn’t find it that useful so wrote my own.

tmpB085

Easy really – once it it on your WIFI – tell your router to fix that IP address. Then ping it in, Say, Node-Red. So if you do that regularly, say every second or so – your PING will return true or false.  A simple function to detect change of state toward true – and you can do whatever you like with the result.

Odroid C2The unit is sealed and I would imagine would take a little light rain. I plan to use mine (with a new label) as a doorbell.  How about an emergency helper for someone with a temporary illness or other problem – with Node-Red you could have it send you an email, a text or other alert or just sound a bell somewhere. I’ve been testing this over and over and I can’t get it to fail. Of course-  if the broadband goes down you’re stuffed.

Oh and here’s the clincher.. Black Friday sale they were going for 99p each – so look out for other excuses for a sale – you might get a bargain.

In other interests, I finally got my hands on an Odroid C2 and my Debian script works a treat on it APART from Webmin – working on that and I’ll do a full write-up soon.

Facebooktwittergoogle_pluspinterestlinkedin

What is Klikr?

Today I became the proud owner of a Klikr – my friend Jonathan dropped one in for me – so, this afternoon I decided to investigate.

Here it is seen photographed next to my Samsung Gear Classic watch on my normal size hand to put it into perspective. I have the black one but there are other options.

Klikr

The unit contains a Bluetooth transceiver and infra-red transmitter and receiver. The idea is simple – you can have it learn key commands to control, say, your TV (by learning existing commands) and you can control that by Bluetooth on your phone.

You might, like me say – well that’s a bit pointless, I have IR remote control on your phone. You might also have a TV which you can already control remotely over the Internet.  However, if you happen to have a central control system, say, a Raspberry Pi controlling the house – you COULD stick Bluetooth onto that (unless it already has it) and control a TV that otherwise has nothing but Infra-red, from anywhere in the world. The device claims to have “voice control” but in reality that is something they’ve put onto the controlling App on your phone. Still, a nice touch.

Anyway, I’m sure you can read all about it if you’re interested, they seem to cost about £25. If you’ve no other way to remotely control a gadget that responds to infra-red this might be another tool to add to your home control toolbox.  I tested it, took no more than a minute to get it talking to my TV and having the Android (they do Apple) App turning things on and off. Doddle.

Oh yes, it was a Kickstarter project, it is made in China, it runs on a single CR2032 battery and will last a long time as it uses low power Bluetooth. Well, as long as you don’t sit turning stuff on and off all day with it.

While interested in this subject I did find this.. http://www.banggood.com/Broadlink-Black-Bean-Smart-Home-Wifi-Remote-IR-Controller-Universal-Appliances-Smart-Control-p-1049494.html?utm_design=18&utm_source=emarsys&utm_medium=Mail_mid90_email&utm_campaign=newsletter-emarsys&utm_content=Winna&sc_src=email_2129478&sc_eh=e375077fc58ebb7d1&sc_llid=376931&sc_lid=89002665&sc_uid=sBhI5Zx9FB

At first glance looks great as it runs on WIFI and can learn infra-red controls… (as does the Anymote hardware but I could not get that to work properly AT ALL). I was about to order one of these devices when I watched an American video – the guy was praising the Black Bean board but said that while it learned his TV remote controls – on playback, nothing happened.  Think I’ll wait a while on that one.

Facebooktwittergoogle_pluspinterestlinkedin

Weather 2 Board and ESP8266

tmpE044NOT the cheapest board on the planet, I was handed a couple of these little boards by a friend this weekend.. the weather-2 board.

The board uses 2 i2c chips – the BME280 which as you may know is a miraculous little chip offering temperature, humidity and pressure readings all in one chip. I already support that in my ESP8266 code. Nothing new there and the chip works as expected when plugged in using this module.

What this board brings to the party is a chip I was previously unaware of – the si1132 – which in one chip offers readings of visible light level, UV level and IR levels.

The original library for this used floats and I’ve reduced that down to integers – looking at the variations I doubt I’ve affected accuracy at all – and these now come in the form of I2c commands in my ESP8266 code..

{si1132_uv}

{si1132_ir}

{si1132_visible}

Assuming the board is attached (or a board containing that chip that works at the same I2c address) – you can grab readings from this chip no problem.

I could envisage one of these outside – in a cover that protects it from the direct light and direct heat of the sun, offering all 6 readings – handy for lots of things.  Or maybe you just want an alarm when you’ve had too much sunbathing – I’ll leave it to others to figure out best uses.

Makes a useful addition to the home control project. Source of the ESP8266 code available as are ROMS.

Facebooktwittergoogle_pluspinterestlinkedin

Roseapple Pi and Wiring Nirvana

Lemon PiYes, you’ve heard it all now, we have Raspberry Pi, Orange Pi, Nano Pi and… Roseapple  Pi.

A long time ago when I first wrote about this board, there was a price tag of $35 (I believe it was called the Lemon Pi – same board, different marketing – hence the image on the right) – well, it is £44 now from AliEspress – who are not known for being expensive…. so is it any better than the Raspberry Pi for example?

Well, this board stands out a mile – it has three USB ports just like the Raspberry Pi – BUT – one of them is USB3  – which could be a game-changer when it comes to using external memory or hard drives!!!

The board ticks boxes for me  – it has both CPU and GPU (Imagination Technologies PowerVR SGX544),  3.5mm audio out (and that also supports TV out for very old people) , microSD  DC5v in on a micro-usb, Ethernet, 3 USBs and a standard HDMI video output – so no accessories needed here. It also has the 40 pin RPI compatible pinout.

The quad-core Cortex A9 Arm processor is supported by 2GB  and according to the spec there’s the possibility of up to 7 UARTS!!!

For video they claim they can handle up to 4K*2K video (H.264). There is supposedly an IR Receiver (but I could not find it) and finally the board is 85mm by 56mm.

 

This board also has Android 5.1.1 available but to be honest I’m sitting back on Android and waiting for it to be properly supported i.e.  Android 7 as you might find on the expensive (except last week when it was on sale for £35) KiKey from LeMaker – which actually DOES handle Android 7.

I decided after my success with other boards to go with Armbian – So I put – it on an SD, plugged it in, plugged in the HDMI and…  it all worked – I could see with a port scanner 192.168.0.42 that it was  called “RoseapplePi” and the display came up – winSCP was just fine.

I installed my own script without a single hitch!! which gives me Node-Red, Apache, SQLite and Webmin along with Mosquitto – all worked well and significantly the speech synth software IVONA which gave me so much trouble  elsewhere – installed without issue.

Using the same criteria for testing as I did with the Orange Pi and Raspberry Pi, here are the times taken to complete the system tests.

  • Orange Pi 488 seconds
  • RoseApple Pi 544 seconds
  • Raspberry Pi 2 1,171 seconds

So armed with Node-Red – I checked the /DEV directory and could only find one serial port – ttlS2.  I tried to access that with the serial node –and the usual permissions issue came up – so learning from my experiments with the Orange file – I simply gave /dev/ttlS2 full read/write/execute permission.  I did a test with the output connected to the input (this is the 4 way connector near the twin USB sockets – pins 1 and 2)  and did a little test- VOILA – serial IO – but that is a lot less than I’d expected (still – Raspberry Pi only has one serial port).

That out of the way I tackled GPIO. For the Orange Pi I’d managed to get a command line utility working called GPIO – no such utility here until I installed this –  Wiring Pi for the Roseapple Pi.

https://github.com/xapp-le/WiringRaPi

That was easy and includes the GPIO utility – it was easy enough to find the pin definitions for the Roseapple Pi. Could I go further I wondered? I installed Wiring Pi in Node-Red and rebooted.

I installed Wiring Pi for Node-Red – http://nodered.org/docs/hardware/raspberrypi.html

I changed the Node-Red (/home/linaro/.node-red/settings.js) settings file..

  functionGlobalContext: {
os:require(‘os’),
wpi: require(‘wiring-pi’)

// octalbonescript:require(‘octalbonescript’),
// jfive:require(“johnny-five”),
// j5board:require(“johnny-five”).Board({repl:false})
},

and restarted Node-Red… Following instructions here – http://nodered.org/docs/hardware/raspberrypi.html  (near the bottom – Wiring Pi) I figured I should now be able to get a blink example going.. but no – the simple blink example produced…

Error: setup: arguments[‘mode’] => (“undefined” in (“wpi”, “gpio”, “sys”, “phys”)) === false

Not only THAT but my serial port had stopped working – was this down to a reboot or had Wiring Pi reset it’s permission? I gave it write permissions and restarted Node-Red. I tried the command line GPIO and…

linaro@localhost:/dev$ gpio mode 14 output
Unable to determine hardware version. I see: Hardware   : gs705a
,
– expecting BCM2708 or BCM2709. Please report this to projects@drogon.net
linaro@localhost:/dev$ gpio mode 14 out
Unable to determine hardware version. I see: Hardware   : gs705a
,
– expecting BCM2708 or BCM2709. Please report this to projects@drogon.net
linaro@localhost:/dev$

So – I uninstalled the wiring Pi mods (npm remove wiring-pi) and rebooted – NOW the GPIO command line utility worked – and I even tested it – picking a number at random..

gpio mode 14 output

gpio write 14 1

gpio write 14 0

Sure enough – a LED on a pin half way up the connector – GPIOD14 – toggled on and off.

Referring back to my instructions in the Orange Pi blog item – using the EXEC function and”gpio”

gpio

The above works a treat – but clearly, that is only good for slow input and output…. would be better by far if wiring-pi would work natively.

Anyway, I figured it all out the hard way – for simple output…… numbers to pins:

  • Pin 40 GPIO21 gpio nothing default off
  • Pin 38 GPIO20  gpio nothing default off
  • Pin 36 GPIO16  gpio write 27 on
  • Pin 32 GPIO12  gpio write 26 on
  • Pin 26 GPIO7  gpio write 10 on
  • Pin 24 GPIO8  gpio write 11 on
  • Pin 22 GPIO25  gpio write 6 on
  • Pin 18 GPIO24  gpio write 5 on
  • Pin 16 GPIO23 gpio write 4 on
  • Pin 12 GPIO18  nothing default off
  • Pin 10 GPIO15  gpio write 16 on
  • Pin 8 GPIO14 gpio write 15 on
  • Pin 3 GPIO2  gpio write 8 on
  • Pin 5 GPIO3  gpio write 9 on
  • Pin 7 GPIO4  nothing default off
  • Pin 11 GPIO17  nothing default off
  • Pin 13 GPIO27  gpio write 2 on
  • Pin 15 GPIO22  nothing default off
  • Pin 19 GPIO10  gpio write 12 on
  • Pin 21 GPIO9  gpio write 13 on
  • Pin 23 GPIO11  gpio write 14 on
  • Pin 29 GPIO5  gpio write 21 on
  • Pin 31 GPIO6  gpio write 22 on
  • Pin 33 GPIO33  gpio write 23 on
  • Pin 35 GPIO19 nothing default off
  • Pin 37 GPIO26  gpio write 25 on

So all of those pins work using the command line “gpio” – and hence via Node-Red where I tested them – but there has to be a better way.

And how did I check this? Node-Red of course

Node-Red

And the function?

global.set(“parp”,global.get(“parp”) ||0);
if (msg.payload==”on”)
{
if (global.get(“parp”)<40) global.set(“parp”,global.get(“parp”)+1); else global.set(“parp”,0);
msg.payload=global.get(“parp”) + ” on”;
}

if (msg.payload==”off”)
{
msg.payload=global.get(“parp”) + ” off”;
if (global.get(“parp”)>0) global.set(“parp”,global.get(“parp”)-1); else global.set(“parp”,40);
}

node.status({text: msg.payload});
return msg;

But the REAL magic is here

Here’s where we come to the real point of this update – apart from the pin definitions above – take a look at my similarly updated FriendlyArm M1 article which not only has the pins for THAT board but also now has a solution for general pin control – for non-root users.. http://tech.scargill.net/cheapest-almost-complete-iot-solution/ – this is what I’ve been waiting for.

Therein you will see a simple C program, easily compiled on the board – honestly – no knowledge needed  (one command-line instruction) and more importantly – the 2 lines necessary to AT LAST make this stuff work for an ordinary user – which means integration into Node-Red.

This now makes at the least, the Roseapple, LeMaker, M1 and NEO usable with Node-Red right down to port level. It has taken me a long time to get this far.

Whether they are right for you compared to the very cheap Orange Pi or the very well supported Raspberry Pi – well that’s another matter.

Facebooktwittergoogle_pluspinterestlinkedin

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.

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 – at a later date I’ll take a look at their Debian offering and see how well that works.

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