<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>none of this matters &#187; hydroponics</title>
	<atom:link href="http://blog.nemik.net/category/hydroponics/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nemik.net</link>
	<description></description>
	<lastBuildDate>Thu, 10 Dec 2009 05:32:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Arduinoponics with OpenWRT</title>
		<link>http://blog.nemik.net/2009/12/arduinoponics-with-openwrt/</link>
		<comments>http://blog.nemik.net/2009/12/arduinoponics-with-openwrt/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 05:28:49 +0000</pubDate>
		<dc:creator>nemik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[hydroponics]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.nemik.net/?p=89</guid>
		<description><![CDATA[I updated my GitHub repo: http://github.com/nemik/arduinoponics with code I wrote for the OpenWRT firmware (version 8.09.1). It provides an AJAXy-updating page to OpenWRT&#8217;s Luci web-interface which displays the analog pin values from the Arduino which the Arduinoponics sketch runs on.
Here is a screenshot, notice the extra &#8216;Sensors&#8217; link on the top right to access the [...]]]></description>
			<content:encoded><![CDATA[<p>I updated my GitHub repo: <a href="http://github.com/nemik/arduinoponics">http://github.com/nemik/arduinoponics</a> with code I wrote for the OpenWRT firmware (version 8.09.1). It provides an AJAXy-updating page to OpenWRT&#8217;s Luci web-interface which displays the analog pin values from the Arduino which the Arduinoponics sketch runs on.</p>
<p>Here is a screenshot, notice the extra &#8216;Sensors&#8217; link on the top right to access the info, the page does not require login<br />
<a href="http://blog.nemik.net/wp-content/uploads/2009/12/Picture-3.png" rel="lightbox[blog]"><img class="alignnone size-medium wp-image-91" title="Arduinoponics OpenWRT screenshot" src="http://blog.nemik.net/wp-content/uploads/2009/12/Picture-3-300x168.png" alt="Arduinoponics OpenWRT screenshot" width="300" height="168" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nemik.net/2009/12/arduinoponics-with-openwrt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing broken JFFS2 partition</title>
		<link>http://blog.nemik.net/2009/11/fixing-broken-jffs2-partition/</link>
		<comments>http://blog.nemik.net/2009/11/fixing-broken-jffs2-partition/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 04:17:14 +0000</pubDate>
		<dc:creator>nemik</dc:creator>
				<category><![CDATA[hydroponics]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.nemik.net/?p=86</guid>
		<description><![CDATA[Lesson #1 of embedded development: don&#8217;t write all your code to your device and not backup/check-in. I did just that when writing some code for the hydroponics monitoring setup on my Fon2100 router running OpenWRT. After trying to opkg install ntpclient and getting a segfault and NTP not working, I restarted  the network on it [...]]]></description>
			<content:encoded><![CDATA[<p>Lesson #1 of embedded development: don&#8217;t write all your code to your device and not backup/check-in. I did just that when writing some code for the hydroponics monitoring setup on my Fon2100 router running <a href="http://openwrt.org/">OpenWRT</a>. After trying to opkg install ntpclient and getting a segfault and NTP not working, I restarted  the network on it which restarted the router. For whatever reason, the router choked and each restart went into failsafe mode. When I telnet&#8217;d into it, dmesg told me the jffs2 partition had trouble mounting with an error in jffs2_link_node_ref.</p>
<p>I had written a bunch of Lua code to read the serial communications coming from the ATMega168 microcontroller (it was sending its analog input values) and store it into files in /tmp which were then read by some more Lua code in the (awesome) <a href="http://luci.subsignal.org/">LuCI</a> framework to make those sensors all cool and AJAXy on the router&#8217;s web-admin menu. This worked great until the NTP attempt. So I wanted all this code back. So in case anyone is as foolish as I was to lose their code in the router, here are the steps I took to recover it. David Woodhouse (dwmw2) and dedekind at #mtd on irc.ipv6.oftc.net were extremely helpful with all this and pointed me in all the right directions.</p>
<ol>
<li>
<div>backup the jffs2 image from the router using dd. mine was coming up in failsafe mode so i had to telnet into 192.168.1.1 and then run command `dd if=/dev/mtdblock2 | gzip -c | ssh nemik@pillbox &#8216;dd of=/tmp/mtd2.gz&#8217; bs=2048` but make sure you do the right mtdblock2 device. do `cat /proc/mtd` and choose the one that is for “rootfs_data”. pillbox is a Linux box on my network I transferred this all to.</div>
</li>
<li>
<div>`gunzip /tmp/mtd2.gz` on the Linux box and i got my 5.5MB partition.</div>
</li>
<li>
<div>wget <a title="ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-1.2.0.tar.bz2" rel="nofollow" href="ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-1.2.0.tar.bz2">ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-1.2.0.tar.bz2</a>. untar, make, make install</div>
</li>
<li>
<div>`sudo mknod /dev/mtd0 c 90 0`</div>
</li>
<li>
<div>`sudo modprobe mtdblock`</div>
</li>
<li>
<div>`sudo dd if=/tmp/mtd2 of=/dev/mtd0 bs=2048`</div>
</li>
<li>
<div>`sudo mount -t jffs2 mtd0 /tmp/1/` THIS DIDN&#8217;T WORK! (right away). The Fon router and openWRT are big-endian and I was trying to mount this on a little-endian x86 box. I needed to recompile the jffs2 kernel module to be big-endian. David Woodhouse (creator of JFFS2) writes how here: [<a title="http://www.infradead.org/pipermail/linux-mtd/2007-May/018227.html" rel="nofollow" href="http://www.infradead.org/pipermail/linux-mtd/2007-May/018227.html">http://www.infradead.org/pipermail/linux-mtd/2007-May/018227.html</a>] I needed to get the kernel source and recompile the jffs2 module</div>
</li>
<li>
<div>get the kernel source `apt-get source linux-image-$(uname -r)`</div>
</li>
<li>
<div>go into the source and do `make prepare_modules`</div>
</li>
<li>
<div>copy /usr/src/linux-headers-2.6.27-14-generic/Module.symvers to the source. this will be different for you, but the Module.symvers is important otherwise the module won&#8217;t load properly</div>
</li>
<li>Change the native_endian #define in fs/jffs2/nodelist.h to be little_endian as David writes in the infraread link on step 7.</li>
<li>
<div>do `make CONFIG_MODVERSIONS=y M=fs/jffs2`</div>
</li>
<li>
<div>if it compiled correctly, you then have a jffs2.ko module. load it via `sudo insmod /home/nemik/code/jffs2/linux-2.6.27/fs/jffs2/jffs2.ko`</div>
</li>
<li>
<div>now try `sudo mount -t jffs2 /dev/mtdblock0 /tmp/1/` and it worked for me!</div>
</li>
</ol>
<p>I was now able to see all my lost files in /tmp/1/ !!! the whole filesystem was there and worked great. I extracted all the code I wrote and learned my lesson never to do development on a router and always backup and check in. Hopefully this helps someone out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nemik.net/2009/11/fixing-broken-jffs2-partition/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New project: Arduinoponics</title>
		<link>http://blog.nemik.net/2009/11/new-project-arduinoponics/</link>
		<comments>http://blog.nemik.net/2009/11/new-project-arduinoponics/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 19:08:04 +0000</pubDate>
		<dc:creator>nemik</dc:creator>
				<category><![CDATA[hydroponics]]></category>

		<guid isPermaLink="false">http://blog.nemik.net/?p=82</guid>
		<description><![CDATA[So I started a new personal project in the past week or so. I built a very crude hydroponics setup using old Gatorade bottles and a Ford windshield washer pump to push nutrient-water through the system from a 2L Coke bottle as the &#8220;reservoir&#8221;. Ghetto. As. Hell. You can check out pics of it here: [...]]]></description>
			<content:encoded><![CDATA[<p>So I started a new personal project in the past week or so. I built a very crude hydroponics setup using old Gatorade bottles and a Ford windshield washer pump to push nutrient-water through the system from a 2L Coke bottle as the &#8220;reservoir&#8221;. Ghetto. As. Hell. You can check out pics of it here: <a href="http://www.flickr.com/photos/nemik/sets/72157622608195083/">http://www.flickr.com/photos/nemik/sets/72157622608195083/</a></p>
<p>So I thought it would be cool to automatically control all this via the Arduino. I built a simple little circuit to control the pump so it runs for a few seconds every 10 minutes. However this could be expanded further so that the entire hydroponics setup can be automated via a computer that talks serially to the Arduino.</p>
<p>The Firmata (<a href="http://firmata.org/">http://firmata.org/</a>) firmware is designed to let a host computer talk to the Arduino in this way. So I modified it a little to for the project. It can use the Firmata functions of reading analog pins to get sensor readings but I wanted to have critical functionality like the turning on/off of the pump at specific intervals to be under the Arduino&#8217;s control. Just in case the host computer crashes or a connection is lost somehow, that a critical part of the plant&#8217;s needs such as water does not break as well.</p>
<p>The project is hosted here <a href="http://github.com/nemik/arduinoponics">http://github.com/nemik/arduinoponics</a> and licensed freely under and MIT license.</p>
<p>There is still a lot of work to do here. I should post schematics for my setup first I suppose. So I&#8217;ll do that once I find a decent software in Mac or Linux that can draw schematics, never done this before.<br />
Also, I need to write host-software for the setup. I have a FON2100 Linux modem running the OpenWRT firmware and it has the Lua language on it. I&#8217;ve never used it before but it doesn&#8217;t seem too hard. I&#8217;m thinking to maybe write a Firmata implementation for Lua (probably based on the existing Java one used in Processing). I already got it talking serial to the Arduino so it might not be too bad. Or I could just use an old laptop and then maybe modify some existing Firmata host software rather than have to make the Lua one; I&#8217;ll have to see. The Fon router is just attractive now because it comes in such a small size and runs off 5V so it could share the power for the Arduino. Provided the 12V adapter I&#8217;m using for the pump and 7805 regulator to the Arduino can handle all this&#8230;it&#8217;s only rated for 1A. I may have to get a larger one.</p>
<p>Anyway, let me know what you think. I would love suggestions for this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nemik.net/2009/11/new-project-arduinoponics/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
