Basic project setup from start to finish



  • Is there a place that explains how to set up a project from start to finish? I am a complete newbie to IOT. I am looking for instructions on how to start a project like the temperature sensor. What are the first steps? Do I create a directory in the examples folder and clone the library I need into that directory then add the dependencies? I need complete hand holding and I have not been able to find it. Thanks in advance!!!


  • Mod

    @toddsantoro great that you are joining the world of IoT, welcome to the MySensors community.

    The step by step guide starts here: https://www.mysensors.org/about



  • Thank you this was just what I was looking for. Cheers!!!


  • Mod

    @toddsantoro you're welcome. Just ask if you get stuck and we'll help you get back on track.



  • @mfalkvidd I'm stuck again... I wired up the motion sensor and compiled the code on the motion sensor page. It pushed everything to the Nano but I get this: Sketch uses 7,500 bytes (24%) of program storage space. Maximum is 30,720 bytes.
    Global variables use 371 bytes (18%) of dynamic memory, leaving 1,677 bytes for local variables. Maximum is 2,048 bytes.
    Invalid library found in /Users/xyz/Documents/Arduino/libraries/TAS_motion_sensor: /Users/xyz/Documents/Arduino/libraries/TAS_motion_sensor
    Invalid library found in /Users/xyz/Documents/Arduino/libraries/TAS_motion_sensor: /Users/xyz/Documents/Arduino/libraries/TAS_motion_sensor

    TAS_motion_sensor is my project folder and the ino file is also named that. WHat am I missing??? DO I need to add the serial gateway stuff to the Nano that has the motion sensor attached to it? I am also using the 3.3v for the radio and the 5v for the motion sensor and I am also using the 2 different grounds provided on the board too. Any help would get me past this first sensor and then I think I will be off to the races.


  • Hero Member

    @toddsantoro From first glance.. you should not put your sketch in the libraries folder but in the sketches folder. Next time please publish the sketch (insert with the "</>" markt in de format menu)





  • Should I create another folder in there called sketches? Here is my sketch copy and pasted from the example on this page: https://www.mysensors.org/build/motion

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik Ekblad
     * 
     * DESCRIPTION
     * Motion Sensor example using HC-SR501 
     * http://www.mysensors.org/build/motion
     *
     */
    
    // Enable debug prints
    // #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #include <MySensors.h>
    
    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define CHILD_ID 1   // Id of the sensor child
    
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Motion Sensor", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID, S_MOTION);
    }
    
    void loop()     
    {     
      // Read digital motion value
      bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
    
      Serial.println(tripped);
      send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
    
      // Sleep until interrupt comes in on motion sensor. Send update every two minute.
      sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
    }```

  • Mod

    @toddsantoro something in the Arduino IDE is referencing libraries/TAS_motion_sensor. Do you have any idea what it could be? As AWI said, nothing should expect TAS_motion_sensor to be in the libraries folder.


  • Mod

    @toddsantoro where did you paste the example sketch? What is the file name and in which folder is that file? (use Sketch->Show sketch folder (ctrk/cmd+K) to locate it)



  • @mfalkvidd I removed everything I have done and started new so that is why you do not see that in the library's folder. I would like to know the exact steps no matter how trivial they are to setting up the sensors project. I am a web programmer and that may be my issue because I know how I would set things up but that does not mean thaty are correct in this situation.


  • Mod

    @toddsantoro the instructions are available at https://www.mysensors.org/about/arduino
    After installing the library you can open the examples from File->Examples->MySensors. There is no need to copy-paste from the build page (but that should work as well).



  • @mfalkvidd OK. I will give it a try. Thanks for your help and patience. I hope to automate my whole 417 sqft home and then help others to do the same.



  • @toddsantoro Actually I have read that and I am still in the dark. From the Arduino GUI I go FILE > NEW. COMMAND + S and save it where? It defaults to the Arduino folder on my machine with just Libraries directory in it. Do I create a SKETCHES folder and save the project there? I just don't know what to do???


  • Mod

    @toddsantoro save it in the suggested directory, next to (not inside) the libraries folder.



  • @mfalkvidd ok... what goes in the file? Copy paste from the example of do I somehow use the motion sensor library? I want to get a basic, best practices work flow going. Again thanks for your help.


  • Mod

    @toddsantoro170 using the example file without modification is usually the best way to start.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.