Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. canyouhearmenow
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by canyouhearmenow

    • USB Serial missing on Maple Mini

      I am trying to use a Maple Mini clone with MySensors, with an NRF24 radio wired to SPI1 as described in MyHwSTM32F1.cpp

      • I can flash the board with a simple test script that has Serial.begin() in setup(), and it will present as a USB serial device to the Windows host (as COM23) ... so far, so good
      • When I flash a script using MySensors, no USB serial device is presented
      • When I redirect MySensors output to the "real" serial port with #define MY_SERIALDEVICE Serial1 and #define MY_DEBUG, I get the MySensors splash screen and all the expected log messages at the real serial output, but the script hangs after the call to Serial.begin() in setup()

      Oh, and I'm doing all this in Platformio, and my platformio.ini both for the "working" simple script and the "non-working" MySensors script contains

      platform = ststm32
      framework = arduino
      board = maple_mini_b20
      board_build.core = maple
      build_flags = 
          -D USBD_USE_CDC
          -D USB_MANUFACTURER="Leaflabs"
          -D USB_PRODUCT="\"Maple Mini\""
          -D ENABLE_USB_SERIAL
          -D ARDUINO_ARCH_STM32F1
      monitor_port = COM23
      

      How does MySensors interfere with the creation of the USB serial device?

      posted in Troubleshooting
      canyouhearmenow
      canyouhearmenow
    • RE: nRF24Doctor

      I need some help.
      I just built an NRF24Doctor following the instruction in the post and on Github.

      • When no NRF24 module is connected, the device starts properly, displays the menu on the LCD, and when I try to select a menu item, it (correctly) displays "Radio init error. Replace radio".

      • When an NRF24 mode is connected (I tried several), the LCD is blank, the serial monitor shows "Channel:90 PaLevel:HIGH PaLevelGw:LOW DataRate:250KBPS Dest:0 Payload:2 Rate:10" in an endless loop.

      • when I run the older "nRf24L01+ connection quality meter" software, it starts ok and the LCD shows FAIL 0% and MISS 0% as expected.

      Any ideas for what might cause this problem? Almost looks like it resets in a loop, maybe because the watchdog triggers? or stack corruption?

      posted in My Project
      canyouhearmenow
      canyouhearmenow
    • MyGasMeter – a low-power link between the gas meter and home automation

      This sensor node is attached to the gas meter in my home. It uses a 2,4 GHz RF link to a MySensors-to-MQTT gateway to report natural gas consumption data to my home automation controller. The gas meter is of the type that creates magnetic pulses when the meter dial moves, so the connection is contact-less, and works without access to the inside of the “official” meter from the utility company.
      MyGasMeterX lg open.jpg

      Initially, MyGasMeter only reports incremental data:

      • frequently, it reports the incremental pulse count since the last report.
      • once per hour, it reports flow [liters/hour] calculated from pulse count.

      Once it has received a base count value from the controller (see below), it also starts reporting absolute data:

      • frequently, it reports the absolute pulse count, i.e. base value + pulses since power on.
      • once per hour, it reports total gas volume [liters] consumed, i.e. (base value + pulses since power on) * liters/pulse.

      With this two-stage approach, the node will always report correct absolute pulse count, even if the gateway misses a message now and then. Also, you can replace the battery on the node and then re-initialize it for the correct absolute pulse count, without relying on EEPROM memory.

      In my home automation setup, this is integrated with openHAB, but it should also be usable with other controllers, because all communication is done via MQTT.

      The node must be battery-powered (read: low supply current, sleep as much as possible), but it can’t use the MySensors sleep() function, because it needs a fairly accurate time base so it can report flow in liters per hour.

      It uses the (not so accurate) internal RC oscillator of the AVR to clock the CPU, but a (much more accurate) external 32768 Hz crystal to clock Timer2, which generates interrupts every 10ms, so it can debounce the reed switch, and do all other housekeeping as needed.

      In between interrupts, it sleeps in SLEEP_MODE_PWR_SAVE mode, which stops most of the processor’s peripherals, except for Timer2. During sleep, Timer0 as used by the Arduino framework is stopped, so we can’t rely on the Arduino millis() function for timing. Instead, we use a milliseconds counter incremented by the Timer2 ISR for timing purposes (has an hour passed? should we report pulse count or flow or climate?).

      Source code and schematics are available in Github. For a more detailed technical description , please visit my blog.

      posted in My Project
      canyouhearmenow
      canyouhearmenow
    • RE: CR2032 coin cells - expected life?

      @Michiel-van-der-Wulp using a megaohms pull-up resistor solves the problem with current consumption, but now you have an input that is more susceptible to interference, because it is high impedance.

      posted in Hardware
      canyouhearmenow
      canyouhearmenow
    • RE: CR2032 coin cells - expected life?

      Good idea to measure battery voltage after an RF transmission, not before ... never thought of that.

      I have built window sensors that last more than 36 months on one CR2032. I usually set the brownout threshold to 1.8V, not 2.7V, and then replace the battery when the voltage drops below ~2.2V.

      You have to be careful not to power any sensors while the node is asleep, that also applies to the lowly reed switch windows sensor! If you just connect it to an input pin and use the internal pull-up of the ATmega processor, then you have a current flowing all the time, when the window is closed and therefore the reed switch inside the sensor is closed. That current is higher than the sleep mode power consumption of the whole processor!

      I can see why internal clock vs 8 MHz crystal doesn't make a difference -- most of the time, the processor will be asleep with all clocks stopped, and a stopped 8 MHz crystal oscillator consumes as much power as a stopped internal RC oscillator ...

      You can find more details about what to watch out for, and some measurements with different configurations, here.

      posted in Hardware
      canyouhearmenow
      canyouhearmenow
    • MyMotionSensor - a low-power sensor for motion and ambient brightness

      I needed a couple of motions sensors to automate lighting in hallways and other rooms. Since the lights should only turn on when it is dark, the system also needs to know the ambient light level in the location where the motion was detected -- so I added a simple brightness sensor to each node.

      This is based on an Arduino Pro Mini clone, it is low power (runs for >18 months one a pair of AA batteries) and low cost (cost of materials <EUR 10 ).

      Source code and schematics are available in Github, and a more detailed description here.

      MyMotionSensor Open.jpg

      I chose the smaller HC-SR505 PIR sensor rather than the larger HC-SR501 sensor used in the MySensors motion sensor example. The PIR sensor appears to be sensitive to power supply fluctuations. In the first prototype, it would often re-trigger immediately after its output returned to low (inactive), presumably because sending a message via the NRF24L01+ module would draw current from the battery, and cause a drop in supply voltage. Therefore, the software ignores transitions of the PIR sensor output for a few seconds after going to sleep.

      posted in My Project
      canyouhearmenow
      canyouhearmenow
    • RE: MySensorsTracker - a simple logger for MySensors MQTT messages

      @evb Still haven't had a chance to look at your PR, sorry.
      Yes, the database tends to grow 🙂 I have about 80MB after a year of use. Just added a function to delete all messages older than, say, a year.

      posted in My Project
      canyouhearmenow
      canyouhearmenow
    • RE: MySensorsTracker - a simple logger for MySensors MQTT messages

      @evb Thanks for your contribution, I will look at your pull request as soon as I can!

      I have adopted a convention for my sketches where they all report the project name and subversion revision number. In the presentation() function, I have a line like

      sendSketchInfo("MyWindowSensor", "$Rev: 1267 $" );
      

      The API version is sent by the MySensors framework automatically.

      The date of the last battery change I have to enter manually (Nodes screen, popup menu item "battery replaced" when you hover over the node number).

      posted in My Project
      canyouhearmenow
      canyouhearmenow
    • MySensorsTracker - a simple logger for MySensors MQTT messages

      I needed a simple tool for keeping track of all the MySensors nodes which I had built and deployed around the house over the years:

      • what is the battery level of each sensor node?
      • what was the last time I changed the battery on that sensor node, i.e. how many months has it been running with the current battery?
      • see at a glance if a sensor has crashed, i.e. has not sent any messages for, say, more than a day
      • is a sensor node sending strange messages?

      This is implemented as a Python script running on a server, with a web-based interface for browsing and filtering messages.

      Source code and documentation in Github

      Here are a few screenshots:
      f0dc543d-0d2c-4411-9ae3-39f6da5b62a9-image.png

      b1865410-8e2e-42f5-92c1-562cdab6e604-image.png

      c2e0a623-5b2c-46b7-adc3-a54c69b67939-image.png

      posted in My Project
      canyouhearmenow
      canyouhearmenow
    • RE: Millis and sleep

      instead of using sleep() and the watchdog timer, you could use a 32768 Hz watch crystal and keep timer T2 running during "sleep". I have built some simple window sensor nodes that consume 10µA when using the sleep() function, and 11µA when using a timer2 interrupt every 20ms, and set_sleep_mode(SLEEP_MODE_PWR_SAVE);
      With the external watch crystal, T2 keeps running during "sleep", whereas the sleep mode used by the MySensors sleep() functions stops all timers, afaik.

      posted in Feature Requests
      canyouhearmenow
      canyouhearmenow
    • RE: Where did everyone go?

      MySensors is a very nice framework for building very low power sensor nodes ... in a hobbyist environment, I like it, I have sensors around the house that have been running for 2+ years on a coin cell battery.

      I am wondering if one of the reasons why no commercial player is offering MySensors-based gadgets might be the choice of license: MySensors is published under GPL, which commercial players may perhaps not be comfortable with. Other popular and successful open source projects, such as Arduino itself, are published under less restrictive licenses such as LGPL.

      posted in General Discussion
      canyouhearmenow
      canyouhearmenow