Back in business!

Wow, its almost been half a year since my last post. The time available for project just wasnt there between my paternity leave, summer vacation and other stuff. Like procrastination.

But here I am, back in business, ready to continue with the different projects I got in my head. First off; back to the weather station.

The temperature reading is done, but as I mentioned in another post I ran into some hiccups when sending and receiving the data. After investigating potential solutions I discovered that the library I used, VirtualWire, is no longer supported*. It is instead replaced by a new, and possibly better, library called RadioHead. Meaning half of my code is obsolete and needs to be redone. At a glance it looks similar, but after 5 months without writing a single line of code I need to get my head around it. So next step will be to figure that out.

I did however find a nice link for getting the arduino talk to the Raspberry Pi. The RPi is the true brains behind this project, and will be connected to a 7 inch display to show all kinds of cool data. I hope. Using the quick guide found here it turns out the Pi just needs a serial python library to be set. The rest is like reading the data off of the serial monitor in the Arduino software. Which should make the data easy to use with Python.

So what is the plan?

  • Fix the wireless communication between the Arduinos.
  • Connect the humidity sensor and the barometer
  • Clean up the code for the Arduinos.

When all this is done its time to get the RPi connected to the display and start thinking of an interface. But this is most likely some time in the future. Hopefully I will be posting more updates in the coming days and weeks.



Seems the VirtualWire library was obsolete long ago, but I failed to realize it until now. Oh well.

Creating a weather station – MX-FS-03V/MX-05V (Part 2)

Getting temperature readings with a weather station is fine and all. It is however impractical to go outside whenever I want to know it. Since a wire or a cable is out of the option, and quite outdated, I want a wireless transmission of the temperature data and whatever sensors I add later. Enter the MX-FS-03V / MX-05V.

Wireless transmitter / reciever (MX-FS-03V / MX-05V)

Roaming the wast market that is eBay I found the MX-FS-03V / MX-05V set. They are cheap and small wireless transmitters / recievers, perfect for the Arduino. I haven’t tried breaking them apart, so I am not familiar with the technical specifications other than that they work at a frequency of 433Mhz. I also know that there are some good libraries for them for the Arduino. I’m using the VirtualWire library found here.

Sending data

This is the transmitter part, MX-FS-03V. No potato for scale...
This is the transmitter part, MX-FS-03V. No potato for scale…

The VirtualWire library is designed for this kind of stuff. Using some sample code I found, and modifying it to send the temperature reading, the sending part was very easy.

This is a very early version of the code, and probably full of unnecessary stuff. Later versions will hopefully have some optimization, and a cleaner code. Basicly what the code does is reading the temperature as in the previous post. Then it converts the temperature number to a string. I assume the library can send numbers just as well, as it sends bit by bit, but with the sample code I could not figure it out. Converting it to a string was easier. It then send the string, and loops. It also strips the string of any leading or trailing whitespace. This corrected an early bug where only a part of the temperature was sent.

This sends the temperature about once every second. The selected transmission speed is 2KB per second, which is way faster than needed. But hey, if it works!

Receiving data

The receiving part.
The receiving part, MX-05V.

The receiving Arduino is, for now, a much more simple code. The only task of this code is to receive the data and print it to the serial monitor.

Both codes are based partially or fully on code I found here. They are also most likely nothing like the end result. Part of the project is to practice programming, so code will be rewritten to better fit the task.


The internet disagrees strongly about the range of these devices. Some list hundreds of meters, others talk about centimeters. On my test bench they are positioned about 10cm apart, thus I have not really tested the range. Both units have the possibility to solder on an antenna, which probably will add to the range. This will be better tested later on.

Its not transmitting across any oceans, but at least it works on my test bench.
Its not transmitting across any oceans, but at least it works on my test bench.

Other possible shortcomings

The two Arduinos have been running for a couple of days now, on my test bench. One of the problems I have been having is that it suddenly stops recieving. The serial monitor prints message recieved, the message however seems incomplete. Not sure what this is about. A simple reset of the receiving device solves it, so I’m sure there is a simple workaround if this turns out to be a problem.

