Hack₂O is a project aimed at creating a DIY irrigation system in the H.A.C.K., a place, where not all hackers are obsessed with supplying the necessary amount of water to plants. The main part is the base and the stepper motor of a flatbed scanner, which can lift and lower the end of a pipe, thus controlling the water flow, depending on the relative height of the end of the pipe and the water level in the tank. For now, the tank is a paint can, which can hold up to 16 liters of water, and has been placed above one of the windows of the hackerspace.
The physical manifestation of Hack₂O at H.A.C.K. currently consists of three parts.
Cron controllerThe AVR-NET-IO board is connected to the water flow controller via I²C and the Internet via Ethernet. It synchronizes its internal clock to an NTP server and sends irrigations commands to the water flow controller using a simple crontab.
Water flow controllerIt consists of a paint can and the scanner base, latter has an Arduino and the motor driver circuit attached to it by screws. When the Arduino receives an I²C packet, it lets the water flow for the specified number of seconds. The details can be seen on the following photo.
Water distributorThe system uses a sprinkler (created from a plastic bottle using soldering iron) to distribute the water evenly over the flower.
The sprinkler is connected to a cone, which collects the water from the flow controller. The whole distributor can be seen on the following photo.
Water level measurement
A metal rod is submerged in the water tank with eight contact pads attached to it. The metal rod is connected to the 5 volts power supply of a 74HC299 shift register, which has the pads connected to its parallel load inputs. Any controller connected to this circuit can parallel load the sensor data into the shift register and then right shift the data out using only three pins (mode, clock, data).
OperationAt the rising edge of the clock pin the water level sensor does one of the following depending on the state of mode pin.
- If the mode pin is pulled to ground, it shifts its contents to right, thus banging LSB to the data line.
- If the mode pin is pulled to high, it loads the sensor data into the shift register.
After startup, the firmware moves the head downwards until a wire loop attached to it hits the bottom of the scanner. In this moment, the head is in a well-known position, so any further movement can be calculated from here.
An AVR-NET-IO board is connected to the Arduino via I²C by latter being the slave on address 20 (0x14). The communication is being done in one byte packets, the Arduino echoes back the byte as a form of acknowledgement.
If the byte sent by the AVR-NET-IO is zero, nothing happens (except for the echo), so it serves as a kind of ping function which can be used in future releases as a monitoring feature. If the byte is non-zero, the head is kept down for the time specified by the byte in seconds.
The exact connections can be seen on the right-hand image.
Important note about acknowledgementWhen using the Arduino Wire library in slave mode, Wire.send() must be called in the request handler. This isn't mentioned in the Wire page of the Arduino wiki, but in the header comment of TwoWire::send().
Interfacing the stepper motor with an Arduino
|Arduino pin||Driver IC pin||Purpose|
|9||1||motor logic (driver 1)|
|11||3||motor logic (driver 2)|
|8||5||motor logic (driver 3)|
|11||7||motor logic (driver 4)|
|GND||8||ground (motor and logic)|
|Vin||9||motor power (12-24 V)|
Assuming the connection used above, the following line will initialize a Stepper object, which can be used to control the motor by calling the appropriate methods (setSpeed, step).
Stepper myStepper(100, 8, 10, 9, 11);
The datasheet of the driver IC can be downloaded in PDF.
The full source code along with the necessary Ethersex patch is available at the GitHub repository under MIT license.
Python QT4 GUI
A Python GUI was added to make experimentation easier (it's much easier to click twice than to enter 8+ characters without any mistakes). It's been deprecated since, because of autocalibration and the switch from serial line to I²C.
2010-07-18First beta version, hacked the hardware together, firmware is capable of performing a full (lower-wait-lift) irrigation cycle after initial calibration.
2010-07-20Added hot glue to the outside of the tank outlet, took photo and uploaded it to wiki after annotation. The applied amount of glue seems to be able to keep the water inside the tank. A video has also been taken: http://vsza.hu/hack2o.avi
A Python QT4 GUI was added with basic functionality.
2010-07-22Checked the tank outlet, and after two days it's still not even wet, so the tank part is working perfectly.
2010-07-25Successfully uploaded an Ethersex OS to the AVR-NET-IO board with NTP support, so it seems it's going to be able to provide a daily irrigation signal to the Arduino. Maybe later it can also be used to send notification about successful irrigation process and monitor the water level. Also, stepper motor controlling code should be migrated to that board as well so the Arduino could be replaced entirely by this board.
2010-07-26Automatic calibration has been added.
2010-07-27The AVR-NET-IO board can now control the Arduino with I²C signals, so the project can be considered to be in its working beta state.
Useful links for I²C communication
- http://www.ethersex.de/index.php/I2C#Pollin_AVR-NET-IO for the AVR-NET-IO side
- http://www.arduino.cc/en/Reference/Wire for the Arduino side
2010-08-14The sprinkler and the flower have been added, so the project is now up and running.
2010-08-20It turned out that by desing the Arduino Stepper library keeps the stepper motor powered all day to keep it in place, which can overheat it. Since the structure stays in one place without this, a few lines of code has been added to release the motor after use.
A water level measurement prototype has also been created and successfully tested.
2010-08-21Fixed I²C acknowledgement issue and a simple debug format bug.
Plans / To-do / Wishlist
automatic calibration(done by 2010-07-26)
- water level measurement in tank (work in progress)
- web interface
- e-mail alerts
- avoid Arduino usage
Contributors to this page:
Page last modified on Thursday 14 of January, 2016 20:46:09 CET by .