OpenSprinkler Forums Third-Party Software OpenSensor: logger & controller for OpenSprinkler networks.

Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #45139

    pbecchi
    Participant

    This is the announcement of a new Software based on ESP8266 the can read and log several type of sensors and control and be controlled by other units using OpenSprikler API.
    One year ago I have ported O.S. version 2.6 to ESP8266 with the idea of building sevral units that could be spread in the garden with the scope of reducing the length of the valve’s wirings.
    Having more then 4 Opensprinkler units WiFi connected to my home network, it became necessary to write a SW to control those units:
    – I have started a Open Sprinkler Manager project to control those units , with the scope of reading sensors and sending API commands to the various unit. But a single OS Manager software it probably not the best way to go. Sensor are often located far away one from the other and the use of a single central unit will lead to HW and SW complexities.
    Since units are based on ESP8266 that can cost less than 5$ each a distritibuted network of sensor/control devices was the way to go.
    – I have started the OpenSensor project with following capability:
    -minimum cost hardware and a WiFi network connectivity
    -reading a wide range of local sensors : temperature, humidity, distance, pulses, ….
    -reading Weather Underground meteo stations data
    -ET0 computations based on meteo station or local sensor’s datas
    -logging sensors or computed data on SPIFFS file.
    -controlling other units with fully customizable commands
    -be controlled from other units
    -upload datas to ThingSpeak channels
    All above functions are easily customized and controlled with dedicated APIs:
    you can define Sensor type GPIO’s , data to be recorded and to be uploaded to ThingSpeak at run time and modify these setup by remote controls
    you can define all control functions at run time using a bitlash type interpreted language, this does include control of local and remote GPIOs

    The unit ca be used for example:
    – to measure a water tank level used to control a filling valve or pump and to stop all Open Sprinkler station if the tank level is too low.
    – to read local temperature ,umidity, rain and consequently control Open Sprinkler units
    – to compute Evotraspiration ET0 using WU stations data or local sensors and to adjust Open Sprinkler rain delay
    – to control any other local or remote device by any local or remote sensor data

    #45145

    szormpas
    Participant

    Hi,

    it sounds amazing, could you please share your firmware and hardware setup to the community?

    Thanks
    Sotirios

    #45147

    pbecchi
    Participant

    I will upload the OpenSensor software on github very soon ;it will be available in github.com/pbecchi/SensorServer.

    The software is in very early deploiement stage , it is under testing and it will need to be cleaned up and better organized

    I am preparing a simple user manual that you will find in the github README file.

    Regarding hardware the project is very open….. as long as you start with a local WiFi network and an ESP8266 ( I use Nodemcu boards in order to use any usb power supply!)
    …you can select the setup you prefer connecting your sensors to any available pin: you will specify your HW setup at run time with a few simple commands!
    Data can be logged locally on the internal flash memory (4MB) using a SPIFFS file: /logs.txt.This file can be read remotely by a web query.You can also send data to Thingspeak channels that you can read from everywhere.
    The type of sensors that OpenSensor supports can be extended very easily including their libraries and adding few lines of code, the ones available right now are:
    -ultrasonic distance sensor like HC SR04
    -temperature humidity sensor like RHT 03 or DHT0xx
    -one wire family sensors like ds18b20 temp probes
    -any other GPIO input reading
    -input data can be also optained by Web Query :e.g. data from another unit and Weather Undergroud Stations Data……
    -you can also compute your data to be recorded

    Output commands can go to any available output pin and control any compatible device :like relay, leds, alarms …whatsoever! or can be sent to another unit or to an Open Sprinkler station.

    The number of available pin can be extended easily using PCF8574 multiplexer unit that you can connect with I2c.

    The unit SW has been made only for remote control so ,at the moment, no local User Interface is forseen (buttons inputs and LCD could be easily added later!)

    For debug and unit control a TELNET server line is available and you can follow the data stream as well as the internal computations.Flash from ESP8266 internal led are used to interpret possible errors at setup stage (like boot loop).

    To control the unit at run time you will have to define a number of RULES and LOGRULES that can be added and modified remotely by an API command, the language is very powerfull and easy to understand is based on a simplified Bitlash interpreter(github.com/billroy/bitlash) that has been ported to ESP8266 with the addition of functions to access remote units pins. This way you can control any output line anywhere in the network1

    For better understanding of the unit capabilities I will later provide examples on the github wiki.

    Since SW is in very early stage and still under development , I look forward to have comments and suggestions from you guys!!!

    Paolo

    #45167

    Ray
    Keymaster

    Very cool. This sounds like an awesome project and thanks for sharing! Among the various applications, this one — to compute Evotraspiration ET0 using WU stations data or local sensors and to adjust Open Sprinkler rain delay — is a particularly interesting approach, as it allows ET-based weather algorithm without having to upgrade OpenSprinkler’s firmware.

    As I’ve started using ESP8266 a lot myself, I really think it’s a fantastic chip, very low cost, easy to use, and have excellent community support. The lack of GPIO pins can be easily solved using an IO expander as you said; I am not too worried about the lack of ADC pins because a lot of modern sensors are I2C-based any ways. Probably the only thing that stops it from being used absolutely everywhere is the power requirement — a WiFi-chip is still quite power hungry and that makes it less suitable for certain projects that need to be placed outdoors or in places where there is no persistent power.

    #45188

    pbecchi
    Participant

    //github.com/pbecchi/SensorServer is now online!

    Remenber that it is still under development and not all features as been tested!

    Your comments and suggestions are welcome!!

    Enjoy!!

    Paolo

    #45213

    Mike
    Participant

    Could this be made to work with non-wifi and non-ESP8266 connected sensors? I want to measure the soil moisture in an area that is outside the range of my wifi. I’ve already got all of the components I need to set up a remote XBee sensor (solar powered with a battery) that will transmit the soil moisture readings to another XBee attached to my OSBo.

    I’m thinking that once I get a soil moisture reading, I’ll use it to calculate a % watering level that I can feed to OpenSprinkler. Would OpenSensor be a good fit for my project?

    Mike

    #45214

    pbecchi
    Participant

    Interesting application Mike!

    If I understand correctely you need to measure ground moisture far from your home network and control an OpenSprinkler unit connected to your home network.
    Keep in mind that with a cheap external repeater you can connect an ESP8266 at 300ft to 1000ft from your home and that for powering it you can simply use one of the several phone USB solar power supply available in the market.
    The ESP8266 is consuming only power when is awaike , during sleep consumption is negligeable, and I presume your measurement can be done only few time a day.
    Total cost cost be in the range 20 to 40 $ ;this is much less than the cost of a couple of XBee transmitter + MCU + solarpower supply.

    In addition once you are connected to the nework used by OS units it is very simple to send API commands to conrol those units.

    I am preparing in the github wiki a description of few example of the OpenSensor possible application:
    one is a unit located inside a glass house that read internal temperature and humidity and ground moisture sensors and control en Open Sprinkler for spraying and operation of a blower and of a heater.

    If you give me more detail on your application I can try to study better your case and develop a example, detailing HW and SW, that I will put in the wiki pages

    #45293

    pbecchi
    Participant

    I have uploaded in github.com/pbecchi/sensorserver/wiki the detailed description of few application examples:

    Example 1 . Measure of the water level in a tank or pool to control a local or remote refilling valve or pump.
    Example 2 . Computation of hourly and daily ET0 from Weather Underground meteo data and/or local sensors
    Example 3 . Glass house control from in/out Temperature Humidity for watering & climatic control(in preparation)

    Any idea for other possible applications? Suggestions are welcome!

    #46210

    raoula
    Participant

    Hi Paolo,

    This is exactly what I have been looking for. I am about to setup a Raspberry Pi running Opensprinkler to manage 12 different watering zones. The watering system is fed from a header tank that is filled but water runoff from a shed and we have recently added a line to fill it from another tank that is @ 700 feet away that is in turn, filled by a well. I want to pump from the remote tank up to the header tank for the watering system. I need to be able to have the remote pump turned on and off based on the water level of the header tank. (your example 1 scenario). I checked out the wiki but couldn’t see any detailed notes on how you set this up. Any assistance you could provide including details of hardware used would be greatly appreciated.

    #46217

    pbecchi
    Participant

    Hi Raul

    I know that my wiki is somehow difficult to understand and that description of Sensor Server features is cryptic and obscure!
    I have tried my best but I am not very good on explanations!
    I believe that SensorServer is a very powerful code and have hundreds of potential utilisations. but it may not be so user friendly and detail explanations very every application is very time consuming!
    I look forward to find some help and to get people , like you , involved on using the code and find possible examples!

    Coming to your application:

    In the attachment you can see how I understand your needs!

    Sensor 1 measure level of Tank 1 and send commands to Sensor2 that control a Pump to fill Tank1 from Tank2.
    Note : all area must be WiFi covered ( you can use any external WiFi repeater like TP-LINK CP210).

    I assume you can install sensor1 in top of tank1, since a ultrasonic sensor is used to measure the water surface distance, and that you have power lines for all units. Sensor 2 can be mounted on top of tank2 (if you want to measure level of tank2) or everywhere near to the pump,since it will be controlled by a relay of Sensor2.

    If this is correct , I can send you schematics of the 2 SensorServer units and a components list.
    I will also tell you how to customise the SW for you application.

    paolo

    Attachments:
    #46224

    raoula
    Participant

    Hi Paolo,
    Thanks so much for your quick reply. Your attachment is spot on. Both water tanks are already within wifi range of each other (and more importantly the router). I can absolutely install sensor 1 in top of tank 1 and 2. I am not sure as to whether to use an electronic sensor for tank 2 or a manual float valve to stop the well pump from filling it at this stage as either should work fine. If you could assist with the schematics and component list and SW would be awesome.

    Thanks again,
    Raoul

    #46228

    pbecchi
    Participant

    Hi

    This is the list 9f what you need for your Hw:

  • 2 Esp8266 ,better 2 NodeMCU 1.2 with 4mB flash
    1 or 2 HC SR04 Ultrasonic sensors
    2 1k resistors and 1 3.3v zener
    1 relay module rated to your pump power
  • Using nodeMcu have the advantage of having all USB interface IC onboard, this way you can just connect to your PC for firmware upload.
    To power the unit any simple USB power converter will go.
    For connection of the HC SR04 you can follow the schematic of the wiki
    https://github.com/pbecchi/SensorServer/wiki/SENSOR-SERVER-Wiki.
    You can route the sensor signal to any Esp Gpio,. The second sensor is for the second unit if you want to measure also tank 2 !
    The second unit should be connected to a relay board: this device should be rated to your pump need and be capable to be driven by a 3.3v signal!
    Again any GPio can be used.

    The connections are so few and simple that you can do it with any breadboard board!

    Software

    One you get one NodeMcu try to compile and upload the Sensor server code, you need to have Arduino 1.6.8 Ice installed in your PC with Esp8266 Arduino Code libraries. You have to download also the driver libraries for the various devices ( I will add a list to the Sensor server Readme)!

    If you are successfully then you will have to just modify the config.txt file to define how sensors are connected to the unit and to add a couple of “rules” that will define how to control your relay.

    When you are ready I will tell you how to do it !

