Category Archives: Armbian

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.. https://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