logo elektroda
logo elektroda
X
logo elektroda

Arduino UNO + ENC28J60 - no external IP address - how to control

sowson 795 23
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19514939
    sowson
    Level 11  
    Hey, such a problem:
    Equipment as in the title. The system controls the watering of the garden. I'm going away for a fortnight and need to run the watering 2-3 times.
    There is a primitive server set up on the Adruino. Starting the watering is done by sending a command locally (example:) 192.168.1.1:75/automat_start.
    The server shows the current status etc.

    Now how to do this from over seas? Supla won't work on an Arduino UNO (min. Arduino mega), while BLYNK takes up more than 100% of the memory together with my server, openHAB similarly....

    I'm wondering if it's somehow possible to send such a command to the internal network (the same as the Arduino) from the SATEL control panel + ETHERNET module - I'm trying to figure it out and I don't think it's possible, but maybe?

    I only need to send the command, the feedback (server preview) I don't need (does it water it I can see on the monitoring).

    Any ideas on how to do this? Someone, something, anything? I have 3 weeks to come up with a solution or my lawn will wither....

    Cheers!
  • ADVERTISEMENT
  • #2 19518731
    sowson
    Level 11  
    In view of the enormous interest in the subject, I will answer for myself. The solutions are:
    - ask your neighbour to remotely start the watering (he is on the same subnet from the same ISP)
    - call the signal from the control panel - you have to cut the LAN cables to use the free wires to send the signal to some free pin in the Arduino
    - water every two days regardless of the weather.

    And the last software solution will probably remain. At most, I'll water when it rains - better than not watering at all if it doesn't rain for a week. I have water from a rainwater tank - enough for a few waterings.

    Thank you for the discussion,
    Greetings (to myself) :D .
  • #3 19518760
    tos18
    Level 42  
    1 try to get an external address (security is a separate issue - your sprinkler is a toy for the whole world)
    2 connect a gsm module and control via sms
    3 use esp instead of arduino and blynk will fit.
    4 poke around on the forum - there are some similar topics. They concern control of other objects but the method is the same.
  • #4 19518861
    sowson
    Level 11  
    external IP - I had this before and everything worked fine. Now the ISP demands 20 PLN/month min. for a year. A bit of an expensive event. Security is assured: the command example is simplified, in fact they are 30 character commands with a rather complicated design....

    gsm - I was thinking but firstly primo in the basement I have no coverage, secondly primo it involves ripping LAN cable and extra costs (module + card) - and I only need for a few days a year....

    esp is out of the question, I was considering an Arduino MEGA + w5100 Ehternet - maybe in the future I'll do it this way - for now I don't have so much time to rework everything, software etc.

    Re 4: I have searched and found nothing that suits me....

    I think I will stay with the automatic as I wrote.
  • ADVERTISEMENT
  • #5 19519079
    mpier
    Level 29  
    Hello,
    You write that blynk does not fit. Have you tried using blynk with the http API? There's a chance that there's already an http client sewn into your program, in which case writing/reading data from blynk is one GET request. You don't need a whole library for this.

    Another option is to use a second Arduino to blynk and send commands to your device. An Android phone could also be suitable and convert text messages into commands to the controller. There are more possibilities.

    Regards
  • ADVERTISEMENT
  • #6 19519292
    sowson
    Level 11  
    Hey,

    well that would be an idea - just how to go about it?
    From the network libraries I only have #include <ETHER_28J60.h>.
    This is a rather poor library.
    The program, after compilation, leaves 559 bytes free out of the available RAM of 2048 bytes. Below 500b the program already crashes in some situations. So it is very tight.... Perhaps I could save a few more individual bytes somewhere if necessary?
    Could you somehow direct me how to check this possibly?
    As I wrote earlier, I don't need full two-way communication, but I do need one command, and if I can get at least a second one with an "OK" confirmation, then it's all good! Just two 0/1 signals.
    Best regards!
  • #7 19519341
    alster1
    CCTV and Stationary Alarms specialist
    Another solution, and in my opinion the most sensible one, is to add a rain sensor to a free pin on the arduino and automate the whole process.
  • #8 19519395
    sowson
    Level 11  
    alster1 wrote:
    Another solution, and in my opinion the most sensible one, is to attach a rain sensor to a free pin on the arduino and automate the whole process.


    Well yes, but 5 minutes before the rain the sensor will not warn....
    If an automatic then in my opinion it must have:
    1. a rain sensor (or rather meter)
    2. a soil moisture sensor (or rather meter)
    3. a wind meter
    4. a thermometer
    5. a local forecast (or, as an alternative, a local barometer)
    6. a logic that can handle this with a fairly high IQ
    Otherwise the system does what it wants. I've seen installations based on just one sensor (any of the above) and the effect was the same if I set the watering every 3 days to a fixed rate.
    But thanks for the suggestions - fact, many irrigation installation companies recommend such a system based on a rainfall sensor....
    Greetings!
  • #9 19519555
    alster1
    CCTV and Stationary Alarms specialist
    sowson wrote:
    Well, yes, but 5 minutes before it rains the sensor won't warn..
    .
    Why should it warn? The purpose of the rain sensor is to shut down the irrigation system when it detects rainfall exceeding a certain intensity and resume the irrigation cycle after a certain time.
    I have been using this solution for several years and it works successfully. Wind meter, thermometer, barometer? What for?
  • ADVERTISEMENT
  • #10 19519705
    sowson
    Level 11  
    Warning: do not switch on watering 5 or 50 minutes BEFORE it rains so as not to waste water - the rain sensor will not do this

    Wind meter: so that if the wind is >10 m/s, do not water - sprinklers, especially static ones, water the façade or bushes in even light winds and the grass is still dry - and lately it has been blowing a lot

    Thermometer: at 20 oC it is enough to water every 3 days, at 30 oC every two days - this is obvious

    A barometer (as a substitute for the online forecast along with the other sensors) can indicate that precipitation is coming and you can hold off watering for a few hours until precipitation is detected, if any (of course in combination with other factors i.e. if the temp was high, if the soil moisture is already critical, no wind, etc.). - that's why I was talking about clever logic and not the usual or/nand gates

    Maybe you are lucky and it (seems to) work for you (everyone praises what they have) but what I have seen in the other two examples is a failure.
    No offence of course, I'm just giving my arguments :D .
    Zdr!
  • #11 19519781
    starob
    Level 29  
    Automated irrigation is a more complex process. For small acreages you can water j/w "by eye".
    For a lawn this is sufficient in my opinion, but for other crops not necessarily.

    alster1 wrote:
    Wind meter, thermometer, barometer? What for?
    .
    Answer.
    Here is an interesting approach to this topic:
    https://github.com/jeroenterheerdt/HASmartIrrigation
    It may not exactly fit the topic of the thread, but it is worth reading for the sake of "theory".
    As I have my own weather station, the watering time at my place is calculated based on actual measurements.
    After commissioning I was surprised how badly I was doing it before.
  • #12 19519821
    sowson
    Level 11  
    Hey,
    I reviewed the article - well that's an approach I understand! I could already base my watering on such an installation and logic.... :D .
    Unfortunately I don't have that much time to run something like this anymore, another matter is it worth it for 10 days a year?

    Generally I prefer to have control over the system and e.g. when my wife reports that the weeds are not coming up from the roots but are just tearing at the surface, this is a sign that you need to water. There has never been a problem before, I had an external IP and everything worked, the grass is growing, it's green etc.
    Another thing is that I sometimes change the configuration: e.g. when we water the flowers with nutrient, the drip line is already switched off for the next watering, the slope with the rockeries is only watered when there is a drought of min. 2 weeks without rain, etc., and a few other dependencies....
    The problem has only come out now that we have to travel and there is no way to remotely switch it on.
  • #13 19519832
    starob
    Level 29  
    sowson wrote:
    The problem has only come up now as you have to travel and there is no way to remotely turn it on.

    So quick it's a bit difficult... maybe for the duration of the trip some free VPN?
    Maybe a relay in the Supli that activates an input in the UNO for watering activation.
  • #14 19519992
    sowson
    Level 11  
    Free VPN - that's the idea, I just have absolutely no idea how to bite it?
    There are some free VPNs floating around the net, and there has to be a client installed on the Arduino yes? If you know how to do it technically, please help.... I'm just afraid I'll run out of memory!
  • #15 19520020
    mpier
    Level 29  
    sowson wrote:
    From the network libraries I only have #include <ETHER_28J60.h>.
    This is a rather poor library.
    The program, when compiled, leaves 559 bytes free from the available RAM of 2048 bytes.
    .
    This is where the problem with this library will be. A program compiled with it is less than 600 bytes, so your code uses quite a lot. Do you keep any constant variables in the frame? Maybe subtitles, or other larger arrays?

    Blynk compiled with some sensible library like EtheretENC (with normal uip) is around 1000 bytes, and with the http API a bit less. If your program compiles with blynk, that might be a solution.

    The rest of the comments as above, but that's more of a topic for a new project. Why are you rejecting the ESP32? It has a lot of ram, memory, has wifi and ethernet.
  • #16 19520064
    sowson
    Level 11  
    Memory is eaten up by the overwhelmingly generated web page showing the status of the device. This is done there by the client.print("html code") command;
    Unfortunately, this cannot be chewed into program memory in the same way as Serial.print(F("text");
    The page is trimmed to the bare minimum anyway (abbreviated designations, no colours or tables, etc.).

    After all, neither the ESP32 nor its predecessor have Ethernet???? Even now I looked on google and they don't have it.... Unless there are some versions that are different?
    WiFi doesn't work in the basement unfortunately....
    Once I change it to an Arduino Mega + W5100 then I will fit the whole Blink and Supla and OpenHUB together with the watering controller but this is a project for winter evenings and not for now :( .
  • #17 19520133
    starob
    Level 29  
    sowson wrote:
    just have absolutely no idea how to bite it?
    .
    It's unlikely to work on the arduino alone. Maybe you have a router with a VPN? It's hard to advise something when you don't know what you have, and I'm not an expert myself.

    On an ad hoc basis, I would use a module with a supla with control via the cloud
  • Helpful post
    #18 19520159
    mpier
    Level 29  
    Instead of "client.print("html code");" use "client.print(PSTR("html code"));". This is for an old compiler, but if your program can be compiled easily, that's probably what you have.
    In the file "ETHER_28j60.h":
    Code: C / C++
    Log in, to see the code
    .
    In the file "ETHER_28j60.cpp".
    Code: C / C++
    Log in, to see the code
    .
    Now by changing "html code" to PSTR("html code") you save 8 bytes.
  • #19 19520243
    sowson
    Level 11  
    mpier - many thanks!
    I've implemented the suggested changes, and have already saved almost 50 bytes in the first line of html code! :D :D :D :D .

    I'll redo the whole page in the evening, see how much memory I have left -> if it keeps coming at this rate there might even be enough for this blynk!!!
    See you later!

    edit:
    Sorki, out of this joy I forgot to add: my TP link N750 router - TL-WDR4300 and as far as I can see VPN does not have....
  • #20 19521788
    sowson
    Level 11  
    I changed the whole site as recommended.
    Unfortunately, the total slowed down a little less than I expected.
    I currently have 860b free after compiling. A bit still not enough to upload the whole blynk.

    But maybe using the libraries from "ETHER_28j60.h" it is possible to truncate the blynk to get it working after all?

    Greetings!
  • #21 19521918
    mpier
    Level 29  
    It can be done, but it will be much more difficult than rewriting the program under a normal Arduino Ethernet compatible library. These libraries are best forgotten about. Unless you are operating directly on packets, the swap will be easy if you only have one function reading data (http query) and one sending a response. Eventually, you can dispense with the cross-page control and use blynk itself (as long as you want to use blynk). The 'watering' part is then left unchanged.
  • #22 19523867
    sowson
    Level 11  
    mpier wrote:
    As long as you don't operate directly on packets, the swap will be easy if you only have one function reading the data (http query) and one sending the response.


    I'm not sure how to respond, so I'll write this:
    The only "internet" library in my program is:
    Code: C / C++
    Log in, to see the code
    .
    Then in the setup section I have the network set up like this:
    Code: C / C++
    Log in, to see the code
    .
    In the main loop main I call the function in which I handle the commands from the network (for example the manual off/on section E):
    Code: C / C++
    Log in, to see the code
    .
    Now I have a function page_www() which generates a web page, roughly looks like this:
    Code: C / C++
    Log in, to see the code
    .
    So am I operating on packages or not? :roll:
    I understand that this diagnosis depends on the future of blynk in this project....
    Zdr!
  • #23 19523990
    krru
    Level 33  
    You mentioned monitoring - so somehow you have a connection from outside. How do you have the monitoring done?
  • #24 19524373
    sowson
    Level 11  
    Howdy!
    DVR (records 24 h with approx. 10 days history) connected via LAN cable to the router (physically standing next to it) access via the network locally via local IP or from the outside via the DVR manufacturer's server by ID number, analogue cameras 3 pcs. (AHD) via twisted-pair cable (+adjusting transformers on both ends). As luck would have it, the watering can controller is in the basement and the cameras in the attic.... far - is that what you meant?

Topic summary

The discussion revolves around controlling an Arduino UNO-based garden watering system remotely using an ENC28J60 Ethernet module. The user seeks solutions to send commands to the Arduino's local server (192.168.1.1:75/automat_start) while away, as existing options like Supla and Blynk are incompatible due to memory constraints. Suggestions include asking a neighbor for help, using a GSM module, or exploring HTTP API with Blynk. The user also considers implementing a rain sensor and optimizing memory usage by modifying the HTML code served by the Arduino. The conversation highlights the challenges of remote access without an external IP and the potential for using a VPN or relay systems for control.
Summary generated by the language model.
ADVERTISEMENT