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
nielsokkerN

nielsokker

@nielsokker
About
Posts
24
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Show Real-time IMU data from four nodes
    nielsokkerN nielsokker

    Ah, thank you for your response! I am gonna take a look at it.

    I made pymys work for version 2.0, just some minor adjustments. I made it work with flask and socket.io, (will post some code and links later, dont have much time now). It display exactly what i want on a webpage and it is pretty real-time.

    The only problem i am facing is that it will not automatically start at boot. I tried every possible solution as far as i know, but i just cant get it running properly. It will start, but will get the error that the bytes are not right(startbyte not right, continuation byte not right). It is so weird that when i start it by hand, it will do fine.

    Does someone have a solution? in the meantime i will try the controller mentioned above.

    Troubleshooting

  • Show Real-time IMU data from four nodes
    nielsokkerN nielsokker

    I will!

    Restored my RPI today. I am going to use pyMYS. Only need something to display it.

    Will keep you guys informed!

    Troubleshooting

  • Show Real-time IMU data from four nodes
    nielsokkerN nielsokker

    Hmm, after looking at it. It seems a big "overkill" for my intentions. What do you guys think about pyMYS. Maybe that will do the job?

    Troubleshooting

  • Show Real-time IMU data from four nodes
    nielsokkerN nielsokker

    @Yveaux and @TheoL,

    Thanks for your help,

    I am going to use this. Exactly what i need!

    Troubleshooting

  • Show Real-time IMU data from four nodes
    nielsokkerN nielsokker

    Hey guys,

    After successfully using domoticz and MySensors to automate my house, i have a new project.

    I want to show data from four nodes on a controller. All four nodes only have an IMU. I got all of the nodes working and they are sending data (pitch and roll) with 4hz. I want to display this data real-time. Currently i tried domoticz but it doesnt refresh enough and i cant get a right datatype.

    Does anyone know a controller that fits my project, or maybe another approach?

    Looking forward to your answers!

    Thanks in advance, Niels

    Troubleshooting

  • How do I turn a Pin to HIGH from controller?
    nielsokkerN nielsokker

    There is an example that exactly gives you what you need. The Relay example is the structure of what you need to use.

    Troubleshooting

  • What is wrong with this sketch?
    nielsokkerN nielsokker

    @Cliff-Karlsson said:

    I tried again with your sketch @nielsokker , I think I only added some sleep. But the motion-sensor just turns on/off super-quick every time the motion triggers. What am I doing wrong ?

    Yea, my example just checks both sensors every second. So it sends both values every second. I know now that is not what you want. At least the code looks better in my opinion (ofc its my code :) ).

    I have to agree with @AWI that it seems like your sensor does not work properly.

    Troubleshooting

  • What is wrong with this sketch?
    nielsokkerN nielsokker

    @Cliff-Karlsson

    I see why. But once again, i think i made your sketch work.

    As i see it. This is the current desired logic.

    once per second, you want to check the following things:

    • is there motion?
    • has there been a change in pressure (HIGH to LOW or LOW to HIGH)?

    But actually you want to check both ALWAYS. The thing you are obviously looking for, are interrupts. I do not know how these work if you do not want to sleep. Maybe there is a wait(interrupt_pin_1_functor, interrupt_pin_2_functor, waittime=forever) function (I know the sleep() version exists).

    Maybe you already know what interrupts are but, in short: When a given interrupt pin notices a difference in value (HIGH to LOW, for example) it gives a signal. The current code is being stopped and the function that is bound to the pin is executed. This function could be sending the new value to the gateway.

    Can someone confirm this?

    Troubleshooting

  • What is wrong with this sketch?
    nielsokkerN nielsokker

    @Cliff-Karlsson

    I dont really understand what you mean. You want it to send its value every second? In that case my attempt still works. You want to use interrupts?

    Troubleshooting

  • What is wrong with this sketch?
    nielsokkerN nielsokker

    @nielsokker

    I see it does not compile. You have to change the define.

    
    #define FSR_Pin = A0; //analog pin 0 needs to be
    

    needs to be

    
    #define FSR_Pin  A0 //analog pin 0 needs to be
    
    Troubleshooting

  • What is wrong with this sketch?
    nielsokkerN nielsokker
    #define MY_DEBUG    // Enables debug messages in the serial log
    #define MY_RADIO_RFM69
    
    #include <SPI.h>
    #include <MySensors.h>
    
    #define MY_REPEATER_FEATURE  // Enables repeater functionality for a radio node
    
    
    #define PRESSURE_ID 1
    #define MOTION_ID 2   // Id of the sensor child
    
    
    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 FSR_Pin = A0; //analog pin 0
    
    int value = 0; // change this to a signed  or unsigned thingy
    int oldvalue = 0; // change this to a signed  or unsigned thingy
    
    #define OPEN 0
    #define CLOSE 1
    
    boolean lastTripped = 0;
    MyMessage msgPressure(PRESSURE_ID, V_TRIPPED);
    MyMessage msgMotion(MOTION_ID, V_TRIPPED);
    
    void setup()
    {
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as inputa
    }
    
    void presentation()
    {
      sendSketchInfo("Pressure/Motion Sensor", "1.0");
      present(PRESSURE_ID, S_DOOR);
      present(MOTION_ID, S_MOTION);
    }
    
    void loop()
    {
      int FSRReading = analogRead(FSR_Pin);
      if (FSRReading > 150)
      {
        value = CLOSE;
      }
      else
      {
        value = OPEN;
      }
      // Read digital motion value
      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR);
    
      if (lastTripped != tripped) // if only the tripped has changed
      {
        //Serial.println(tripped);
        send(msgMotion.set(tripped ? "1" : "0")); // Send tripped value to gw
        lastTripped = tripped;
      }
      if (value != oldvalue)
      {
        send(msgPressure.set(value ? "1" : "0"));
        oldvalue = value;
      }
      wait(SLEEP_TIME);
    }
    

    I changed the loop part. I had a lot of double code which did not do anything. I changed some ints to defines because they did not change ever. I changed sleep to wait since it is a repeater (they cannot sleep). Also. After every round you want to sleep, so why not just write it once instead of in every if statement.

    I hope this helps you.

    Troubleshooting

  • What is wrong with this sketch?
    nielsokkerN nielsokker

    I am trying to debug it. I will let you know in a second.

    Troubleshooting

  • Mqtt-client-gateway / nodes do not get an id
    nielsokkerN nielsokker

    Oh sorry I see it now. In that case good luck ;)

    I am going to take a look at the API to see if something is there.

    Troubleshooting

  • Problems with first sensors
    nielsokkerN nielsokker

    @blebbens

    The old define, might become useless, but it wont be in the way either. It is your choice.

    Troubleshooting

  • Mqtt-client-gateway / nodes do not get an id
    nielsokkerN nielsokker

    @Thomas-Augustinus

    I'm not 100 percent sure, but i think that the controller tells the nodes what id they have. Right now you do not have this. To solve this: set a static ID (see 2.0 API) or attach a controller.

    Troubleshooting

  • Problems with first sensors
    nielsokkerN nielsokker

    @Tore-André-Rosander said:

    define child id"

    I think so too.

    These are probably just minor mistakes, changing from MySensors versions.

    Troubleshooting

  • Problems with first sensors
    nielsokkerN nielsokker

    @SGi

    I am not an expert but i had the same problem. I think a controller determines the id. But since you have none, it can't be done this way. Set a static ID with

    #define MY_NODE_ID 11 
    

    or something

    Troubleshooting

  • Programming
    nielsokkerN nielsokker

    I can only give you my personal advice.

    Since you're on this forum, I expect that you are interested in sensors and stuff. In that case. Download this library and look at the examples. Try to understand them and try to adjust them slightly.

    But, maybe it is a better idea to google "c++ tutorial". Arduino is C++ based. And this will definitely teach you the basics of the language.

    Last, try to look at the Arduino website.

    General Discussion

  • Converting a sketch from 1.5.x to 2.0.x
    nielsokkerN nielsokker

    @pascalgauthier

    I'm not sure. I think the developers will know.

    Announcements

  • Converting a sketch from 1.5.x to 2.0.x
    nielsokkerN nielsokker

    @pascalgauthier

    I think the function "wait()" might be useful. It is like a sleep, but now it calls "process()"

    Announcements
  • Login

  • Don't have an account? Register

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