Page 1 of 1

OS and language advice

Posted: Tue Feb 27, 2018 9:23 pm
by RaspberryRog
Hello,

I have a basic home automation system comprising 6 nodes which monitor and control various things (e.g. security lights) around the house. They are controlled by a central controller and communicate via sub-GHz wireless links using a simple home-grown protocol. All the software was written using an Eclipse IDE in C.

Currently the central controller is a node but with different software. What I want to do is use a RPi Zero W connected to a sub-GHz radio to become the system's central controller:

Stage 1 is therefore providing the current functionality but using a RPi Zero W.
Stage 2 is to extend this to allow web browser access to monitor and alter parameters in the central controller.

The extra hardware is trivial but I'd like some advice on which way to go regarding the RPi OS and programming language.
Is Raspbian the right way to go for example? It seems to be the preferred OS but are there any pitfalls in terms of my project?
Programming language, I suspect, comes down to C or Python. Does the desire to have web browser access later on impact the programming language?

Any views gratefully received.

Many thanks,
Rog.

Re: OS and language advice

Posted: Tue Feb 27, 2018 10:35 pm
by Heater
Use Raspbian and node.js.

Re: OS and language advice

Posted: Tue Feb 27, 2018 11:11 pm
by PeterO
Heater wrote:
Tue Feb 27, 2018 10:35 pm
Use Raspbian and node.js.
Use Raspbian. Your existing C code should be usable with very few changes as long as none of your hardware (e.g. your radio network interfaces) rely on closed source drivers that are only available for Intel x86 architectures.
PeterO

Re: OS and language advice

Posted: Wed Feb 28, 2018 6:15 am
by Heater
Certainly keep your C code if it is substantial already.
Does the desire to have web browser access later on impact the programming language?
I would not want to be writing the required server side part of that in C. It would be a tedious, error prone and ugly mess. C is really not suited to this. Nobody does that unless they really have to, say a web interface to a tiny micro-controller.

That web server side stuff is far more easily done in Python and even more easily done in node.js.

Re: OS and language advice

Posted: Wed Feb 28, 2018 8:05 am
by PeterO
RaspberryRog wrote:
Tue Feb 27, 2018 9:23 pm
Does the desire to have web browser access later on impact the programming language?
Ok, so I missed that on the first reading...

It depends what you mean by "web browser access". If all you want to do is display some data, then it becomes a matter of creating a few html files and making the C code write suitable data files to be displayed. All the "web access" can then handled by an apache web server.

But if you want something more interactive, then I would go for Python. It has lots of useful libraries for http server and client side.

PeterO

Re: OS and language advice

Posted: Tue Apr 10, 2018 4:31 am
by DavidS
The desire for a web based interface will not have any effect on the choice of OS or Programming language.

As you say you are already working with C, stick with C. It is what you are already using, so it only makes since to stick with it.

As for the OS, you can use whatever OS you wish, there does not seem to be anything in your project that would make any difference to the OS used. Raspbian/Linux is likely a good choice, just because it is well supported. Other options include FreeBSD, Plan 9, MINIX 3, RISC OS, Xinu, and many others. The choice of OS comes down to what you are comfortable using for the application, and if you require WiFi connectivity. As it is likely that you already use Linux daily it is likely a good idea to stick with it, unless you are more familiar with one of the other OS's for the RPi.

You can dynamically generate HTML with embedded refresh from any language, you can do a very simple HTTP server that also handles post requests in any programming language. So as stated stick with C if that is what you are already working in.

********* FOOTNOTE *********
Why a web based interface? There are many better options for a remote UI, including X. Remember X is intended for remote display and user interaction of applications, and X comes with 98% of operating systems (including most of the OS's for the RPi). So I would think it would make a lot more since to use X than to use a web based interface.

For a monitoring system I am surprised that you want any network access, though I guess if it is only on a local area network without any external connection to the system it can make since.