Shipment from eBay

Today another shipment from eBay arrived. Actually several, all stuff ordered through eBay from China. Shipping time is 2-6 weeks.

I am always happy to find these in my mailbox. Ordering electronics parts from China is cheap, but takes some time to arrive.
I am always happy to find these in my mailbox. Ordering electronics parts from China is cheap, but takes some time to arrive.

So today several components arrived. Two more sensors for the weather station, the barometer sensor and the humidity sensor. This means I have all the internal components for the outdoor module. Now I need to hook them up to the Arduino and get the readings working.

I also got some ATTiny85 microcontrollers. These are intended for use later in the project, when I miniaturize the whole thing. In the end I want to create a custom circuit board for the weather station project.

The LED’s are for another project I have in mind, more about that in another post.

Lastly I ordered a ESP8266 module. This is supposed to be a wifi-capable gadget that can also control I/O’s, much like an Arduino. As of yet I have no plans for it, but what project would not benefit from a wifi connection?

From top left: Barometer, humidity sensor, ATTiny85, ESP8266 with extra antenna, and LED’s at the bottom.


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.