Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. alco
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    alco

    @alco

    1
    Reputation
    3
    Posts
    5
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    alco Follow

    Best posts made by alco

    • RE: Domoticz/Mysensors

      Hi
      Thanks. The good thing is that the light circuit is independent from Arduino and Raspberry. That was the main reason behind it. I was supposed to add a description but something went wrong and I only published the schematic. Anyway, I have got a problem with a script for this solution.
      Anybody can help with the programming?

      posted in Domoticz
      alco
      alco

    Latest posts made by alco

    • RE: Domoticz/Mysensors

      #define MY_DEBUG
      #define MY_GATEWAY_SERIAL

      // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
      #if F_CPU == 8000000L
      #define MY_BAUD_RATE 38400
      #endif

      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE

      // Inverses behavior of inclusion button (if using external pullup)
      //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP

      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN 3

      #include <SPI.h>
      #include <MySensors.h>
      #include <Bounce2.h>

      // Enable repeater functionality for this node
      #define MY_REPEATER_FEATURE

      #define RELAY_ON 1 // GPIO value to write to turn on attached relay
      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
      #define noLightSwitch 10 //2-11
      int relayPin[] = {2,3,4,5,6,7,8,9,10,11}; // switch around pins to your desire
      int buttonPin[] = {A0,A1,A2,A3,A4,A5,A6,A7,A8,A9}; // switch around pins to your desire
      Bounce debouncer[10];
      MyMessage msg[10];

      void before() {
      //sendHeartbeat();
      wait(100);
      // Initialize Relays with corresponding buttons
      for (int i = 0; i < noLightSwitch; i++){
      // Setup the button.
      pinMode(buttonPin[i], INPUT_PULLUP);
      wait(100);
      // Then set relay pins in output mode
      pinMode(relayPin[i], OUTPUT);
      wait(100);
      digitalWrite(relayPin[i], RELAY_OFF);
      msg[i].sensor = i; // initialize messages
      msg[i].type = V_LIGHT;
      //send(msg[i].set(loadState(i))); // make controller aware of last status
      //wait(100);
      // setup debouncer.
      debouncer[i] = Bounce(); // initialize debouncer
      debouncer[i].attach(buttonPin[i]);
      debouncer[i].interval(20);
      }
      }

      void setup() {
      // Setup locally attached sensors
      delay(100);
      presentation();
      }

      boolean inputState;
      void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Relay", "1.0");
      // Register all sensors to gw (they will be created as child devices)
      for (int i = 0; i < noLightSwitch; i++){
      present(buttonPin[i], S_LIGHT);
      inputState =! digitalRead(buttonPin[i]);
      send(msg[i].set(inputState));
      }
      wait(100);
      }

      void loop() {
      // Send locally attached sensor data here
      for (int i = 0; i < noLightSwitch; i++){
      if (debouncer[i].update()) {
      inputState =! digitalRead(buttonPin[i]);
      send(msg[i].set(inputState));
      }
      wait(100);
      }
      }

      void receive(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_LIGHT) {
      for (int i = 0; i < noLightSwitch; i++) {
      if (i == message.sensor){
      digitalWrite(relayPin[i], RELAY_ON);
      wait(100);
      digitalWrite(relayPin[i], RELAY_OFF);
      wait(100);
      inputState =! digitalRead(buttonPin[i]);
      send(msg[i].set(inputState));
      }
      }
      }
      }

      posted in Domoticz
      alco
      alco
    • RE: Domoticz/Mysensors

      Hi
      Thanks. The good thing is that the light circuit is independent from Arduino and Raspberry. That was the main reason behind it. I was supposed to add a description but something went wrong and I only published the schematic. Anyway, I have got a problem with a script for this solution.
      Anybody can help with the programming?

      posted in Domoticz
      alco
      alco
    • Domoticz/Mysensors

      IMG_1446.JPG

      posted in Domoticz
      alco
      alco