Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Newbie needs help

Newbie needs help

Scheduled Pinned Locked Moved Hardware
7 Posts 4 Posters 1.7k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • masterkenobiM Offline
    masterkenobiM Offline
    masterkenobi
    wrote on last edited by
    #1

    Hi,

    I just started on mysensors and I have zero knowledge in electronics.

    I want to create some sensor nodes using arduino pro mini.

    However i have few doubts. Hope someone can help a newbie.

    1. I can see only one VCC pin (excluding the one on programming header which i would like keep it for uploading sketches in future). How do I connect my radio and sensor? Shouldn't it be at least 2 VCC pins? Or can I fit in 2 wires into the same VCC pin?

    2. I'm powering the sensor node with 2 AA batteries. The negative terminal goes to ground. What about the positive terminal? Does is goes to RAW?

    I'm sorry for the silly questions.

    mfalkviddM 1 Reply Last reply
    0
    • masterkenobiM masterkenobi

      Hi,

      I just started on mysensors and I have zero knowledge in electronics.

      I want to create some sensor nodes using arduino pro mini.

      However i have few doubts. Hope someone can help a newbie.

      1. I can see only one VCC pin (excluding the one on programming header which i would like keep it for uploading sketches in future). How do I connect my radio and sensor? Shouldn't it be at least 2 VCC pins? Or can I fit in 2 wires into the same VCC pin?

      2. I'm powering the sensor node with 2 AA batteries. The negative terminal goes to ground. What about the positive terminal? Does is goes to RAW?

      I'm sorry for the silly questions.

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      Welcome @masterkenobi !

      1: You can connect as many things as you like to the vcc pin. A breakout board is very handy when prototyping to make it easy to connect many things to the same pin.

      2: it depends. Search for 2xAA in the forum and you'll find lots of discussions. But to get started connect + on the batteries to Vcc.

      masterkenobiM 1 Reply Last reply
      2
      • mfalkviddM mfalkvidd

        Welcome @masterkenobi !

        1: You can connect as many things as you like to the vcc pin. A breakout board is very handy when prototyping to make it easy to connect many things to the same pin.

        2: it depends. Search for 2xAA in the forum and you'll find lots of discussions. But to get started connect + on the batteries to Vcc.

        masterkenobiM Offline
        masterkenobiM Offline
        masterkenobi
        wrote on last edited by
        #3

        @mfalkvidd thanks.

        I manage to build a couple of sensors powered by 2 AA batteries.

        However I'm stuck at monitoring the battery level.

        After I uploaded BatteryPoweredSensor.ino to my board, it overwrote the sensor sketch I uploaded earlier.

        Do I have to merge both sketches into one before upload?

        1 Reply Last reply
        0
        • Boots33B Offline
          Boots33B Offline
          Boots33
          Hero Member
          wrote on last edited by
          #4

          Yes each time you upload a sketch it replaces the one that is already there.

          masterkenobiM 1 Reply Last reply
          0
          • D Offline
            D Offline
            danivalencia
            wrote on last edited by
            #5

            Here you have a sample of one of my battery nodes. Now I'm using V2.0 of Library, but this used to work before updating

            #include <MySensor.h>  
            #include <SPI.h>
            #include <BH1750.h>
            
            #define SN "SensorLuz"
            #define SV "1.0"
            unsigned long SLEEP_TIME = 300000; // 5 minutos
            #define CHILD_ID_LIGHT 0
            #define NODE_ID 7
            
            #define VBAT_PER_BITS 0.003363075  
            #define VMIN 1.9                                  //  Vmin (radio Min Volt)=1.9V (564v)
            #define VMAX 3.0                                  //  Vmax = (2xAA bat)=3.0V (892v)
            int batteryPcnt = 0;                              // Calc value for battery %
            int batLoop = 0;                                  // Loop to help calc average
            int BATTERY_SENSE_PIN = A0; 
            
            MySensor gw;
            BH1750 lightSensor;
            
            uint16_t lastlux;
            
            MyMessage msgLux(CHILD_ID_LIGHT, V_LEVEL);
            MyMessage msgLuxUnit(CHILD_ID_LIGHT, V_UNIT_PREFIX);
            
            void setup()  
            {  
               analogReference(INTERNAL);
            
              gw.begin(NULL, NODE_ID);
              lightSensor.begin();
              gw.sendSketchInfo(SN, SV);
              gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
              gw.send(msgLuxUnit.set("lux"));
            
            }
            
            void loop()     
            {     
            
              uint16_t lux = lightSensor.readLightLevel();
              Serial.print("Lux: ");
              Serial.println(lux);
              if (lux != lastlux) {
                  gw.send(msgLux.set(lux));
                  lastlux = lux;
              }
              batM();
              
              gw.sleep(SLEEP_TIME);
            }
            
            void batM() //The battery calculations
            {
               delay(500);
               int sensorValue = analogRead(BATTERY_SENSE_PIN);    
               delay(500);
               
               float Vbat  = sensorValue * VBAT_PER_BITS;
               int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
               //Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");  
               
              
               if (batLoop > 24) {  //24 ciclos de 5 min = 2h.
                 gw.sendBatteryLevel(batteryPcnt);
                 batLoop = 0;
               }
               else 
               {
               batLoop++;
               }
            }
            
            1 Reply Last reply
            0
            • Boots33B Boots33

              Yes each time you upload a sketch it replaces the one that is already there.

              masterkenobiM Offline
              masterkenobiM Offline
              masterkenobi
              wrote on last edited by
              #6

              @Boots33 said:

              Yes each time you upload a sketch it replaces the one that is already there.

              Thanks.

              @danivalencia said:

              Here you have a sample of one of my battery nodes. Now I'm using V2.0 of Library, but this used to work before updating

              Thanks.

              There is also another thing concern me. What if my neighbor also into Mysensors? Will he be able to view all the data from my sensors? How do I secure the nodes?

              D 1 Reply Last reply
              0
              • masterkenobiM masterkenobi

                @Boots33 said:

                Yes each time you upload a sketch it replaces the one that is already there.

                Thanks.

                @danivalencia said:

                Here you have a sample of one of my battery nodes. Now I'm using V2.0 of Library, but this used to work before updating

                Thanks.

                There is also another thing concern me. What if my neighbor also into Mysensors? Will he be able to view all the data from my sensors? How do I secure the nodes?

                D Offline
                D Offline
                danivalencia
                wrote on last edited by
                #7

                @masterkenobi said:

                There is also another thing concern me. What if my neighbor also into Mysensors? Will he be able to view all the data from my sensors? How do I secure the nodes?

                Take a look at https://forum.mysensors.org/topic/1021/security-introducing-signing-support-to-mysensors

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                12

                Online

                11.7k

                Users

                11.2k

                Topics

                113.0k

                Posts


                Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • MySensors
                • OpenHardware.io
                • Categories
                • Recent
                • Tags
                • Popular