Orange Pi PC Setup

Here’s a new  video  as we’ve changed the script since the one I had up here yesterday – it takes a long time to do the install and so here is what you get when you’ve done the install.

The script now does it all. So – take a look at the previous blog on the subject where I refer to a Debian installation  which you need to put onto a microSD – and then copy 2 files over before utilizing it. Once you start the Orange Pi PC up – it will appear on your network as “orangepi” – you should be able to access it without referring to the IP number.

On it’s own it will come up in graphical mode but I did not use that – instead I used winSCP to open it up and started a terminal session – at which point it asks you to type something in to re size the image – and reboot. Do that and come back to the terminal.

Grab the above script and put it in the /home/orangepi directory on the OrangePi – go in as that user (password orangepi) – don’t vary from this – don’t set up a root user or use other images etc….   once in – change the permissions on the script to give the owner execute permissions.

Then run the script in the terminal ( ./ –  at the first set of questions select a for all – and then grab coffee you will need it.  Occasionally you might be asked to select directories – go with defaults – you will also be asked for passwords – if it is the orangepi password it is orangepi – if it is for something that has been installed I suggest the same but you can use any password – I use the same one throughout.

Don’t deviate – it will take over half an hour likely.  At the end the unit will reboot and you are all set – other than password security on Node-Red which you may not need anyway.  Everything should just work – ignore WARNINGS and some daft npn errors…. they look awful but it all works.

The only thing I’ve not been able to get working is node-red-contrib-ivona – it anyone wants to work on that I’d appreciate it.

As for ports – well I’ve installed GPIO and so this can be called from an EXEC node. Here’s a simple example:-


On power up – initialise a global variable (let’s call it to 0.

When trying to output to a port – (lets’ say 14 –  where the command is GPIO WRITE 14 1) check first to see if it has been used and if not – send a MODE command first (ie GPIO MODE 14 OUT).

Here is the code for that function.

[pcsh lang=”java” tab_size=”4″ message=”” hl_lines=”” provider=”manual”]

if (( & (1<<msg.topic))===0)
    { |= (1<<msg.topic);
      var tmp=msg.payload;
      msg.payload=" mode "+msg.topic + " out";
    msg.payload=" write " + msg.topic + " " + msg.payload;
return msg;



Update October 2016 – Bill Price wrote in to comment that someone had fixed an issues with audio and so I’m including this link….



19 thoughts on “Orange Pi PC Setup

  1. There is a .FEX file out there for the Orange Pi PC which is supposed to help cool things off – but I cannot find a simple guide as to what to actually DO with that .FEX file.

    1. seen various guides online, but the risk is to break other things… so, i attached passive cooling heatsinks, and i can always attach a little fan to the gpio pins

  2. Peter, these lines enable installation of webmin using the official repo (and as such have automatic updates together with the other system ones, via apt-get), and allows access to https://ip:10000 using the standard orangepi user, no need to allow root access at all, and 0 user interaction required during setup via your script:

    task_start “Install Webmin” “Installing Webmin – expect interaction”
    if [ $skip -eq 0 ]
    echo “deb sarge contrib” |sudo tee –append /etc/apt/sources.list.d/webmin.list > /dev/null
    sudo apt-key add jcameron-key.asc
    sudo apt-get update -y
    sudo apt-get install -y webmin
    # you can login to webmin on https://ip:10000 using user orangepi and his password, default orangepi

  3. Thanks to help from MRSHARK – most issues now gone – no work needed after running script – serial will work……. we have IVONA to solve and it would be nice to get security for both node-red and node-red-ui added into script… along with a better means to quieten it down when not showing warnings etc.

    1. ehm… don’t know how to say…
      i just did
      cd .node-red/
      npm install node-red-contrib-ivona
      and it installed, with no errors this time… maybe they solved the problems… but my node is locked on REQUESTING… try you…
      and 0 requests results on ivona control panel…

  4. what’s the second line you add to settings.js at 24:30?
    there’s nothing in the script that talk about it…

      1. no, it seems something like
        but video is low-res and not quite readable… can you add a note to the script?

        1. It is as you say – so earlier in the script there is npm install moment – which is a handy tool for date calculations -then in the script as you say moment:require(‘moment’)

          This allows you to use in your functions…. describing how to use moment is beyond the scope of this blog.

  5. Peter, just add this before line 239 (chmod…), to change the user pi to orangepi:
    sudo sed -i -e ‘s#=pi#=orangepi#g’ /lib/systemd/system/nodered.service

    and these 2 lines before line 172 (sudo…):
    sudo apt-get remove –purge nginx nginx-common
    sudo apt-get autoremove

    and correct line 380 from:
    task_start “MP3 Installation” “Installing mg123…”
    task_start “MP3 Installation” “Installing mpg123…”

    1. and some apt-get commands have the “auto yes” option “-y”, some other have not, better to add the switch everywhere, so to reduce the interactivity only to the passwords prompts

      1. Working on it – modified the script – will try it before updating – thanks for the feedback – I added bits over time and others helped hence the inconsistency – also at one point I gave up on the Orange Pi as I got very annoyed at the UTTER lack of support from the manufacturer.

        1. maybe even the last bit of “self script mod” can be avoided…
          i refer to the settings.js editing…
          with the “sudo sed” line in my first comment here, you can now avoid self editing the script to change pi to orangepi
          maybe it can be done something like this, in the end lines of your script, to automate even this steps:
          start node red, to create the file settings.js
          stop node red
          use sed to modify that line

          let me try, wait a few minutes to test, BRB

        2. done!
          you can automate the settings.js editing with these 2 lines, at the end of your script:

          sudo service nodered start ; sleep 5 ; sudo service nodered stop
          sed -i -e “s/\/\/\ os:require(‘os’)\,/os:require(‘os’)\,\n\tmoment:require(‘moment’)/g” .node-red/settings.js

          try removing or renaming the settings.js and launch these lines in a prompt, and see yourself 🙂

    2. last thing, you don’t need to remove the gui environment, in case you need it in the future…
      you can start debian in command line instead of gui with this command:
      sudo systemctl set-default

      and you can start gui from command line when neede with

      ore restore gui login with
      sudo systemctl set-default

Comments are closed.