Pages

Friday, September 15, 2023

Freeboard revisited 4: install Freeboard on Raspberry

For an index to all my stories click this text


A few years ago I wrote a story on Freeboard. Freeboard is a dashboard for IOT purposes that was free to use at that time. You can re-read that story here: http://lucstechblog.blogspot.com/2019/10/freeboard.html
A few months after I wrote that story Freeboard suddenly became a paid service. Their servers were no longer free to use for hobbyists like you and me.

Then I found a story on how someone was able to use Freeboard (legally) for free again. Freeboard's source was published on Github and free to download and use by anyone. So I copied the software to my own repositry and tried to put it on a Github page which failed. You can re-read that story here: http://lucstechblog.blogspot.com/2023/08/freeboard-revisisted-part-1.html

The next step was to try to install Freeboard on a free webhost called 000webhost. And that worked great. Read here how to do that and build your own Freeboard dashboard again: http://lucstechblog.blogspot.com/2023/08/freeboard-revisited-2.html

When Freeboard worked again I needed an easy means to send data to it to display test data. The easiest way to do that was to design a webpage with some Javascript that send data to Freeboard. This story tells how to do that and gives the source code: http://lucstechblog.blogspot.com/2023/08/freeboard-revisited-3-freeboard-console.html

If you read the previous stories you know Freeboard is up and running again for free. You can use these stories to get Freeboard running for yourself and it'll work great. No strings attached. And no fees to be paid.

For me it worked great. But there was some small thing nagging me. Everything works fine but Freeboard is stored in the cloud. And I do like not to be dependend. Then a thought crossed my mind.
If Freeboard just needs a webserver to function why not use a Raspberry Pi for that. Raspberry's are cheap and make a great webserver. And best of all, they make you independend of the cloud again.

I have several Raspberry's doing different stuf and I still have some spare ones. So I took a Raspberry 3B, installed it and started building a webserver.

Freeboard on a Raspberry Pi

I am not going to tell you how to install a Raspberry Pi as there are loads of webpages that cover this in detail. If you have no idea just follow the steps in the documentation from the Raspberry Pi foundation: https://www.raspberrypi.com/documentation/computers/getting-started.html

I always run my Raspberry's headless. This means I do not attach a mouse, keyboard and monitor but run VNC and do all the work from my PC. Is a tiny bit slower as working direct on the Raspberry but saves desk-real-estate. If you do not know how to install VNC consult the Raspberry documentation: https://www.raspberrypi.com/documentation/computers/remote-access.html#virtual-network-computing-vnc

After setting the Pi up the first thing we have to do is to install a webserver program on the Raspberry Pi. The most popular is Apache. So open a terminal window on the Raspberry and give the next command:

sudo apt install apache2 -y

This downloads and installs the Apache webserver software.

Apache stores the web-page in /var/www/html

So we need to transfer the Freeboard files from the Github repositry to that directory on the Raspberry.

That is easy.

git clone https://github.com/Freeboard/freeboard.git



Just type this command in a Raspberry terminal and a new folder will be made with the name freeboard. All necessary files are downloaded from Github and placed inside this folder.

The access to the /var/www/html directory is restricted so we need to open it.

The easiest way to copy files is with the file manager. However the /var/www/html directory has a restricted access. To overthrow this type the next command in a terminal window:

sudo pcmanfm

This opens the filemanager in sudo mode and now we have all the rights we need.

Open the freeboard directory in a Filemanager window and open a second window with the var/www/html directory.



Now you can drag the files in the freeboard directory into the var/www/html directory just like you would do when dragging files in windows.

Done !!!

How to access Freeboard.

First step is to find your Raspberry's IP adress.



The easiest way is to hoover your mouse over the up-down arrow on the top-right of Raspberry's screen. It will show you it's IP adress.



Another option is to type hostname -I into a terminal window. This shows you the IP-number of your Raspberry.

As you can see my Raspberry's IP adres on my internal net is 192.168.1.87.

 

Now open your webbrowser on your PC, tablet or phone and type the IP number in the browsers URL bar and there you are !!


Access your data world-wide

To access your Freeboard from outside your house you need to set port-forwarding in your router. As every router is different I can only show how it is done in my Zyxell router.



Open the web-page of your router.

First make sure you know the IP adress of the Raspberry. In my case it was 192.168.1.87



Clicking on the Freeboard icon in my router reveals the same IP adress.



At the bottom of the screen from the network settings click on NAT



As you can see I added Freeboard to my Port Forwarding list.



And this is how I filled in my settings.
The Freeboard server IP is 192.168.1.87. It is a webserver so accessed through port 80 and I redirected that port to 8085.

The last step is to point your browser to https://www.whatsmyip.org/



The whatsmyip service shows your internet IP adress. This adress together with port 8085 makes Freeboard available to you from anywhere in the world.



Judt point your phone's or tablet browser to YOUR-IP-ADRESS:8085 from anywhere in the world and you get access to your Freeboard.

And that's it !!!! We've done it !!
Freeboard is up and running for free again, be it from a webhost like the previous story in this range showed or be it from your own Rasberry Freeboard server.

Something is lacking.

I think you might have noticed that something is lacking.
There is no means to set switches, lamps, fans etc on or off. We can only display data on Freeboard.

Well luckily there are add-ons freely available that makes sending data to an ESP possible. That is what we are going to tackle in an upcoming story.

Till next time.
Have fun !!

Luc Volders