Skip to content

General Discussion

A place to talk about whateeeever you want
1.5k Topics 14.2k Posts
  • Pin Change Interrupts debounce

    16
    0 Votes
    16 Posts
    2k Views
    alexsh1A
    @yveaux said in Pin Change Interrupts debounce: @alexsh1 The easiest way would probably use a debounce-library. I'll look into that. Thank you
  • How do I access Mysensors Cloud

    8
    0 Votes
    8 Posts
    3k Views
    hekH
    I did some development but it has been "on ice" for over a year. The idea was to offer something running in the "cloud" for quick testing and sharing sensor readings with friends and family. But (as always) it quickly grow out of proportion (storing historic data, dashboards, mail triggers etc) and I realised other projects does this much better. I.e. a hosted NodeRED would do the trick (e.g. https://fred.sensetecnic.com/). Another issue would also be how to handle the hosting cost for the service (which would require a few more cpu cycles and storage than the current site). Not sure what will happen with the code, it was pretty tied to the main site with users etc. Maybe I will pick up the work some rainy day. :)
  • Process Multiple "receive" at once

    13
    0 Votes
    13 Posts
    1k Views
    YveauxY
    @soloam good to hear! Thanks for reporting back :+1:
  • Wake Up Receiver for Battery Powered Nodes?

    4
    0 Votes
    4 Posts
    1k Views
    SurgeTransientS
    So I did more digging and I found the AS3933 IC. They have reference designs/demo boards (very expensive!). Still not sure about range, but it looks like this is possible.
  • WIndow Roller Shutter - Position

    8
    0 Votes
    8 Posts
    3k Views
    P
    I have a similar situation: my house had manually operated roller shutters, where you had to keep the button pressed to open or close them. Importantly when the end stop is reached, the motor is not powered in the moving direction anymore (probably some integrated reed contact or something). If this is the case for you, my solution will work well: Just make a normal arduino relay (1 for every direction) and calibrate them with a timer. Then just make sure that you add some time for the opening direction (a few seconds), it will make sure that for every cycle any drift is compensated. This even worked for me when I had to reset the system with the rollers at a certain percentage => just move up and down a few times and it's ok again. In my system I have implemented the manual switches (which used to switch the 220V by connecting them with the 5V node source and switching dedicated input pins on the arduino. I have two nodes, one with 3 roller shutters and one with 1 shutter and 1 awning. (I think on the 3 up/down variant, there were not enough input pins for manual input, so I had all bound to one up-down switch). Here's my code (it has become somewhat messy, and if I remember correctly I changed from 100% open to 100% closed mode when changing from home assistant to openhab2): /** 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 0.4 - October 13, 2017 - Powerpenguin Added dedicated inputs for all manual switches (This is possible for 2 up/down actuators: D2-D5 relay, D9-D13 nRF24, A0-A3=D14-D17: switches) Version 0.3 - October 9, 2017 - PowerPenguin DESCRIPTION Based on Dimmable LED Light using PWM from Henrik Ekblad Simple control of window shades which are already motorised and don't provide any more feedback, i.e. we want to send a target percentage from the controller to the shade which then moves as tgt_percentage * time_to_fully_close In the first implementation we assume that the starting state is fully open, so some "drift" is to be expected? Or "overshoot" opening by a margin to make sure 100% corresponds to fully open? (yes: home assistant takes % open, not % closed) The sketch supports multiple blinds, i.e. multiple relays connected to the arduino. There are two relays per blind, for up/down respectively Also, additional pins are read for a push-button, to manually give the up or down signal (will start/stop moving one or covers simultaneously, based on btcidmap[]) To avoid the relays coils from being powered in normal operation, and most relays are active low, high/low has been reversed (so high unless activated) (better buy active high relays!) The code has become somewhat messy, better to use interrupt on manual switch? Event based? */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <MySensors.h> #define SN "WindowShades" #define SV "0.4" #define PIN_BASE 2 // first of the Arduino pins attached to relay #define LOOP_DELAY 950 // loop delay in ms #define LOOP_DELAY_SMALL 30 // delay between transmissions for different sensors #define PIN_BASEA 14 // base of the analog pins to be used as digital input #define NCOV 2 // number of covers, each have an up and down relay; maximum is half the number of available digital i/o pins #define NCSW 2 // number of pairs (up/down) of manual override switches enum coverstates_enum {UP, DOWN, STOPPED}; static bool btmanup_pressed[NCSW]; static bool btmandn_pressed[NCSW]; bool initialValueSent[NCOV]; static int8_t currentLevel[NCOV]; static int8_t targetLevel[NCOV]; static int8_t time_open[NCOV]; static int8_t time_close[NCOV]; static unsigned long tstart[NCOV]; static int8_t lstart[NCOV]; // the manual button vs. CID mapping has to be specified manually, since sometimes we want one manual button to control more channels static int8_t btcidmap[NCOV] = {0, 1}; static coverstates_enum state[NCOV]; // number of values must be NCOV MyMessage msgPct[NCOV]; void setup() { // initialise all child actuators and related vars for (int8_t cid = 0; cid < NCOV; cid++) { msgPct[cid] = MyMessage(cid, V_PERCENTAGE); pinMode(PIN_BASE + 2 * cid, OUTPUT); pinMode(PIN_BASE + 2 * cid + 1, OUTPUT); state[cid] = STOPPED; initialValueSent[cid] = false; currentLevel[cid] = 100; targetLevel[cid] = 100; time_open[cid] = 29; // seconds to open, if not the same for all covers specify independently time_close[cid] = 27; // seconds to close } // specify times independently if not the same for all covers below time_close[0] = 40; time_open[0] = time_close[0] + 3; // overshoot to make sure we open completely, motor stops anyway time_close[1] = 26; time_open[1] = time_close[1] + 3; // overshoot to make sure we open completely, motor stops anyway // time_close[2] = 22; // time_open[2] = time_close[2] + 3; // overshoot to make sure we open completely, motor stops anyway for (int8_t i = 0; i < NCSW; i++) { pinMode(PIN_BASEA + 2 * i, OUTPUT); pinMode(PIN_BASE + 2 * i + 1, OUTPUT); btmanup_pressed[i] = false; btmandn_pressed[i] = false; } } void presentation() { // Register the Cover with the controller sendSketchInfo(SN, SV); for (int cid = 0; cid < NCOV; cid++) { present(cid, S_COVER); } } void loop() { int8_t cid; int8_t delta; for (cid = 0; cid < NCOV; cid++) { if (!initialValueSent[cid]) { Serial.println("Sending initial value"); send(msgPct[cid].set(currentLevel[cid])); Serial.println("Requesting initial value from controller"); request(cid, V_PERCENTAGE); wait(LOOP_DELAY); // extra delay to give more time for initial handshake } else { // toggle moving if manual button pressed (since we arrive heare about once a second, // we don't need debounce, but we need to press the button up to 1 s to have a reaction btmanup_pressed[btcidmap[cid]] = (bool)digitalRead(PIN_BASEA + 2 * btcidmap[cid]); btmandn_pressed[btcidmap[cid]] = (bool)digitalRead(PIN_BASEA + 2 * btcidmap[cid] + 1); // if both pressed, reset (no reaction) if (btmanup_pressed[btcidmap[cid]] && btmandn_pressed[btcidmap[cid]]) btmanup_pressed[btcidmap[cid]] = btmandn_pressed[btcidmap[cid]] = false; if (btmanup_pressed[btcidmap[cid]]) { btmanup_pressed[btcidmap[cid]] = false; if (state[cid] == STOPPED) { targetLevel[cid] = 100; } else { // if already moving, then stop by setting target to current currentLevel[cid]; } } if (btmandn_pressed[btcidmap[cid]]) { btmandn_pressed[btcidmap[cid]] = false; if (state[cid] == STOPPED) { // if (reference) not moving, then make go up targetLevel[cid] = 0; } else { // if already moving, then stop by setting target to current currentLevel[cid]; } } if (currentLevel[cid] > targetLevel[cid]) { // move down (close) => means decreasing pct! if (state[cid] != DOWN) { // we just started going down state[cid] = DOWN; tstart[cid] = millis(); lstart[cid] = currentLevel[cid]; // mstotgt[cid] = (currentLevel[cid] - targetLevel[cid]) * 10 * time_close[cid]; // remaining time to target } digitalWrite(PIN_BASE + 2 * cid, 0); // down pin digitalWrite(PIN_BASE + 2 * cid + 1, 1); // up pin // level change over elpased time, don't exceed targetLevel (will lead to control settle behaviour) currentLevel[cid] = max(lstart[cid] - (millis() - tstart[cid]) / (10 * time_close[cid]), targetLevel[cid]); Serial.print("Sending percentage feedback..."); Serial.println(currentLevel[cid]); send(msgPct[cid].set(currentLevel[cid])); } else if (currentLevel[cid] < targetLevel[cid]) { // move up (open) if (state[cid] != UP) { // we just started going up state[cid] = UP; tstart[cid] = millis(); lstart[cid] = currentLevel[cid]; // mstotgt[cid] = (currentLevel[cid] - targetLevel[cid]) * 10 * time_close[cid]; // remaining time to target } digitalWrite(PIN_BASE + 2 * cid, 1); // down pin digitalWrite(PIN_BASE + 2 * cid + 1, 0); // up pin // level change over elpased time, don't exceed targetLevel (will lead to control settle behaviour) currentLevel[cid] = min(lstart[cid] + (millis() - tstart[cid]) / (10 * time_open[cid]), targetLevel[cid]); Serial.print("Sending percentage feedback..."); Serial.println(currentLevel[cid]); send(msgPct[cid].set(currentLevel[cid])); } else if (currentLevel[cid] == targetLevel[cid]) { // we always stop when the level is reached // we don't change the state here, because we want to send a final level value to the controller first digitalWrite(PIN_BASE + 2 * cid, 1); // down pin digitalWrite(PIN_BASE + 2 * cid + 1, 1); // up pin if (state[cid] != STOPPED) send(msgPct[cid].set(currentLevel[cid])); state[cid] = STOPPED; } // Serial.println("Sending current level to controller"); // Serial.println(currentLevel[cid]); // Serial.println("targetLevel = "); // Serial.println(targetLevel[cid]); // if (state[cid] != STOPPED) send(msgPct[cid].set(currentLevel[cid])); // send current estimated percentage back to gateway, until stopped state reached // if (currentLevel[cid] != targetLevel[cid]) state[cid] = STOPPED; } wait(LOOP_DELAY_SMALL); } wait(LOOP_DELAY); } void receive(const MyMessage &message) { // the message sets the target value for each sensor. // as long as the target is not reached, the approriate relay pin is kept high // and the controller is informed every LOOP_DELAY ms about the progress // Serial.println("Message received from gateway (cid):"); // Serial.println(message.sensor); if (message.isAck()) { Serial.println("This is an ack from gateway"); } switch (message.type) { case V_PERCENTAGE: if (!initialValueSent[message.sensor]) { Serial.println("Receiving initial value from controller"); initialValueSent[message.sensor] = true; } targetLevel[message.sensor] = atoi(message.data); targetLevel[message.sensor] = targetLevel[message.sensor] > 100 ? 100 : targetLevel[message.sensor]; targetLevel[message.sensor] = targetLevel[message.sensor] < 0 ? 0 : targetLevel[message.sensor]; Serial.println("Received V_PERCENTAGE from controller"); break; case V_UP: targetLevel[message.sensor] = 100; Serial.println("Received V_UP from controller"); break; case V_DOWN: targetLevel[message.sensor] = 0; Serial.println("Received V_DOWN from controller"); break; case V_STOP: Serial.println("Received V_STOP from controller"); targetLevel[message.sensor] = currentLevel[message.sensor]; break; } } Good luck!
  • 0 Votes
    2 Posts
    1k Views
    ThucarT
    @jkandasa I just finished a Gateway build with TinyGSM. You can find it here: https://www.openhardware.io/view/567/MySensors-GSM-Gateway
  • scanning 5 antenna input ports

    15
    0 Votes
    15 Posts
    2k Views
    SchlogS
    @tbowmo I ended up building a swr circuit and just send a 433mhz signal . I know 433MHZ!!?? It was a small transmitter I have laying around Gives me a real nice return single with an antenna on line and almost nothing with no antenna. Now I have to turn the return signal I can control. Going to use the Arduino to analog read the signal and give my a digital output. This gives me the control points I need. I can also use an external Analog to Digital convertor like the PCF 8591 but first going to use the Arduino to do the A/D conversion. Thanks for your help Ed NW4K 73's
  • Profile picture?

    4
    0 Votes
    4 Posts
    861 Views
    SchlogS
    @dbemowsk I just when back and changed it this time it looks like it took. Thank everyone..
  • Fake DS18B20 sensors.

    4
    0 Votes
    4 Posts
    4k Views
    NeverDieN
    I got hit by this as well. They're fakes: http://www.lungstruck.com/electronics/counterfeit-ds18b20-temp-sensors/ Mine are exactly as described in the linked article.
  • Openhab - MySensor Binding 2.2 0r 2.3

    4
    0 Votes
    4 Posts
    2k Views
    D
    @donny152 You should try OpenLuup. works great with mysensors and vera plugings and is very stable and you can use your vera as a zwave controler. http://forum.micasaverde.com/index.php/board,79.0.html
  • 5v cable

    8
    0 Votes
    8 Posts
    1k Views
    mfalkviddM
    @ben999 doubling cable = doubling conductance. So you're almost right ;-)
  • Frequency usage regulations

    9
    4 Votes
    9 Posts
    2k Views
    B
    @bakcsa Thanks a lot for your explanation and the directions. Thumbs up!
  • Geophone - sensing earthquakes and other seismic vibrations

    2
    0 Votes
    2 Posts
    1k Views
    NeverDieN
    @alowhum I've heard of geophones being used to detect footsteps outdoors. Cost was around $60/sensor IIRC. http://www.kr4.us/Geophone-SM-24.html?gclid=CjwKCAiAoNTUBRBUEiwAWje2lqjbwf7gdzmiPalzIry4JBhZ-L-kqX6qqSt4UV0atkOPNGlab9Q5ZxoC_H8QAvD_BwE
  • Security: 433 RFX vs Mysensors security

    15
    0 Votes
    15 Posts
    2k Views
    C
    @nca78 said in Security: 433 RFX vs Mysensors security: @chbla said in Security: 433 RFX vs Mysensors security: @nca78 I'm still deciding what to use. Pro Mini if I don't find anything better. I'm interested in where you buy your BME680 breakout boards, there are not so many around :) I think I bought them here: http://www.watterott.com/de/BME680-Breakout I'm located in Austria
  • Send Images over MySensors and Arducam possible?

    2
    0 Votes
    2 Posts
    799 Views
    mfalkviddM
    @cablesky it seems to be possible according to https://forum.mysensors.org/topic/1668/sending-image-data-over-the-mysensors-network/
  • ARDUINO+WIFI -> Domoticz on Raspberry Pi3 (water meter)

    5
    0 Votes
    5 Posts
    2k Views
    gohanG
    Mysensors has a "savestate" function that can be used to save variables in eeprom without too much hassle, but in your case it since it is a mains powered node you could just report every pulse and have the controller save the data and when node boots it will just asks Domoticz the last pulse count (look at energy pulse meter example in library) but I think that will work only if using mqtt gateway as for the ethernet it will just miss the retrival of the pulse count because the controller takes some time to connect to the ethernet GW. As an alternative there are other solutions like ESPEasy that have already some built in funtions easy to use without need to do lot of coding.
  • Strange Error when pigw failed

    5
    0 Votes
    5 Posts
    795 Views
    gohanG
    You could give a try without reflashing nodes , just save the current binary :)
  • Logo

    10
    0 Votes
    10 Posts
    1k Views
    dbemowskD
    First attempt playing with the logo. I did a manual filament change from yellow to blue. Didn't have any black PLA, only ABS, otherwise I would have used black. This is more of a lithophane style which didn't do the best, but is still okay. I want to try to figure this out using paths in inkscape and exporting them to OpenSCAD. Having some trouble with that though. I'll figure it out in time. The picture is next to a soda can so you can get an idea of the size. [image: 1518854622252-a241d8c1-cfe2-48f9-89c3-50dbe1c7d346-image.png]
  • BananaPi M1 gateway wont work

    2
    0 Votes
    2 Posts
    655 Views
    X
    @kebibg hello Was you able to bring it to work? Thanks, Simon
  • Conflicts with neighbour's gateways ?

    multiple gateway
    8
    0 Votes
    8 Posts
    2k Views
    hekH
    @ricorico94 From the NRF24 datasheet: [image: 1518649573838-screen-shot-2018-02-15-at-00.05.12-resized.png] https://www.sparkfun.com/datasheets/Components/SMD/nRF24L01Pluss_Preliminary_Product_Specification_v1_0.pdf So, you should probably choose address a bit careful. To change base address just add a define in your sketch like this (before including MySensors.h): #define MY_RF24_BASE_RADIO_ID 0x00,0xFC,0xE1,0xA8,0xA8

11

Online

11.7k

Users

11.2k

Topics

113.1k

Posts