We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Water the Garden



  • I'd like to water the garden controlled by Onion Omega 2+.

    The plan is to control solenoid valves to water different areas with necessary quantity.

    Currently, I'm able to control 8 relays via the Omega console, which means I could control the valves.
    Next, I'm going to write a Python script to switch the relays. At first, I'll just schedule it using a cron-job.

    Question: Should I put 1kOhm resistors between Omegas GPIO's and the relay control inputs to protect the Omega against current peaks?

    Up to now it has been 2 hours of great fun!

    Here is my plan:

    Step 1

    • water 5 different zones on a fixed schedule

    Step 2

    • let Omega decide to skip watering based on weather API current conditions and today's rain probability

    Step 3

    • read cistern water level and switch to tap water if needed

    Step 4

    • delay watering if it is likely to rain tomorrow and cistern level is below a threshold

    Step 5

    • Build a nice mobile web frontend with AngularJS with stats and manual-watering-button [water now!]

    Further steps

    • refine decision model, like to check if it actually rained as forecasted, via API
    • add an earth moisture sensor
    • learning function for cistern size
    • learn watering frequency and quantity based on manual oversteer or user feedback - let's see

    Hardware available

    Hardware considered

    • flowmeter (any recommendations? I don't want leakage underground, should be frost-resisting, accuracy isn't important)
    • Arduino Dock to read Ultrasonic sensor
    • Moisture sensor

    Photos will follow!



  • @freizeitnerd
    I'm using the DIGITEN G1" Water Flow Hall Effect Sensor Switch Flow Meter Flowmeter Counter 1-60L/min from Amazon for $10.99. Threads aren't exactly NPT, but if you need NPT, you can cut them easily by cutting channels in a female NPT connector and threading it on. You can get accurate flow by measuring time between pulses and accurate measure by counting pulses. It needs 5V to operate but doesn't output 5V. It might be a could idea to use a diode to protect the Omega input, although it probably isn't needed.



  • Thanks Wayne! I ordered two 🙂

    I switched to the Arduino Dock. Do I get the documentation right, that most of the GPIOs aren't available because they are used to communicate with the "Arduino"?

    "By default, the Serial, SPI, and I2C pins implement these communication protocols and cannot be used as GPIOs. Similarly, the I2S and PWM pins are set to GPIO mode by default." Source

    Which results in 6 GPIO left, right? 0,1,2,3,11,18

    GSIP Pin Out



  • @freizeitnerd said in Water the Garden:

    I switched to the Arduino Dock. Do I get the documentation right, that most of the GPIOs aren't available because they are used to communicate with the "Arduino"?

    "By default, the Serial, SPI, and I2C pins implement these communication protocols and cannot be used as GPIOs. Similarly, the I2S and PWM pins are set to GPIO mode by default." Source

    Which results in 6 GPIO left, right? 0,1,2,3,11,18

    Almost right.

    Omega2(+) is acessing the inside flash via the hardware SPI pins, these pins are not used by the Arduino Dock 2 (the on board ATmega328P).


    If you do not want to communicate serially with Arduino via UART1 then RX1 and TX1 are free.
    The GPIO15, GPIO16 and GPIO17 pins are in use only if Omega2(+) programms (ie uploads a sketch) the ATmega328P.
    So you could use these pins via the on board bidirectional level shifter at 5V logic level on the Arduino Dock 2.

    Unofficial Arduino Dock 2 schematic



  • I got little further, see Github Repo.

    Wrote setup.sh to setup multiplexed GPIOs. Which is a little bit a shoot in the dark. I find it difficult to turn from GPIO Groups to GPIO Numbers to use.

    Thanks, György I also use GPIO 45 and 46 now.
    Problem: Omega 2+ won't boot if a relay control pin is connected to GPIO 1.
    Currently connected GPIOs to the relais: 0 2 3 11 18 45 46

    Wrote a Valve class to control the relay (and open the valves) and a little script to test/play with the relais.

    I'd love to get comments!

    PS: How to add code with highlighting and indention here?



  • @freizeitnerd said in Water the Garden:

    PS: How to add code with highlighting and indention here?

    Blocks of code are fenced by lines with three back-ticks ``` in Markdown.
    See also the COMPOSE button at the top right corner of the edit frame please 😉


  • administrators

    @freizeitnerd Updated the documentation to indicate which GPIOs need to be floating for a successful boot: https://docs.onion.io/omega2-docs/using-gpios.html#important-special-gpios



  • @Lazar-Demin thanks! That helps!

    btw. is there any project going on to write a Ruby wrapper for GPIO interaction?

    Still not watering anything, but ...
    I went ahead in Ruby and found myself writing a 'wrapper' to switch my valves (basically GPIO's). I could contribute if there is any project.

    See GitHub Repo

          stdin, stdout, stderr = Open3.popen3("fast-gpio set #{@gpio_number} #{v}")
          if stderr.gets
            raise(OnionGpioWrapperError, stderr.gets)
          end
    


  • Hi @Wayne-Holloway ! Can you read the water flow directly in omega GPIO or you need to connect them to the arduino dock ? I can't correctly read my sensor because I don't know how to do this by omega GPIO interrupts. Best regards!



Looks like your connection to Community was lost, please wait while we try to reconnect.