#46507

raoula
Participant

Hi Paolo,

My hardware arrived today finally so I am going to start working on this shortly. I was wondering if it would be possible to change it a little so that the Ultrasonic Sensor is run from the Raspberry Pi direct (which is running opensprinkler) and just use a single ESP2688 at the remote end. Given I am only doing a maximum of 12 zones from the raspberry pi for sprinkler operations (likely only 2-3 in the next couple of years), there should be sufficient pins left to physically hook everything up. Basically just trying to reduce the number of components required at the end of the day if possible.

I tried connecting to Arduino IDE 1.8.2 and have been having a few issues getting it to do anything, so I downloaded ESP8266 LuaLoader 0.91 and flashed the firmware and have been able to get it connected to my wifi and respond to commands straight away. I am incredibly new to this and learning as I go so any guidance you can provide on what I am doing wrong / what I might be missing for Arduino IDE to not be working?

What are your thoughts on connecting the sensor directly to the Pi, and if you think it will work, are you able to assist me with the code required and how to integrate it with the proposed system, including the code for the remote receiver (ESP8266) that is responsible for turning the remote pump on and off.

Cheers,
Raoul

#46508

pbecchi
Participant

Hi Raul

If you don’t have experience on Arduino IDE for Esp8266 , you should follow the installation instructions of GitHub.com/esp8266/Arduino.
If you find difficulties may be the best will be that you tell me your configuration and the type components you want to use and I will compile and build the firmware for you. You will have only to flash the firmware and the config.txt file on the Esp8266 .

