What version of the PCB did you order? The NRF24 or the RFM69?
I used the NRF24 but found it very unreliable and swapped all my sensors to RFM69.
As almost every NRF24 from china is fake you will find out that the range between sensor and gateway is a couple of meters.
The RFM69 (on 868 MHz) will have a range up to 50 meters and above. If used indoors it will easy go over 30 meters.
Posts made by mickecarlsson
-
RE: 💬 Easy/Newbie PCB for MySensors
-
RE: Windows GUI/Controller for MySensors
Here is a version that I downloaded a long time ago.
EDIT: It seems that I can't upload files. Bummer. PM me if you want the file. -
RE: Windows GUI/Controller for MySensors
Bug in MYScontroller.
When I edit the file firmware_config.csv and set a version number with a decimal the output in the debug is wrong.
This is my file:Type,Name,Version,File,Comments 10,Blink,1,Blink.ino.hex,blinking example 20,Tvattstugan-2,3,Tvattstugan-2.ino.hex,Testar Flash 30,Tvattstugan,2,Tvattstugan.ino.hex,Tvattstugan 40,Sovrummet,2.1,Sovrummet.ino.hex,Sovrummet
Note that I have 2.1 as the version in 40, Sovrummet.
But when I load the repo in MYSController v is 65535:2021-02-13 17:06:37 REPO FW "Blink" loaded. t=10, v=1, blocks=80, crc=0x46D4 2021-02-13 17:06:37 REPO FW "Tvattstugan-2" loaded. t=20, v=3, blocks=1488, crc=0x6D13 2021-02-13 17:06:37 REPO FW "Tvattstugan" loaded. t=30, v=2, blocks=960, crc=0xBB4F 2021-02-13 17:06:37 REPO FW "Sovrummet" loaded. t=40, v=65535, blocks=936, crc=0x6AB3 2021-02-13 17:06:37 REPO FW repository loaded. Items=4
And in the GUI the version is also 65535.
Actually there are two bugs.
If I add (sloppy I know) more empty lines at the end in the firmware_config.csv file I get this in the debug:2021-02-13 17:13:35 REPO FW "Blink" loaded. t=10, v=1, blocks=80, crc=0x46D4 2021-02-13 17:13:35 REPO FW "Tvattstugan-2" loaded. t=20, v=3, blocks=1488, crc=0x6D13 2021-02-13 17:13:35 REPO FW "Tvattstugan" loaded. t=30, v=2, blocks=960, crc=0xBB4F 2021-02-13 17:13:35 REPO FW "Sovrummet" loaded. t=40, v=65535, blocks=936, crc=0x6AB3 2021-02-13 17:13:35 ERROR 2107-15-31 is not a valid date specification
Other than that, great piece of software. Thanks.
-
Faulty Easy PCB boards modified
I bought 20 of the Rev 10 Easy PCB boards from Openhardware, but could not get them to work with the flash memory.
See thread here: Bug in Easy PCB
So I just bite the dust and forgot about them. Until a couple of days ago when I decided to see if I could get them to work.
I modified the PCB and got them to work.
- The unmodified board
- Cut line between pin 7 and the capacitor and scrape of at the right of the C7.
- Solder the capacitor, solder a blob from the capacitor to the scraping.
- Solder a blob between pin 7 and 8 on the flash chip
- Solder a piece of wire between pin 6 of the flash chip and pin 13 of the Arduino.
I then started to try to flash the Sensebender OTA firmware to my Arduinos. It was a No Go, I had tons of trouble until I decided to change the Arduino to another version that I had.
Sad to say, all Funduino Mini pro's that I have are all faulty.
I had some other Mini pro that was marked Deek-Robot, those worked like a charm.
I did some testing yesterday and was able to flash new firmware via OTA and MYSController.
More about that in an another thread as I found some quirks in the process of doing OTA. -
RE: Started with MySensors and about to give up (some feedback)
I started with MySensors, Pro Mini and NRF24. I had tons of problems. I borrowed from work our WiFi scanner equipment and checked the 2.4 GHz. It was a total mess. Our DECT-phone almost killed the channel that was used for MySensors. And I discovered, as many has, the NRF24 was all counterfeit.
So, i trashed all NRF24 and moved to RFM69. That was nearly three years ago. My gateway is a Raspberry Pi.
My controller is Domoticz.
Conclusion, and a note to all MySensors users out there. Move away from NRF24 and go with RFM69, you will never look back. -
RE: What does 1 and 0 in send(msg.set(value==HIGH ? 1 : 0)) really means?
The code that you posted:
send(msg.set(value==HIGH ? 1 : 0))
Translates to this
If ”value” is HIGH (true) then send 1, if not send 0It has nothing to do with PIN 0 or 1
The same goes for
digitalWrite(RELAY_PIN_1, loadState(CHILD_ID_RELAY1)?RELAY_ON:RELAY_OFF);
It translates to
On RELAY_PIN_1, if it’s state is 1 write HIGH to RELAY_PIN_1 else write LOW.If you use serial in your sketch you can’t use PIN 0 or 1 as those pins are TX and RX.
-
RE: My experiences with MySensors
I started out with NRF 2.4 MHz radios for my 8 nodes MySensors and Domoticz. As I also install WiFi networks for customers and have access to our equipment at work I did a measurement at home because I could not get a reliable network.
First measurement revealed that my DECT wireless phone occupied the same channel that was the default for the NRF radios. And that my neighbors run their WiFi occupying all other channels. Equipment used was Ekahau.
I tried to tweak the channels but no avail.
So, I bought new radios, RFM833, and that was the end of my troubles. For two year now my eight nodes have not skipped a beat. I measure temperature, humidity, light (lux), UV and radioactivity.And all my WiFi at home is at 5GHz as the 2.4 was exhausted.
I have about 40 NRF radios in a box with no use for them. -
RE: My experiences with MySensors
@rodaman if you have bought real NRF modules you have been satisfied.
Or if you have bought RFM 433, 833 or 915 MHz radios you had been more that pleased.
Not MySensors fault. -
RE: My experiences with MySensors
Be aware that most of the cheap NRF boards from China are counterfeit. If you have those in an environment with a lot of WiFi you won’t get any range at all. And all “modifications” to improve range posted on YouTube are not any improvement.
You need to buy real NRF modules with external antenna.
Just my two cents. -
RE: Magic mirror
I do, really easy to setup. I have decided to only show the temperatures and battery status when battery level is low.
-
RE: 💬 Easy/Newbie PCB for MySensors
@sundberg84 if you look at the schematic you have connected MySX pin 10 to D2, but according to the spec for the MySX 2.4 it should go to D4.
-
RE: 💬 Easy/Newbie PCB for MySensors
I have now checked the PCB, and you are right @JPM
Pin 6 of the flash chip is not connected at all. No wonder I could not get that to work. Strangely is that the schematic is OK.
Thanks for finding this, I will modify my boards to get them working. -
RE: 💬 Easy/Newbie PCB for MySensors
I checked the schematic, and:
First mistake: Seems that the schematic is OK, the label for SCK (pin 6) is connected to physical pin 16 which is PCINT13 on the Arduino,
Second mistake: that is a bug, filter capacitor is not connected correctly.
Third mistake: That is also a bug, pin 7 and 3 should be connected to VCC
Now I am going to check the PCB, be back shortly, -
RE: 💬 Easy/Newbie PCB for MySensors
I just checked my batch of Rev 10, random check of the batch checked out OK. I have 20 boards.
-
RE: Anyone using FlashForge Finder?
@dbemowsk the Flashforge Finder dont have a heatbed and only uses PLA. And if you dont clean the bed with IPA it will lift. I always print with brim just to be sure.
-
RE: Anyone using FlashForge Finder?
Just do a regular calibration. Just hand tight the knobs, no force needed. Then start the calibration. Slowly rotate the knob until it the printer beeps. When the calibration is done. Print one of these that fits the bed thingiverse calibration
Carefully check the result. You should have a consistent print. If not, twist the knob closest to where you need to move re-calibrate. Thin line, the bed need to be closer to the nozzle, thick line that curls, move the bed away.
Note, when turning the knobs, just move it 1/4th turn each time. And make a note wich knob, the direction (clock wise or counter clock wise).To get more info, search on youtube for flash forge finder calibration, there are a lot of videos there.
-
RE: Anyone using FlashForge Finder?
I bought Buildtak that I replaced the bed with. I don’t use glue. I did print out a couple of calibration figures that I downloaded from Thingiverse. After a couple of re-calibrations and printing with the calibration figures I have not touched the calibration again.
However, when I printed the MySensors box from Thingiverse the corners still lifted.
That was when I found the suggestion to print with a rim.
Now my prints never lift.
I also clean the bed after each print with IPA. -
RE: Anyone using FlashForge Finder?
Print with a rim. There is a tickbox for it.
-
RE: Anyone using FlashForge Finder?
Yes, and I am very pleased with it.
-
RE: cannot save water meter in arduino EEPROM
@ahmedhodhod did it work with the suggested links?
-
RE: cannot save water meter in arduino EEPROM
PLease, DON’T write to eeprom in the loop(), you will destroy the eeprom. The lifecycle for the eeprom is 100000 writes/read, after that it is destroyed.
info about eeprom writes at arduinoEDIT: With the current code (write to eeprom every second) the eeprom will be destroyed after aprox 69 days.
-
RE: Very strange bugs. 2.3. RFM69.
I don't know if it affecting your case, but according to the source code for the BH1750 library you need to set the mode:
Source code for bh1750 library
Note that the begin() function needs a mode parameter, and that is used in configure, it if is not provided it is an invalid mode,void BH1750::begin(uint8_t mode) { Wire.begin(); //write8(mode); configure(mode); } void BH1750::configure(uint8_t mode) { switch (mode) { case BH1750_CONTINUOUS_HIGH_RES_MODE: case BH1750_CONTINUOUS_HIGH_RES_MODE_2: case BH1750_CONTINUOUS_LOW_RES_MODE: case BH1750_ONE_TIME_HIGH_RES_MODE: case BH1750_ONE_TIME_HIGH_RES_MODE_2: case BH1750_ONE_TIME_LOW_RES_MODE: // apply a valid mode change write8(mode); _delay_ms(10); break; default: // Invalid measurement mode #if BH1750_DEBUG == 1 Serial.println("Invalid measurement mode"); #endif break; } }```
-
RE: RFM69 new driver delay
@pepson said in RFM69 new driver delay:
And tell me how you have connected Gateway to RPI3? By ethernet or by serial ? Because i see in your building Gateway that you dont use parameter ETHERNET on port 5003
I use Ethernet to connect to my Domoticz.
The reason that you don't see my configuration for ETHERNET or PORT is because they are default when you configure.
If you look at the file Makefile.inc you will see the build options. In my case the file looks like this:SOC=BCM2837 CPPFLAGS=-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_RFM69 -DMY_RFM69_NEW_DRIVER -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RFM69_FREQUENCY=RFM69_868MHZ -DMY_IS_RFM69HW LDFLAGS=-pthread PREFIX=/usr/local CC=gcc CXX=g++ BUILDDIR=build BINDIR=bin GATEWAY_DIR=/usr/local/bin INIT_SYSTEM=systemd SPI_DRIVER=BCM
So in my case I have these defines:
MY_RADIO_RFM69
MY_RFM69_NEW_DRIVER
MY_GATEWAY_LINUX
MY_DEBUG
LINUX_SPI_BCM
LINUX_ARCH_RASPBERRYPI
MY_RFM69_FREQUENCY=RFM69_868MHZ
MY_IS_RFM69HW -
RE: RFM69 new driver delay
This is my generic temperature/humidity/battery level sketch that I use. I have upgraded all my nodes and gateway to 2.3.0 yesterday and I don't have any issue whatsoever
/** * 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. * ******************************* * * DESCRIPTION * * This is a sketch I use to measure temperature, humidity and battery level on * my Easy/Newbie PCB for MySensors (rev 9) * Hardware used: * Easy/Newbie PCB for MySensors * BME280 (I only use temperature and humidity, all code for barometic pressure removed) * */ // Enable debug prints to serial monitor //#define MY_DEBUG #define MY_SPLASH_SCREEN_DISABLED // This saves a couple of bytes // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER #define MY_RFM69_FREQUENCY RFM69_868MHZ #include <MySensors.h> #include <Wire.h> // Enables the Wire communication protocol. // Bosch BME280 Embedded Adventures MOD-1022 weather multi-sensor Arduino code, // written originally by Embedded Adventures. // https://github.com/embeddedadventures/BME280 #include <BME280_MOD-1022.h> // Internal battery measurement https://github.com/Yveaux/arduino_vcc #include <Vcc.h> // Change all text variables here, no need to hunt them down in the sketch // For sendSketchInfo() #define SKETCH_NAME "Generic Temeperature/Humidity" #define SKETCH_VERSION "1.13" // For present() #define PRESENT_TEMP_TEXT "Temperature Generic" #define PRESENT_HUM_TEXT "Humidity Generic" #define PRESENT_BAT_TEXT "Batteri Test-3" // Battery measurements const float VccMin = 1.8*1.0; // Min Vcc level, in Volts. Example for 2xAA Alkaline. const float VccMax = 2.0*1.5; // Max Vcc level, in Volts. Example for 2xAA Alkaline. const float VccCorrection = 1.0/1.0; // Measured Vcc by multimeter divided by reported Vcc Vcc vcc(VccCorrection); // VARIABLES YOU CAN CHANGE // Send temperature only if it has changed? 1 = Yes 0 = No. #define COMPARE_TEMP 0 // Set this value to the minimum change in temperature to measure. // BME280 has +-0.5 degrees precision, so it really doesn't matter that much. float tempThreshold = 0.5; // Send temperature only if changed? 1 = Yes 0 = No. #define COMPARE_HUM 0 // Set this value to the minimum change in humidity to measure. // BME280 has +-3% relative humidity precision, so it really doesn't matter that much. float humThreshold = 0.5; #define TEMP_CHILD_ID 1 #define HUM_CHILD_ID 2 #define VOLTAGE_CHILD_ID 3 float lastTemperature = -1; // Store previous measurement float lastHumidity = -1; // Stores the previous measurement bool reportRSSI = false; // true = send RSSI to controller int sendBattery = 6; // report battery level only after 6 loops = 6*4 minutes = 24 minutes // Placeholder for batteryloop, set to one above sendBattery so that we get a report on startup int batteryLoop = sendBattery + 1; // Time between send (in milliseconds), in this case, 4 minutes. unsigned long FOUR_MINUTE_SEND_FREQUENCY = 4 * 60000; // MYSENSORS COMMUNICATION VARIABLES MyMessage temperatureMsg(TEMP_CHILD_ID, V_TEMP); MyMessage humidityMsg(HUM_CHILD_ID, V_HUM); MyMessage voltageMsg(VOLTAGE_CHILD_ID, V_VOLTAGE); void setup() { #ifdef MY_DEBUG Serial.begin(115200); #endif Wire.begin(); // For the BME280 sensor #ifdef MY_DEBUG Serial.println(F("Starting ...")); #endif } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); // Present the sensors to the gateway and controller present(TEMP_CHILD_ID, S_TEMP, PRESENT_TEMP_TEXT); present(HUM_CHILD_ID, S_HUM, PRESENT_HUM_TEXT); present(VOLTAGE_CHILD_ID, S_MULTIMETER, PRESENT_BAT_TEXT); } void loop() { #ifdef MY_DEBUG Serial.println(F("Read BME280 and report it's values.")); #endif GetTemperatureHumidity(); // Get temperature and humidity if(batteryLoop > sendBattery) { // Is the batteryLoop higher than sendBattery? #ifdef MY_DEBUG Serial.println(F("Read the battery voltage and report it.")); #endif MeasureBattery(); // Measure and report battery level batteryLoop = 0; // Reset batteryLoop count } #ifdef MY_DEBUG Serial.print(F("Go to sleep for: ")); Serial.print(FOUR_MINUTE_SEND_FREQUENCY / 60000); Serial.println(F(" minutes.")); #endif batteryLoop++; // Increase batteryLoop before we sleep. sleep(FOUR_MINUTE_SEND_FREQUENCY); // Sleep for 4 minutes } /************************************************ * GetTemperatureHumidity() * Routine for measuring temperature and humidity * Generic one that fits my need ************************************************/ void GetTemperatureHumidity() { #ifdef MY_DEBUG Serial.println(""); Serial.println(F("BME280 - Requesting new data from sensor module.")); #endif BME280.readCompensationParams(); // Need to read the NVM compensation parameters. // Normal mode for regular automatic samples BME280.writeStandbyTime(tsb_0p5ms); // tsb = 0.5ms BME280.writeFilterCoefficient(fc_16); // IIR Filter coefficient 16 BME280.writeOversamplingPressure(os16x); // pressure x16 BME280.writeOversamplingTemperature(os8x); // temperature x8 BME280.writeOversamplingHumidity(os8x); // humidity x8 BME280.writeMode(smNormal); #ifdef MY_DEBUG Serial.println(F("Getting new values")); #endif while (BME280.isMeasuring()) { // Wait for BME280 to fininsh reading data #ifdef MY_DEBUG Serial.println("Measuring..."); #endif delay(50); } Serial.println("Done!"); // Read out the data - must do this before calling the getxxxxx routines BME280.readMeasurements(); float temperature = BME280.getTemperatureMostAccurate(); // Get the temperature first. float humidity = BME280.getHumidityMostAccurate(); // Get the humidity. #ifdef MY_DEBUG Serial.print(F("BME280 - Temperature = ")); Serial.print(temperature); Serial.println(" °C"); Serial.print(F("BME280 - Humidity = ")); Serial.print(humidity); Serial.println(F(" %")); #endif // Now, let's send the measurements to the gateway. // Send temperature if the temperature difference bigger than the threshold if (COMPARE_TEMP == 1 && abs(temperature - lastTemperature) < tempThreshold) { #ifdef MY_DEBUG Serial.print(temperature - lastTemperature); Serial.println(F(" Temperature difference too small, don't send it to gateway.")); #endif } else { #ifdef MY_DEBUG Serial.println(F("Sending new temperature to the gateway.")); #endif send(temperatureMsg.set(temperature, 1)); lastTemperature = temperature; // Save temperatures for compare in the next round. } // Send humidity if the humidity difference is bigger than the threshold. if (COMPARE_TEMP == 1 && abs(humidity - lastHumidity) < humThreshold) { #ifdef MY_DEBUG Serial.print(humidity - lastHumidity); Serial.println(F(" Humidity difference too small, don't send it to the gateway.")); #endif } else { #ifdef MY_DEBUG Serial.println(F("BME280 - Sending the new humidity to the gateway.")); #endif send(humidityMsg.set(humidity, 1)); lastHumidity = humidity; // Save new humidity to be able to compare in the next round. } #ifdef MY_DEBUG Serial.println(F("BME280 - Measurement complete. Putting sensor to sleep.")); #endif BME280.writeMode(smSleep); // set the BME280to sleep mode, save battery } // End of GetTemperatureHumidity /* * MeasureBattery() * Routine for measuring battery level * Generic one that fits my need * NOTE: You need to calibrate the measurement to get correct readings */ void MeasureBattery() { float Vbat = vcc.Read_Volts(); int batteryPercent = static_cast<int>(vcc.Read_Perc(VccMin, VccMax)); #ifdef MY_DEBUG Serial.print(F("Battery percent: ")); Serial.print(batteryPercent); Serial.println(" %"); Serial.print(F("Battery Voltage: ")); Serial.print(Vbat); Serial.println(F(" Volts")); #endif sendBatteryLevel(batteryPercent); send(voltageMsg.set(Vbat,2)); //send battery in Volt 2 decimal places }
-
RE: RFM69 new driver delay
You only need repeater fi you have a node far away that can’t reach the gateway, then you add repeater on a node nearer the gateway.
See here: MySensors Network
And if the node has repeater defined it must allways have power and no Sleep.
Sorry, I can’t test the sketch. -
RE: RFM69 new driver delay
You don't ned to change bootloader, I do because I run on battery and it fits my need.
I can't test your sketch as I don't have the necessary hardware to test it.
How far apart are your nodes?
My antenna is from AliExpress -
RE: RFM69 new driver delay
OK,
Here goes what I have:
Arduino Pro Mini, chinese clones. Regulator and led removed. Soldered on EasyPCB rev 9.
Radio is RFM69 868 MHz with helicoil antenna on the nodes, 86 mm antenna on the Gateway
Bootloader is from https://github.com/MCUdude/MiniCore
The bootloader settings are:
Board: ATmega328
Bootloader: Yes
Variant: 328P / 328PA
BOD: 1.8v
Clock: 1MHz internal
Compiler LTO: Disabled (default)On the EasyPCB I have only soldered the radio, the antenna and the Arduino. No booster, no capacitors, no resistors.
I have put a link on the REG and run the node on two AA batteries.
The nodes only have one sensor, the BME280.The controller I use is Domoticz, latest version (I think).
I have now reprogrammed some of the nodes to 2.30 and I use NEW_DRIVER.
Gateway - 2.3.0
Patio - 2.3.0
Test-node - 2.3.0
Kitchen - 2.3.0
Bedroom - 2.3.0
UV and LUX - 2.3.0No problems at all.
However, I do not use the receive() function on my nodes.
And I see that you use the REPEATER setting, if your node can reach the gateway the disable repeater. -
RE: RFM69 new driver delay
I just checked all my nodes:
- Garage - measures temperature/humidity and power usage - uses NEW_DRIVER, Arduino UNO, powered all times.
- Storage - measures temperature/humidity and power usage - uses NEW_DRIVER, Arduino UNO powered all times.
- Greenhouse - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
- Patio - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
- Bedroom - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
- Kitchen area - measures temperature/humidity - uses "old" driver, Arduino Pro Mini, battery powered.
My nodes are within 40 meters from the gateway.
I will no reprogram the node 4 and 5 to use the new driver to see if that makes any difference.
Node 1 and 2 are the nodes farthest away from the gateway, there is one brick wall and three wood walls between the node and the gateway. -
RE: RFM69 new driver delay
Just a hunch, add 4 mm to it so that it is 86 mm instead..
And the power supply for the RPi must be able to provide at leat 1.5 A at 5Volt. Dont go for a cheap powersupply, it wont cope with the power drain from the ROi. -
RE: RFM69 new driver delay
What kind of antenna do you have on the RPi for the radio? And what kind of antenna do you have on the node?
-
RE: RFM69 new driver delay
@mickecarlsson said in RFM69 new driver delay:
> cat /proc/cpuinfo > . > . > Hardware : BCM2835 > Revision : a02082
Type as above and check the last entries, my RPi is revision a02082
Se here for more info:
Raspberry Pi revision codes -
RE: RFM69 new driver delay
@pepson
Yes, I run gateway 2.30 and nodes on 2.20 without new driver. No probems. -
RE: RFM69 new driver delay
I run mysgw 2.30 on a RPi 3 Model B and all nodes on 2.20 with RFM69:
cat /proc/cpuinfo . . Hardware : BCM2835 Revision : a02082
I did a git pull then configured:
./configure --my-transport=rfm69 --my-is-rfm69hw --my-rfm69-frequency=868 make sudo make install
Note that I don't use LED's or specify gateway. My Controller is Domoticz
I then started the gateway with debug (note missing -d) (and the log is from today):
pi@mysensors-gw:~ $ sudo /usr/local/bin/mysgw Jun 21 06:36:58 INFO Starting gateway... Jun 21 06:36:58 INFO Protocol version - 2.3.0 Jun 21 06:36:58 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,VER=2.3.0 Jun 21 06:36:58 DEBUG TSF:LRT:OK Jun 21 06:36:58 DEBUG TSM:INIT Jun 21 06:36:58 DEBUG TSF:WUR:MS=0 Jun 21 06:36:58 DEBUG TSM:INIT:TSP OK Jun 21 06:36:58 DEBUG TSM:INIT:GW MODE Jun 21 06:36:58 DEBUG TSM:READY:ID=0,PAR=0,DIS=0 Jun 21 06:36:58 DEBUG MCO:REG:NOT NEEDED Jun 21 06:36:58 DEBUG Listening for connections on 0.0.0.0:5003 Jun 21 06:36:58 DEBUG MCO:BGN:STP Jun 21 06:36:58 DEBUG MCO:BGN:INIT OK,TSP=1 Jun 21 06:37:18 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;2; Jun 21 06:37:18 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;2;Get Version Jun 21 06:37:20 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;18;PING Jun 21 06:37:30 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;18;PING Jun 21 06:37:37 DEBUG TSF:MSG:READ,22-22-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.3 Jun 21 06:37:37 DEBUG TSF:MSG:READ,22-22-0,s=2,c=1,t=1,pt=7,l=5,sg=0:48.0
After the debug check I pressed ctrl-c and started mysgw as a service
sudo systemctl start mysgw.service
System has been running without any hickup since then.
If you check the commit 2175c993ef81b78527c85649f5bdc3585d2f41b2 you will notice that -d is removed and some other features has been added.
git log 2175c993ef81b78527c85649f5bdc3585d2f41b2 commit 2175c993ef81b78527c85649f5bdc3585d2f41b2 Author: Marcelo Aquino <marceloaqno@users.noreply.github.com> Date: Fri Mar 23 07:00:34 2018 -0300 Linux: Use config file for gateway settings (#1061) - The following settings can be use on the config file: - verbose=[debug,info,notice,warn,err] - Logging verbosity. - log_file[0|1] - Enable logging to a file. - log_filepath=(FILE) - Log file path. - log_pipe=[0|1] - Enable logging to a named pipe(aka fifo). Use this option to view your gateway's log messages from the log_pipe_file (defined below). To do so, run the following command on another terminal: - $ cat "log_pipe_file" - log_pipe_file=(FILE) - syslog=[0|1] - Enable logging to syslog. - eeprom_file=[/etc/mysensors.eeprom] - eeprom_size=[1024] - Change some mysgw parameters: - Added: - -q, --quiet: for quiet mode, disable log messages written to the terminal. - Removed: - -d, --debug: removed, log messages are now enabled by default. - Replaced: - -b, --background: replaced by --daemon - isatty() is no longer used, log messages by default are printed to stderr unless the gateway is started with --quiet (#1022) - MY_LINUX_CONFIG_FILE: no longer holds the path to the eeprom file, but to the configuration file
My nodes has these definitions (I don't use New Driver):
#define MY_SPLASH_SCREEN_DISABLED // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_FREQUENCY RFM69_868MHZ
-
RE: 💬 Easy/Newbie PCB for MySensors
Still no rev 6 on itead or pcbway for rfm69 version
-
RE: 💬 Easy/Newbie PCB for MySensors
@sundberg84
OK, good news. I will check it tomorrow and hopefully order a batch (or two). -
RE: What did you build today (Pictures) ?
@sundberg84 the RFM69 is soldered 180 degrees wrong on the new board
-
RE: What did you build today (Pictures) ?
@sundberg84 thanks for the offer, I can wait for the final, no worries. Do you have a list of the new components added on the back?
-
RE: What did you build today (Pictures) ?
@sundberg84 how is the rev10 progress going? I am about to order a batch of EasyPCB but want the new bells and whistles
-
RE: Apparently incomplete RFM69HW modules received
It look like the RFM69W version.
See the different versions here: RFM69-versions -
RE: Possible Bug version 2.2.0
Test if this reduces your memory consumption.
This is what I have added
Disable the splash screen with:
#define MY_SPLASH_SCREEN_DISABLED // This saves a couple of bytes
Then for every serial.print I have embedded those with #ifdef MY_DEBUG/#endif
There is no need to serial print when running in silent mode.
I have also embedded the missing serial.print with the F("string") function.
This saves memory by storing strings in flash instead of memory.
I could not get the code to compile as I don't have the proper DHT library.// ---- - Stazione Meteo Francy Ver 1 - ---- // Enable debug prints // #define MY_DEBUG #define MY_SPLASH_SCREEN_DISABLED // This saves a couple of bytes // Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC #define MY_RF24_CHANNEL 84 #define MY_SIGNING_SOFT #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #define MY_SIGNING_REQUEST_SIGNATURES // Definisco il Nodo #define MY_NODE_ID 66 // Nomino i figli del Nodo #define CHILD_ID_TEMP 1 #define CHILD_ID_aaaa 2 #define CHILD_ID_HUMI 3 #define CHILD_ID_bbbb 4 #define CHILD_ID_BARO 5 #define CHILD_ID_LIGHT 6 #define LIGHT_SENSOR_ANALOG_PIN 0 const float ALTITUDE = 335; //----------------------------- Pressione //float pressione = 1017; //int forecast = 4; const char *weather[] = { "stable", "sunny", "cloudy", "unstable", "thunderstorm", "unknown" }; enum FORECAST { STABLE = 0, // "Stable Weather Pattern" SUNNY = 1, // "Slowly rising Good Weather", "Clear/Sunny " CLOUDY = 2, // "Slowly falling L-Pressure ", "Cloudy/Rain " UNSTABLE = 3, // "Quickly rising H-Press", "Not Stable" THUNDERSTORM = 4, // "Quickly falling L-Press", "Thunderstorm" UNKNOWN = 5 // "Unknown (More Time needed) }; //----------------------------------------- #include <SPI.h> #include <MySensors.h> #include <DHT.h> #include <Wire.h> #include <Adafruit_BMP085.h> DHT dht; //----------------------------- Adafruit_BMP085 bmp = Adafruit_BMP085(); // Digital Pressure Sensor float lastPressure = -1; float lastTemp = -1; int lastForecast = -1; const int LAST_SAMPLES_COUNT = 5; float lastPressureSamples[LAST_SAMPLES_COUNT]; // this CONVERSION_FACTOR is used to convert from Pa to kPa in forecast algorithm // get kPa/h be dividing hPa by 10 #define CONVERSION_FACTOR (1.0/10.0) int minuteCount = 0; bool firstRound = true; // average value is used in forecast algorithm. float pressureAvg; // average after 2 hours is used as reference value for the next iteration. float pressureAvg2; float dP_dt; bool metric; //----------------------------- //Dichiarazioni per pause dei diversi blocchi unsigned long int time; unsigned long int lettura_Press; unsigned long int lettura_Temp; unsigned long int letturaluce_time; //------------------------------ int lastLightLevel; //Dichiarazione Luminosita float temperatureDTH2; void presentation() { sendSketchInfo("Temp e Umidita", "3"); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_aaaa, S_LIGHT); present(CHILD_ID_HUMI, S_HUM); present(CHILD_ID_bbbb, S_LIGHT); present(CHILD_ID_BARO, S_BARO); present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); } MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgaaaa(CHILD_ID_HUMI, V_LIGHT); MyMessage msgHumi(CHILD_ID_HUMI, V_HUM); MyMessage msgbbbb(CHILD_ID_HUMI, V_LIGHT); MyMessage msgPres(CHILD_ID_BARO, V_PRESSURE); MyMessage msgForecast(CHILD_ID_BARO, V_FORECAST); MyMessage msg4(CHILD_ID_LIGHT, V_LIGHT_LEVEL); void setup() { // Setto il Pin dove e collegato il sensore di Temperatura DHT22 dht.setup(3); #ifdef MY_DEBUG //Settaggi del BMP180 if (!bmp.begin()) { Serial.println(F("Could not find a valid BMP085 sensor, check wiring!")); while (1) {} } #endif metric = getControllerConfig().isMetric; //Fine settaggi BMP180 //-- Setup Variabili MILLIS per sensore di Pressione time=millis(); lettura_Press = millis(); lettura_Temp = millis(); letturaluce_time = millis(); } void loop() { //Attivo Time MILLIS time=millis(); //----------- Inizio DHT22 ------------------------ if(time>lettura_Temp+12000){ delay(dht.getMinimumSamplingPeriod()); #ifdef MY_DEBUG Serial.println(F("--- Temperatura --- ")); #endif float temperatureDTH; float humidity = dht.getHumidity(); float temperatureDHT = dht.getTemperature(); temperatureDTH2 = temperatureDTH; //Invio la lettura della Temperatura send(msgTemp.set(temperatureDHT, 1)); //delay(6000); // Faccio una pausa ed invio altra lettura //Invio lettura Umidita send(msgHumi.set(humidity, 1)); //delay(4000); lettura_Temp=millis(); } //---------- Inizio Pressione --------------------------- if(time>lettura_Press+11000){ #ifdef MY_DEBUG Serial.println(F("--- Tempo passato lego la Pressione--- ")); #endif float temperatureDHT2; float pressure = bmp.readSealevelPressure(ALTITUDE) / 100.0; float temperature = temperatureDHT2; if (!metric) { // Convert to fahrenheit temperature = temperature * 9.0 / 5.0 + 32.0; } int forecast = sample(pressure); #ifdef MY_DEBUG Serial.print(F("Pressione = ")); Serial.print(pressure); Serial.println(F(" hPa")); Serial.print(F("Forecast = ")); Serial.println(weather[forecast]); #endif if (pressure != lastPressure) { send(msgPres.set(pressure, 0)); lastPressure = pressure; } if (forecast != lastForecast) { send(msgForecast.set(weather[forecast])); lastForecast = forecast; } lettura_Press=millis(); } //-------------- Inizio Luminosita -------------------------- if(time>letturaluce_time+10000){ #ifdef MY_DEBUG Serial.print(F("Tempo passato lego la Luce: ")); #endif int16_t lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; #ifdef MY_DEBUG Serial.println(lightLevel); #endif //delay(1000); if (lightLevel != lastLightLevel) { if(lightLevel > lastLightLevel + 7 || lightLevel < lastLightLevel - 7){ send(msg4.set(lightLevel)); #ifdef MY_DEBUG Serial.print(F("Invio nuova lettura LUX: ")); Serial.println(lightLevel); #endif lastLightLevel = lightLevel; } } letturaluce_time=millis(); } //Fine Luminosita //--------- Eventuale 4 Modulo ------------------------- // Chiusura Loop } //------------ Aggiuntivo Previsione del Barometro --------------------- float getLastPressureSamplesAverage() { float lastPressureSamplesAverage = 0; for (int i = 0; i < LAST_SAMPLES_COUNT; i++) { lastPressureSamplesAverage += lastPressureSamples[i]; } lastPressureSamplesAverage /= LAST_SAMPLES_COUNT; return lastPressureSamplesAverage; } // Algorithm found here // http://www.freescale.com/files/sensors/doc/app_note/AN3914.pdf // Pressure in hPa --> forecast done by calculating kPa/h int sample(float pressure) { // Calculate the average of the last n minutes. int index = minuteCount % LAST_SAMPLES_COUNT; lastPressureSamples[index] = pressure; minuteCount++; if (minuteCount > 185) { minuteCount = 6; } if (minuteCount == 5) { pressureAvg = getLastPressureSamplesAverage(); } else if (minuteCount == 35) { float lastPressureAvg = getLastPressureSamplesAverage(); float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR; if (firstRound) // first time initial 3 hour { dP_dt = change * 2; // note this is for t = 0.5hour } else { dP_dt = change / 1.5; // divide by 1.5 as this is the difference in time from 0 value. } } else if (minuteCount == 65) { float lastPressureAvg = getLastPressureSamplesAverage(); float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR; if (firstRound) //first time initial 3 hour { dP_dt = change; //note this is for t = 1 hour } else { dP_dt = change / 2; //divide by 2 as this is the difference in time from 0 value } } else if (minuteCount == 95) { float lastPressureAvg = getLastPressureSamplesAverage(); float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR; if (firstRound) // first time initial 3 hour { dP_dt = change / 1.5; // note this is for t = 1.5 hour } else { dP_dt = change / 2.5; // divide by 2.5 as this is the difference in time from 0 value } } else if (minuteCount == 125) { float lastPressureAvg = getLastPressureSamplesAverage(); pressureAvg2 = lastPressureAvg; // store for later use. float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR; if (firstRound) // first time initial 3 hour { dP_dt = change / 2; // note this is for t = 2 hour } else { dP_dt = change / 3; // divide by 3 as this is the difference in time from 0 value } } else if (minuteCount == 155) { float lastPressureAvg = getLastPressureSamplesAverage(); float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR; if (firstRound) // first time initial 3 hour { dP_dt = change / 2.5; // note this is for t = 2.5 hour } else { dP_dt = change / 3.5; // divide by 3.5 as this is the difference in time from 0 value } } else if (minuteCount == 185) { float lastPressureAvg = getLastPressureSamplesAverage(); float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR; if (firstRound) // first time initial 3 hour { dP_dt = change / 3; // note this is for t = 3 hour } else { dP_dt = change / 4; // divide by 4 as this is the difference in time from 0 value } pressureAvg = pressureAvg2; // Equating the pressure at 0 to the pressure at 2 hour after 3 hours have past. firstRound = false; // flag to let you know that this is on the past 3 hour mark. Initialized to 0 outside main loop. } int forecast = UNKNOWN; if (minuteCount < 35 && firstRound) //if time is less than 35 min on the first 3 hour interval. { forecast = UNKNOWN; } else if (dP_dt < (-0.25)) { forecast = THUNDERSTORM; } else if (dP_dt > 0.25) { forecast = UNSTABLE; } else if ((dP_dt > (-0.25)) && (dP_dt < (-0.05))) { forecast = CLOUDY; } else if ((dP_dt > 0.05) && (dP_dt < 0.25)) { forecast = SUNNY; } else if ((dP_dt >(-0.05)) && (dP_dt < 0.05)) { forecast = STABLE; } else { forecast = UNKNOWN; } // uncomment when debugging #ifdef MY_DEBUG Serial.print(F("Forecast at minute ")); Serial.print(minuteCount); Serial.print(F(" dP/dt = ")); Serial.print(dP_dt); Serial.print(F("kPa/h --> ")); Serial.println(weather[forecast]); #endif return forecast; }```
-
RE: Trouble wiring a Dalla 18B20 to Arduino D1 Mini
@zboblamont
No, it is shorting pin 1 and 3 on the DS1820 -
RE: Trouble wiring a Dalla 18B20 to Arduino D1 Mini
Remove the yellow wire behind the DS1820, you are shorting it.
-
RE: 💬 Easy/Newbie PCB (RFM69 HW/W edition) for MySensors
Yes, you can use the pictures. If you need better pictues I can provide it to you.
-
RE: 💬 Easy/Newbie PCB (RFM69 HW/W edition) for MySensors
I have just finished soldering my last four easypcb with BME280:
-
RE: 💬 Easy/Newbie PCB (RFM69 HW/W edition) for MySensors
This area that I have painted red. -
RE: 💬 Easy/Newbie PCB (RFM69 HW/W edition) for MySensors
Proposal.
Make two of the pads at the extra area with A4 and A5 (I2C) as more and more sensors are I2C.
Preferably the two pads next to VCC and GND.
Like the BMP280 and BME280, they are I2C with VCC, GND, SCL and SDA, so first line of pins in the extra area should be:
VCC o-o-o-o
GND o-o-o-o
A5 -o o o o
A4 -o o o oThe new layout with the SMD on the bottom layer looks good.
-
RE: 💬 Easy/Newbie PCB (RFM69 HW/W edition) for MySensors
Please make the pad for the antenna on the "bottom" larger, same as "above". Most ready-made antennas are with a 90 degree wire for easier soldering.
-
RE: 💬 Easy/Newbie PCB for MySensors
@sundberg84 I have now a node running with the BAT link removed, the REG link attached and I have used the Arduino_Vcc library.
The battery report are consistent with the battery voltage measured with a digital volt meter.
EDIT: Code below had a bug in it, I have fixed the bug and updated the code. The bug affected the temperature readings
So, to run the RFM69 board on two AA batteries I have done the following:- Removed regulator and led from Arduino
- Burned a new bootloader with a 1.7 volt BOD
- Put a link in REG position
- Solder radio to board
- Solder antenna to board.
- Solder BME280 to power and A5, A6
And that's it.
Here is my code:
/** * 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. * ******************************* * * DESCRIPTION * * This is a sketch I use to measure temperature, battery level and signal level on * my Easy/Newbie PCB for MySensors (rev 9) * Hardware used: * Easy/Newbie PCB for MySensors * BME280 (I only use temperature and humidity, all code for barometic pressure removed) * */ // Enable debug prints to serial monitor //#define MY_DEBUG #define MY_SPLASH_SCREEN_DISABLED // This saves a couple of bytes // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER #define MY_RFM69_FREQUENCY RFM69_868MHZ // #define MY_RFM69_ENABLE_ENCRYPTION #include <MySensors.h> #include <Wire.h> // Enables the Wire communication protocol. // Bosch BME280 Embedded Adventures MOD-1022 weather multi-sensor Arduino code, // written originally by Embedded Adventures. // https://github.com/embeddedadventures/BME280 #include <BME280_MOD-1022.h> // Internal battery measurement https://github.com/Yveaux/arduino_vcc #include <Vcc.h> #define SKETCH_NAME "Test-4" #define SKETCH_VERSION "1.10" // Battery measurements const float VccMin = 2.0*1.0; // Min Vcc level, in Volts. Example for 2xAA Alkaline. const float VccMax = 2.0*1.5; // Max Vcc level, in Volts. Example for 2xAA Alkaline. const float VccCorrection = 3.02/3.12; // Measured Vcc by multimeter divided by reported Vcc Vcc vcc(VccCorrection); // VARIABLES YOU CAN CHANGE // Send temperature only if it has changed? 1 = Yes 0 = No. #define COMPARE_TEMP 0 // Set this value to the minimum change in temperature to measure. // BME280 has +-0.5 degrees precision, so it really doesn't matter that much. float tempThreshold = 0.5; // Send temperature only if changed? 1 = Yes 0 = No. #define COMPARE_HUM 0 // Set this value to the minimum change in humidity to measure. // BME280 has +-3% relative humidity precision, so it really doesn't matter that much. float humThreshold = 0.5; #define TEMP_CHILD_ID 1 #define HUM_CHILD_ID 2 #define VOLTAGE_CHILD_ID 3 float lastTemperature = -1; // Store previous measurement float lastHumidity = -1; // Stores the previous measurement int sendBattery = 6; // report battery level only after 6 loops = 6*4 mintes = 24 minutes int batteryLoop = 0; // Placeholder for batteryloop unsigned long FOUR_MINUTE_SEND_FREQUENCY = 4 * 60000; // Time between send (in milliseconds). // MYSENSORS COMMUNICATION VARIABLES MyMessage temperatureMsg(TEMP_CHILD_ID, V_TEMP); MyMessage humidityMsg(HUM_CHILD_ID, V_HUM); MyMessage voltageMsg(VOLTAGE_CHILD_ID, V_VOLTAGE); void setup() { #ifdef MY_DEBUG Serial.begin(115200); #endif Wire.begin(); // For the BME280 sensor #ifdef MY_DEBUG Serial.println(F("Starting ...")); #endif } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); // Present the sensors to the gateway and controller present(TEMP_CHILD_ID, S_TEMP, "Temperature Test-4"); present(HUM_CHILD_ID, S_HUM, "Relative humidity Test-4"); present(VOLTAGE_CHILD_ID, S_MULTIMETER, "Battery Test-4" ); } void loop() { #ifdef MY_DEBUG Serial.println(F("Read BME280 and report it's values.")); #endif GetTemperatureHumidity(); // Get temperature and humidity if(batteryLoop > sendBattery) { // Is the batteryLoop higher than sendBattery? #ifdef MY_DEBUG Serial.println(F("Read the battery voltage and report it.")); #endif MeasureBattery(); // Measure and report battery level batteryLoop = 0; // Reset batteryLoop count } #ifdef MY_DEBUG Serial.print(F("Go to sleep for: ")); Serial.print(FOUR_MINUTE_SEND_FREQUENCY / 60000); Serial.println(F(" minutes.")); #endif batteryLoop++; sleep(FOUR_MINUTE_SEND_FREQUENCY); // Sleep for 4 minutes } void GetTemperatureHumidity() { #ifdef MY_DEBUG Serial.println(""); Serial.println(F("BME280 - Requesting new data from sensor module.")); #endif BME280.readCompensationParams(); // Need to read the NVM compensation parameters. // Normal mode for regular automatic samples BME280.writeStandbyTime(tsb_0p5ms); // tsb = 0.5ms BME280.writeFilterCoefficient(fc_16); // IIR Filter coefficient 16 BME280.writeOversamplingPressure(os16x); // pressure x16 BME280.writeOversamplingTemperature(os8x); // temperature x8 BME280.writeOversamplingHumidity(os8x); // humidity x8 BME280.writeMode(smNormal); #ifdef MY_DEBUG Serial.println(F("Getting new values")); #endif while (BME280.isMeasuring()) { // Wait for BME280 to fininsh reading data #ifdef MY_DEBUG Serial.println(F("Measuring...")); #endif delay(50); } Serial.println(F("Done!")); // Read out the data - must do this before calling the getxxxxx routines BME280.readMeasurements(); float temperature = BME280.getTemperatureMostAccurate(); // Get the temperature first. float humidity = BME280.getHumidityMostAccurate(); // Get the humidity. #ifdef MY_DEBUG Serial.print(F("BME280 - Temperature = ")); Serial.print(temperature); Serial.println(" °C"); Serial.print(F("BME280 - Humidity = ")); Serial.print(humidity); Serial.println(F(" %")); #endif // Now, let's send the measurements to the gateway. // Send temperature if the temperature difference bigger than the threshold if (COMPARE_TEMP == 1 && abs(temperature - lastTemperature) < tempThreshold) { #ifdef MY_DEBUG Serial.print(temperature - lastTemperature); Serial.println(F(" Temperature difference too small, don't send it to gateway.")); #endif } else { #ifdef MY_DEBUG Serial.println(F("Sending new temperature to the gateway.")); #endif send(temperatureMsg.set(temperature, 1)); lastTemperature = temperature; // Save temperatures for compare in the next round. } // Send humidity if the humidity difference is bigger than the threshold. if (COMPARE_TEMP == 1 && abs(humidity - lastHumidity) < humThreshold) { #ifdef MY_DEBUG Serial.print(humidity - lastHumidity); Serial.println(F(" Humidity difference too small, don't send it to the gateway.")); #endif } else { #ifdef MY_DEBUG Serial.println(F("BME280 - Sending the new humidity to the gateway.")); #endif send(humidityMsg.set(humidity, 1)); lastHumidity = humidity; // Save new humidity to be able to compare in the next round. } #ifdef MY_DEBUG Serial.println(F("BME280 - Measurement complete. Putting sensor to sleep.")); #endif BME280.writeMode(smSleep); // set the BME280to sleep mode, save battery } // GetTemperatureHumidity /* * * MeasureBattery * * */ void MeasureBattery() //The battery calculations { float Vbat = vcc.Read_Volts(); int batteryPercent = static_cast<int>(vcc.Read_Perc(VccMin, VccMax)); #ifdef MY_DEBUG Serial.print(F("Battery percent: ")); Serial.print(batteryPercent); Serial.println(" %"); Serial.print(F("Battery Voltage: ")); Serial.print(Vbat); Serial.println(F(" Volts")); #endif sendBatteryLevel(batteryPercent); send(voltageMsg.set(Vbat,2)); //send battery in Volt 2 decimal places }
-
RE: 💬 Easy/Newbie PCB for MySensors
@sundberg84 said in Easy/Newbie PCB for MySensors:
Why dont you use the internal library to measure the battery voltage? Im thinking about this and can't find a reason to move the voltage divider since without the booster you could just use the internalref and a library to measure the voltage?
Good point, I have not thought of that. I will test it it. And will probably save some uA in the process. Thanks,
-
RE: 💬 Easy/Newbie PCB for MySensors
If I don’t use the booster and connect both BAT and REG and feed the board with two AA batteries i can use the battery components to measure the voltage of the battery. That is how I use it today.
-
RE: 💬 Easy/Newbie PCB for MySensors
Now that I think of it, there is a small difference between the NRF and RFM board, the prototype area on the RFM board is not correctly spaced, the holes are a fraction to narrow spaced, one cant fit a header there without bending the pins
-
RE: 💬 Easy/Newbie PCB for MySensors
Put the battery measurement components under the Arduino. This makes the board more generic and frees up space on the right side of the board that can be used for more sensors. Expand the prototype area so that more sensors can be installed on the board.
And if one uses the board for battery only, the whole right section can be cut off but the battery measurement circuit is still there. -
RE: MySensors 2.2.0 released
On a Raspberry Pi 3 I get this warning when compiling 2.2.0
In file included from ./MySensors.h:343:0, from examples_linux/mysgw.cpp:83: ./drivers/RFM69/new/RFM69_new.cpp:663:12: warning: ‘void RFM69_ATCmode(bool, int16_t)’ defined but not used [-Wunused-function] LOCAL void RFM69_ATCmode(const bool onOff, const int16_t targetRSSI) ^
pi@mysensors-gw:~/MySensors $ lsb_release -da
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie
Edit: Forgot the configure line:
./configure --my-transport=rfm69 --my-is-rfm69hw --my-rfm69-frequency=868 -
RE: With MySensors PC cold start!
Yoy need to have two = in the code
if (is_Reset == 1 )
-
RE: Cannot run MySensors on RPI 3
Download the development version of MySensors and try that. I could not get MySensors to work on a RPI 3 with the 2.1.1 version.
-
RE: Sending a string in send() - not doing as I want it to do
THANKS!!
That did it:RSSI String: T: 127 R:-49 PL:-2 PP:0 TSF:MSG:SEND,13-13-0-0,s=1,c=1,t=47,pt=0,l=23,sg=0,ft=0,st=OK:T: 127 R:-49 PL:-2 PP:0
-
RE: Sending a string in send() - not doing as I want it to do
// Debug #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER #define MY_RFM69_FREQUENCY RFM69_868MHZ // #define MY_RFM69_ENABLE_ENCRYPTION #include <MySensors.h> #define SKETCH_NAME "Test-text" #define SKETCH_VERSION "1.0" #define CHILD_ID_RSSI_INFO 1 // Mysensors settings MyMessage msgRSSI(CHILD_ID_RSSI_INFO, V_TEXT); void before() { } void setup() { Serial.begin(115200); // for serial debugging. Serial.println(F("Start up sensor.")); } void presentation() { present(CHILD_ID_RSSI_INFO, S_INFO, "RSSI Info"); } void loop() { #ifdef MY_DEBUG Serial.println(F("Starting new measurements")); #endif CheckRSSI(); // Sleep #ifdef MY_DEBUG Serial.println(F("Waiting 1 minute")); #endif wait(60000); }
-
Sending a string in send() - not doing as I want it to do
Hi,
I have this function in my sketch:void CheckRSSI() { char SendingRSSI[10]; char ReceivingRSSI[10]; char TxPowerLevel[10]; char TxPowerPercent[10]; String sendRSSI; itoa(RFM69_getSendingRSSI(), SendingRSSI,10); wait(200); itoa(RFM69_getReceivingRSSI(), ReceivingRSSI,10); wait(200); itoa(RFM69_getTxPowerLevel(), TxPowerLevel,10); wait(200); itoa(RFM69_getTxPowerPercent(), TxPowerPercent,10); wait(200); // Now, combine all values and send it in // Line should look like "T:-90 R:-81 PL:20 PP:100" sendRSSI = "T: "; sendRSSI.concat(SendingRSSI); sendRSSI.concat(" R:"); sendRSSI.concat(ReceivingRSSI); sendRSSI.concat(" PL:"); sendRSSI.concat(TxPowerLevel); sendRSSI.concat(" PP:"); sendRSSI.concat(TxPowerPercent); #ifdef MY_DEBUG Serial.print(F("RSSI String: ")); Serial.println(sendRSSI); #endif send(msgRSSI.set(sendRSSI)); }
The output is:
RSSI String: T: -59 R:-51 PL:-2 PP:0 TSF:MSG:SEND,13-13-0-0,s=1,c=1,t=47,pt=0,l=23,sg=0,ft=0,st=1
Why does send() only send 1 instead of the string?
Using 2.2.0-rc.1 -
RE: [SOLVED] BME280 power consumtion
I am using this:
// Bosch BME280 Embedded Adventures MOD-1022 weather multi-sensor Arduino code, // written originally by Embedded Adventures. // https://github.com/embeddedadventures/BME280 #include <BME280_MOD-1022.h>```
-
RE: Water pressure sensor
Change
lecture_adc = BAR_SENSOR_ANALOG_PIN;
To
lecture_adc = analogRead(BAR_SENSOR_ANALOG_PIN);
-
RE: [SOLVED] BME280 power consumtion
Just add:
BME280.writeMode(smSleep); // go to sleep, save battery
After your have read the bme280, just before you call sleep().
-
RE: 💬 Power Meter Pulse Sensor
How is the pulse counter set up? Is it connected to the S0 port?
Edit:
If you are using S0 it is vital that you use a pull down resistor, if you dont’t have that you get false pulses.
-
RE: RPI Gateway - !TSM:INIT:TSP FAIL
Same error here.
gcc version 4.9.2 (Raspbian 4.9.2-10)
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
Replacingprintf("bcm2835_delayMicroseconds %" PRIu64 "\n", micros);
with
printf("bcm2835_delayMicroseconds %lld\n", micros);
in file drivers/BCM/bcm2835.c fixed the issue.
EDIT:
It did compile, but it segfaults when I try to start mysgw
Time to get a fresh copy from gitEDIT2:
Fix from commit in bug report fixed it. -
RE: RPI Gateway - !TSM:INIT:TSP FAIL
git clone https://github.com/mysensors/MySensors.git --branch development ./configure make sudo make install sudo /usr/local/bin/mysgw -d
This is how I did it on a Raspberry Pi 3.
-
RE: RPI Gateway - !TSM:INIT:TSP FAIL
You have run ./configure twice, run it like this:
./configure --my-transport=nrf24 --my-gateway=ethernet --my-port=5003
-
Add function MySensorsClearEEprom()
One thing that I have found quite frustrating is that when I develop some new feature or add a sensor to my MySensors-network I always forget to clear the eeprom and then I need to reprogram the arduino with /mysensors/MySensors/examples/ClearEepromConfig/ClearEepromConfig.ino
Then I have to reprogram the code again and do my testing.
Could you add a new function to the core code that has a function like:MySensorsClearEEprom() { #ifdef MYDEBUG Serial.println("Started clearing. Please wait..."); #endif for (uint16_t i=0; i<EEPROM_LOCAL_CONFIG_ADDRESS; i++) { hwWriteConfig(i,0xFF); } #ifdef MYDEBUG Serial.println("Clearing done."); #endif }
I then can i my code while testing add this function in setup()
#define PORT_CLEAR_EEPROM 6 pinMode(PORT_CLEAR_EEPROM,INPUT); digitalWrite(PORT_CLEAR_EEPROM,HIGH); if(digitalRead(PORT_CLEAR_EEPROM) == LOW) { MySensorsClearEEprom() }
If I set (in this case) port 6 to ground, the eeprom is cleared.
-
RE: 💬 Easy/Newbie PCB for MySensors
I went for the BME280, a little expensive, but it uses I2C and can be run from 1.71 volt to 3.3 volt.
-
RE: 💬 NodeManager
@ronnyandre you need to uninstall those libraries and install those mentioned in the heading: Installing the dependencies: NodeManager
-
RE: Combine airquality, temperature code and send to the ethernet gateway
There are two errors:
The serious one:void setup() { dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) { Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!"); /*---MQ2---------------------------------------------------------*/ Ro = MQCalibration(MQ_SENSOR_ANALOG_PIN); //Calibrating the sensor. Please make sure the sensor is in clean air } // Sleep for the time of the minimum sampling period to give the sensor time to power up // (otherwise, timeout errors might occure for the first reading) sleep(dht.getMinimumSamplingPeriod()); }
If you look at where you have put your initializing code you will realize that the code is never run unless you make the UPDATE_INTERVAL so small that it is less than dht.getMinimumSamplingPeriod
Change the setup() to this instead:void setup() { dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) { Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!"); } // Sleep for the time of the minimum sampling period to give the sensor time to power up // (otherwise, timeout errors might occure for the first reading) sleep(dht.getMinimumSamplingPeriod()); /*---MQ2---------------------------------------------------------*/ Ro = MQCalibration(MQ_SENSOR_ANALOG_PIN); //Calibrating the sensor. Please make sure the sensor is in clean air }
The second one is this:
sendSketchInfo("TemperatureAndHumidity", "1.1"); sendSketchInfo("Air Quality Sensor", "1.0"); /*MQ2*/
You should only have one entry:
sendSketchInfo("Temperature, Humidity and Gas", "1.1");
-
RE: 💬 Easy/Newbie PCB for MySensors
Allright, now it looks like I am getting them
PCBs have been finished and are ready to be sent out. -
RE: 💬 Power Meter Pulse Sensor
Here is a code example that works for me. I have an energy meter with S0 output and I use Domoticz as the controller.
/** * 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 1.0 - Henrik EKblad * Version 1.1 - Mikael Carlsson * * DESCRIPTION * This sketch provides an example how to implement a sensor reading from an energy meter * Use this sensor to measure KWH and Watt of your house meeter * You need to set the correct pulsefactor of your meeter (blinks per KWH). * The sensor starts by fetching current KWH value from gateway. * Reports both KWH and Watt back to gateway. * * Unfortunately millis() won't increment when the Arduino is in * sleepmode. So we cannot make this sensor sleep if we also want * to calculate/report watt-number. * http://www.mysensors.org/build/pulse_power */ // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <MySensors.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your light sensor. (Only 2 and 3 generates interrupt!) #define PULSE_FACTOR 1000 // Nummber of blinks per KWH of your meter #define SLEEP_MODE false // Watt-value can only be reported when sleep mode is false. #define MAX_WATT 10000 // Max watt value to report. This filters bad data. #define CHILD_ID 1 // Id of the sensor child unsigned long SEND_FREQUENCY = 20000; // Minimum time between send (in milliseconds). We don't want to spam the gateway. double ppwh = ((double)PULSE_FACTOR)/1000; // Pulses per watt hour bool pcReceived = false; volatile unsigned long pulseCount = 0; volatile unsigned long lastBlink = 0; volatile unsigned long watt = 0; unsigned long oldPulseCount = 0; unsigned long oldWatt = 0; double oldKwh; unsigned long lastSend; MyMessage wattMsg(CHILD_ID,V_WATT); MyMessage kwhMsg(CHILD_ID,V_KWH); MyMessage pcMsg(CHILD_ID,V_VAR1); void setup() { // Fetch last known pulse count value from gw request(CHILD_ID, V_VAR1); // Use the internal pullup to be able to hook up this sketch directly to an energy meter with S0 output // If no pullup is used, the reported usage will be too high because of the floating pin pinMode(DIGITAL_INPUT_SENSOR,INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, RISING); lastSend=millis(); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Energy Meter", "1.0"); // Register this device as power sensor present(CHILD_ID, S_POWER); } void loop() { unsigned long now = millis(); // Only send values at a maximum frequency or woken up from sleep bool sendTime = now - lastSend > SEND_FREQUENCY; if (pcReceived && (SLEEP_MODE || sendTime)) { // New watt value has been calculated if (!SLEEP_MODE && watt != oldWatt) { // Check that we dont get unresonable large watt value. // could happen when long wraps or false interrupt triggered // We need to send in all values at one time to get consistent data if (watt<((unsigned long)MAX_WATT)) { send(wattMsg.set(watt)); // Send watt value to gw Serial.print("Watt: "); Serial.println(watt); oldWatt = watt; send(pcMsg.set(pulseCount)); // Send pulse count value to gw Serial.print("pulseCount: "); Serial.println(watt); double kwh = ((double)pulseCount/((double)PULSE_FACTOR)); oldPulseCount = pulseCount; send(kwhMsg.set(kwh, 4)); // Send kwh value to gw Serial.print("kWh: "); Serial.println(kwh); oldKwh = kwh; } } lastSend = now; } else if (sendTime && !pcReceived) { // No count received. Try requesting it again request(CHILD_ID, V_VAR1); lastSend=now; } if (SLEEP_MODE) { sleep(SEND_FREQUENCY); } } void receive(const MyMessage &message) { if (message.type==V_VAR1) { pulseCount = oldPulseCount = message.getLong(); Serial.print("Received last pulse count from gw:"); Serial.println(pulseCount); pcReceived = true; } } void onPulse() { if (!SLEEP_MODE) { unsigned long newBlink = micros(); unsigned long interval = newBlink-lastBlink; if (interval<10000L) { // Sometimes we get interrupt on RISING return; } watt = (3600000000.0 /interval) / ppwh; lastBlink = newBlink; } pulseCount++; }```
-
RE: 💬 Power Meter Pulse Sensor
OK, I think I have nailed it. I am now running a beta code pulling S0 from my energy meter and I am getting consistent results.
Before when I checked the domoticz.db I got this for Energy:sqlite> select Name, sValue from DeviceStatus; Storage kWh|0.000;4773.700
Now I get this:
sqlite> select Name, sValue from DeviceStatus; Storage kWh|118.000;11678062.000
Notice that the first field is now with value, previously it was 0.000 (and I have updated the meter count to the actual value)
And in table Meter I now get consistent results:sqlite> SELECT Value, Usage, Date FROM Meter WHERE DeviceRowID=43; 11678003|1170|2017-07-22 09:25:00 11678012|1170|2017-07-22 09:30:00 11678021|1180|2017-07-22 09:35:00 11678031|1180|2017-07-22 09:40:00 11678043|1170|2017-07-22 09:45:00 11678053|1180|2017-07-22 09:50:00 11678062|1180|2017-07-22 09:55:00 11678072|1180|2017-07-22 10:00:00
The field Usage is now populated as it should.
I will let the code run for a couple of days, then I will post the updated code here. -
RE: 💬 Easy/Newbie PCB for MySensors
This happened to me too, I ordered from the link, and thought I was Ok with the order. Yesterday I did find out that my order was waiting for the gerber files, so I downloaded, zipped and uploaded the to itead. I also mailed them about it. Got a reply that they should check the gerber files.
-
RE: 💬 Power Meter Pulse Sensor
EDIT:
This was not the case, I am still debugging the issue, in the mean time I have deleted the code.After some debugging it seems that Domoticz messes with the V_WATT and V_KWH, and the solution is to have two sensors, one for kWh and one for W.
After I changed it, I have consistent W and kWh.
See also this issue for Home Assistant