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. Help hacking a LED outdoor security light motion sensor

Help hacking a LED outdoor security light motion sensor

Scheduled Pinned Locked Moved Hardware
8 Posts 2 Posters 2.3k Views 2 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.
  • breimannB Offline
    breimannB Offline
    breimann
    wrote on last edited by
    #1

    Hi there, love this community! You all rock!

    My topic relates to an outdoor LED security light i'm trying to turn into a node on my MYS network.

    I have 3 of them, they have a 6v battery pack on them, a pretty standard motion sensor and a high intensity LED. Also a 7v 1W solar panel to charge the battery.

    I measured the voltage that the sensor sends to the LED and it's 3.95volts.

    My question is this:

    I'm hoping to put a Pro Mini 3.3volt 8MHz inside plus a 1 channel relay board plus NRF.

    BUT

    **If I just directly send the motion sensor triggered voltage of 3.95volts to a digital input pin on the Pro Mini, would it blow something up since it's more than 3.3volts??
    **
    Thanks!

    AWIA 1 Reply Last reply
    0
    • breimannB breimann

      Hi there, love this community! You all rock!

      My topic relates to an outdoor LED security light i'm trying to turn into a node on my MYS network.

      I have 3 of them, they have a 6v battery pack on them, a pretty standard motion sensor and a high intensity LED. Also a 7v 1W solar panel to charge the battery.

      I measured the voltage that the sensor sends to the LED and it's 3.95volts.

      My question is this:

      I'm hoping to put a Pro Mini 3.3volt 8MHz inside plus a 1 channel relay board plus NRF.

      BUT

      **If I just directly send the motion sensor triggered voltage of 3.95volts to a digital input pin on the Pro Mini, would it blow something up since it's more than 3.3volts??
      **
      Thanks!

      AWIA Offline
      AWIA Offline
      AWI
      Hero Member
      wrote on last edited by
      #2

      @breimann that would be a risk. I can think of a few other options. But to keep your line of thought : use a voltage divider or resistor with a 3v zener diode.

      breimannB 2 Replies Last reply
      0
      • AWIA AWI

        @breimann that would be a risk. I can think of a few other options. But to keep your line of thought : use a voltage divider or resistor with a 3v zener diode.

        breimannB Offline
        breimannB Offline
        breimann
        wrote on last edited by
        #3

        Thanks @AWI. Can you possibly send a little circuit diagram or a link to one like you are referring to?

        I was thinking of using an SMD 3.3v regulator but it seems like a bit of overkill and I'm trying to save on space as much as possible.

        1 Reply Last reply
        0
        • AWIA AWI

          @breimann that would be a risk. I can think of a few other options. But to keep your line of thought : use a voltage divider or resistor with a 3v zener diode.

          breimannB Offline
          breimannB Offline
          breimann
          wrote on last edited by
          #4

          @AWI do you mean something like this?

          0_1479280272876_resister and zener divider.png

          where the 5v input is my 3.95v and I replace the zener with a 3v zener instead?

          If that's right, could you help me with calculating the value of the resister and the exact specs for the zener please?

          Thanks in advance.

          AWIA 1 Reply Last reply
          0
          • breimannB breimann

            @AWI do you mean something like this?

            0_1479280272876_resister and zener divider.png

            where the 5v input is my 3.95v and I replace the zener with a 3v zener instead?

            If that's right, could you help me with calculating the value of the resister and the exact specs for the zener please?

            Thanks in advance.

            AWIA Offline
            AWIA Offline
            AWI
            Hero Member
            wrote on last edited by
            #5

            @breimann That is exactly what I meant ;-) You can use any zener (3.3V is fine also) and the value of 10kohm for the resistor is ok.

            Another solution would be to just use a 5v pro-mini.

            breimannB 1 Reply Last reply
            0
            • AWIA AWI

              @breimann That is exactly what I meant ;-) You can use any zener (3.3V is fine also) and the value of 10kohm for the resistor is ok.

              Another solution would be to just use a 5v pro-mini.

              breimannB Offline
              breimannB Offline
              breimann
              wrote on last edited by
              #6

              @AWI thanks a lot for this advice. very helpful.

              I could use a 5v pro mini, true, but wouldn't the power consumption be more?

              I also don't have any, just 3.3v ones, 8mhz.

              AWIA breimannB 2 Replies Last reply
              0
              • breimannB breimann

                @AWI thanks a lot for this advice. very helpful.

                I could use a 5v pro mini, true, but wouldn't the power consumption be more?

                I also don't have any, just 3.3v ones, 8mhz.

                AWIA Offline
                AWIA Offline
                AWI
                Hero Member
                wrote on last edited by
                #7

                @breimann The power consumption of (a non modified) 5v pro mini, is only a little higher. Looking at your setup you should have some power left.
                But then again, if you have only 3.3v ones available.. go for the zener solution.

                1 Reply Last reply
                0
                • breimannB breimann

                  @AWI thanks a lot for this advice. very helpful.

                  I could use a 5v pro mini, true, but wouldn't the power consumption be more?

                  I also don't have any, just 3.3v ones, 8mhz.

                  breimannB Offline
                  breimannB Offline
                  breimann
                  wrote on last edited by
                  #8

                  @AWI i've since done some more work on this and discovered the switched 3.95v didn't share a common ground with the rest of the circuit. So i ended up hooking up a DIL reed relay PRMA 0105 (5v) onto it, and used the relay contacts to connect to pin D3 on my nano.

                  So i've got it operating that whenever the motion sensor is tripped it toggles my 1 channel relay board, but what isn't working is being able to manually switch it from in domoticz.

                  Would someone be able to take a look at my code which i've taken from this thread

                  My code is:

                  /*
                  DESCRIPTION
                  Sketch for 1x relay with buttons bistable. After back power all relays set OFF and send correct status OFF to controller.
                  */

                  // Enable debug prints to serial monitor
                  #define MY_DEBUG

                  // Enable and select radio type attached
                  #define MY_RADIO_NRF24
                  //#define MY_RADIO_RFM69

                  // Enabled repeater feature for this node
                  #define MY_REPEATER_FEATURE

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

                  // Define Relays
                  #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 Sensor ID's
                  #define SSR_A_ID 1 // Id of the sensor child

                  // Define buttons and relays
                  const int buttonPinA = 3;
                  const int relayPinA = 4;

                  // Define Variables
                  int oldValueA = 0;
                  bool stateA = false;
                  int trigger = 0;

                  Bounce debouncerA = Bounce();

                  MyMessage msgA(SSR_A_ID, V_STATUS);

                  void setup()
                  {

                  pinMode(buttonPinA, INPUT_PULLUP); // Setup the button Activate internal pull-up

                  // After setting up the buttons, setup debouncer
                  debouncerA.attach(buttonPinA);
                  debouncerA.interval(5);

                  // Make sure relays are off when starting up
                  digitalWrite(relayPinA, RELAY_OFF);
                  // Then set relay pins in output mode
                  pinMode(relayPinA, OUTPUT);

                  /*--------------------- Added these lines for toggle switch-------------------------*/
                  

                  oldValueA = digitalRead(buttonPinA); // set oldValueA to the current status of the toggle switch
                  // send(msgA.set(false)); // Send off state for relayA to ensure controller knows the switch is off
                  // send(msgB.set(false)); // Send off state for relayB to ensure controller knows the switch is off

                  }

                  void presentation() {
                  // Send the sketch version information to the gateway and Controller
                  sendSketchInfo("Relay with Bistable", "1.1");

                  // Register all sensors to gw (they will be created as child devices)
                  present(SSR_A_ID, S_LIGHT);

                  }

                  /*
                  Example on how to asynchronously check for new messages from gw
                  */
                  void loop()
                  {
                  if (trigger == 0){
                  send(msgA.set(false)); // Send off state for relayA to ensure controller knows the switch is off
                  trigger = 1;
                  }

                  debouncerA.update();
                  // Get the update value
                  int valueA = debouncerA.read();
                  if (valueA != oldValueA) {
                  // send(msgA.set(stateA ? false : true), true); // Send new state and request ack back
                  send(msgA.set(stateA ? false : true), false); // Send new state with no request for ack
                  stateA = stateA ? false : true; // invert the state
                  digitalWrite(relayPinA, stateA ? RELAY_ON : RELAY_OFF); // toggle the relay
                  oldValueA = valueA;
                  }

                  }

                  void receive(const MyMessage &message) {
                  // We only expect one type of message from controller. But we better check anyway.
                  if (message.type == V_STATUS) {

                  switch (message.sensor) {
                    case 1:
                      stateA = message.getBool();
                      digitalWrite(message.sensor + 4, stateA ? RELAY_ON : RELAY_OFF);
                      
                      break;
                    case 2:
                  
                      break;
                  }
                  
                    // Write some debug info
                  Serial.print("Incoming change for sensor:");
                  Serial.println(message.sensor);
                  Serial.print("from node:");
                  Serial.println(message.sender);
                  Serial.print(", New status: ");
                  Serial.println(message.getBool());
                  

                  }
                  }

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


                  14

                  Online

                  11.7k

                  Users

                  11.2k

                  Topics

                  113.1k

                  Posts


                  Copyright 2025 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