Saturday, July 23, 2011

Jeenode + VG400 moisture sensor up and running



I got the Jeenodes and the VG400 moisture sensor a while ago, but tonight I finally had some time to look at it.

The Arduino environment, which I have never used before, was surprisingly easy to use. I just connected the VG400 to the board wrote a couple of lines to read the input from the analog IO pin and there was a working moisture sensor. Almost too easy, and cheap, about 40 Euros (or $60) for the sensor and the jeenode together.

After I got the sensor working I verified that I got could communicate wirelessly between two nodes.

The next step is to write the code for sending/receiving data, using the existing libraries, and get a better understand for what you can do to minimize power consumption, which I guess it wise to do before using batteries to power this thing.

Monday, July 11, 2011

Watching videos on the iPad without iTunes

I bought an iPad when they came out and while it is a nice device it is crippled since you need to use iTunes for syncing. Having a wireless device which you have to connect to something else than a charger defeats the purpose.

However, since the iPad browser supports HTML5 it supports video and it is just a matter of getting the videos into the browser. Also, since the browser only supports H264 video and AAC audio you will need to do regular encoding jobs, as you might have videos with unsupported formats.



Step-by-step instruction


1. Install linux:)


2. Install the apache web server.

Run: 'sudo apt-get install apache2'

and surf to http://127.0.0.1 to see if it is up and running


3. Install the libx264 codec, the iPad will only playback videos with a h264 video stream and AAC audio stream.
http://ubuntuforums.org/showthread.php?t=786095


4. Install ffmpeg, for encoding videos

Run: 'sudo apt-get install ffmpeg'


5. Download my video scripts with:

git clone git://github.com/dkarlss/video-scripts.git

and put them in you bin directory: e.g. /home/username/bin


6. set up a user cronjob (which uses the previous referenced scripts) to encode videos

Run ' crontab -e' and add the line

0 0 * * * /home/testuser/bin/encode_all /home/testuser >> /tmp/testuser_encode_all.log 2>&1

and change testuser to your user name (or to a path were you videos are).

Video encoding will start at 00:00.


7. Set up a root cronjob to create links to all the videos (so that the web-server can reference them) and build a web page.

Run ' sudo crontab -e' and add the line

0 5 * * * /home/testuser/bin/build_video_web /home/testuser /home/testuser/bin >> /var/log/testuser_build_video_web.log 2>&1

and change testuser to your username (or to a path where your videos and bins are).

The webpage will be built at 5 in the morning since the video encoding
should be done by then.


8. You are done, just surf to you web server and watch your movies on the iPad.




Sunday, July 10, 2011

Source code

I was just about to make a post about another project of mine but got stuck because of Blogspots poor handling of source code.

dd-wrt

Wireless routers, all the pain and suffering they have inflicted on us users with their poor stability, lack of firmware updates and general crappiness.

As I wanted to replace or now classic Linksys WRT54GL router (which is the only router I have ever owned which actually worked OK) with a router with 802.11n capabilities I bought the Linksys e3000 and put DD-WRT on it, it worked great!


Before switching firmware I did try out the stock firmware having the router daisy chained to the WRT54GL for a number of weeks. The conclusion was that you always seemed to end up having to fallback to the old router, as the e3000 with stock firmware, was very unstable.

I guess it IS possible to create a low cost high quality wireless router after all, it is just that DLink, Netgear and Linksys cannot create the software for it.


Saturday, July 9, 2011

Sensors

As I am building a sensor networks I need sensors, I guess thinking about the sensors should be the first priority but my project is probably more about the network itself than the sensors, or more about the technology for making the measurements than the actual measurements:)

One thing I could think of for my sensor network was to use if for determining when our plants needs watering, hence I needed a moisture sensor.

I found a number of designs on the web which measured moisture by measuring the resistance between two metal rods (in a block of gypsum) placed in the soil:


This design is very cheap so I might use if I decide to build many sensors but first I need to evaluate the Vegetronix VG400-LV.


The Vref for the A/D input for the Jeenode is 3.3V and the output from the VG400 is 0 - 1.8V, so the input signal should be handled by just connecting it directly to the Jeenode, although some if the precision is lost it should be acceptable for my purpose.

Building sensor network, getting the hardware

My initial idea was to get a number of Arduino boards with Bluetooth LE (a radio technology which I really would like to play with). However, all the Arduino boards were really expensive and I could not find a single one with Bluetooth LE, so it was no alternative.

After surveying the market for nodes for my sensor network I settled for jeenodes:

The Jeenode is similar to Arduino, the same tool chain can be used when developing for it, but it is much cheaper, about $20 per node, which includes an Amtel 328, ports for connecting it to sensors and a radio module for multi channel FSK for the ISM-band. It is going to be fun to play with when I get it.

Creating a cheap sensor network

As my vacation is coming up I started thinking about fun summer projects. Creating a small wireless sensor network was my first idea, which could be used for monitoring something in our home, like plants. The connection between electronics and biological processes is interesting, not sure why:)