Raspberry Pi Monster Script Part 3

I’ve updated the script – gotten rid of MYSQL – too many questions about SD life – and I have to say, SQLITE3 – though slightly different takes mininal modification of SQL assuming you’re doing things like logging of data and relatively straight-forward queries – it really is worthwhile. Apart from admin there are no passwords as it is not meant for massive, multi-user environment on a big server – it is meant for jobs just like this. The file is a simple file that can be moved about and it works well.  Even my PHP queries took only minutes to change to work with SQLITE3 and recent PHP versions support it directly so no need for extra libraries.

I’ve also taken out RabbitMQ in favour of Mosquitto as I needed websockets compatible with THINGSTUD.IO and RabbitMQ wasn’t having it – so after a lot of messing around I finally got websockets and Mosquitto running together and compatible.

Finally I have added support for speech – SERIAL and GPIO – all of it works. I’ll put Node-Red examples on the blog as time goes on.

“The Script” – has since been updated considerably and you should refer to this article


44 thoughts on “Raspberry Pi Monster Script Part 3

  1. Thanks for the script, it made installing the modules much easier. I followed the instructions in the youtube video by Peter Oakes and everything installs fine. However I am unable to use any of the Johnny5 nodes in Node-red. If I start node red using ‘node-red-start’ and create a flow with a Johnny5 node, the instant I deploy it, node-red will crash with the following error: wiringPiSetup: Must be root (did you forget sudo?) /usr/bin/node-red-pi Aborted nodered.service: main process halted. So I tried starting with ‘sudo node-red-start’ the same thing happens – it crashes. What am I doing wrong?

    1. Personally I’ve not used Johnn5 modules so it would be nice if someone else has the answer. We also now have this PIGPIO stuff….. I tried the i2c on that and it worked.

      1. Tim, does this help:

        As of this writing, node.js (version 0.10.29) and the node-red application come pre-installed on raspbian, however for us to use johnny-five we’ll need to run node-red as the root user.

        Edit the /etc/init.d/nodred script in your favorite text editor on the pi. Switch the line containing USER=pi to USER=root

        In the latest version of raspbian (2016-03-18-raspbian-jessie), the script file is /lib/systemd/system/nodered.service.

        From here: https://github.com/rwaldron/johnny-five/wiki/Getting-started-with-Raspberry-Pi-node-red-and-IoT


        1. Hang on a minute – doesn’t changing to root make all your flows disappears as you’re no longer the original user?

        2. And the latest version of Raspbian I have only came out weeks ago – does this change anything?

          1. Yes Peter, flows disappear indeed. I couldnt get Node-red i2c working, made a mess of my setup and I’m now trying to get your Monsterscript working. Once I get there I can continue trying, for example to see if the new Raspbian version makes a change…

  2. Hi I’ve come back to this project having just received an OrangePi. I then set about loading the 2 scripts (newer Orange script). I referred back to Pete’s blogs on “monster scripts” as I had done before with the Raspberry but they seem to be edited and no longer have the fools guide as to where to place the 2 files and the command line to run them. Also the link at the bottom of script 2 is dead. Sorry I struggle with linux.

  3. You might want to put

    if [ “$(id -u)” = “0” ]; then
    echo “Sorry, you tried to run this as root tsk, tsk.”
    exit 1

    at the start which will ensure you don’t start the script with sudo accidentally 😉

    You can also install different versions based on the cpu the Pi has using the following:

    #Run CPUINFO get 3rd bit of revision line if starts with 1000 over voltage so strip out
    #then get first character of whats left

    PITYPE=$(cat /proc/cpuinfo | grep ‘Revision’ | awk ‘{print $3}’ | sed ‘s/1000//’ | cut -c-1)
    echo $PITYPE

    #If its an a its a RPi2/RPi3
    if [ “$PITYPE” == “a” ]; then
    echo “RPi2/RPi3”
    #add the bits for a RPi2 & RPi3 here
    #its an older pi
    echo “Older RPi”
    #add the bits for a RPi & RPiZero here

      1. No problem.
        It would also make sense to do the

        “sudo apt-get purge -y wolfram-engine
        sudo apt-get autoremove -y scratch
        sudo apt-get autoremove -y sonic-pi
        sudo apt-get autoremove -y minecraft-pi”

        bit up front as at the moment you are upgrading them (along with everything else on line46) to the latest version to then delete them.

  4. I have spent countless hours trying to get node, nodered, lamp, and webmin to play together on the same RPi2. Insanely, expecting a diffeent outcome, I kept trying every formula I could find, over and over, only to be unsuccessful, repeatedly,

    Then I tried your script.

    It worked! Just worked, first time.

    Thanks for this, I learned a lot too.

    1. Thank you – I too spend endless hours on each bit, failing over and over – and when I finally got it, put it in the script. If come come up with improvements or additions or changes – by all means fire them back in here… the script is a work in progress and will need some alteration for the latest Raspbian recently put out.

  5. Right… I’m so very very sorry, but just spotted on my new PI the writing “model B+…”
    I have somehow clicked the wrong button when ordering it and when it came with shiny new 4 USB ports and micro sd (as compared to my older PI s) I assumed it was the latest and greatest.
    Sorry again for wasting everyone’s time. I feel such a fool!

    1. Don’t worry I’ve made MUCH worse mistakes than that. I’d imagine you’ll get much of that back on EBAY – meaning a new Pi2 will cost very little – trust me – it’s worth it – way more powerful. I just can’t get my head around how much processing I’m getting out of Node-Red (on my new stat) and the Pi2 is not blinking an eye…

Comments are closed.