Saturday, December 7, 2013

Part 2 - weatherview weather-station with single board computer

Hopefully you are here because you already purchased the items from part one. The cubieboard2  development board comes with Android operating system already installed. We need to get rid of that and replace it with Ubuntu. You can use Ubuntu desktop, that will give you a nice graphical interface as well, however since I only use it with remote clients and I have no monitor, no keyboard or mouse connected to it - I did not really need a graphical user interface. Hence I used the Ubuntu server. Much smaller footprint and requires less resources because the X-server is not there.

You can and probably will boot the cubieboard up in Android,  was really curious to see what it can do - and got disappointed pretty quickly since there was barely any application I could use on it. All you need is a TV with an HDMI port, a USB keyboard and mouse connected to the cubieboard2. After it boots up you can see the cubieboard android image on the screen and you can select from the available applications with the mouse. If you have the WiFi dongle connected you can connect to your WiFi router and browse the internet with it - or you can plug it into a router with an Ethernet cable.

I personally spent quite a few hours to get this working. Well, when you are ready, here is what you need to do.

I think it would be time to mention that for the following steps you will need some linux knowledge. It can be done without, I am not an expert either, but I can be a very persuasive researcher when it comes to something I want to do.

Download the firmware update application from here:

http://cubieboard.org/download/ scroll down to software tools and download and install the PhoenixSuite for windows:

Download    windows(32/64bit)

Then download the Ubuntu server image for cubieboard2 from the same place, choose the:

Link    Lubuntu Server           (Include server-13.06-v1.00 and server-13.06-v1.06)

After download you may need to unpack/unzip/unrar the image file, save it to a directory you can load it back from.

To install the new image, you need to do the followings:


  • Run the PhoneixSuite application.
  • On the firmware tab click on the Browse button to select the image downloaded.
  • Find the button on the cubieboard2 which is labelled FEL and hold it down while you plug in the USB cable into the mini USB plug on the board. Of course the other end of the USB cable is already connected to your computer.
  • Once plugged in the PhoenixSuite will see the connected board and will ask you if you want to format before you upload the image. I recommend to format it.
  • It will take about 5-6 minutes to upload the new lubuntu firmware in the nand memory, but once it is done you can disconnect it and plug it to you keyboard and monitor to load the lubuntu server image now.
Originally it may take a few minutes to see the root prompt, this depends on several factors, like your network setup, etc.

When you finally get the prompt, there are a few things you can do to get things moving faster. We will get to that in a minute. For now you need to decide what network you will want to use - LAN or WiFi.  

If you want to use the WiFi, you will need to install a few packages as those are not in the default image. For now you need to modify a file in the /etc/dhcp folder, find the dhclient.conf file and change the following line:

#timeout 60; 
to
timeout 15;

save the file and close it. This will cut down your reboot time next time in case the network is not found.

Now, in order to install the packages necessary to get the WiFi running you will need to do the followings: 

apt-get install wireless-tools wpasupplicant

now you can go and modify the /etc/network/interfaces file. You will need to add your WiFi information to it:

first line usually is:

auto lo eth0

make it into

auto lo eth0 wlan0

now, go down to the end and add your wlan0 interface information:

iface wlan0 inet dhcp
wpa-ssid Your Network SSID Name
wpa-psk Your WiFi password

if you do not use wep instead of wpa, just search Google for what you need to add o your file.

if all done correctly you could do a 

service networking restart

to enable your WiFi interface.

you can check with an:

ifconfig

if all things are correct and you got an ip address on all your interfaces.

So now that we have the cubieboard2 up and running, we need to load a kernel which will work correctly with the weather-station connected to its USB port. The kernel included with the distribution I downloaded did not have all the necessary USB modules compiled in. Lucky I found one which had all the required features compiled in. Once that was uploaded, the WMR200 started working and pushing the data as expected.

To do this follow the link below to download the firmware which is working:

http://www.cubieforums.com/index.php/topic,1077.0.html

