Today we have something technical for our nerds!
We are collecting some data!

You have probably already noticed that if you go here in the blog on “Route”, a map is displayed, which shows almost in real time our position. And a little green tent marks the spot where we spent the night.

collecting data

How do we do that?

Attached to the front of my (Klaus) bicycle is this little box:

It is a self constructed box from the 3D printer. It has a small plexiglass window and vents that are arranged so that air but no rain can get in (hopefully).

Opening the case reveals some electronics:

Collecting data

The heart is a microcontroller from the company Particle called “Boron” which can be programmed in C and which has as a special feature a built-in SIM, with which you can send a small contingent of data over the GSM network almost anywhere in the world.

GPS module and different sensors

There also is a battery, a GPS module and sensors for temperature, humidity, air pressure, acceleration, light intensity and UV radiation.

I programmed the Boron to power the GPS module every 10 minutes. As soon as it has determined the current position, the values of the other sensors are read out. From the position data and the data from the sensors a handy data packet is made, which is send via http to our web server.

The web server receives the data, performs some queries and calculations and then stores the data in a database.

Distance

For example, from the position data just sent and the position of the previous record, it uses a simple Pythagoras to calculate the distance traveled in the last 10 minutes. This in turn gives our average speed in these 10 minutes.
This distance calculation is of course a bit inaccurate, because simply every 10 minutes the points are connected by straight lines and curves are not counted. Therefore, after a few hundred kilometers and different riding situations (country roads, city explorations), we compared the calculated total distance with our odometers on the bike and thus determined a correction factor, which is now included in the distance calculation.

Road Quality

With the help of the acceleration sensor I try to get a measure for the quality of the road: is it nice and smooth or are there many bumps? To do this, I add up all accelerations in x, y, or z direction for 10 seconds and calculate an average value from this.

Altitude

From the air pressure our altitude above sea level is determined. Unfortunately, this is not possible directly, because the air pressure not only changes with the altitude, but also fluctuates with the weather (high and low pressure areas). You need an additional reference value (in aviation this is the QNH, the estimated pressure at sea level at a location). The server obtains this by requesting the current coordinates from an aviation web service, which then returns the QNH of the nearest airport.

Weather forecast

Then the server asks a Norwegian meteorological institute how the weather will develop at the current position in the next 24 hours and stores a color value for each hour (blue to violet = light to heavy rain, orange to light yellow = more or less strong sun, etc.).

Visualizing all this data

Once all this data is in the database, it is easy to build web pages from it to visualize it. For example, there is the well-known LiveRoute or a page where you can select any period of time and the data is then displayed as a line graph: EnvDataCollect.

collecting data

The Boron also supports Bluetooth. I have therefore built a small iOS App for my phone, with which I can control whether everything works, even if I have no internet access with my phone. The communication between my data collector and the phone runs directly via Bluetooth.

As a little treat, the colored weather forecast is also displayed (which the Boron gets as a reply from the server when it has delivered its data packet). This way we always have a very accurate weather forecast for the next 24 hours, even if we don’t have internet access at the moment!

collecting data

Collecting data, all these ones and zeros, are very heavy to carry, so Andrea has to carry one more bag instead 🙂

1 thought on “Collecting some data

Comments are closed.

error: Content is protected !!