Skip to content

General Discussion

A place to talk about whateeeever you want
1.5k Topics 14.2k Posts
  • [MySigningAtsha204Soft 1.5.4] HMAC linux keygenerator

    1
    3 Votes
    1 Posts
    576 Views
    No one has replied
  • Free analog electronics course for everyone who understands Dutch

    2
    2 Votes
    2 Posts
    887 Views
    TheoLT
    I just realized that the site is also available in English. The book itself seems to be available in English. But I don't see a link to an english youtube channel.
  • Witch temp/hum sensor is best to use for battery powered sensors?

    4
    0 Votes
    4 Posts
    5k Views
    chrilleC
    @AWI I fully agree! The AM2302 (aka DHT-22) does not work, when the supply drops slightly below 3.3V, while the AM2321works at much lower voltage. I have used the AM2321 for more than 6 months to monitor my greenhouse
  • Does mysensors needs wireless? Can I use ethernet?

    4
    0 Votes
    4 Posts
    2k Views
    hekH
    @mfalkvidd Yes, a pinned topic would be nice.
  • Merge Sketches

    2
    0 Votes
    2 Posts
    787 Views
    korttomaK
    Have you seen the video collection here -> http://www.mysensors.org/about/videos There is one called "Combining MySensors example sketches" maybe it can be helpful for you.
  • Doubt about Serial Gateway and Actor in same Arduino

    4
    0 Votes
    4 Posts
    1k Views
    sundberg84S
    @erangel - well not sure if I understand you, but yes - you can have a raspberry pi as gateway (search the forum) and then have arduino as nodes talking with the gateway wireless.
  • Introduction & Controller question

    4
    0 Votes
    4 Posts
    1k Views
    M
    @KrisJacobs Hi Kris. I settled on domoticz pretty quickly. No complaints as yet. Am running it on a (free to me) HP mini with Ubuntu, but the pi documentation appears pretty thorough.
  • Ethernet Gateway

    ethernet gateway
    4
    0 Votes
    4 Posts
    3k Views
    D
    Hi . Here is my example .. working with my code for Relay board 32 relay by I2C IO expander. #include <MySensor.h> #include <SPI.h> // Define version #define VSN "v1.0" // Define Name #define NAME "Test" // Define Sensor - button #define BLU 1 // Button Left Up #define BLD 2 // Button Left Down #define BRU 3 // Button Right Up #define BRD 4 // Button Right Down // Sensor objects MySensor gw; void setup() { // eeprom_write_byte((uint8_t*)EEPROM_NODE_ID_ADDRESS, (byte)255); gw.begin(incomingMessage,AUTO); // Node ID auto .. if not used gateway , Node ID must define manualy gw.sendSketchInfo( NAME, VSN ); // Name and version gw.present(BLU, S_LIGHT); gw.present(BLD, S_LIGHT); gw.present(BRU, S_LIGHT); gw.present(BRD, S_LIGHT); } void loop() { gw.process(); } void incomingMessage(const MyMessage &message) { if (message.type == V_LIGHT) { MyMessage response (message.getByte(),V_LIGHT) ; // message.getByte() = payload define what relay want change state response.setDestination(1); // My Relay Board gw.send(response); } }```
  • Re-assign ID

    myscontroller reassign id
    3
    0 Votes
    3 Posts
    3k Views
    D
    [2016-04-27 20:55:10.973 Info] INFO *** Logging START *** [2016-04-27 20:55:10.974 Info] VERSION MYSController 0.1.2.282 [2016-04-27 20:55:33.569 Info] NODE New node discovered, node id=2 [2016-04-27 20:55:33.570 Info] CHILD New child discovered, node id=2, child id=internal [2016-04-27 20:55:33.570 Info] DEBUG Assigned firmware=Blink to node=2 [2016-04-27 20:55:33.571 Info] INFO BL version=257 [2016-04-27 20:55:33.572 Info] INFO Send FW info to node 2: type=A, version=1, blocks=0x02C8, CRC=0xB718 [2016-04-27 20:55:33.573 Info] TX 2;0;4;0;1;0A000100C80218B7 [2016-04-27 20:55:33.574 Info] RX 2;255;4;0;0;0A000100C80218B70101 [2016-04-27 20:55:33.655 Info] SIGNING Node 2 does not require signing [2016-04-27 20:55:33.656 Info] SIGNING MYSController is not signing [2016-04-27 20:55:33.656 Info] TX 2;255;3;0;15;0 [2016-04-27 20:55:33.658 Info] RX 2;255;3;0;15;0 [2016-04-27 20:55:33.658 Info] DEBUG Update child id=255, type=ARDUINO_NODE [2016-04-27 20:55:33.659 Info] RX 2;255;0;0;17;1.5.4 [2016-04-27 20:55:33.662 Info] TX 2;255;3;0;6;M [2016-04-27 20:55:33.663 Info] RX 2;255;3;0;6;0 [2016-04-27 20:55:35.671 Info] RX 2;255;3;0;11;Bin.Sensor Sleep [2016-04-27 20:55:35.674 Info] RX 2;255;3;0;12;1.0 [2016-04-27 20:55:35.676 Info] CHILD New child discovered, node id=2, child id=3 [2016-04-27 20:55:35.677 Info] DEBUG Update child id=3, type=DOOR [2016-04-27 20:55:35.678 Info] RX 2;3;0;0;0; [2016-04-27 20:55:35.679 Info] CHILD New child discovered, node id=2, child id=4 [2016-04-27 20:55:35.679 Info] DEBUG Update child id=4, type=DOOR [2016-04-27 20:55:35.681 Info] RX 2;4;0;0;0; [2016-04-27 20:55:35.722 Info] RX 2;3;1;0;16;1 [2016-04-27 20:55:35.745 Info] RX 2;255;3;0;0;79 [2016-04-27 20:55:40.876 Info] RX 2;4;1;0;16;0 [2016-04-27 20:55:41.375 Info] RX 2;4;1;0;16;1 [2016-04-27 20:55:42.819 Info] RX 2;3;1;0;16;0 [2016-04-27 20:55:43.461 Info] RX 2;3;1;0;16;1 [2016-04-27 20:55:54.189 Info] TX 2;0;3;0;13;0 [2016-04-27 20:56:13.510 Info] REPO FW "Blink" loaded. t=10, v=1, blocks=712, crc=0xB718 [2016-04-27 20:56:13.523 Info] REPO FW "TimeReporter" loaded. t=20, v=1, blocks=840, crc=0x4AC5 [2016-04-27 20:56:13.542 Info] REPO FW "Sensebender Micro" loaded. t=100, v=1, blocks=1344, crc=0x3482 [2016-04-27 20:56:13.552 Info] REPO FW "Sensebender Blink" loaded. t=110, v=1, blocks=768, crc=0x1314 [2016-04-27 20:56:13.552 Info] REPO FW repository loaded. Items=4 [2016-04-27 20:56:17.551 Info] TX 2;0;3;0;13;0 [2016-04-27 20:57:00.075 Info] CHILD New child discovered, node id=2, child id=3 [2016-04-27 20:57:00.076 Info] RX 2;3;1;0;16;0 [2016-04-27 20:57:00.439 Info] RX 2;3;1;0;16;1 [2016-04-27 20:57:02.092 Info] CHILD New child discovered, node id=2, child id=4 [2016-04-27 20:57:02.094 Info] RX 2;4;1;0;16;0 [2016-04-27 20:57:02.363 Info] RX 2;4;1;0;16;1
  • Triple Axis Compass Sensor for mailbox?

    12
    0 Votes
    12 Posts
    3k Views
    Cliff KarlssonC
    I used the BinarySwitchSleepSensor sketch and tried adding the battery measuring info. Does this look ok If I only want the sensor to sleep until the magnetswitch attached to PIN 2 is opened and every 6h it reports battery? // Enable debug prints to serial monitor #define MY_DEBUG #define SLEEP_TIME 21600000 // Sleep time between reads (in milliseconds) // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <SPI.h> #include <MySensor.h> #define SKETCH_NAME "Mailbox +Battery" #define SKETCH_MAJOR_VER "1" #define SKETCH_MINOR_VER "0" #define PRIMARY_CHILD_ID 3 #define CHILD_ID_BATTERY 1 #define BATTERY_FULL 3143 // 2xAA usually give 3.143V when full #define BATTERY_ZERO 2340 #define PRIMARY_BUTTON_PIN 2 // Arduino Digital I/O pin for button/reed switch // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED); MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE); long oldvoltage = 0; void setup() { // Setup the buttons pinMode(PRIMARY_BUTTON_PIN, INPUT); // Activate internal pull-ups digitalWrite(PRIMARY_BUTTON_PIN, HIGH); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER); // Register binary input sensor to sensor_node (they will be created as child devices) // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. present(PRIMARY_CHILD_ID, S_DOOR); delay(250); present(CHILD_ID_BATTERY, S_CUSTOM); } // Loop will iterate on changes on the BUTTON_PINs void loop() { uint8_t value; static uint8_t sentValue=2; // Short delay to allow buttons to properly settle sleep(5); value = digitalRead(PRIMARY_BUTTON_PIN); if (value != sentValue) { // Value has changed from last transmission, send the updated value send(msg.set(value==HIGH ? 1 : 0)); sentValue = value; } long voltage = readVcc(); if (oldvoltage != voltage) { // Only send battery information if voltage has changed, to conserve battery. send(voltage_msg.set(voltage / 1000.0, 3)); // redVcc returns millivolts. Set wants volts and how many decimals (3 in our case) sendBatteryLevel(round((voltage - BATTERY_ZERO) * 100.0 / (BATTERY_FULL - BATTERY_ZERO))); oldvoltage = voltage; } // Sleep until something happens with the sensor sleep(PRIMARY_BUTTON_PIN-2, CHANGE, SLEEP_TIME); } long readVcc() { // From http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/ // Read 1.1V reference against AVcc // set the reference to Vcc and the measurement to the internal 1.1V reference #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) ADMUX = _BV(MUX5) | _BV(MUX0); #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) ADMUX = _BV(MUX3) | _BV(MUX2); #else ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #endif delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Start conversion while (bit_is_set(ADCSRA, ADSC)); // measuring uint8_t low = ADCL; // must read ADCL first - it then locks ADCH uint8_t high = ADCH; // unlocks both long result = (high << 8) | low; result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000 return result; // Vcc in millivolts }
  • WISP computer has no battery, gets power wirelessly from radio waves

    3
    0 Votes
    3 Posts
    1k Views
    ahmedadelhosniA
    Yeah that's a weak point. This technolgy seems to grow fast and will save a lot of effort in industry and IOT applications.
  • Several dimmers

    11
    0 Votes
    11 Posts
    4k Views
    M
    The answer was simple Change digitalWrite( LED_PIN_1, 0); to analogWrite( LED_PIN_1, 0);
  • Code problem

    6
    0 Votes
    6 Posts
    1k Views
    M
    Well everything almost fixed. The code if somebody will be building something similar... 4 push buttons attached and 3 dimmers + MQ and DHT22 All the logic is supposed to be handled by the controller. Problems remaining... If you set the button state in the controller - it doesn't get updated on the node... Any hints appreciated on this And the major problem - if the node resets the LIGHTS are ON! As has been hinted in another topic the code has to be rewritten so in the beginning it sets the values to zero and informs the controller isntead of pulling values. But my lack of knowledge stops me on this one. So help will be much appreciated #define SN "Kitchen Hood" #define SV "1.0" #include <MySensor.h> #include <SPI.h> #include <DHT.h> #include <math.h> #include <Wire.h> #include <Bounce2.h> //DEFINE CHILD_IDS #define DIMMER_NODE_1 0 #define DIMMER_NODE_2 1 #define DIMMER_NODE_3 2 #define CHILD_ID_HUM 4 #define CHILD_ID_TEMP 5 #define CHILD_ID_MQ 6 #define CHILD_BUT1 7 #define CHILD_BUT2 8 #define CHILD_BUT3 9 #define CHILD_BUT4 10 //BUTTONS #define BUTTON_PIN1 A0 #define BUTTON_PIN2 A1 #define BUTTON_PIN3 A2 #define BUTTON_PIN4 A3 //MQ+DHT #define MY_LEDS_BLINKING_FEATURE #define HUMIDITY_SENSOR_DIGITAL_PIN 8 const int MQ_Pin = A4; //DIMMER #define LED_PIN_1 3 #define LED_PIN_2 5 #define LED_PIN_3 6 #define FADE_DELAY 10 MySensor gw; DHT dht; //BUTTONS Bounce debouncer_1 = Bounce(); Bounce debouncer_2 = Bounce(); Bounce debouncer_3 = Bounce(); Bounce debouncer_4 = Bounce(); int oldValue_1=-1; int oldValue_2=-1; int oldValue_3=-1; int oldValue_4=-1; bool state1; bool state2; bool state3; bool state4; MyMessage msgbut1(CHILD_BUT1,V_TRIPPED); MyMessage msgbut2(CHILD_BUT2,V_TRIPPED); MyMessage msgbut3(CHILD_BUT3,V_TRIPPED); MyMessage msgbut4(CHILD_BUT4,V_TRIPPED); //MQ+DHT float lastTemp; float lastHum; float hum_floa; float last_mq_reading; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgMQ(CHILD_ID_MQ, V_LEVEL); //DIMMER byte currentLevel[3] = {0,0,0}; MyMessage dimmerMsg0(0, V_DIMMER); MyMessage lightMsg0(0, V_LIGHT); MyMessage dimmerMsg1(1, V_DIMMER); MyMessage lightMsg1(1, V_LIGHT); MyMessage dimmerMsg2(2, V_DIMMER); MyMessage lightMsg2(2, V_LIGHT); unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) void setup() { Serial.begin(9600); Serial.println( SN ); gw.begin( incomingMessage ); gw.sendSketchInfo(SN, SV); //MQ+DHT dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); gw.present(CHILD_ID_HUM, S_HUM); gw.present(CHILD_ID_TEMP, S_TEMP); gw.present(CHILD_ID_MQ, S_AIR_QUALITY); gw.wait( 50 ); //DIMMER gw.present( DIMMER_NODE_1, S_DIMMER ); gw.wait( 50 ); gw.present( DIMMER_NODE_2, S_DIMMER ); gw.wait( 50 ); gw.present( DIMMER_NODE_3, S_DIMMER ); gw.wait( 50 ); gw.request( DIMMER_NODE_1, V_DIMMER ); gw.wait( 50 ); gw.request( DIMMER_NODE_2, V_DIMMER ); gw.wait( 50 ); gw.request( DIMMER_NODE_3, V_DIMMER ); //BUTTONS pinMode(BUTTON_PIN1,INPUT); digitalWrite(BUTTON_PIN1, HIGH); pinMode(BUTTON_PIN2,INPUT); digitalWrite(BUTTON_PIN2, HIGH); pinMode(BUTTON_PIN3,INPUT); digitalWrite(BUTTON_PIN3, HIGH); pinMode(BUTTON_PIN4,INPUT); digitalWrite(BUTTON_PIN4, HIGH); debouncer_1.attach(BUTTON_PIN1); debouncer_1.interval(5); debouncer_2.attach(BUTTON_PIN2); debouncer_2.interval(5); debouncer_3.attach(BUTTON_PIN3); debouncer_3.interval(5); debouncer_4.attach(BUTTON_PIN4); debouncer_4.interval(5); gw.present(CHILD_BUT1, S_DOOR); gw.wait( 50 ); gw.present(CHILD_BUT2, S_DOOR); gw.wait( 50 ); gw.present(CHILD_BUT3, S_DOOR); gw.wait( 50 ); gw.present(CHILD_BUT4, S_DOOR); gw.wait( 50 ); } void loop() { gw.process(); int value_but_1 = debouncer_1.read(); int value_but_2 = debouncer_2.read(); int value_but_3 = debouncer_3.read(); int value_but_4 = debouncer_4.read(); //BUTTONS debouncer_1.update(); if (value_but_1 != oldValue_1) { if ( value_but_1==0) { state1 = !state1; gw.send(msgbut1.set(state1)); } oldValue_1 = value_but_1; } debouncer_2.update(); if (value_but_2 != oldValue_2) { if ( value_but_2==0) { state2 = !state2; gw.send(msgbut2.set(state2)); } oldValue_2 = value_but_2; } debouncer_3.update(); if (value_but_3 != oldValue_3) { if ( value_but_3==0) { state3 = !state3; gw.send(msgbut3.set(state3)); } oldValue_3 = value_but_3; } debouncer_4.update(); if (value_but_4 != oldValue_4) { if ( value_but_4==0) { state4 = !state4; gw.send(msgbut4.set(state4)); } oldValue_4 = value_but_4; } } //DHT+MQ delay(dht.getMinimumSamplingPeriod()); float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT"); } else if (temperature != lastTemp) { lastTemp = temperature; gw.send(msgTemp.set(temperature, 1)); } float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum) { lastHum = humidity; gw.send(msgHum.set(humidity, 1)); } float mq_reading = analogRead(MQ_Pin); if (isnan(mq_reading)) { Serial.println("Failed mq_reading"); } else if (mq_reading != last_mq_reading) { last_mq_reading = mq_reading; gw.send(msgMQ.set(mq_reading, 1)); } //DIMMER void incomingMessage(const MyMessage &message) { if (message.type == V_LIGHT || message.type == V_DIMMER) { int requestedLevel = atoi( message.data ); requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 ); requestedLevel = requestedLevel > 100 ? 100 : requestedLevel; requestedLevel = requestedLevel < 0 ? 0 : requestedLevel; Serial.print( "Changing level to " ); Serial.print( requestedLevel ); Serial.print( ", from " ); Serial.println( currentLevel[message.sensor] ); fadeToLevel( requestedLevel, message.sensor); switch(message.sensor) { case 0: gw.send(lightMsg0.set(currentLevel[0] > 0 ? 1 : 0)); gw.send( dimmerMsg0.set(currentLevel[0]) ); break; case 1: gw.send(lightMsg1.set(currentLevel[1] > 0 ? 1 : 0)); gw.send( dimmerMsg1.set(currentLevel[1]) ); break; case 2: gw.send(lightMsg2.set(currentLevel[2] > 0 ? 1 : 0)); gw.send( dimmerMsg2.set(currentLevel[2]) ); break; } } } void fadeToLevel( int toLevel, byte sensorId ) { int delta = ( toLevel - currentLevel[sensorId] ) < 0 ? -1 : 1; while ( currentLevel[sensorId] != toLevel ) { currentLevel[sensorId] += delta; switch(sensorId) { case 0: analogWrite( LED_PIN_1, (int)(currentLevel[sensorId] / 100. * 255) ); break; case 1: analogWrite( LED_PIN_2, (int)(currentLevel[sensorId] / 100. * 255) ); break; case 2: analogWrite( LED_PIN_3, (int)(currentLevel[sensorId] / 100. * 255) ); break; } delay( FADE_DELAY ); } }```
  • Easily configure settings

    2
    0 Votes
    2 Posts
    726 Views
    hekH
    @miclane said: Has anyone worked on it? Nope, not that I know of.
  • Monitor if an outlet has power - send email

    10
    0 Votes
    10 Posts
    4k Views
    ThomasDrT
    Hello, Measure A socket directly is always a risk. just take a power adapter, power the Mysensors Note and send a Life Bit to your Application. Is the Outlet power down the Note send no Life Bit and your Application can send a E-Mail. regards Thomas
  • NRF24L01+PA+LNA

    32
    0 Votes
    32 Posts
    11k Views
    OitzuO
    @Mark-Swift let us know how they perform. The supplier looks very professional. Would be interesting if they really reach the promised 2.1km :D (I wonder with which antenna) even better to use 3.3v (hence on my next one to play it safe I'll use a spare 5v -> 3.3v level shift converter too). Or use a 3.3V pro mini.
  • Z-wave sensor

    5
    1 Votes
    5 Posts
    3k Views
    hekH
    The MySensors project was created to bypass the rigorous rules of z-wave and closeness of their protocol and source code. MySensors is capable of everything on your list every node is a repeater low power encryption I addition we provide message authentication and "standardized" OTA updates capability. The latest version of z-wave addresses some of their previous security problems.. but considering their closeness it's hard to know how good they are.
  • MQTT dimmer message

    9
    0 Votes
    9 Posts
    3k Views
    martinhjelmareM
    gw.process is called in the loop, so messages should be processed even with repeater mode turned off. I suggest upgrading the library to 1.5.4 for the nodes, as the bug regarding payloads was solved with that version.
  • Looking for a GPS tracker

    gps
    1
    0 Votes
    1 Posts
    814 Views
    No one has replied
  • Telephone line switch

    4
    0 Votes
    4 Posts
    1k Views
    mfalkviddM
    The relay example should work fine I think.

8

Online

11.8k

Users

11.2k

Topics

113.2k

Posts