the version of your kernel is reported when the cubieboard boots up on the top of the screen. If yours is newer than 3.4.67+ then you might not need to replace your kernel, at the time of this writing the version which came with the distribution is 3.4.64, so it needs to be replaced.

The steps to replace the kernel are outlined in the article below:

http://www.cubieforums.com/index.php/topic,1086.msg6498.html#msg6498

If by any chance you screw up something and your cubieboard2 does not boot up any more, no worries, just go to the top of the page and start over from reloading the default firmware.

If your new kernel is booting properly, then it will be time to install the necessary files for the weather view. For this I found an excellent guide, it is actually written for a Raspberry PI, but following these steps will work properly for our purposes.


You can leave out the last portions of the last step about installing the customized icon since this is not really a Raspberry PI.

From here on all want is left is to start the wview, and make sure it is running after the WMR200 is connected to the USB port.

So plug in the WMR200 to the USB port. On the console type:

tail -f /var/log/syslog

and you can check the last entries on your log to see if the USB has been recognized properly.

press Control C and exit the above tail command. Type:

service wview start

which should start the weather station software. Do the tail command above again to check if you are receiving sensor data. Wait for a few seconds/minutes and if you do not see "waiting for RAIN, WIND, TEMP, PRESSURE" or any of these individually then your system most likely started up properly an receiving the data from the sensors.

You will need to properly configure your wview software through a www interface, for more information see the project page here:


Well good luck and let me know how you make out.





Thursday, December 5, 2013

Part 1 - weatherview weather-station with single board computer

For the past year and half I was running an Oregon Scientific WMR-200 weather-station. The beauty of this unit is that it can connect with USB to a computer, and using a proper interface software will the data coming from the weather-station can be uploaded to Weather Underground or other weather logging websites.


The weather-station comes with a base station, a rain sensor, wind speed and direction sensor, an external humidity and temperature sensor and a small solar panel to supply addional power to the devices, make the battery life longer.
You can also use the data to upload it to your own website, and display the data there, this would look something like this:


The above pages can be customized if you wish. The wview interface software uploads the data through an FTP link and updates the necessary files every 5 minutes.

Since this weather-station is usually located somewhere in your living room, entrance, etc. a small computer connected with USB is desired to be attached to it, perhaps as small as possible to stay hidden from the eyes of the visitors. Last year I found a small Zotac computer which was about a 10 inch square and can be wall mounted. I installed Ubuntu server on this last year and I was quite happy with it till I saw there are better, smaller and much cheaper options on the market these days.

Some people used the Raspberry PI for this and that works perfectly well, however the recent advances of the single board computers introduced several new variants some even with dual core Cortex processors. Some examples are: Marsboard, Cubieboard A10, Cubieboard A20, Cubietruck.

So why these and why not the Raspberry PI? Well, first these are much faster, second these have a lot more NAND memory, so one can run a full version of linux (Ubuntu) server with additional capabilities. The Cubieboards have 2Gb, 4Gb and even 9Gb NAND flash memory which makes them perfect for this job. With 2 USB ports, possibilities to add a SATA HDD (even SSD) this little beast can become quite a server for your weather-station.

I purchased mime from http://store.r0ck.me/, but the shipping and responses from them were very slow, order from here only if you do not want it right away. On the other side I ordered some cubietruck boards from here: https://www.miniand.com/ and surprisingly this site was very fast in processing and shipping as well.

The home page where you can find a whole bunch of information about these boards is: http://cubieboard.org/ with a comprehensive repository of images and a so-so active forum which eventually helped me to finalize this project.

The cubieboard A20 used in this project looks like this:
The board has 4Gb of NAND Flash, plenty to run a full linux server on it. The Dual core A20 processor is very fast, with the Ubuntu server is installed on it will boot in less that 8-10 seconds.

There are 3 more things you should purchase with your cubieboard A20:

- a USB wireless plug (around 8-9 dollars, well worth the price)


- a 2A power supply which has enough juice to power the board from a 110V outlet


- a case for your cubieboard A20 which will allow a cleaner installation - no circuit board will be visible

Once you received all these you are ready to start the work and build your own weather-station.