Adding MySensors to existing arduino project? Minimal code needed?



  • Hi, I've got a working Arduino based garage door opener project that I'd like to connect to MySensors for monitoring and control..

    It ran before on a plain Uno, with a wifi module that I can't remember the name of, which was in a Zigbee form factor, and was a serial Wifi interface.. I'm in the process, and almost done migrating to a new Sparkfun 8266 Thing Dev board so that the Wifi would be built in, and I could more easily socket the microcontroller to remove it without unwiring the whole thing from the garage when I need to make code changes, which is how my Arduino currently is..

    SO.. My goal being that I want to monitor and control the door, I naturally thought I'd make a sensor node, but I dont have enough IO pins left over to support an NRF radio module, so I changed sights and decided to try to make it a WiFi gateway that would just report on itself, since it's already connected to my WiFi..

    I thought I could just add:

    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 185
    #include <MySensors.h>

    to my existing arduino project, and then hopefully add the code to register the devices and go from there, but it's not working.. I realize I dont know enough about the MySensors code to be able to retrofit my project like this. I've looked, but can't find anything that specifically talks about retrofitting an existing project like this.. Is there something out there that I'm missing? Any cookbook for the minimal required code to do so? If not, I think I'm at the point that I'm going to have to start over with the MySensors gateway sketch, and then import my "business logic" into it.. Maybe that's the easiest way??

    Any help would be greatly appreciated!!



  • Hello 172pilot.

    I am in the same boat. I created a watering system based on 2 Arduinos, one is outside and one inside, the latter acting as monitoring screen that regulary receives values from the outside station. I want to change to MySensors in order to have more possibilities.

    I now use a Raspberry Pi that acts as MySensors gateway with a NRFL01 module and also as controller running Domoticz.

    To get started I programmed another Arduino with some basic sensor code so that I have some test data to send to my gateway and after this worked I now start to adapt my outside station code to report it's data to my gateway.

    Over here I only need to include

    #define MY_RADIO_NRF24
    #include <MySensors.h>  
    

    to my working code and then define the sensor node id etc. as you can see from the various examples.

    So I would suggest to first start with a test sensor node so that you can check that the basic data transfer is actually working fine.

    In your scenario you would probably try to run the gateway code on an Arduino and connect it to your controller by a WiFi connection and see if this happens correctly, but this is different from my project.



  • Thanks for the reply.. It seems that if you can do what you did with the sensor code, presumably it should work with the gateway code, so I guess I just need to make some time to try some more.. Otherwise I think i'm just going to have to move back to a bigger arduino and just use an NRF and forget about the wifi on the new version..

    Thanks!


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 3
  • 3
  • 5
  • 6

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts