MySensored 230v motion sensor with light level


  • Hero Member

    I have been searching for a nice enclosure to use with some motion sensors but nothing was to my satisfactory. So I started to look at different motion sensors to see if I could find something I could modify. I found this one at my local electronics shop. Both looks and prize was right so I picked one up.

    I cut the Live copper strip to the relay and removed the wire that would normally go to the lamp and removed 2 capacitors (marked with red and green), soldered 2 wires to were a capacitor had been to access the relay contacts (marked with green).
    WP_20141126_001.jpg

    Destroid one of them 90 cent iPhone charger clones to get a 5v power supply added a Pro Mini with radio and a LM393 photo resistor.
    Connected the relay contacts to GND and a binary in on the arduino and the photo transistor to a analog in.
    WP_20141126_003.jpg

    Here is the result:
    WP_20141126_006.jpg

    And here is the sketch:

    Have not attached it to the ceiling yet just had it on the floor for testing, motion sensor works great but I'm not sure if the light sensor will be sensitive enough.

    Think I'm going to add a 2A glas fuse to it because of the cheep 5v power just in case.


  • Hero Member

    @korttoma

    No way to use the on board power for the Arduino?


  • Hero Member

    Good example you to work with 230 Volts relatively safe without too much effort!

    No way to use the on board power for the Arduino?

    Yes that should be possible but maybe less safe.


  • Hero Member

    Finally had time to mount this thing to it's final location and as I feared the light sensor is not sensitive enough. Does anyone have a suggestion of a light sensor that has high sensitivity at low light levels?


  • Hardware Contributor

    @korttoma have you tried using a ldr-resistor on an analog input?


  • Hero Member

    I found an LDR at my local store that is 24 kohm - 1 Mohm acording to simulation it will give me 100mV - 2,3V on A0 with R1 at 20kohm. Could this work better then the LM393 Light Sensor I'm using now?

    LDR.jpg


  • Hero Member

    So I replaced the LM393 Light Sensor with an LDR according to the previous picture.

    I had to make a small change to the sketch since the reading was inverted. High value at low light and vice versa:

    Replaced:

    int lightLevel = 1023 - analogRead(LIGHT_SENSOR_ANALOG_PIN);
    

    with:

    int lightLevel = analogRead(LIGHT_SENSOR_ANALOG_PIN);
    

    I now get way better sensitivity at low light level, I'm happy :D

    Now to PLEG some lights according to Light level in Vera.


  • Contest Winner

    Be careful using cheap Chinese iPhone charger clones. They are definitely not safe to use: http://www.righto.com/2012/03/inside-cheap-phone-charger-and-why-you.html


  • Hero Member

    @Anticimex Yeah, I know. This is why I added a small glass fuse to the 230v of it all. I hope this will be sufficient if something does go wrong.


  • Contest Winner

    @korttoma Yes, that's a good ide. Just wanted to mention it in case someone decides to read partial parts and go ahead and do "crazy stuff". You would not believe what people do given a little encouragement :)

    I plan to, at some point, do a bit checkup on the availablility of AC/DC converters, "battery eliminators" that could be suitable with respect to cost, but most of all, efficiency. Not nice to have something that goes too warm and waste energy for powering a device that itself draws next to nothing :)



  • @korttoma Very interesting project. Nice work! I'm just curious does it dim the lights in response to varying ambient light levels or is it a ON/OFF setup?


  • Hero Member

    @jeylites At the moment I turn on a light from the motion detected but only if the light level is under a certain limit. My plan is to adjust the light level in the room according to the sensor but for this I will need another dimmer device for the main light in the room.

    The device from this thread only sends motion and light level to my main controller (Vera) where the logic for light control is done by using a plugin called PLEG.



  • @korttoma Nice!

    That will be great to have the the lights dim in response to varying ambient sensor light levels. I'm still researching on AC triac based PWM dimming which I'm planning to use My Sensor LED Dimmer run it.

    !AC-board-schematic.jpg electronique_interface_230V_001.gif


  • Hero Member

    @korttoma You will need a light level sensor or LDR to do such thing.. You can find them in the store



  • Cool, I tried do do "crazy stuff" on this one, without encouragement...
    https://www.mrosupply.com/electrical/signaling-visual-audio/2487583_21104634000_pfannenberg-inc/



  • @korttoma love this and works great! But is there any way to remove the relay from the equation so you don't get that clicking noise each time the sensor goes off?

    Thanks!


  • Hero Member

    Hi @Cameron-Payne I'm not sure how to replace the relay in a safe way but maybe an optocoupler could do the trick if you can find one that can handle 230VAC.


Log in to reply
 

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