Close

Raspberry Pi 2B

A project log for IAQ WSN

We are building a wireless sensor network that is monitoring indoor air quality

vlapp17vlapp17 01/15/2016 at 08:570 Comments

The Raspberry Pi 2 comes in great when a low-cost, multi-purpose minicomputer with computational power is needed. Our reason to choose this device is that we want the setup to be able to run independently from its makers. Leaving an expensive PC or smartphone is more difficult in a public building than leaving small boxes with relatively cheap hardware. The Raspberry Pi is used in our project as the sink of the network, and therefore it needs to be able to connect to the server (Arduino WiFi shield), receive data sent by the Arduino, process this data and display it to the user. The Raspberry Pi runs on Raspbian, which is a version of the OS Linux, and in order to execute all the necessary commands it needs to run several programmes. Now, as an open source operating system, Linux is very different from Windows and assumes that everything more specific than basic programming and mathematics programmes are to be built by the user himself. An http server has to be configured in order for a TCP client/server socket to work, Raspberry Pi has a descriptive tutorial on how to do this. Then the TCP client can be programmed in Python, we found code for that online. The TCP socket creates a connection between the Raspberry Pi and the WiFi shield of the Arduino through a port defined in the code, so that it can receive data from the Arduino. Real-time graphing could possibly be done with Python with an adjusted version of a tutorial we also found online. We could make a list of the data that is received each time, and instead of pins assign an index in the list to the data from each type of sensor.

We have tried to install a readymade TCP client/server by changing a kernel and installing wine, we have installed Windows 10 IoT to see if that could install and run a readymade TCP client/server and finally back to Linux we have adjusted different TCP Python codes but it all seemed to not work. The problem was that we did not know the Raspberry Pi is secured and that a TCP needs to be configured in a special way to overcome this, but luckily Raimond Frentrop from the Optics group could tell us running an http server would solve the issue of dealing with all the detailed fiddling with the TCP. This is due to the Raspberry Pi trusting the http server rather than a bare TCP socket. We have configured the http server as a last minute resort to establish a link between the Arduino and the Raspberry Pi. It turned out that the web page has to be configured to allow changes to be made to it by the Arduino so that the Raspberry Pi can then read that data, but we did not look into this.

Discussions