DHT11 and Ethernet Gateway with enc28j60



  • Hallo.
    That's my first project with MySensor since so foar I have only tested different examples I found on internet,
    My project is to create a Temperature/Humidity sensor in each room of my house and then control the temperature of each room by using a dedicated electric valve for each radiator (interfaced with a MySensor node based on relay). As temperature/humidity sensor I have DHT11 and as gateway I have enc28j60. I'm using a Arduino Pro Mini 5v. The "brain" of the system will be a Raspberry PI 3 equipped with DomoticZ.
    First problem is how to combine the examples I have found in MySensors (DHT code and enc28j60 code) in a sketch. Can you help me or indicate where to find how to integrate two sketches (examples) in one?


  • Mod

    @giangired https://forum.mysensors.org/topic/2597/combining-mysensors-examples should get you going I think. Try it, and if you run into trouble post information about the trouble and your sketch.



  • @mfalkvidd Thanks a lot. Effectively I did the same with DHT11 sketch and enc28j60 gateway sketch. The combined sketch has been successfully compiled and later on I will test it. I have a question: the temp and humidity values are sent through the Arduino serial link (correct?) by using the "send" instruction. Adding the enc28j60 gateway code, it is automatically send through the Etehernet link?


  • Mod

    @giangired yes that is correct.



  • @mfalkvidd I did the test and I obtained a weird result. After several initial test (I started with examples to check the functionality of the ENC28j60, like pinging the Google site) i can say that the wiring between Arduino Pro Mini and ENC28j60 is correct (I saw pinging on my serial monitor). When I test my sktech (that concern one DHT11, two relays and one switch) the connection with the controller (Raspberry PI 3 with Domoticz) is not assured. Time to time I see teh connection on Domoticz but very often the connection is not present. Which debug I can do? Which string I have to receive on my serial monitor to be sure that the Ethernet module is properly recognized? For your info, the power led on the ENC28j60 is lighted and the two leds (green and yellow) on RJ45 port are blinking. I tried to ping the ENC28j60 but I cannot ping it.


  • Mod

    @giangired I don't have any ethernet gateways, but from earlier forum discussion this seems to be normal output:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=R-NGA--,VER=2.1.1
    IP: 192.168.178.134
    0;255;3;0;9;Eth: connect
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:REG:NOT NEEDED
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=NA
    


  • @mfalkvidd My output is identical with the exception of the row related the Eth. I see the row only when the connection with Domoticz is established. Could be a problem of power? I mean, can be a problem related the power despite the green/yellow led of the RJ45 are blinking?



  • @mfalkvidd
    Now it's working fine. It was an electrical problem. I changed the power supply and now it's working.
    Now I have a new question. I use an Arduino Pro Mini Node with ethernet gateway. I have connected to the same node two relays, one switch, one PIR and one DHT11. The question is: what about sleep times? I mean, from the examples of DHT and PIR and others, often it's indicated a Sleep time. SInce the sketch has a unique Loop, how I have to manage the Sleep. Currently I have removed the sleep and I use a counter for each sensor attached to the same MySensors Node. Is this the right solution?


  • Mod

    @giangired yes, a counter or using millis() (which technically is a counter) is the right solution. Relay nodes can’t sleep, because nodes can not receive incoming commands when sleeping.


Log in to reply
 

Suggested Topics

  • 8
  • 2
  • 90
  • 1
  • 3
  • 7

18
Online

11.4k
Users

11.1k
Topics

112.7k
Posts