I have not tested the power consumption. This is mostly a potential problem for the transmitter, as it will be battery powered. I am not sure my cheap china type multimeter is capable of measuring the current draw, but this will be tested later on.

Next up!

The next part is getting the Ardiuno to talk to a Raspberry Pi. Why a RPi? This is where all the number crunching stuff will happen. I can run a web server on it, and it runs Python, which I find a lot easier than C/C++.

I also need to add more sensors, to get a complete weather station. An eBay shopping round is imminent!

My test bench. Currently sporting an Arduino, a fakeDuino, a
My test bench. Currently sporting an Arduino, a fakeDuino, a DS18B20 temperature sensor, a MX-FS-03V transmitter and a MX-05V receiver.

Getting cheap eBay Arduinos to work

As the price of an eBay type of Arduino, or a NHduino as mine say, is about a tenth of a genuine Arduino I fell for the temptation and bought one. Thinking it was just like any other Arduino I plugged it into my computer, just to have the Arduino IDE tell me there was nothing connected.

A not-so-genuine Arduino with the CH340 chipset
A not-so-genuine Arduino

Some googling around tells me its the USB controller on the copies that messes things up, but luckily there is a pretty simple solution.

This blog post by Alexandre de Pellegrin got links to download the needed drivers, both for Windows, Mac and Linux, for the CH340 chipset. The Windows drivers worked perfectly, but I could not get the Mac drivers to work so I would have to look a bit more into that.

So getting cheap eBay Arduinos to work is pretty much as easy (at least on windows) as the genuino Arduino, you just need another driver.

Creating a weather station – DS18B20 (Part 1)

Greetings world!

This will be my first attempt at writing a technical blog. I have a lot of ideas lying around, and hope this blog can inspire both myself and someone else to get creative and do stuff.

So my first post is part 1 of creating a weather station. I already have a bought one in my kitchen, but this project I think is perfect for learning more about the Arduino Uno and C programming, and further on Raspberry Pi with Python programming, as well as some databases and other cool stuff I have planned. So without further ado; Creating a weather station (Part 1):

Getting the temperature

The core function of any weather station is reading the temperature. Luckily we have come a bit further than reading the data off an old school mercury filled glass tube. Today we got electronics! After roaming the internet for a while I found that the DS18B20 is a well supported, well documented and fairly cheap component, perfect for the cause.

Connecting the DS18B20

Due to the vast amount of information about this component on the internet, connecting it to the Arduino was a breeze.

Connecting the DS18B20 to the Arduino requires 4 cables, a 4.7k resistor, the Arduino board and of course the DS18B20 itself.
Connecting the DS18B20 to the Arduino requires 4 wires, a 4.7k resistor, the Arduino board and off course the DS18B20 itself.

Red wire is power (5V), black wire is ground and white wire is the data wire.

Programming the Arduino to read from the DS18B20

The programming required to read any data of the DS18B20 is pretty ugly, at least for a rookie like my self. Luckily there is a heap of programmers better suited than me to write these kinds of programs, and since programmers are cool people they often share they work. Reading data of the One-wire protocol is easy thanks to two libraries:

The OneWire library is for reading the raw data itself. Its mentioned on the Arduino web site, and can be found here. This library can be used for any device that uses the One-wire protocol.

The data from the OneWire library is of no use in its current form for the end user. Hex data tells me very little about the weather or the temperature. The Arduino library database has a library called DallasTemperature, which is perfect for making the data nice and pretty.

Having installed these two libraries, I used the sample sketch to produce a readable temperature output.

This code outputs the current temperature. I have not dug into the library code to see what it actually does, thus I do not know how often it updates the temperature. It does seem to check about once every second, and for my use that is more than enough.

Requesting temperatures…DONE
Temperature for Device 1 is: 20.12

So there it is, 20.12°C on my workbench at the moment. The accuracy is ±0.5°C, but I can actually see the temperature change by breathing in the sensors direction.

The circuit setup for the DS18B20 temperature sensor.
The circuit setup for the DS18B20 temperature sensor.