Skip to content

My Project

Show off and share your great projects here! We love pictures!
964 Topics 13.5k Posts
  • My simple and minimalistic calculator with only two buttons

    lcd arduino attiny85
    2
    2 Votes
    2 Posts
    1k Views
    mfalkviddM
    Nice work! Reminds me of this great short story by Isaac Asimov from 1958.
  • Parking Sensor Node

    5
    3 Votes
    5 Posts
    3k Views
    Boots33B
    Updated the sketch for MySensors V2 and am now using the Adafruit Neopixel library /** ******************************* * * DESCRIPTION * A node to indicate correct parking position to allow closing of garage door. * uses a pre built IR beam "door minder" to detect car position *MySensors V2 and using Adafruit neopixel library and bounce2 library * Connect N/O contacts of Infrared device between * pin 3 and GND. * * Connect a N/O reed switch between GND and pin 2 * * Connect RGB Led strip data terminal to pin 4 * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 #include "MySensors.h" #include <SPI.h> #include <Bounce2.h> #include <Adafruit_NeoPixel.h> #define NUM_LEDS 18 // How many leds are in the strip? change this to the number of LEDs in your strip #define PIN 4 // Data pin that led data will be written out over #define CHILD_ID 0 // door switch MySensors id number #define IR_PIN 3 // Arduino Digital I/O pin for infrared device #define DOOR_PIN 2 // pin garage door switch is connected to int marker = 0; // used to decide if LEDs are allowed to turn white int irValue ; // holder for ir state int doorValue ; // holder for garage door state int oldDoorValue=-1; //set to -1 to ensure current door switch status is sent at startup unsigned long startMillis = 0; // holder for the time when garage door first opens unsigned long millisNow = 0; // holder for the current time const long activeTime = 120000; // Time the sensor will stay active after garage door is opened in milliseconds. change this to suit your situation Bounce debouncerA = Bounce(); // Instantiate Bounce object 1.... iR switch Bounce debouncerB = Bounce(); // Instantiate Bounce object 2.... Garage Door switch MyMessage msg(CHILD_ID,V_TRIPPED); // Parameter 1 = number of pixels in strip // Parameter 2 = Arduino pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800); void setup() { /* ----Setup the buttons as inputs and activate their internal pull-up resistor---- */ pinMode(IR_PIN,INPUT_PULLUP); //set pin as input and activate internal pull-up resistor pinMode(DOOR_PIN,INPUT_PULLUP); //set pin as input and activate internal pull-up resistor /* ---After setting up the buttons, setup debouncers---- */ debouncerA.attach(IR_PIN); debouncerA.interval(5); debouncerB.attach(DOOR_PIN); debouncerB.interval(5); strip.begin(); strip.show(); // Initialize all pixels to 'off' } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Park Sensor", "2.0"); // Register all sensors to gateway (they will be created as child devices) present(CHILD_ID, S_DOOR); // Register binary input sensor to gw } void loop() { updateSwitches(); // call function to check switches status millisNow = millis(); // get the current time if (millisNow - startMillis < activeTime){ // check to see if timeout has been reached if (doorValue == HIGH ) { // garage door is open if (irValue == LOW ) { // car is in ir beam ledChange(strip.Color(255, 0, 0)); // car is blocking ir beam,turn LEDs red } else{ ledChange(strip.Color(0, 255, 0)); // car is out of ir beam, turn LEDs green } } else{ if (marker == 1){ ledChange(strip.Color(127, 127, 127)); // door down but timer not finished. turn leds white for entry mode } } } else { // Timeout has been reached. Turn off LEDs if (marker == 1){ // check marker to only turn off if needed ledChange(strip.Color(0, 0, 0)); // turn off leds (black) marker = 0; } } } /* --------------start of functions-------------- */ /* --Update the switches status, send door state change if required -- */ void updateSwitches (){ debouncerA.update(); // IR switch debouncerB.update(); // Door switch irValue = debouncerA.read(); // get the state of the IR switch doorValue = debouncerB.read(); // get the state of the Door switch if (doorValue != oldDoorValue) { // Check if digital input has changed and send in new value if it has send(msg.set(doorValue==HIGH ? 1 : 0)); // Send in the new value if (doorValue == HIGH){ // door is open startMillis = millis(); // store start time of door opening for timeout check marker = 1; } oldDoorValue = doorValue; } } /* ----------function to change LED color------------*/ void ledChange(uint32_t c) { for(uint16_t i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, c); } strip.show(); }
  • Retrofit sensors into 240v LED Night Light : Help a novice?

    7
    0 Votes
    7 Posts
    2k Views
    SuperKrisS
    The kind of "PSU" thats is in that night light is not ideal for a mysensors application. I suggest you use this one: https://www.domoticz.com/forum/viewtopic.php?f=42&t=7832 I think using the housing is a good idea, but please throw away those electronics. Here in the netherlands we have a cheap ass store called "Action" where they sell those 433mhz controlled remote plug in switches. You get 3 of them + a remote control for just € 10,-. I think they can be a pretty good housing too.
  • Update from 1.41 to 2.0?

    5
    0 Votes
    5 Posts
    2k Views
    Dan S.D
    @tekka Thanks! Exactly what I needed
  • Curent sensor/power with 2xcts013-30 + light + temperature

    1
    0 Votes
    1 Posts
    894 Views
    No one has replied
  • How To: 2 Door Chime Automation Hack (Thanks @petewill)

    9
    3 Votes
    9 Posts
    10k Views
    D
    Update 17-July-2016 Sensor v2.2 MySensors 2.0 Update I have updated the code in the latest post for the release of MySensors 2.0! Not much has changed, just the calls. All of the same functionality is kept. Since MySensors 2.0 does not include any external libraries, you will need to manually add the debounce 2 library to your Arduino IDE/MySensors2 setup. The official GitHub repo is located here. Install it the same as any Arduino Library. Any comments or questions please ask. V2.2 Sketch: /* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 2.2 - Removed MySensors 1.5 code and replaced with MySensors 2.0 * Version 2.1 - Derrick Rockwell (Drock1985) * - Complete Re-write of code to provide better flow/structure. * Version 2.0 - ResentedPoet * * Based on original concept/code by @petewill for 1 Door bell chime. See original thread * http://forum.mysensors.org/topic/2064/how-to-doorbell-automation-hack * This sketch is used to control a front and back doorbell ring with relays as well as send an * alert when the buttons are pressed. For front door, Connect the button to ground and digital * pin 3. The relay controlling the doorbell is conntected to pin 4. For rear door bell * connect second button to ground and digital pin 5. The relay controlling that pin goes * to pin 6. */ // Enable debug prints // #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 2 //or use AUTO to have your home controller assign it for you. #define MY_REPEATER_FEATURE // Enabled repeater feature for this node. Comment out if you do not want repeater function #include <MySensors.h> #include <SPI.h> #include <Bounce2.h> #define FRONT_DOOR_BUTTON 3 // Arduino Digital I/O pin number for the front doorbell button #define FRONT_CHIME_RELAY 4 // Aduino Digital I/O pin number for the front door chime relay #define CHILD_ID_FRONT 0 // Child ID for the front doorbell sensor #define BACK_DOOR_BUTTON 5 // Arduino Digital I/O pin number for the back doorbell button #define BACK_CHIME_RELAY 6 // Aduino Digital I/O pin number for the back door chime relay #define CHILD_ID_BACK 1 // Child ID for the back doorbell sensor #define CHILD_ID_MUTE 2 // Child ID for the mute option #define CHIME_MUTE_STATE // Used to hold value of door chime mute funtion. #define CHIME_OFF 0 // Variable to define ring the chime #define CHIME_ON 1 #define FRONT_CHIME_RELAY_ON LOW // Variable for front chime. Reverse low/high if relay pin set different #define FRONT_CHIME_RELAY_OFF HIGH // Variable for front chime. Reverse low/high if relay pin set different #define BACK_CHIME_RELAY_ON LOW // Variable for front chime. Reverse low/high if relay pin set different #define BACK_CHIME_RELAY_OFF HIGH // Variable for front chime. Reverse low/high if relay pin set different Bounce debouncerF = Bounce(); Bounce debouncerB = Bounce(); boolean CHIME_MUTE = 1; MyMessage msg(CHILD_ID_MUTE, CHIME_MUTE); MyMessage frontDoorbell(CHILD_ID_FRONT, V_TRIPPED); MyMessage backDoorbell(CHILD_ID_BACK, V_TRIPPED); MyMessage chimeMute(CHILD_ID_MUTE, V_LIGHT); int pestTimeout = 4000; // Delay between registered button presses. Stops button mashers ;) Set to whatever delay you want. unsigned long previousMillis=0; // Tracks time since last door chime button press void setup() { // Setup the button and activate internal pull-up pinMode(FRONT_DOOR_BUTTON, INPUT); pinMode(BACK_DOOR_BUTTON, INPUT); digitalWrite(FRONT_DOOR_BUTTON, HIGH); digitalWrite(BACK_DOOR_BUTTON, HIGH); // After setting up the button, setup debouncer debouncerF.attach(FRONT_DOOR_BUTTON); debouncerB.attach(BACK_DOOR_BUTTON); debouncerF.interval(5); debouncerB.interval(5); // Make sure relays are off when starting up digitalWrite(FRONT_CHIME_RELAY, FRONT_CHIME_RELAY_OFF); digitalWrite(BACK_CHIME_RELAY, BACK_CHIME_RELAY_OFF); // Then set relay pins in output mode pinMode(FRONT_CHIME_RELAY, OUTPUT); pinMode(BACK_CHIME_RELAY, OUTPUT); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("2 Door Chime Sensor", "2.2"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_FRONT, S_MOTION); present(CHILD_ID_BACK, S_MOTION); present(CHILD_ID_MUTE, S_LIGHT); send(chimeMute.set(1)); } void loop() { unsigned long currentMillis = millis(); debouncerF.update(); debouncerB.update(); int valueF = debouncerF.read(); int valueB = debouncerB.read(); //Front Doorbell if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueF != HIGH && CHIME_MUTE == 1) { digitalWrite(FRONT_CHIME_RELAY, FRONT_CHIME_RELAY_ON); send(frontDoorbell.set(1)); wait(50); digitalWrite(FRONT_CHIME_RELAY, FRONT_CHIME_RELAY_OFF); send(frontDoorbell.set(0)); previousMillis = currentMillis; } if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueF != HIGH && CHIME_MUTE == 0) { send(frontDoorbell.set(1)); wait(50);; send(frontDoorbell.set(0)); previousMillis = currentMillis; } //Back Doorbell if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueB != HIGH && CHIME_MUTE == 1) { digitalWrite(BACK_CHIME_RELAY, BACK_CHIME_RELAY_ON); send(backDoorbell.set(1)); wait(450); digitalWrite(BACK_CHIME_RELAY, BACK_CHIME_RELAY_OFF); send(backDoorbell.set(0)); previousMillis = currentMillis; } if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueB != HIGH && CHIME_MUTE == 0) { send(backDoorbell.set(1)); wait(50); send(backDoorbell.set(0)); previousMillis = currentMillis; } } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.isAck()) { Serial.println("This is an ack from gateway"); } if (message.type == V_LIGHT) { // Change relay state CHIME_MUTE = message.getBool(); send(msg.set(CHILD_ID_MUTE, CHIME_MUTE?CHIME_ON:CHIME_OFF)); // Store state in eeprom saveState(CHILD_ID_MUTE, CHIME_MUTE); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
  • Battery operated Lux Sensor

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • 2xAA powered PIR

    2
    4 Votes
    2 Posts
    1k Views
    alexsh1A
    [image: 1467975977974-2016-07-08-11.51.06.jpg]
  • My 1AA battery sensor

    prototype powered battery low
    23
    4 Votes
    23 Posts
    24k Views
    jsiddallJ
    Looks like it has been a year or two now. Is it still going on the original battery?
  • Li-Ion current clamp sensor

    2
    0 Votes
    2 Posts
    1k Views
    thazlett144T
    Did you get anywhere with this in the end? This is something I would like to do also!
  • Energy pulse meter + outside temperature

    temp energy pulse me
    13
    5 Votes
    13 Posts
    12k Views
    M
    @NickBuilder I now have looked at the code and (of course) you are right, the interrupt is used for the pulse count which I think is the best way of programming this function. My sensor is based on an old version of this code but modified for use with Openhab (which does not give any start value back, this function has to be own programmed). Another modification is that same unit monitors a number of temperature sensors. The "thing" has been in operation since my first post above and works well but I guess I should make an effort to modernize the code. Maybe a task for the long and dull autumn/winter days here.
  • Watermeter Elster V200 PR6P:1

    16
    1 Votes
    16 Posts
    7k Views
    YveauxY
    @hek said: parts of the power meter example seems to have ended up in it. Especially the header :laughing:
  • MySensors nodes with Ethernet interface only

    6
    0 Votes
    6 Posts
    3k Views
    E
    Will this include nodes with ESP8266 modules too?
  • CC128 Node

    1
    1 Votes
    1 Posts
    755 Views
    No one has replied
  • Mini motion detector based on Biltema PIR LED

    3
    6 Votes
    3 Posts
    2k Views
    D
    And now everything is connected together. I had to change some values on the resistors. R6 = 10k and C4 = 10 nF gives 2.5 seconds ON time. I also changed the sensitivity from 4 s to 0.05 Seconds, I am considering changing this a bit to some greater value to increase the time some. [image: 1467401532879-20160701_211141_resized.jpg] I also need to do some changes to the Arduino board as the on led is always on and i think i should remove the regulator to save some more power. [image: 1467401646837-20160701_211414_resized.jpg]
  • Got another problem

    2
    0 Votes
    2 Posts
    666 Views
    L
    seems I have a problem with Domoticz and my ESP8266 Gateway. ![alt text]([image: 1467318176393-upload-a531d3d9-8450-411e-8e7f-7d9c73eb9449] image url)
  • Home Automation and monitoring

    mysensors arduino home automation
    1
    1 Votes
    1 Posts
    2k Views
    No one has replied
  • Coal or water level sensor

    2
    0 Votes
    2 Posts
    2k Views
    malukoM
    thanks romeak01 i have update with my sample, i think that will run ok. #include <MySensor.h> #include <SPI.h> //import MySensors library #define trigPin 6 #define echoPin 5 int max = 91; //distance (cm) from min water level to sensor int min = 6; // distance (cm) from max water level to sensor int procent; //distance percentage int ilosc; //amount of the tank as a percentage #define child_id_ilosc 1 //setting to identify the amount of water in the tank MySensor gw; MyMessage msgilosc(child_id_ilosc, V_IMPEDANCE); void setup() { pinMode(trigPin, OUTPUT); //Pin, that its connet to trig pinMode(echoPin, INPUT); //a echo, input gw.begin(); //launch MySensors library gw.sendSketchInfo("Water tank meter", "1.0"); gw.present(child_id_ilosc, S_WEIGHT); //present data to controller } void loop() { long czas, dystans, diferenca; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); czas = pulseIn(echoPin, HIGH); dystans = czas / 58; diferenca = max -min; procent = (((dystans - min) * 100) / diferenca); ilosc = 100 - procent; gw.send(msgilosc.set(ilosc)); // send to controller delay(1000); // delay }```
  • Chinese Solar Lipo powered PIR led lamp.

    42
    1 Votes
    42 Posts
    28k Views
    ranseyerR
    @gyro Thanks for the Answer. Mine was produced in China too... Her the picture of the backside: [image: lamp4daul3.jpg] No connections, but a board name: YYGF-601L. I would be happy for any hints...
  • PIR faceplate

    5
    0 Votes
    5 Posts
    2k Views
    Mark JeffordM
    https://www.openhardware.io/view/4/EasyNewbie-PCB-for-MySensors Made up in China for about £10 Inc shipping I think Dirtypcbs is an awesome website :)

9

Online

11.8k

Users

11.2k

Topics

113.2k

Posts