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.
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.
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.
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).
- 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.
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().
|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.
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.
A Python QT4 GUI was added with basic functionality.
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.
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.
- 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
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.
I²C acknowledgement issue and a simple debug format bug.
automatic calibration(done by 2010-07-26)
- water level measurement in tank (work in progress)
- web interface
- e-mail alerts
- avoid Arduino usage