@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.
Posts made by mickecarlsson
-
RE: Anyone using FlashForge Finder?
-
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