Regarding Raspberry Pi it is possible to Port my code to it but it is going to be a long difficult work. I strongly suggest you buy another Esp8266 that will cost only few dollars! Or if is possible to use one of the OpenSprinkler IO to drive your relay pump, then you may use a single Esp8266 connected to the Ultrasonic sensor on tank 1.

Today there is no possible connection of an Ultrasonic sensor to a OpenSprinkler unit!

Keep in touch!

Paolo

#46509

raoula
Participant

Thanks for the quick reply – I am learning this all quite quickly and quite enjoying it. I wasnt concerned with the $$ (I think it cost me $10 for the ESP8266), just thought it would be one less component in the mix, but if its going to be quicker and easier to use a second esp8266 then I will just go ahead and purchase one. The specific item I purchased is this one: http://www.ebay.com.au/itm/272580283375 – do you see any reason this wouldnt work? I have successfully upgraded to firmware 0.96, configured it onto my network and started a tiny web server on it to test the unit works and it seems fine. Obviously I havent even looked at the pin config as yet, so if you can see why it wouldnt work I would appreciate it. If you confirm its ok, then I will grab another one the same, or if you can recommend a better one then I will go for that.

Cheers,
Raoul

#46516

pbecchi
Participant

Hi Raul

With the wemos D1 , little expensive but good ESP8266 choise, have you received the ultrasonic module and the relay module? You can try to connect it to your Wemos d1 following the schematics that i previously have given to you. Pay attention to the voltage : Esp 8266 GPIO are 3.3v while most of the boards are 5v. You can use the 5v out of the Wemos board for the v+ connection but you have to convert voltage on Esp Gpio input lines; the few components in the schematics are for that function.
For the relay (normally 5v) with the appropriate driver transistor may be directly connected, pay also attention that relay contact are rated to the pump current and voltage.

I will try to answer ASAP your post but I am afraid we are in 12h time difference.

Paolo

#46713

Ray
Keymaster

Just a quick tip about the 5V to 3.3V level conversion: in general you can simply use a series resistor (1K ohm is good enough) to connect any 5V output to a GPIO pin on ESP8266. This is fine because most microcontrollers have internal zener diodes that protects the pin from over-voltage, and adding a 1K ohm resistance limits the current, so this is the simplest way to do level conversion with only 1 resistor.

Viewing 17 posts - 1 through 17 (of 17 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Third-Party Software OpenSensor: logger & controller for OpenSprinkler networks.