Skip to content

Development

Discuss Arduino programming, library tips, share example sketches and post your general programming questions.
1.5k Topics 13.5k Posts

Subcategories


  • 56 578
    56 Topics
    578 Posts
    HJ_SKH
    Hi2All! Surprising is here. After about 24hours I refresh HA and suddenly my motion sensor was integrated. There is also second entity > battery : 0 , have to look deeper into that for understanding. Need to change little in the sketch, because don't want every short time 'no movement' so only when there is motion and maybe once a hour indication sensor is alive. Meantime I found 3 other good threats: https://forum.mysensors.org/topic/11200/finally-progress-evidence-based-radio-testing-method-and-capacitors https://forum.mysensors.org/topic/1664/which-are-the-best-nrf24l01-modules/27 https://forum.mysensors.org/topic/9550/build-a-reliable-power-supply-chain Very usefull for me also finally progress because of lacking time in the past. Great jobs are done here! Thanks for this all of you guys or girls!
  • Battery sensor measure for li-ion cells?

    20
    0 Votes
    20 Posts
    10k Views
    m26872M
    @Tmaster I'd like to add a few things about the settings a Vmin and Vmax. If you get a Vbat value outside of [Vmin Vmax] the calculation would give a negative result. Since it's then sent as an uint8_t, it'll not be easy read or meaningful. Due to this it's sometimes a good advice to make the interval wider, use a constraint or handle the exceptions. Vmin 4.3V is a conservative limit. The APM internal vreg (ldo?) is probably working a lot lower depending on the load. You have to find out yourself.
  • Use MySensors to decode 433Mhz weather sensors

    2
    0 Votes
    2 Posts
    1k Views
    hekH
    Here is a recent example: http://forum.mysensors.org/topic/2286/experimenting-with-cheap-433mhz-gadgets
  • Has anyone attempted to make a MyHwATMega1284p ?

    1
    0 Votes
    1 Posts
    679 Views
    No one has replied
  • Another ProMini 3.3V timing isue and the solution

    3
    2 Votes
    3 Posts
    1k Views
    TheoLT
    @mfalkvidd Thank you. I just remembered I would have had a 4th option. Using a ATtiny85 to transmit the IR-code. But I haven't really digged into the ATtiny85 it's still on my wishlist. I could have programmed the ATtiny85 to listen to a digital input and let it fire the IR code on an interrupt, let's say if the pin is lowering (should work in theory if you use an internal pullup)
  • Extra info page or wiki.

    17
    3 Votes
    17 Posts
    5k Views
    A
    Hey guys, I've already had this idea. Then, I've started creating an unoffical documentation page on ReadTheDocs that I hope to fill the lacks on official documentation. So, I am using my point of view and studying the whole library. I hope that helps someone (I am really at the beginning).
  • Node is sending - but no reads....

    4
    0 Votes
    4 Posts
    1k Views
    M
    Ok, in addition, I found out, that everything works fine if I let nodes talk to the gateway directly. If the nodes are behind repeaters (I tried 3 different ones) they can send alright but they don't receive reads.
  • Buzzer on Gateway

    5
    0 Votes
    5 Posts
    3k Views
    TheoLT
    @Tmaster I've created a Node containing a Piezo buzzer a while ago. I stripped all other things from my Sketch. It compiles, but I haven't tested it. Just try it and see if it works. /** * MySensors RoomSensor with piezo alarm for audio feedback, like weather alarm when there's a huricane alarm. * The alarm is just a standard alarm in your Home Automation controller. * * Version 1.0 * Created 25-10-2015 * release date 25-10-2015 * Author by Theo * * * Parts used: * - Arduino ProMini 3.3V * - 3V Piezo buzzer (is actually surprisingly loud for such a tiny PIEZO), You can greatly improve on the volume by wrapping a paper tube around the piezo */ /** * Include all needed libraries. */ #include <MySensor.h> // The core of this Sketch. Enables communication from the radio to the MySensors gateway #include <SPI.h> // Needed by the MySensors Radio, it communicates with the Arduino by SPI /** * Define the child ID's of the supported sensors. */ #define SIRENE_CHILD_ID 0 // The child ID of the sirene as presented to the Domotica Controller /** * Declare constants for the PIN's we use in this sketch. */ #define PIEZO_PIN 5 // The arduino pin to which the piezo buzzer is attached /** * Declare other constants used by the sketch */ #define PIEZO_ON_DURATION 600 // The period the piezo makes a sound when the alarm is on and snooze mode is off. #define PIEZO_OFF_DURATION 500 // The silent period when the alarm is on and snooze mode is off /** * Section for MySensors specific variables and declarations. */ #define SN "Sirene" // The name of the sketch as being presented to the MySensors gateway. B.t.w. current Domoticz version ignores it #define SV "1.0" // The version of the sketch as being presented to the MySensors gateway. B.t.w. current Domoticz version ignores it MySensor gw; // You'll need this object for communication from an to the Gateway. Contains all logic inl the Radio communication MyMessage sireneMsg( SIRENE_CHILD_ID, V_LIGHT ); // trying to figure out what type type to use to make it known as a siren..??? // Message for sending the alarm on/off state to the MySensors gateway /** * Declare variables used by the Sketch */ boolean alarmOn = false; // alarm state indicator. False meaning off, true meaning we're in business. unsigned long nextPiezoEvent = 0; // The next timestamp the piezo sound has to be turned on or off. We'll use the arduino's internal clock for this boolean piezoOn = false; // indicator whether the sound is on or off during the alarm /** * Initialize everything we need before we can start the Sketch: * - setup MySensors communication * - present the child id's to the MySensors gateway * - declare pin modes and initialize the debouncer */ void setup() { #ifdef DEBUG // turn on the Serial monitor if #define DEBUG is uncommented in MyConfig.h (MySensors library) Serial.begin( 115200 ); // only debug to serial monitor during development #endif // setup a connection to the MySensor's gateway and request an ID if we do not have one yet. gw.begin(incomingMessage); gw.sendSketchInfo(SN, SV); #ifdef DEBUG // Print some debug info Serial.println( "Radio is connect right." ); #endif // present the children to the gateway gw.present( SIRENE_CHILD_ID, S_LIGHT, "Sirene" ); // S_LIGHT is not correct gw.sendBatteryLevel( 100, false ); // Let the Domotica controller no that we're a 100% powered sensor. gw.request( SIRENE_CHILD_ID , V_LIGHT ); // request current state. An alarm might be active. // setup the pin's used by this Sketch pinMode( PIEZO_PIN, OUTPUT); } /** * Piezo event has been triggered, depending on the current sirence state we need to make some nois or turn it off. * We'll determine the timestamp of the next piezo event as well */ void handlePiezoEvent() { unsigned long curMS = millis(); if ( piezoOn == true ) { // Piezo is currently on, we need to switch it of digitalWrite( PIEZO_PIN, 0 ); nextPiezoEvent = curMS + PIEZO_OFF_DURATION; piezoOn = false; } else { // Piezo is off, time to make some noise ;-) analogWrite( PIEZO_PIN, 255 ); nextPiezoEvent = curMS + PIEZO_ON_DURATION; piezoOn = true; } } /** * Main loop of the sketch. */ void loop() { if ( alarmOn == true ) { // Alarm handling code if ( millis() >= nextPiezoEvent ) { // check if the piezo has to be turned on or off. handlePiezoEvent(); } } gw.wait( 5 ); // Just wait 50s not really necessary but give the arduino some rest. It's working really hard for us and we should be grateful for that. // besides it calls gw.process() which we need for incomming messages. } /** * Call back handler, for handling messages send by the MySensors gateway */ void incomingMessage(const MyMessage &message) { if ( message.type == V_LIGHT ) { // Check if the Gateway has reported an Alarm_type message (should be an V_ALARM as off the next Domoticz release. if ( message.sensor == SIRENE_CHILD_ID ) { // Is the message for our alarm child? alarmOn = message.getBool(); // get alarm value sent by Domotica controller #ifdef DEBUG // print some debug info Serial.println( "Sirene state changed to " + (String)alarmOn ); #endif if ( alarmOn == false ) { // turn off the alarm as asked by the Domotica controller analogWrite( PIEZO_PIN, 0 ); // turn off the noise } else { // Schedule the next piezo event nextPiezoEvent = 0; piezoOn = false; } } } } Edited: I'm not good with Fritzling, I just don't find it very user friendly. That's probably why I don't spend some time on how to use it. But i just realized that you might want to know how to hookup the piezo buzzer to the arduino ;-) Just connect the radio as described on the mysensors.org build site. I've used a 3.3V piezo, cause I mostly use ProMini's 3.3V for my MySensor nodes. But if you have another Arduino you'd probably need a 5V piezo buzzer. Connecting the piezo is really easy. Hook the ground of the buzzer to one of the GND pins of your Arduino. Hook the positive pin of the buzzer to Pin 5 of your Arduino and you're good to go.
  • How to receive time?

    7
    0 Votes
    7 Posts
    5k Views
    L
    @Meister_Petz Sometimes thats the most difficult problem ;) Glad to have helped!
  • Connecting sensor to gateway via RS485 instead of nRF24

    rs485
    13
    0 Votes
    13 Posts
    10k Views
    N
    Hi, Have you seen the following: rs485-rs232-serial-transport-class-for-mysensors-org Is that what you are looking for?
  • Request ACK from node to gateway possible?

    9
    0 Votes
    9 Posts
    5k Views
    S
    @Anduril said: ok, what is the behavior if there is no ACK coming back? Trying again for several times before discarding the message? How long is the timeout? We are discussing this topic in http://forum.mysensors.org/topic/2189/serial-api-noack-when-sending-with-ack-failed as well. Currently MySensors never resends any messages. You have to program it into your serial application by yourself. It would have to wait for an ACK message and send again, if it didn't come back within time. In the linked thread we are hoping to find a way for implementing this on the hardware of the gateway.
  • Node.js Modules for MySensors

    2
    1 Votes
    2 Posts
    1k Views
    tbowmoT
    @wpreul There are also modules available for node-red: http://forum.mysensors.org/topic/1965/nodered-injected-between-domoticz-and-mysensors https://www.npmjs.com/package/node-red-contrib-mysensors
  • Request: Humidity and temperature sensors calibration variable.

    5
    0 Votes
    5 Posts
    2k Views
    TheoLT
    @wim Glad that I could help.
  • A question could be written so in the EPROM memory of a node.?

    3
    0 Votes
    3 Posts
    1k Views
    M
    I meant not save the state locally, I want to send a status and save it to a memory address automatically. For xample in esp2666 gateway to remotely write the key wify and network name and save memory addresses It would be a command such as node address, memory address, value
  • How to read a seven segment display?

    6
    0 Votes
    6 Posts
    2k Views
    karl261K
    [image: 1445117073033-image.jpg] I think it does not look too complicated. Finally got around to open the thing. I am surprised by its simplicity, at least it looks like. Plenty of space. But I am scared that the display is just pressed into the board. I hope I won't kill it. So know I have to find out how it works... It should be also super easy to control the four buttons (only two are actually needed) with optocouplers... I wonder if it is possible to hack the radio transmission... Comments?
  • Water level code

    6
    0 Votes
    6 Posts
    3k Views
    P
    I am using straight bolts. I am still working through issues however combining multiple binary switches (bolts), 2 moisture sensors, and a relay.
  • Domoticz Temperature display on sensor node

    domoticz request vtemp
    10
    0 Votes
    10 Posts
    8k Views
    C
    Hi This is a typical homer project in that I spend half an hour here and half an hour there so it moves very slowly! What I have so far: Plan for 10-15 zone heating control based on standard Y plan heating system. I need to generate control signals for: Boiler on DHW valve on Heating valve on *12-13 radiator valve heads (24v DC) a) Domoticx setup based on a list of zones - the lua scripts are maybe 75% done and working so far - needs tweaks and tidying up before its shareable sensibly. b) Battery powered sensor/ display node arduino based. Has dallas DS1820 temp sensor, 128 x 64 Oled display and three buttons using mysensors 2.4Ghz radio. It links with domoticz, displays (on demand) the room temp, setpoint and the buttons allow local control - boost/cut temp to xDeg for 1 hr. The sensor runs off 2 x AAA cells and takes 11uA standby with pulses of 25mA so could just run off a coin cell for 12-18months. The code is 80-90% complete but haven't started a PCB yet. c) Dallas one wire sensors for some rooms where I am not bothering with a local display node. Also to be used for DHW and outside temperature for display/prediction. d) Some 24vDC thermal actuators for the radiators - that's the biggy and now won't happen till next year and the heating is off. I also need to replace some valve bodies on some radiators so it will need (at least) a day off work at some point to do all the plumbing. e) Android front end based on Netio - tried open remote but found that a bit long winded. This is 20% complete - just done 2 zones to prove the concept. This will drive a wall mounted tablet replacing the old room stat and also be the interface from my phone etc when away from home. f) I haven't started boxing up the RPI - it needs a 24cDC 2-3 amp PSU for the radiator valves and wiring to all rooms - yuk! This may wet your appetite but it is very much a work in progress and wouldn't make much sense if I published it yet. I'll post bits as they become meaningful - but its a way away yet. If nothing else it tells you what's possible. That has taken me quite a bit of experiment to get this far.I've tried at least 5 different home automation packages and have now settled on Domoticz and Netio front end. At least - now I am on the implementation phase! Regards Coppo
  • Implementing Controller(arduino yun) In Gateway

    16
    0 Votes
    16 Posts
    5k Views
    A
    @phill No one is helping here.............
  • List all connected nodes

    1
    0 Votes
    1 Posts
    777 Views
    No one has replied
  • Managing interrupts from several sources

    7
    0 Votes
    7 Posts
    3k Views
    joaoabsJ
    Hello, Fresh update: With 5k1 pull-down resistors the reel switches work as expected (with the diode "OR"), so I can keep the original plan and use the MySensors sleep methods. Thanks for that tip! And by the way, is it possible to configure the MySensors interrupts on the rising edge, or is it just limited to change? However, with the PIR (modified to work at 3.3V) the maximum voltage it reaches with a 5k1 pull-down resistor is 2.2V, witch is still not enough to activate the interrupt. I kept increasing the pull-down resistor up to 20k, but then the behaviour gets erratic: It starts activating/deactivating without any sense. Was anyone been able to use a modified HC-SR501 PIR (initial diode and 3.3v voltage regulator bypassed) successfully, or the step up to 5V is really needed? (Its a shame to step up 3.3v to 5v so then step it down again to 3.3v, but if there is no other way...). Anyone willing to share the experience with HC-SR501 PIR's in mysensors framework? Thanks, Joao
  • routing protocol

    2
    0 Votes
    2 Posts
    833 Views
    hekH
    Repeater nodes keep a list in EEPROM on where to send messages (next hop) so they'll reach the final target. This table is kept updated by inspecting messages arriving to the repeater. You'll probably have to look in the code for more details.

17

Online

11.7k

Users

11.2k

Topics

113.0k

Posts