Changing sensor arduino board


  • Hero Member

    As a trial I set up a light sensor with a arduino uno board. Plugged the gateway (with Nano) into the vera USB and tested it. Having verified that everything is working properly--sensor is posted and reporting values in Vera and the gateway and sensor board are communicated. Now I would like to replace the sensor Uno board with a nano for actual use. However, I would like for the gateway/Vera not to see this as a new sensor (with new id), but to see it as the same light sensor that previously operated with the Uno board. How do I do that?


  • Hero Member

    You'll probably get a more definitive answer, but if you want to test it sooner - I'm guessing that if you give the nano a static node id matching the one perviously assigned to the uno (and run the same sketch), there won't be much that the Vera do to tell them apart.

    (Assuming the Uno will be off the network, or will have it's node id erased)


  • Hero Member

    Zeph, thanks for your quick reply. I think that should work. Will try it and report back.


  • Mod

    The answer @zeph gave will do for sure.
    Another option is to write the value to the EEPROM yourself before uploading the sketch.
    Both work I guess...


  • Hero Member

    As a start I read the EEprom value in the UNO board and the values were:

    byte 0 = 1
    2 = 0
    3 = 1

    All the rest were 255 (default values)

    I assume if I write those values to bytes 1,2,and 3 of the nano board before I upload the sensor sketch, that should accomplish what I want?


  • Hero Member

    The debug statement on the sensor with the UNO board says the radio id stored in EEPROM is 1. I assume this is the same as the byte values I posted above. If so will write those values to bytes 0,1,and 2 of the nanao board and set those on the UNO back to 255.

    To dio the way Zeph suggests, how do I set a static node id for the sensor. I think it has to do with the sensor's begin statement?


  • Admin

    @Dan-S.

    http://www.mysensors.org/build/sensor_api#the-full-api
    Set static id with second argument to gw.begin() (just NULL first if you don't use callback).


  • Hero Member

    Decided the easiest way (for me anyway) was just to write the first 3 different byte values (1,0,1) of the UNO board to the NANO board I wanted to use. Ran an EEPROM write utility to verify the operation and uploaded my sensor sketch. Need to wire it up for final test. Also wrote 255 to first 3 bytes of the UNO board for future use in testing.


  • Hero Member

    Wrote the 1st 3 bytes (1,0,1) to the new Nano sensor board and uploaded the sensor sketch. Was recognized as sensor id 1, same as previous UNO board which was the desired result.

    Probably could have gotten the same result by only writing the number 1 (the sensor-id) to the first byte or calling gw.begin() with the sensor-id set to 1.


Log in to reply
 

Suggested Topics

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts