@ZenBlizzard , yes thanks, thats the point. How to deal with smartSleep() and battery lifetime.

Posts made by dirkc
-
RE: single-click, double-click, long-press button possible with MySensors?
-
single-click, double-click, long-press button possible with MySensors?
Hi all,
has anyone yet implemented some kind of multi tap button with MySensors?
Such as single-click, double-click, long-press, ... ?I think, I cannot work with interrupts, as I can get a HIGH/LOW once only and cannot count for long-press? Correct? And a battery mode node cannot be used either (with
smartSleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR_2),...
) because I have to check for e.g. a long-press which might last some seconds ...Thanks in advance for any comment or code example?
-
RE: bootloaders
@terence-faul any solution so far?
I found this:
create a file, e.g.
mysensors_bootloader_130_8Mhz.json
and save it to~/.platformio/boards/
{ "build": { "core": "arduino", "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO", "f_cpu": "8000000L", "mcu": "atmega328p", "variant": "standard" }, "frameworks": [ "arduino" ], "fuses": { "efuse": "0xFE", "hfuse": "0xD2", "lfuse": "0xE2", "lock": "0x0F", "unlock": "0x3F" }, "name": "MySensorsBootloader 1.3.0 (Atmega328P@8M,3.3V)", "upload": { "maximum_ram_size": 2048, "maximum_size": 30720, "protocol": "arduino", "require_upload_port": true, "speed": 57600 }, "url": "http://www.mysensors.org", "vendor": "MySensors" }
the platformio.ini should look like this:
[env:mysensors_bootloader_130_8Mhz] platform = atmelavr framework = arduino board = MYSBootloader_8MHz.hex src_build_flags = -I/Users/dirk/Arduino/libraries/MySensors lib_deps = # Using a library name
but I do not know where to store the
MYSBootloader_8MHz.hex
-
RE: Atmega328 internal temperature sensor (yes it exists!)
@mfalkvidd said in Atmega328 internal temperature sensor (yes it exists!):
hwCPUTemperature()
sorry, stupid question maybe, but with my 328p based sensors hwCPUTemperature() is not automatically callable using just
#include <MySensors.h>
--> neither with 2.2.0 nor with 2.3.0Do I have to include
/hal/architecture/AVR/MyHwAVR.h
?
Cannot compile it, what path should I use in the#include
statement? -
RE: π¬ simple MySensors MultiSensor Board
@terxw all files from https://www.openhardware.io/view/562/simple-MySensors-MultiSensor-Board were sufficient, when I ordered my boards at allpcb. But you can create them with eagle on your own.
-
RE: π¬ simple MySensors MultiSensor Board
I always suggest to use caps wherever you power the board, because it "levels" or "balances" the current so it has more "stability". The resistor connected to reset is always needed as "pull-up", without that, the processor will either reboot or be unstable.
-
RE: What did you build today (Pictures) ?
@thucar what display do you use and where did you buy it? What library did you use?
-
RE: Multiple Relays + Motion sketch, fully customizable, optional timer, manual override
@ostoja look at this video with an explanation of this topic and how to handle the IDs
https://forum.mysensors.org/post/26597 -
RE: Multiple Relays + Motion sketch, fully customizable, optional timer, manual override
@ostoja said in Multiple Relays + Motion sketch, fully customizable, optional timer, manual override:
// Present all sensors to controller for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { present(i, S_TEMP); } // Register all sensors to gw (they will be created as child devices) for (int sensor = 1; sensor <= NUMBER_OF_RELAYS; sensor++) { present(sensor, S_BINARY, "Relay", ack); }
With this two "for" loops you set present(n) multiple times. in the first for() you start with 0 until MAX_ATTACHED_DS18B20-1, in the second for() you start with 1 until NUMBER_OF_RELAYS-1, so this will assign the sensors with identical IDs as the relays.
I have not checked the internal code of this method, but I would think that you should better user a different range in the second for() loop starting at least with MAX_ATTACHED_DS18B20+1. -
RE: MBSBootloader with different CSN/CE Pin problem
Thanks, @tekka, but unfortunately I am still using the wrong code. I tried every combination, but as I am not sure what am doing here, I doubt to make progress.
set MOSI,SCLK,CE,CSN to OUTPUT ->
SPI_DDR = _BV(SPI_MOSI) | _BV(SPI_SCLK) | _BV(CE_PIN) | _BV(CSN_PIN)
set PB2 to OUTPUT ->| _BV(PB2)
set MISO to INPUT ->| ~_BV(SPI_MISO)
and set CSN to output ->CSN_DDR = _BV(CSN_PIN);
The controller still doesn't recognize the node, so I cannot use OTA. But when I flash the sketch (with the CE and CSN pin defined to 8 and 9) with a programmer to an atmega328p with a standard bootloader it works, so my PCB seems ok.
#elif defined(SPI_PINS_CSN9_CE8) // set pin mode: MOSI,SCLK,CE,CSN = OUTPUT, MISO = INPUT // PB2 is SS pin has to be defined as OUTPUT, else SPI goes to slave mode SPI_DDR = _BV(SPI_MOSI) | _BV(SPI_SCLK) | _BV(CE_PIN) | _BV(CSN_PIN) | _BV(PB2) | ~_BV(SPI_MISO); // set CSN = output CSN_DDR = _BV(CSN_PIN); #endif
Looking to other bootloaders was no success, e.g. optiboot.
Thanks in advance for any hint or better some sample code.
-
RE: MBSBootloader with different CSN/CE Pin problem
@tekka I also did some changes to assign the SPI pins CSN to pin 9 and CE to pin 8.
So the code in the
HW.h
now looks like this, but I am not sure how to change theinitSPI()
method:#elif defined(SPI_PINS_CSN9_CE8) #define CSN_PORT PORTB // port for CSN #define CSN_DDR DDRB // DDR for CSN #define CSN_PIN PB1 // Arduino Pin 9 <-> Bit 1 of port B #define CE_PORT PORTB // port for CE #define CE_DDR DDRB // DDR for CE #define CE_PIN PB0 // Arduino Pin 8 <-> Bit 0 of port B #endif
static void initSPI(void) { // Initialize the SPI pins: SCK, MOSI, CE, CSN as outputs, MISO as input #if defined(SPI_PINS_CE9_CSN10) // CSN_PIN (=PB2) is SS pin and set as output SPI_DDR = _BV(SPI_MOSI) | _BV(SPI_SCLK) | _BV(CE_PIN) | _BV(CSN_PIN); #elif defined(SPI_PINS_CSN7_CE8) // PB2 is SS pin has to be defined as OUTPUT, else SPI goes to slave mode SPI_DDR = _BV(SPI_MOSI) | _BV(SPI_SCLK) | _BV(CE_PIN) | _BV(PB2); CSN_DDR = _BV(CSN_PIN); #elif defined(SPI_PINS_CSN9_CE8) // set pin mode: MOSI,SCLK,CE,CSN = OUTPUT, MISO = INPUT SPI_DDR = _BV(SPI_MOSI) | _BV(SPI_SCLK) | _BV(CE_PIN) | _BV(CSN_PIN) | ~_BV(SPI_MISO); // set CSN = output CSN_DDR = _BV(CSN_PIN); #endif
Is there any further code I have to change?
Thanks in advance for any hint, I am not used to code on that bit level and AVR macros.
-
RE: π¬ MySensors Light Switch
What kind of Solid State Relay do you use? Can you switch 230V/4W LED bulbs with this Solid State Relay? I tried some "Songle" relays once and that causes the bulb to flicker all the time.
-
RE: Is there a logging function in the Raspberry Pi Gateway?
@strangeoptics I've created a simple python file just to connect to an ethernet MySensors gateway and monitor all output:
https://github.com/dirkclemens/myssniffer.py/blob/master/myssniffer.py
If you want to use it with a serial gateway you have to make some changes in the main() routine to grab data from the usb port instead the ethernet port. -
RE: Adding a local RCSwitch to a serial gateway crashes it
@LastSamurai
I did more or less the same, but two calls are different in my settingIn presentation() I use this call, but that is not your problem
present(i, S_BINARY, "Relais");
I suggest to change the send() method like this, because you first have to select the relay with setSensor()
send(msgRelay.setSensor(CHILD_ID_RELAY1+i).set((bool)bValue));
-
RE: best approach to add MySensors Node to an existing smoke detector?
@user2684 good approach, I'll have to check my smoke detector, which is a German brand
https://www.amazon.de/Merten-547019-ARGUS-Rauchmelder-polarweiΓ/dp/B000ONMOGQ
Don't know if the schematic is available. -
best approach to add MySensors Node to an existing smoke detector?
I have several smoke detectors around in my house, all driven by a 9 Volt block but without a radio. I think about the best approach to add a MySensors node to it. I do not have the schematics of the smoke detector.
I want to use the 9 Volt block, so the node needs a voltage regulator.
The node should draw as less current as possible, so connecting the buzzer from the smoke detector via an optocoupler to the MySensors node will need far too much current. What about a zener? What about a voltage divider (resistors) to reduce buzzer voltage to Arduino pin level?
Any other idea? Thanks in advance -
RE: Need advice on choosing software
@iamtheghost if you are looking for a universal solution, openhab2 is worth a closer look. MyController is focusing on MySensors only, but for this scenario, I find it useful. Simple installation, easy to use.
I've tried openhab 1.7 with my devices but it uses far too much resources on my raspberry 2. consider a platform with at least 2GB of ram.
So I switched back to FHEM as this is the only solution supporting my old FS20/FHT devices. UI definitively needs some polish and I really don't like perl, but I still have these old devices. MySensors is fully supported in FHEM. -
RE: Need advice on choosing software
@iamtheghost have you checked this: https://www.mysensors.org/controller
What about this
http://mycontroller.org/ -
RE: Windows GUI/Controller for MySensors
I have problems using the OTA feature with MYSController.
- "undefined firmware/type" reported.
My setup:
- ESP8266 Gateway 2.1.1
- MYSController Version 1.0.0beta (build 3314)
- atmega328p chip with own pcb, internal osc 8MHz, and MYSBootloaderV13pre.hex (taken from the same zip file as MYSController.exe)
The log file in MYSController shows "undefined firmware/type" :
Where can I find the latest software (exe and boot loader)?
-
the "Reload repo" toolbar button is always greyed, but the "firmware_config" is available, has all entries and the hex files are in the same directory.
-
is there a more detailed description available for the columns of the "firmware_config" file?
thanks in advance
- "undefined firmware/type" reported.
-
RE: MyMessage with bool value from relay state to controller (fhem)?
@gohan I don't know. I also tried
V_STATUS
, doesn't work either ...edit:
V_STATUS
works, was a wrong configuration in FHEM -
MyMessage with bool value from relay state to controller (fhem)?
I have a 4 channel relay in my node (version 2.11).
It can be controlled by FHEM. Working fine so farAdditionally I have a RCSwitch (https://github.com/sui77/rc-switch) receiver connected to the same node to switch the same 4 channel relay via a remote control (one of those cheep 433Mhz remote controls / seems to be stupid, but is necessary as backup)
When I receive the messages from the remote control via RCSwitch I want to send a MyMessage to the controller and front-end to visualize the status.
send(msgRelay.setSensor(CHILD_ID_RELAY1+id).set((bool)bValue));
The UI doesn't seem to receive these messages, instead the log shows
MYSENSORS_DEVICE MYSENSOR_1: ignoring C_SET-message no reading-mapping for childId 1, type tripped
I define the message like:
MyMessage msgRelay(CHILD_ID_RELAY1, V_TRIPPED);
Any idea? Thanks in advance
-
RE: π¬ Building a Raspberry Pi Gateway
@marceloaqno ok, thanks, I will change the radio.
-
RE: π¬ Building a Raspberry Pi Gateway
@gohan, @marceloaqno : sorry, I corrected the "typo", the NRF was already connected as shown in https://www.mysensors.org/view/180#wiring. I double checked that again.
What is the correct setup for ./configure ? -
RE: π¬ Building a Raspberry Pi Gateway
When talking about this Raspberry Pi Gateway, I suppose, that its just connecting the NFR24L01+ to the Raspberry Pi GPIO and run
./bin/mysgw -d
right? On my Pi it does not work this way, maybe the NFR24L01+ is not ok. Instead I am running an external esp-wifi-gateway, but a direct gateway seems the better solution to me.
So did I get it right, that I can use a NFR24L01+ connected to the Raspberry PI GPIO without any external gateway? If so, what are the parameters for building the mysgw daemon? I tried this one:./configure --spi-driver=SPIDEV --spi-spidev-device=/dev/spidev0.0
update: as in https://www.mysensors.org/view/180#wiring
22 β CE
24 β CSN/CS
23 β SCK
19 β MOSI
21 β MISOSPI is activated:
$ls /dev/spidev* /dev/spidev0.0 /dev/spidev0.1
And this is the result, when building it with the settings mentioned above. (Raspberry Pi 3, jessie 4.9.13-v7+)
$ sudo ./bin/mysgw -d mysgw: Starting gateway... mysgw: Protocol version - 2.1.1 mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1 mysgw: TSM:INIT mysgw: TSF:WUR:MS=0 mysgw: !TSM:INIT:TSP FAIL mysgw: TSM:FAIL:CNT=1 mysgw: TSM:FAIL:PDT mysgw: TSM:FAIL:RE-INIT mysgw: TSM:INIT mysgw: !TSM:INIT:TSP FAIL mysgw: TSM:FAIL:CNT=2 mysgw: TSM:FAIL:PDT mysgw: TSM:FAIL:RE-INIT mysgw: TSM:INIT mysgw: !TSM:INIT:TSP FAIL mysgw: TSM:FAIL:CNT=3 mysgw: TSM:FAIL:PDT mysgw: TSM:FAIL:RE-INIT mysgw: TSM:INIT mysgw: !TSM:INIT:TSP FAIL mysgw: TSM:FAIL:CNT=4 mysgw: TSM:FAIL:PDT
And can someone show how to bind this gateway into FHEM? As said, today I am running an esp-wifi-gateay.
Thanks in advance for any support...