Hi Everyone,
Has anyone noticed that they no longer receive sensor readings into the Vera Plus? Not sure why and maybe looking to move controllers. Any suggestions on what controller works best without the monthly cost?
Hi Everyone,
Has anyone noticed that they no longer receive sensor readings into the Vera Plus? Not sure why and maybe looking to move controllers. Any suggestions on what controller works best without the monthly cost?
Should have dove deeper when you fist said radio, looks like everything was taken care off except the radio power. Jumped a wire over there and bang worked.
Thanks again for the help.
HI All.
Still having problems and this is my first purchase from PCBway not sure if the code need to be changed for this board but I am using PCB MySensors Gateway Ethernet 3.0 developed by fifisoft57. The radios work on other projects and it is almost like the pins are not correct I traced them and they appear right but......... Has anyone used this board if so did you have any issues? I would say it is my solder job but I did 3 boards one should work.
ANy help would be great.
Hi Everyone,
I am trying to add a gateway to anther project and this time I am using the W5100 mini and the PCBWAY board designed by FIFIsoft57 (hopefully you see this). The code for the gateway I beleive had to be changed. PLease see my modes below any guidance would be greatly appreciated. This is the PCB MySensors Gateway Ethernet 3.0.
/*
* 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-2019 Sensnology AB
* Full contributor list: https://github.com/mysensors/MySensors/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
* Contribution by a-lurker and Anticimex
* Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
* Contribution by Tomas Hozza <thozza@gmail.com>
*
*
* DESCRIPTION
* The EthernetGateway sends data received from sensors to the ethernet link.
* The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
*
* The GW code is designed for Arduino 328p / 16MHz. ATmega168 does not have enough memory to run this program.
*
* LED purposes:
* - To use the feature, uncomment MY_DEFAULT_xxx_LED_PIN in the sketch below
* - RX (green) - blink fast on radio message received. In inclusion mode will blink fast only on presentation received
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
* - ERR (red) - fast blink on error during transmission error or receive crc error
*
* See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
*
*/
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_RF24
//#define MY_RADIO_NRF5_ESB
//#define MY_RADIO_RFM69
//#define MY_RADIO_RFM95
// Enable gateway ethernet module type
#define MY_GATEWAY_W5100
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
#define MY_W5100_SPI_EN 4
// Enable Soft SPI for NRF radio (note different radio wiring is required)
// The W5100 ethernet module seems to have a hard time co-operate with
// radio on the same spi bus.
#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
#define MY_SOFTSPI
#define MY_SOFT_SPI_SCK_PIN A0 // CHanged from D14
#define MY_SOFT_SPI_MISO_PIN A2 // CHanged from D16
#define MY_SOFT_SPI_MOSI_PIN A1 // Changed from D15
#endif
// When W5100 is connected we have to move CE/CSN pins for NRF radio
#ifndef MY_RF24_CE_PIN
#define MY_RF24_CE_PIN 5
#endif
#ifndef MY_RF24_CS_PIN
#define MY_RF24_CS_PIN 6
#endif
// Enable UDP communication
//#define MY_USE_UDP // If using UDP you need to set MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS below
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
#define MY_IP_ADDRESS 192,168,2,203
// If using static ip you can define Gateway and Subnet address as well
//#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
//#define MY_IP_SUBNET_ADDRESS 255,255,255,0
// Renewal period if using DHCP
//#define MY_IP_RENEWAL_INTERVAL 60000
// The port to keep open on node server mode / or port to contact in client mode
#define MY_PORT 5003
// Controller ip address. Enables client mode (default is "server" mode).
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
//#define MY_CONTROLLER_URL_ADDRESS "my.controller.org"
// The MAC address can be anything you want but should be unique on your network.
// Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
// Note that most of the Arduino examples use "DEAD BEEF FEED" for the MAC address.
#define MY_MAC_ADDRESS 0xDD, 0xDD, 0xBE, 0xEF, 0xFE, 0xED
// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
//#define MY_INCLUSION_BUTTON_FEATURE
// Set inclusion mode duration (in seconds)
#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300
// Flash leds on rx/tx/err
// Uncomment to override default HW configurations
#define MY_DEFAULT_ERR_LED_PIN 8 // Error led pin
#define MY_DEFAULT_RX_LED_PIN 7 // Receive led pin
#define MY_DEFAULT_TX_LED_PIN 9 // Transmit led pin
#if defined(MY_USE_UDP)
#include <EthernetUdp.h>
#endif
#include <Ethernet.h>
#include <MySensors.h>
void setup()
{
// Setup locally attached sensors
}
void presentation()
{
// Present locally attached sensors here
}
void loop()
{
// Send locally attached sensors data here
}
and this is what message I receive.
0 MCO:BGN:INIT GW,CP=RNNGA---,FQ=16,REL=255,VER=2.3.2
4 TSM:INIT
5 TSF:WUR:MS=0
11 !TSM:INIT:TSP FAIL
13 TSM:FAIL:CNT=1
15 TSM:FAIL:DIS
16 TSF:TDI:TSL
0 MCO:BGN:INIT GW,CP=RNNGA---,FQ=16,REL=255,VER=2.3.2
4 TSM:INIT
5 TSF:WUR:MS=0
11 !TSM:INIT:TSP FAIL
13 TSM:FAIL:CNT=1
15 TSM:FAIL:DIS
16 TSF:TDI:TSL
10019 TSM:FAIL:RE-INIT
10021 TSM:INIT
10028 !TSM:INIT:TSP FAIL
10030 TSM:FAIL:CNT=2
10032 TSM:FAIL:DIS
10034 TSF:TDI:TSL
Hi
Thank you for your reply and I understand that, if you look at the code you will see that pin 3 isn't named/defined in the coed. Unless I am missing something
Thanks
Hi,
I see in the pictures of the connection that the soil sensor is attached to 3.3V, GND and D3 but I can't see where D3 is named. How do you obtain a read from D3 if it isn't named in the code?
Hi All,
I am using the Pete B. Push button concept to turn my kettle on and start boiling and need a little help. When I press the button it will not send the code to turn the kettle on. I used the same wire diagram as Petes ground sample. It is a ground and a simple touch button as I can touch the wires tomorrow to simulate a button and confirmed itβs ground. Has anyone complete code for this and if so can I use it?
Thanks
Tim
Hit post to quick sorry, my plan is to have 4 probes each on a timer. Press the button and put on the steak have Alexa tell you to flip after 2 minutes for rare and the another 2 minutes and she will tell you done with a temp of 125f.....
Hi All,
I am developing a BBQ Sensor that will set a timer for each probe and tell me when to turn it over depending on what I am cooking (i.e 135F = rare, 2 minutes side one and 2 minutes side 2). Any idea if anyone has developed something like this already? I found the smoker files but I am BBQ fellow not a smoker.....
Thanks
I figured why wait, this has the temp, hum and 2 relays working not problem. One relay controls my fan for my AV and the other controls my doorbell for my HTD Lync system.
/**
* 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 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz)
*
* DESCRIPTION
* This sketch provides an example of how to implement a humidity/temperature
* sensor using a DHT11/DHT-22.
*
* For more information, please visit:
* http://www.mysensors.org/build/humidity
*
*/
// Enable debug prints
#define MY_DEBUG
#define MY_NODE_ID 29
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
//#define MY_RS485
// Enable repeater functionality for this node
#define MY_REPEATER_FEATURE
#include <SPI.h>
#include <MySensors.h>
#include <DHT.h>
// Set this to the pin you connected the DHT's data pin to
#define DHT_DATA_PIN 3
#define RELAY_1 4 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define RELAY_2 5 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define NUMBER_OF_RELAYS 2 // Total number of attached relays
#define RELAY_ON 1 // GPIO value to write to turn on attached relay
#define RELAY_OFF 0 // GPIO value to write to turn off attached relay
// Set this offset if the sensor has a permanent small offset to the real temperatures
#define SENSOR_TEMP_OFFSET 0
// Sleep time between sensor updates (in milliseconds)
// Must be >1000ms for DHT22 and >2000ms for DHT11
static const uint64_t UPDATE_INTERVAL = 60000;
// Force sending an update of the temperature after n sensor reads, so a controller showing the
// timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
// the value didn't change since;
// i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
static const uint8_t FORCE_UPDATE_N_READS = 10;
#define CHILD_ID_HUM 28
#define CHILD_ID_TEMP 30
float lastTemp;
float lastHum;
uint8_t nNoUpdatesTemp;
uint8_t nNoUpdatesHum;
bool metric = true;
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
DHT dht;
void before()
{
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
// Then set relay pins in output mode
pinMode(pin, OUTPUT);
// Set relay to last known state (using eeprom storage)
digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
}
}
void presentation()
{
// Send the sketch version information to the gateway
sendSketchInfo("AVCABRelayTempAndHumidity", "1.1");
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);
metric = getControllerConfig().isMetric;
}
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());
}
void receive(const MyMessage &message)
{
// Force reading sensor, so it works also after sleep()
dht.readSensor(true);
// Get temperature from DHT library
float temperature = dht.getTemperature();
if (isnan(temperature)) {
Serial.println("Failed reading temperature from DHT!");
} else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
// Only send temperature if it changed since the last measurement or if we didn't send an update for n times
lastTemp = temperature;
if (!metric) {
temperature = dht.toFahrenheit(temperature);
}
// Reset no updates counter
nNoUpdatesTemp = 0;
temperature += SENSOR_TEMP_OFFSET;
send(msgTemp.set(temperature, 1));
#ifdef MY_DEBUG
Serial.print("T: ");
Serial.println(temperature);
#endif
} else {
// Increase no update counter if the temperature stayed the same
nNoUpdatesTemp++;
}
// Get humidity from DHT library
float humidity = dht.getHumidity();
if (isnan(humidity)) {
Serial.println("Failed reading humidity from DHT");
} else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
// Only send humidity if it changed since the last measurement or if we didn't send an update for n times
lastHum = humidity;
// Reset no updates counter
nNoUpdatesHum = 0;
send(msgHum.set(humidity, 1));
if (message.type==V_STATUS) {
// Change relay state
digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
// Store state in eeprom
saveState(message.sensor, message.getBool());
#ifdef MY_DEBUG
Serial.print("H: ");
Serial.println(humidity);
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
#endif
} else {
// Increase no update counter if the humidity stayed the same
nNoUpdatesHum++;
}
// Sleep for a while to save energy
sleep(UPDATE_INTERVAL);
}}
HI
I did get it to work and will post the sketch later today after work. I have it working on the ESP8266 and Arduino.
HI Everyone,
I noticed that I couldn't find a relay working with ESP8266MOD, I was messing with it over the last few days and figured out that the following sketch works. The big fix was in the sketch you use pin 0 for the relay and actually attach it to pin 3. This works great with WEMOS ESP8266.
'''
// Enable debug prints to serial monitor
#define MY_DEBUG
#define MY_NODE_ID 97 //esp8266relay
// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
// Enable repeater functionality for this node
#define MY_REPEATER_FEATURE
#include <MySensors.h>
#define RELAY_1 0 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define NUMBER_OF_RELAYS 1 // Total number of attached relays
#define RELAY_ON 1 // GPIO value to write to turn on attached relay
#define RELAY_OFF 0 // GPIO value to write to turn off attached relay
void before()
{
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
// Then set relay pins in output mode
pinMode(pin, OUTPUT);
// Set relay to last known state (using eeprom storage)
digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
}
}
void setup()
{
}
void presentation()
{
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Relay", "1.0");
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
// Register all sensors to gw (they will be created as child devices)
present(sensor, S_BINARY);
}
}
void loop()
{
}
void receive(const MyMessage &message)
{
// We only expect one type of message from controller. But we better check anyway.
if (message.type==V_STATUS) {
// Change relay state
digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
// Store state in eeprom
saveState(message.sensor, message.getBool());
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
}
}
""
This works whether its correct or not it is working again.
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
#define MY_NODE_ID 31
// Enable repeater functionality for this node
#define MY_REPEATER_FEATURE
#include <MyConfig.h>
#include <MySensors.h>
#include <SPI.h>
#include <DHT.h>
#define DHT_DATA_PIN 3
#define RELAY_1 4 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define CHILD_ID_HUM 28
#define CHILD_ID_TEMP 27
#define NUMBER_OF_RELAYS 2 // Total number of attached relays
#define RELAY_ON 1 // GPIO value to write to turn on attached relay
#define RELAY_OFF 0 // GPIO value to write to turn off attached relay
// Set this offset if the sensor has a permanent small offset to the real temperatures
#define SENSOR_TEMP_OFFSET 0
// Sleep time between sensor updates (in milliseconds)
// Must be >1000ms for DHT22 and >2000ms for DHT11
static const uint64_t UPDATE_INTERVAL = 10000;
// Force sending an update of the temperature after n sensor reads, so a controller showing the
// timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
// the value didn't change since;
// i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
static const uint8_t FORCE_UPDATE_N_READS = 10;
float lastTemp;
float lastHum;
uint8_t nNoUpdatesTemp;
uint8_t nNoUpdatesHum;
bool metric = true;
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
DHT dht;
void before()
{
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
// Then set relay pins in output mode
pinMode(pin, OUTPUT);
// Set relay to last known state (using eeprom storage)
digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
}
}
void presentation()
{
// Send the sketch version information to the gateway and Controller
sendSketchInfo("TempHum2Relay", "1.1B");
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);
metric = getControllerConfig().isMetric;
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
// Register all sensors to gw (they will be created as child devices)
present(sensor, S_BINARY);
}
}
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());
}
void loop()
{
// Force reading sensor, so it works also after sleep()
dht.readSensor(true);
// Get temperature from DHT library
float temperature = dht.getTemperature();
if (isnan(temperature)) {
Serial.println("Failed reading temperature from DHT!");
} else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
// Only send temperature if it changed since the last measurement or if we didn't send an update for n times
lastTemp = temperature;
if (!metric) {
temperature = dht.toFahrenheit(temperature);
}
// Reset no updates counter
nNoUpdatesTemp = 0;
temperature += SENSOR_TEMP_OFFSET;
send(msgTemp.set(temperature, 1));
#ifdef MY_DEBUG
Serial.print("T: ");
Serial.println(temperature);
#endif
} else {
// Increase no update counter if the temperature stayed the same
nNoUpdatesTemp++;
}
// Get humidity from DHT library
float humidity = dht.getHumidity();
if (isnan(humidity)) {
Serial.println("Failed reading humidity from DHT");
} else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
// Only send humidity if it changed since the last measurement or if we didn't send an update for n times
lastHum = humidity;
// Reset no updates counter
nNoUpdatesHum = 0;
send(msgHum.set(humidity, 1));
#ifdef MY_DEBUG
Serial.print("H: ");
Serial.println(humidity);
#endif
} else {
// Increase no update counter if the humidity stayed the same
nNoUpdatesHum++;
}
// Sleep for a while to save energy
sleep(UPDATE_INTERVAL);
}
void receive(const MyMessage &message)
{
// We only expect one type of message from controller. But we better check anyway.
if (message.type==V_STATUS) {
// Change relay state
digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
// Store state in eeprom
saveState(message.sensor, message.getBool());
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
} }
HI Everyone,
I have my temp/hum sensor in my AV cab and what two computer fans to cool it down. I have tried this and it originally worked with one relay and I got creative and screwed it up. When i tried to get it back to the original version i couldn't as I yes saved over it. I have checked on the forum and see projects like this but they don't appear to work. Can should one give a few pointers?
#define MY_DEBUG
#define MY_RADIO_NRF24
#define MY_REPEATER_FEATURE
#define MY_NODE_ID 29
#include <MyConfig.h>
#include <MySensors.h>
#include <SPI.h>
#include <DHT.h>
#define DHT_DATA_PIN 3
#define RELAY_1 4
#define CHILD_ID_HUM 28
#define CHILD_ID_TEMP 29
#define NUMBER_OF_RELAYS 1
#define RELAY_ON 1
#define RELAY_OFF 0
#define SENSOR_TEMP_OFFSET 0
static const uint64_t UPDATE_INTERVAL = 40000;
static const uint8_t FORCE_UPDATE_N_READS = 10;
float lastTemp;
float lastHum;
uint8_t nNoUpdatesTemp;
uint8_t nNoUpdatesHum;
bool metric = true;
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
DHT dht;
void before()
{
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
pinMode(pin, OUTPUT);
digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
}
}
void presentation()
{
sendSketchInfo("TempHumRelay", "1.2");
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);
metric = getControllerConfig().isMetric;
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
present(sensor, S_BINARY);
}
}
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(dht.getMinimumSamplingPeriod());
}
void loop()
{
dht.readSensor(true);
float temperature = dht.getTemperature();
if (isnan(temperature)) {
Serial.println("Failed reading temperature from DHT!");
} else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
lastTemp = temperature;
if (!metric) {
temperature = dht.toFahrenheit(temperature);
}
nNoUpdatesTemp = 0;
temperature += SENSOR_TEMP_OFFSET;
send(msgTemp.set(temperature, 1));
#ifdef MY_DEBUG
Serial.print("T: ");
Serial.println(temperature);
#endif
} else {
nNoUpdatesTemp++;
}
float humidity = dht.getHumidity();
if (isnan(humidity)) {
Serial.println("Failed reading humidity from DHT");
} else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
lastHum = humidity;
nNoUpdatesHum = 0;
send(msgHum.set(humidity, 1));
#ifdef MY_DEBUG
Serial.print("H: ");
Serial.println(humidity);
#endif
} else {
nNoUpdatesHum++;
}
sleep(UPDATE_INTERVAL);
}
void receive(const MyMessage &message)
{
if (message.type==V_STATUS) {
digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
saveState(message.sensor, message.getBool());
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
} }
Hi
Thanks and I have changed the ID as follows;
#define MY__ID 9 //Manually set the ID here. Comment out to auto assign
//#define MY__ID 9 //Manually set the ID here. Comment out to auto assign
No matter what i do I still get node 254,. Still most be something I am missing, any ideas?
HI Everyone,
This is the fridge sensor that Bulldog and Pete B put together, I had it working but since the vera update any new mysensors loading always load with the same node id even when i try to change it manually as in the sketch below, any idea what I am doing wrong? The node loads only as 254 node......
Please help.
#include <DallasTemperature.h>
#include <OneWire.h>
#include <Bounce2.h>
//MySensors configuration options
#define MY_DEBUG //Uncomment to enable MySensors related debug messages (additional debug options are below)
#define MY_RADIO_NRF24 // Enable and select radio type attached
#define MY__ID 9 //Manually set the ID here. Comment out to auto assign
#include <MySensors.h>
#define SKETCH_NAME "White Refrigerator Monitor"
#define SKETCH_VERSION "1.1b"
#define DWELL_TIME 20 //value used in all wait calls (in milliseconds) this allows for radio to come back to power after a transmission, ideally 0
#define ONE_WIRE_BUS 3 // Pin where dallas sensors are connected
#define TEMPERATURE_PRECISION 12 //The resolution of the sensor
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature dallasTemp(&oneWire); // Pass our oneWire reference to Dallas Temperature.
//MySensor gw;
unsigned long tempDelay = 225000;
float lastTemperature[2];
unsigned long tempMillis;
bool metric = false;
// arrays to hold device addresses
DeviceAddress dallasAddresses[] = {
{0x28, 0xFF, 0x4F, 0x87, 0x70, 0x17, 0x4, 0x9D}, //Freezer Address -- 1 Modify for your sensors
{0x28, 0xFF, 0x25, 0x59, 0x70, 0x17, 0x4, 0x25} //Fridge Address -- 2 Modify for your sensors
};
//Set up debouncer (used for door sensors)
Bounce debouncer[] = {
Bounce(),
Bounce()
};
//Make sure to match the order of doorPins to doorChildren.
//The pins on your Arduino
int doorPins[] = {4, 5};
//The child ID that will be sent to your controller
int doorChildren[] = {32, 33};
//Freezer temp will be Child 0 and Fridge temp will be Child 1
//used to keep track of previous values contact sensor values
uint8_t oldValueContact[] = {1, 1};
uint8_t doorLedPins[] = {6, 7};
// Initialize temperature message
MyMessage dallasMsg(0, V_TEMP);
MyMessage doorMsg(0, V_TRIPPED);
void presentation()
{
// Send the sketch version information to the gateway
sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
// Register all sensors to gw (they will be created as child devices)
// Present temp sensors to controller
for (uint8_t i = 0; i < 2; i++) {
present(i, S_TEMP);
wait(DWELL_TIME);
}
// Present door sensors to controller
for (uint8_t i = 0; i < 2; i++) {
present(doorChildren[i], S_DOOR);
wait(DWELL_TIME);
}
}
void setup()
{
// Startup OneWire
dallasTemp.begin();
// set the temp resolution
for (uint8_t i = 0; i < 2; i++) {
dallasTemp.setResolution(dallasAddresses[i], TEMPERATURE_PRECISION);
}
// // Startup and initialize MySensors library. Set callback for incoming messages.
// gw.begin(NULL, NODE_ID);
//
// // Send the sketch version information to the gateway and Controller
// gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
//Set up door contacts & LEDs
for (uint8_t i = 0; i < 2; i++) {
// Setup the pins & activate internal pull-up
pinMode(doorPins[i], INPUT_PULLUP);
// Activate internal pull-up
//digitalWrite(doorPins[i], HIGH);
// After setting up the button, setup debouncer
debouncer[i].attach(doorPins[i]);
debouncer[i].interval(700); //This is set fairly high because when my door was shut hard it caused the other door to bounce slightly and trigger open.
//Set up LEDs
pinMode(doorLedPins[i], OUTPUT);
digitalWrite(doorLedPins[i], LOW);
}
}
void loop()
{
unsigned long currentMillis = millis();
if (currentMillis - tempMillis > tempDelay) {
// Fetch temperatures from Dallas sensors
dallasTemp.requestTemperatures();
// Read temperatures and send them to controller
for (uint8_t i = 0; i < 2; i++) {
// Fetch and round temperature to one decimal
float temperature = static_cast<float>(static_cast<int>((metric ? dallasTemp.getTempC(dallasAddresses[i]) : dallasTemp.getTempF(dallasAddresses[i])) * 10.)) / 10.;
// Only send data if temperature has changed and no error
if (lastTemperature[i] != temperature && temperature != -127.00) {
// Send in the new temperature
send(dallasMsg.setSensor(i).set(temperature, 1));
lastTemperature[i] = temperature;
}
}
tempMillis = currentMillis;
}
for (uint8_t i = 0; i < 2; i++) {
debouncer[i].update();
// Get the update value
uint8_t value = debouncer[i].read();
if (value != oldValueContact[i]) {
// Send in the new value
send(doorMsg.setSensor(doorChildren[i]).set(value == HIGH ? "1" : "0"));
digitalWrite(doorLedPins[i], value);
oldValueContact[i] = value;
}
}
}
Thanks for the arduino code, i will give it a shot.
SO does anyone have any code for this project? I need the arduino code. Thanks in advance, excellent project btw.
Yes the file ending in .ino is missing as you can see by your post above.
thanks for the reply and I might be missing it but the Arduino file is not posted under the code tab.
Hi Can someone point me in the direction of the Ardunio code for this project? I have everything built and can get any code to work with the liquid crystal lib?
Hi I need your help, I created this clock and complied the sketch, looked like it worked but when adding it to very I get the error message that D_LcdText1.xml is not available. Where do I find that and how do i add it to the Vera Plus?
Excellent project and can't wait to have it up and running.
Hi
And thanks for the reply, I do have the PT1000 as well as those sensors. The only thing is I am trying to find a use for the PT1000. I have already placed one in my deep freeze and one out door but have several more that I just want to use. It's not the cost as most of the projects on this are cheap, it's the challenge of getting it done.
Thanks again, I
HI
Do you think you can use the PT1000 two wire temp sensor for this project? I have a number of them and they are water proof and very durable.
Hi I created a project from your MP3 project and installed it on Vera however when I did it changes the mysensors file and creates a new RGB light. Any ideas why?
Ok, spent half the day trying to figure out what I was doing wrong and all I had to do was read the forum. The radios I purchase were junk. Not one of the 10 worked. Had everything placed on a board figured my workmanship was a little off or something. The radio was last to be checked.
WOOOOOOWWWWO
Thanks Everyone this post saved me a lot more time.
Hi
Having some issues with the sketch compiling, I am using the 1.84 arduino and the latest libraries 2.1.1 mysensors. I have not made any changes to the sketch at all. Debug is remarked out.
Any help or guidance would be greatly appreciated .
Arduino: 1.8.4 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"
In file included from C:\Users\Audrey\AppData\Local\Temp\arduino_modified_sketch_110779\IrrigationController.ino:95:0:
C:\Users\Audrey\Documents\Arduino\libraries\MySensors/MySensors.h:328:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
^
C:\Users\Audrey\AppData\Local\Temp\arduino_modified_sketch_110779\IrrigationController.ino:99:31: fatal error: LiquidCrystal_I2C.h: No such file or directory
#include <LiquidCrystal_I2C.h>
^
compilation terminated.
exit status 1
Error compiling for board Arduino Pro or Pro Mini.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Hi Running this code I get the following errors anyone know why?
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Nano, ATmega328"
Build options changed, rebuilding all
Using library SPI in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Using library MySensors in folder: C:\Users\Audrey\Documents\libraries\MySensors
Using library Robot IR Remote in folder: C:\Program Files (x86)\Arduino\libraries\RobotIRremote
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI -IC:\Users\Audrey\Documents\libraries\MySensors -IC:\Program Files (x86)\Arduino\libraries\RobotIRremote\src C:\Users\Audrey\AppData\Local\Temp\build2205553450015260610.tmp\IRSendRec.cpp -o C:\Users\Audrey\AppData\Local\Temp\build2205553450015260610.tmp\IRSendRec.cpp.o
IRSendRec.ino:95:5: error: 'decode_type_t' does not name a type
IRSendRec.ino:114:1: error: 'IRsend' does not name a type
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IRSendRec.ino: In function 'byte lookUpPresetCode(decode_results*)':
IRSendRec.ino:246:38: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:256:38: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino: In function 'bool storeRCCode(byte)':
IRSendRec.ino:300:30: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:302:49: error: 'class decode_results' has no member named 'address'
IRSendRec.ino: In function 'void sendRCCode(byte)':
IRSendRec.ino:322:39: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:84:38: note: in definition of macro 'Type2String'
IRSendRec.ino:322:39: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:84:50: note: in definition of macro 'Type2String'
IRSendRec.ino:323:18: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:328:10: error: 'irsend' was not declared in this scope
IRSendRec.ino:331:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:338:10: error: 'irsend' was not declared in this scope
IRSendRec.ino:341:23: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:342:8: error: 'irsend' was not declared in this scope
IRSendRec.ino:344:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:345:8: error: 'irsend' was not declared in this scope
IRSendRec.ino:347:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:348:8: error: 'irsend' was not declared in this scope
IRSendRec.ino:352:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:353:8: error: 'irsend' was not declared in this scope
IRSendRec.ino:355:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:355:32: error: 'SAMSUNG' was not declared in this scope
IRSendRec.ino:356:8: error: 'irsend' was not declared in this scope
IRSendRec.ino:358:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:358:32: error: 'WHYNTER' was not declared in this scope
IRSendRec.ino:359:8: error: 'irsend' was not declared in this scope
IRSendRec.ino:361:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:361:32: error: 'AIWA_RC_T501' was not declared in this scope
IRSendRec.ino:362:8: error: 'irsend' was not declared in this scope
IRSendRec.ino:364:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:364:32: error: 'LG' was not declared in this scope
IRSendRec.ino:364:48: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:364:75: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:368:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:372:12: error: 'irsend' was not declared in this scope
IRSendRec.ino:375:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:376:8: error: 'irsend' was not declared in this scope
IRSendRec.ino:380:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IRSendRec.ino:380:32: error: 'DENON' was not declared in this scope
IRSendRec.ino:381:8: error: 'irsend' was not declared in this scope
IRSendRec.ino: In function 'void dump(decode_results*)':
IRSendRec.ino:403:29: error: 'class decode_results' has no member named 'address'
'decode_type_t' does not name a type
The problem I had was it didn't actually read the temp when I combined the sensor with the radio. The radio worked and could send data back to Vera but is was wrong. I removed the reference to the pin and it reads and sends the correct data, I would like to add more than one temp sensor. I want to check my fridge temps similar to the project pet and bulldog complete, with one exception. I want to repurpose my extra floor sensors they only have two wires vs. a Dallas temp that has 3.
If you have an idea on how to add the extra sensor that would be great.
Hi
Thank you. I had the sketch calculating correctly by I couldn't get the sketch to work with the mysensors side. Both sketches worked but when I combined them the radio worked but the temp sensors didn't. This is what I have working, this calculates the temp correctly and transmits the correct reading.
#define MY_DEBUG
#define MY_RADIO_NRF24
#define THERMISTORPIN A0 // Same
#define THERMISTORNOMINAL 10000 // Same
#define TEMPERATURENOMINAL 25
#define NUMSAMPLES 5
#define BCOEFFICIENT 3950
#define SERIESRESISTOR 10000
#define CHILD_ID 98 // Id of the sensor child
#include <MyConfig.h>
#include <MySensors.h>
#include <math.h>
#include <SPI.h>
const unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
MyMessage msg(CHILD_ID, V_TEMP);
int samples[NUMSAMPLES];
void setup(void) {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("PT Temperature Sensor", "1.1");
// Present all sensors to controller
present(0, S_TEMP);
}
void loop(void) {
float average;
// take N samples in a row, with a slight delay
average = 0;
for (uint8_t i=0; i < NUMSAMPLES; i++) {
samples[i] = analogRead(THERMISTORPIN);
average = samples[1] + samples[2] + samples[3] + samples[4] +samples[5];
delay(10);
}
average = average / NUMSAMPLES;
average = SERIESRESISTOR * ((1823.0 / average) -1);
float temperature;
temperature = log(average); // ln(R/Ro)
temperature = 1 / (0.001129148 + (0.000234125 * temperature) + (0.0000000876741 * temperature * temperature * temperature));
temperature = temperature - 273.15; // Convert Kelvin to Celsius
Serial.print("Temperature ");
Serial.print(temperature);
Serial.println(" *C");
// Send in the new temperature
send(msg.setSensor(0).set(temperature,1));
sleep(SLEEP_TIME);
}
Ncie for the extra in floor heating sensors you have when building.
thanks, looking forward to it
Hi Everyone,
I managed to get this to compile and send data to Vera, however the results that worked in the old version doesn't calculate the correct temp. I am missing something but can figure it out. ALL HELP WOULD BE APPRECIATED.
Thanks
#define MY_DEBUG
#define MY_RADIO_NRF24
#define THERMISTORPIN A0 // Same
#define THERMISTORNOMINAL 10000 // Same
#define TEMPERATURENOMINAL 25
#define NUMSAMPLES 5
#define BCOEFFICIENT 3950
#define SERIESRESISTOR 10000
#define CHILD_ID 98 // Id of the sensor child
#include <MyConfig.h>
#include <MySensors.h>
#include <SPI.h>
const unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
MyMessage msg(CHILD_ID, V_TEMP);
int samples[NUMSAMPLES];
void setup(void) {
pinMode(THERMISTORPIN, INPUT);
analogReference(EXTERNAL);
// Send the sketch version information to the gateway and Controller
sendSketchInfo("PT Temperature Sensor", "1.1");
// Present all sensors to controller
present(0, S_TEMP);
}
void loop(void) {
float average;
// take N samples in a row, with a slight delay
for (uint8_t i = 0; i < NUMSAMPLES; i++) {
samples[i] = analogRead(THERMISTORPIN);
delay(12);
}
// average all the samples out
average = 0;
for (uint8_t i = 0; i < NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;
// convert the value to resistance
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
float temperature;
temperature = average / THERMISTORNOMINAL; // (R/Ro)
temperature = log(temperature); // ln(R/Ro)
temperature /= BCOEFFICIENT; // 1/B * ln(R/Ro)
temperature += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
temperature = 1.0 / temperature; // Invert
temperature -= 258.95; // convert to C
Serial.print("Temperature ");
Serial.print(temperature);
Serial.println(" *C");
Serial.print("Average analog reading ");
Serial.println(average);
Serial.print("analog reading ");
Serial.println(THERMISTORPIN);
Serial.print("analog reading samples ");
Serial.println(samples[1]);
Serial.print("analog reading samples ");
Serial.println(samples[2]);
Serial.print("analog reading samples ");
Serial.println(samples[3]);
Serial.print("analog reading samples ");
Serial.println(samples[4]);
Serial.print("analog reading samples ");
Serial.println(samples[5]);
// Send in the new temperature
send(msg.setSensor(0).set(temperature,1));
// delay(1000);
sleep(SLEEP_TIME);
}
Did you get this working and if so can you share?
Hi
Thank you for the prompt reply, I will have a look.
Thanks
T
Hi Everyone,
I am using this old sketch for a two wire temp probe and upgraded to the 2.1.1 gateway and can't figure out what to change to get it to work. Do anyone know of a basic guide? I can't find one.
#include <MySensor.h>
#include <SPI.h>
#define THERMISTORPIN A0
#define THERMISTORNOMINAL 10000
#define TEMPERATURENOMINAL 25
#define NUMSAMPLES 5
#define BCOEFFICIENT 3950
#define SERIESRESISTOR 10000
const unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
MySensor gw;
// Initialize temperature message
MyMessage msg(0,V_TEMP);
int samples[NUMSAMPLES];
void setup(void) {
pinMode(THERMISTORPIN, INPUT);
analogReference(EXTERNAL);
// Startup and initialize MySensors library. Set callback for incoming messages.
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Temperature Sensor", "1.1");
// Present all sensors to controller
gw.present(0, S_TEMP);
}
void loop(void) {
// Process incoming messages (like config from server)
gw.process();
float average;
// take N samples in a row, with a slight delay
for (uint8_t i=0; i< NUMSAMPLES; i++) {
samples[i] = analogRead(THERMISTORPIN);
delay(10);
}
// average all the samples out
average = 0;
for (uint8_t i=0; i< NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;
Serial.print("Average analog reading ");
Serial.println(average);
// convert the value to resistance
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
Serial.print("Thermistor resistance ");
Serial.println(average);
float temperature;
temperature = average / THERMISTORNOMINAL; // (R/Ro)
temperature = log(temperature); // ln(R/Ro)
temperature /= BCOEFFICIENT; // 1/B * ln(R/Ro)
temperature += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
temperature = 1.0 / temperature; // Invert
temperature -= 258.95; // convert to C
Serial.print("Temperature ");
Serial.print(temperature);
Serial.println(" *C");
// Send in the new temperature
gw.send(msg.setSensor(0).set(temperature,1));
// delay(1000);
gw.sleep(SLEEP_TIME);
}
Hi Everyone,
Just trying to get everything set back up correctly and I def have something wrong, my distance sensors show Zero.
0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
3 TSM:INIT
4 TSF:WUR:MS=0
11 TSM:INIT:TSP OK
13 TSF:SID:OK,ID=254
15 TSM:FPAR
51 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
2059 !TSM:FPAR:NO REPLY
2061 TSM:FPAR
2097 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
2615 TSF:MSG:READ,0-0-254,s=255,c=3,t=8,pt=1,l=1,sg=0:0
2620 TSF:MSG:FPAR OK,ID=0,D=1
4105 TSM:FPAR:OK
4106 TSM:ID
4107 TSM:ID:OK
4109 TSM:UPL
4118 TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4128 TSF:MSG:READ,0-0-254,s=255,c=3,t=25,pt=1,l=1,sg=0:1
4133 TSF:MSG:PONG RECV,HP=1
4136 TSM:UPL:OK
4137 TSM:READY:ID=254,PAR=0,DIS=1
4150 TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
4157 TSF:MSG:READ,0-0-254,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
4166 TSF:MSG:SEND,254-254-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
4177 TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
4211 TSF:MSG:READ,0-0-254,s=255,c=3,t=6,pt=0,l=1,sg=0:M
4234 TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=11,pt=0,l=15,sg=0,ft=0,st=OK:Distance Sensor
4246 TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
4265 TSF:MSG:SEND,254-254-0-0,s=1,c=0,t=15,pt=0,l=0,sg=0,ft=0,st=OK:
4272 MCO:REG:REQ
4282 TSF:MSG:SEND,254-254-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
4289 TSF:MSG:READ,0-0-254,s=255,c=3,t=27,pt=1,l=1,sg=0:1
4294 MCO:PIM:NODE REG=1
4296 MCO:BGN:STP
4298 MCO:BGN:INIT OK,TSP=1
Ping: 0 cm
4336 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
4341 MCO:SLP:TPD
4343 MCO:SLP:WUP=-1
Ping: 0 cm
4380 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
4386 MCO:SLP:TPD
4387 MCO:SLP:WUP=-1
Ping: 0 cm
4425 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
4430 MCO:SLP:TPD
Any idea why? Pins are set correctly 5 and 6.
Thanks
Hi
Attached below I am getting an error trying to upgrade to 2.1.1 lib, it must be where the files are saved (I think???). ANy helpw would be great.
Thanks
/**
* 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 - Changed for MySensors usage by Bart Eversdijk
* Version 1.1 - Added option to record manual presets up to 240
* Version 2.0 - Migrated to MySensrors version 2.0
*
* DESCRIPTION
*
* IRrecord: record and play back IR signals as a minimal
* An IR detector/demodulator must be connected to the input RECV_PIN.
* An IR LED must be connected to the output PWM pin 3.
*
*
* The logic is:
* If a V_IR_RECORD is received the node enters in record mode and once a valid IR message has been received
* it is stored in EEPROM. The first byte of the V_IR_RECORD message will be used as preset ID
*
* If a V_IR_SEND the IR message beloning to the preset number of the first message byte is broadcasted
*
*
* Version 0.11 September, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
// Enable debug prints
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
#define MY_NODE_ID 5
#include <SPI.h>
#include <MySensors.h>
#include <IRremote.h> // https://github.com/z3t0/Arduino-IRremote/releases
// OR install IRRemote via "Sketch" -> "Include Library" -> "Manage Labraries..."
// Search for IRRemote b shirif and press the install button
// Arduino pin to connect the IR receiver to
int RECV_PIN = 8;
#define CHILD_ID 2
#define MY_RAWBUF 50
const char * TYPE2STRING[] = {
"UNKONWN",
"RC5",
"RC6",
"NEC",
"Sony",
"Panasonic",
"JVC",
"SAMSUNG",
"Whynter",
"AIWA RC T501",
"LG",
"Sanyo",
"Mitsubishi",
"Dish",
"Sharp",
"Denon"
};
#define Type2String(x) TYPE2STRING[x < 0 ? 0 : x]
#define AddrTxt F(" addres: 0x")
#define ValueTxt F(" value: 0x")
#define NATxt F(" - not implemented/found")
// Raw or unknown codes requires an Arduino with a larger memory like a MEGA and some changes to store in EEPROM (now max 255 bytes)
// #define IR_SUPPORT_UNKNOWN_CODES
typedef union
{
struct
{
decode_type_t type; // The type of code
unsigned long value; // The data bits if type is not raw
int len; // The length of the code in bits
unsigned int address; // Used by Panasonic & Sharp [16-bits]
} code;
#ifdef IR_SUPPORT_UNKNOWN_CODES
struct
{
decode_type_t type; // The type of code
unsigned int codes[MY_RAWBUF];
byte count; // The number of interval samples
} raw;
#endif
} IRCode;
#define MAX_STORED_IR_CODES 10
IRCode StoredIRCodes[MAX_STORED_IR_CODES];
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results ircode;
#define NO_PROG_MODE 0xFF
byte progModeId = NO_PROG_MODE;
// Manual Preset IR values -- these are working demo values
// VERA call: luup.call_action("urn:schemas-arduino-cc:serviceId:ArduinoIr1", "SendIrCode", {Index=15}, <device number>)
// One can add up to 240 preset codes (if your memory lasts) to see to correct data connect the Arduino with this plug in and
// look at the serial monitor while pressing the desired RC button
IRCode PresetIRCodes[] = {
{ { RC5, 0x01, 12, 0 }}, // 11 - RC5 key "1"
{ { RC5, 0x02, 12, 0 }}, // 12 - RC5 key "2"
{ { RC5, 0x03, 12, 0 }}, // 13 - RC5 key "3"
{ { NEC, 0xFF30CF, 32, 0 }}, // 14 - NEC key "1"
{ { NEC, 0xFF18E7, 32, 0 }}, // 15 - NEC key "2"
{ { NEC, 0xFF7A85, 32, 0 }}, // 16 - NEC key "3"
{ { NEC, 0xFF10EF, 32, 0 }}, // 17 - NEC key "4"
{ { NEC, 0xFF38C7, 32, 0 }}, // 18 - NEC key "5"
{ { RC6, 0x800F2401, 36, 0 }}, // 19 - RC6 key "1" MicroSoft Mulitmedia RC
{ { RC6, 0x800F2402, 36, 0 }} // 20 - RC6 key "2" MicroSoft Mulitmedia RC
};
#define MAX_PRESET_IR_CODES (sizeof(PresetIRCodes)/sizeof(IRCode))
#define MAX_IR_CODES (MAX_STORED_IR_CODES + MAX_PRESET_IR_CODES)
MyMessage msgIrReceive(CHILD_ID, V_IR_RECEIVE);
MyMessage msgIrRecord(CHILD_ID, V_IR_RECORD);
void setup()
{
// Tell MYS Controller that we're NOT recording
send(msgIrRecord.set(0));
Serial.println(F("Recall EEPROM settings"));
recallEeprom(sizeof(StoredIRCodes), (byte *)&StoredIRCodes);
// Start the ir receiver
irrecv.enableIRIn();
Serial.println(F("Init done..."));
}
void presentation ()
{
// Send the sketch version information to the gateway and Controller
sendSketchInfo("IR Rec/Playback", "2.0");
// Register a sensors to gw. Use binary light for test purposes.
present(CHILD_ID, S_IR);
}
void loop()
{
if (irrecv.decode(&ircode)) {
dump(&ircode);
if (progModeId != NO_PROG_MODE) {
// If we are in PROG mode (Recording) store the new IR code and end PROG mode
if (storeRCCode(progModeId)) {
Serial.println(F("Stored "));
// If sucessfull RC decode and storage --> also update the EEPROM
storeEeprom(sizeof(StoredIRCodes), (byte *)&StoredIRCodes);
progModeId = NO_PROG_MODE;
// Tell MYS Controller that we're done recording
send(msgIrRecord.set(0));
}
} else {
// If we are in Playback mode just tell the MYS Controller we did receive an IR code
if (ircode.decode_type != UNKNOWN) {
if (ircode.value != REPEAT) {
// Look if we found a stored preset 0 => not found
byte num = lookUpPresetCode(&ircode);
if (num) {
// Send IR decode result to the MYS Controller
Serial.print(F("Found code for preset #"));
Serial.println(num);
send(msgIrReceive.set(num));
}
}
}
}
// Wait a while before receive next IR-code (also block MySensors receiver so it will not interfere with a new message)
delay(500);
// Start receiving again
irrecv.resume();
}
}
void receive(const MyMessage &message) {
//Serial.print(F("New message: "));
//Serial.println(message.type);
if (message.type == V_IR_RECORD) { // IR_RECORD V_VAR1
// Get IR record requets for index : paramvalue
progModeId = message.getByte() % MAX_STORED_IR_CODES;
// Tell MYS Controller that we're now in recording mode
send(msgIrRecord.set(1));
Serial.print(F("Record new IR for: "));
Serial.println(progModeId);
}
if (message.type == V_IR_SEND) {
// Send an IR code from offset: paramvalue - no check for legal value
Serial.print(F("Send IR preset: "));
byte code = message.getByte() % MAX_IR_CODES;
if (code == 0) {
code = MAX_IR_CODES;
}
Serial.print(code);
sendRCCode(code);
}
// Start receiving ir again...
irrecv.enableIRIn();
}
byte lookUpPresetCode (decode_results *ircode)
{
// Get rit of the RC5/6 toggle bit when looking up
if (ircode->decode_type == RC5) {
ircode->value = ircode->value & 0x7FF;
}
if (ircode->decode_type == RC6) {
ircode->value = ircode->value & 0xFFFF7FFF;
}
for (byte index = 0; index < MAX_STORED_IR_CODES; index++)
{
if ( StoredIRCodes[index].code.type == ircode->decode_type &&
StoredIRCodes[index].code.value == ircode->value &&
StoredIRCodes[index].code.len == ircode->bits) {
// The preset number starts with 1 so the last is stored as 0 -> fix this when looking up the correct index
return (index == 0) ? MAX_STORED_IR_CODES : index;
}
}
for (byte index = 0; index < MAX_PRESET_IR_CODES; index++)
{
if ( PresetIRCodes[index].code.type == ircode->decode_type &&
PresetIRCodes[index].code.value == ircode->value &&
PresetIRCodes[index].code.len == ircode->bits) {
// The preset number starts with 1 so the last is stored as 0 -> fix this when looking up the correct index
return ((index == 0) ? MAX_PRESET_IR_CODES : index) + MAX_STORED_IR_CODES;
}
}
// not found so return 0
return 0;
}
// Stores the code for later playback
bool storeRCCode(byte index) {
if (ircode.decode_type == UNKNOWN) {
#ifdef IR_SUPPORT_UNKNOWN_CODES
Serial.println(F("Received unknown code, saving as raw"));
// To store raw codes:
// Drop first value (gap)
// As of v1.3 of IRLib global values are already in microseconds rather than ticks
// They have also been adjusted for overreporting/underreporting of marks and spaces
byte rawCount = min(ircode.rawlen - 1, MY_RAWBUF);
for (int i = 1; i <= rawCount; i++) {
StoredIRCodes[index].raw.codes[i - 1] = ircode.rawbuf[i]; // Drop the first value
};
return true;
#else
return false;
}
#endif
if (ircode.value == REPEAT) {
// Don't record a NEC repeat value as that's useless.
Serial.println(F("repeat; ignoring."));
return false;
}
// Get rit of the toggle bit when storing RC5/6
if (ircode.decode_type == RC5) {
ircode.value = ircode.value & 0x07FF;
}
if (ircode.decode_type == RC6) {
ircode.value = ircode.value & 0xFFFF7FFF;
}
StoredIRCodes[index].code.type = ircode.decode_type;
StoredIRCodes[index].code.value = ircode.value;
StoredIRCodes[index].code.address = ircode.address; // Used by Panasonic & Sharp [16-bits]
StoredIRCodes[index].code.len = ircode.bits;
Serial.print(F(" value: 0x"));
Serial.println(ircode.value, HEX);
return true;
}
void sendRCCode(byte index) {
IRCode *pIr = ((index <= MAX_STORED_IR_CODES) ? &StoredIRCodes[index % MAX_STORED_IR_CODES] : &PresetIRCodes[index - MAX_STORED_IR_CODES - 1]);
#ifdef IR_SUPPORT_UNKNOWN_CODES
if(pIr->code.type == UNKNOWN) {
// Assume 38 KHz
irsend.sendRaw(pIr->raw.codes, pIr->raw.count, 38);
Serial.println(F("Sent raw"));
return;
}
#endif
Serial.print(F(" - sent "));
Serial.print(Type2String(pIr->code.type));
if (pIr->code.type == RC5) {
// For RC5 and RC6 there is a toggle bit for each succesor IR code sent alway toggle this bit, needs to repeat the command 3 times with 100 mS pause
pIr->code.value ^= 0x0800;
for (byte i=0; i < 3; i++) {
if (i > 0) { delay(100); }
irsend.sendRC5(pIr->code.value, pIr->code.len);
}
}
else if (pIr->code.type == RC6) {
// For RC5 and RC6 there is a toggle bit for each succesor IR code sent alway toggle this bit, needs to repeat the command 3 times with 100 mS pause
if (pIr->code.len == 20) {
pIr->code.value ^= 0x10000;
}
for (byte i=0; i < 3; i++) {
if (i > 0) { delay(100); }
irsend.sendRC6(pIr->code.value, pIr->code.len);
}
}
else if (pIr->code.type == NEC) {
irsend.sendNEC(pIr->code.value, pIr->code.len);
}
else if (pIr->code.type == SONY) {
irsend.sendSony(pIr->code.value, pIr->code.len);
}
else if (pIr->code.type == PANASONIC) {
irsend.sendPanasonic(pIr->code.address, pIr->code.value);
Serial.print(AddrTxt);
Serial.println(pIr->code.address, HEX);
}
else if (pIr->code.type == JVC) {
irsend.sendJVC(pIr->code.value, pIr->code.len, false);
}
else if (pIr->code.type == SAMSUNG) {
irsend.sendSAMSUNG(pIr->code.value, pIr->code.len);
}
else if (pIr->code.type == WHYNTER) {
irsend.sendWhynter(pIr->code.value, pIr->code.len);
}
else if (pIr->code.type == AIWA_RC_T501) {
irsend.sendAiwaRCT501(pIr->code.value);
}
else if (pIr->code.type == LG || pIr->code.type == SANYO || pIr->code.type == MITSUBISHI) {
Serial.println(NATxt);
return;
}
else if (pIr->code.type == DISH) {
// need to repeat the command 4 times with 100 mS pause
for (byte i=0; i < 4; i++) {
if (i > 0) { delay(100); }
irsend.sendDISH(pIr->code.value, pIr->code.len);
}
}
else if (pIr->code.type == SHARP) {
irsend.sendSharp(pIr->code.address, pIr->code.value);
Serial.print(AddrTxt);
Serial.println(pIr->code.address, HEX);
}
else if (pIr->code.type == DENON) {
irsend.sendDenon(pIr->code.value, pIr->code.len);
}
else {
// No valid IR type, found it does not make sense to broadcast
Serial.println(NATxt);
return;
}
Serial.print(" ");
Serial.println(pIr->code.value, HEX);
}
// Dumps out the decode_results structure.
void dump(decode_results *results) {
int count = results->rawlen;
Serial.print(F("Received : "));
Serial.print(results->decode_type, DEC);
Serial.print(F(" "));
Serial.print(Type2String(results->decode_type));
if (results->decode_type == PANASONIC) {
Serial.print(AddrTxt);
Serial.print(results->address,HEX);
Serial.print(ValueTxt);
}
Serial.print(F(" "));
Serial.print(results->value, HEX);
Serial.print(F(" ("));
Serial.print(results->bits, DEC);
Serial.println(F(" bits)"));
if (results->decode_type == UNKNOWN) {
Serial.print(F("Raw ("));
Serial.print(count, DEC);
Serial.print(F("): "));
for (int i = 0; i < count; i++) {
if ((i % 2) == 1) {
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
}
else {
Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
}
Serial.print(" ");
}
Serial.println("");
}
}
// Store IR record struct in EEPROM
void storeEeprom(byte len, byte *buf)
{
saveState(0, len);
for (byte i = 1; i < min(len, 100); i++, buf++)
{
saveState(i, *buf);
}
}
void recallEeprom(byte len, byte *buf)
{
if (loadState(0) != len)
{
Serial.print(F("Corrupt EEPROM preset values and Clear EEPROM"));
for (byte i = 1; i < min(len, 100); i++, buf++)
{
*buf = 0;
storeEeprom(len, buf);
}
return;
}
for (byte i = 1; i < min(len, 100); i++, buf++)
{
*buf = loadState(i);
}
}
ERROR
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Nano, ATmega328"
Using library SPI in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Using library MySensors in folder: C:\Users\Audrey\Documents\Arduino\libraries\MySensors
Using library Robot IR Remote in folder: C:\Program Files (x86)\Arduino\libraries\RobotIRremote
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI -IC:\Users\Audrey\Documents\Arduino\libraries\MySensors -IC:\Program Files (x86)\Arduino\libraries\RobotIRremote\src C:\Users\Audrey\AppData\Local\Temp\build1415505741175231405.tmp\IrSensor.cpp -o C:\Users\Audrey\AppData\Local\Temp\build1415505741175231405.tmp\IrSensor.cpp.o
IrSensor.ino:95:5: error: 'decode_type_t' does not name a type
IrSensor.ino:114:1: error: 'IRsend' does not name a type
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino:135:1: error: too many initializers for 'IRCode::<anonymous struct>'
IrSensor.ino: In function 'byte lookUpPresetCode(decode_results*)':
IrSensor.ino:246:38: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:256:38: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino: In function 'bool storeRCCode(byte)':
IrSensor.ino:300:30: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:302:49: error: 'class decode_results' has no member named 'address'
IrSensor.ino: In function 'void sendRCCode(byte)':
IrSensor.ino:322:39: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:84:38: note: in definition of macro 'Type2String'
IrSensor.ino:322:39: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:84:50: note: in definition of macro 'Type2String'
IrSensor.ino:323:18: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:328:10: error: 'irsend' was not declared in this scope
IrSensor.ino:331:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:338:10: error: 'irsend' was not declared in this scope
IrSensor.ino:341:23: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:342:8: error: 'irsend' was not declared in this scope
IrSensor.ino:344:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:345:8: error: 'irsend' was not declared in this scope
IrSensor.ino:347:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:348:8: error: 'irsend' was not declared in this scope
IrSensor.ino:352:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:353:8: error: 'irsend' was not declared in this scope
IrSensor.ino:355:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:355:32: error: 'SAMSUNG' was not declared in this scope
IrSensor.ino:356:8: error: 'irsend' was not declared in this scope
IrSensor.ino:358:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:358:32: error: 'WHYNTER' was not declared in this scope
IrSensor.ino:359:8: error: 'irsend' was not declared in this scope
IrSensor.ino:361:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:361:32: error: 'AIWA_RC_T501' was not declared in this scope
IrSensor.ino:362:8: error: 'irsend' was not declared in this scope
IrSensor.ino:364:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:364:32: error: 'LG' was not declared in this scope
IrSensor.ino:364:48: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:364:75: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:368:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:372:12: error: 'irsend' was not declared in this scope
IrSensor.ino:375:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:376:8: error: 'irsend' was not declared in this scope
IrSensor.ino:380:24: error: 'struct IRCode::<anonymous>' has no member named 'type'
IrSensor.ino:380:32: error: 'DENON' was not declared in this scope
IrSensor.ino:381:8: error: 'irsend' was not declared in this scope
IrSensor.ino: In function 'void dump(decode_results*)':
IrSensor.ino:403:29: error: 'class decode_results' has no member named 'address'
'decode_type_t' does not name a type
Thank you for your help, the thing is working. It has something to do with the way I have the Arduino software setup, for some reason I can't just copy a sketch and paste it in for a new sketch.
Messing around with it and got this message, still not idea how to fix it
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"
Using library MySensors in folder: C:\Users\Audrey\Documents\Arduino\libraries\MySensors
Using library Ethernet in folder: C:\Program Files (x86)\Arduino\libraries\Ethernet
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Users\Audrey\Documents\Arduino\libraries\MySensors -IC:\Program Files (x86)\Arduino\libraries\Ethernet\src C:\Users\Audrey\AppData\Local\Temp\build1062139905146989693.tmp\GatewayW5100.cpp -o C:\Users\Audrey\AppData\Local\Temp\build1062139905146989693.tmp\GatewayW5100.cpp.o
In file included from GatewayW5100.ino:2:0:
C:\Users\Audrey\Documents\Arduino\libraries\MySensors/MySensors.h:328:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
^
Error compiling.
Why do i get this error? Any idea how to fix it?
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"
In file included from C:\Users\Audrey\Documents\Arduino\libraries\MySensors/drivers/RF24/RF24.cpp:23:0,
from C:\Users\Audrey\Documents\Arduino\libraries\MySensors/MySensors.h:290,
from GatewayW5100.ino:116:
C:\Users\Audrey\Documents\Arduino\libraries\MySensors/drivers/RF24/RF24.h:37:17: fatal error: SPI.h: No such file or directory
#include <SPI.h>
^
compilation terminated.
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Ok, I screwed up and downloaded the latest arduino software 1.8.3 and can't get my libraries to work correctly. I am trying to upgrade my sensors to 2.1.1 and rebuild my gateway using a new nano I put together. I am using the5100 connection with the radio wired to a0..... It the 1.8.3 not to be used for the overseas board?
hi everyone,
has the pin setup changed? it looks like it has from the sketch. I used a0, a1 and a2 for the radio.
What is the chances of posted the detailed wiring and parts list? This sounds excellent.
Thansk
Nice project would love to see the finished product as I want to try it as well. Can you post all the details once you get it do Easy?
Thanks and good luck
Can't find out how to actually fix this error. Any wording to point me in the correct direction?
Hi
Not sure if anyone has seen the hackaday post below, is uses a SDR to read your power consumption. I am using it and want to incorporate it into mysensors, any ideas?
http://hackaday.com/2014/02/25/using-sdr-to-read-your-smart-meter/
I use vera for my home automation.
Hi Everyone,
Has anyone been able to set this appliance controller to turn on with my sensors? I want to use it for turning xmas lights on inside. It is a Chamberlain CLLAD Security+ Plug-In Light Control.
Thanks
T
Failure running mysensors plugin
I switched to a Vera Plus a few months ago and at the same time my Ethernet gateway went down. I blamed it on the Ethernet module and switched to W5100. It shows connected to the router and Vera. When I run it connected to my computer it shows gateway started and radio ok. So I am a little confused why I get the error message failure running mysensors plugin. One final thing I also upgraded to the newest firmware on Vera.
Thanks, I will explore that as well.
Hack Chamberlain garage keypad.
Hi anyone ever hack a garage door keypad? I am interested in not only open/close my door but would like the option to change the code on the keypad. I am figuring I can connect a wire to each button on the keypad and wire it to and arduino uno Then connect a wire to the purple button on the motor unit to another arduino. Once done add the code to press the purple button, then enter code twice and it should be changed. If it works I like then to add it to Vera as a my sensor lock. Do you think this can be done? Was it done before?
Hi Pete and thanks for replying to my note. No I didn't make any changes at all and my GW went down. I figured something was wrong with it so I tried to build another and couldn't program it because of the Chinese nano. I switched to the Uno and my sensors didn't come back online. At th same time I was figuring this out I had changed to a new Vera plus and had issues with the restore. I think it was a combination of everything. I am back up with the uno and worked around the Chinese nano loading the arduino software to an older computer and using older drivers. I do believe I have it up and working. Thanks again for everything your help is greatly appreciated.
I almost forgot I also received a radio fail error on the monitor, it was from a sensor that I had in use and worked so the wiring was correct. it's almost like the nano's have a virus or something.
Hi, I have a similar problem and moved back to an Arduino UNO for my gateway however I have 30 sensors that are nano's and all have gone down. Not sure why the USB would cause an issue for the sensors in use, they are not connected to a computer and all only connect to the gateway. I lost communication with the GW a few weeks ago and figured it had something to do with the upgrade to VP. Any help that can get this back would be appreciated. I have tried the following;
@petewill, thanks for the reply and sorry it took me so long. I have decided to keep it to a small project starting with the remote on off, then moving to a trigger to my camera. I plan on breaking the doorbell down once the wife is out of the house for a day, lol. Thanks again.
Excellent project, great work.. So I need to pick your mind.... I have a doorbell that can change music and volume. I hope to be able to fully control it by zwave using this app with Vera...Any ideas.....
Hi, I started a similar project would you have the detail wire, equipment list and code for your project.
Thanks
First of all i would like to say thanks for all the help in the past its totally appreciated.
I have a weather station from Acu-Rite
Approved Operating Frequencies
App ID443730, Approval Date: 04/07/2014
Grant Notes FCC Rule Parts Frequency
Range (MHZ) Output
Watts Frequency
Tolerance Emission
Designator
15.231(e) 433.92 - 433.92
Exhibits
I am trying to connect this into my Vera and need help, i| have read all the information but cant get this to work, actually I cant even get the sniffers to pick it up. What am i doing wrong, need some brain support.
I have both the nanos and the unos and tried both with a cheap 433mhz trans/rec.
Tim
Thank you very much worked great, I have the probe in my deep freeze ... If something goes wrong I get a notification. No more spoiled food. Thank you very much, it was very well appreciated..
Hi
I need help my temp sensor sends the temp value to the gateway I can see it in serial connection but I can see the actual value in the Vera sensor. How do I get Vera to post the value? It can see the sensor and has set it up but still reads a blank. Help please and thanks
Hi Fleinze, thanks for the help. I am using A0 for the pin and I decided to rebuild the Dallas temp sketch, I can compile it and the radio looks like it is communicating, I just can get it to register as a sensor in vera. Any ideas?
NEW Sketch
#include <MySensor.h>
#include <SPI.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
#define ONE_WIRE_BUS A0 // Pin where sensor is connected
#define MAX_ATTACHED_DS18B20 16
#define LONG_WAIT 500
#define SHORT_WAIT 50
#define ID_S_TEMP 97
#define THERMISTORPIN A0
#define THERMISTORNOMINAL 10000
#define TEMPERATURENOMINAL 25
#define NUMSAMPLES 5
#define BCOEFFICIENT 3950
#define SERIESRESISTOR 10000
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature.
MySensor gw;
float lastTemperature[MAX_ATTACHED_DS18B20];
int numSensors=A0;
boolean receivedConfig = false;
boolean metric = true;
// Initialize temperature message
MyMessage msg(A0,V_TEMP);
int samples[NUMSAMPLES];
void setup(void) {
Serial.begin(115200);
analogReference(EXTERNAL);
// Startup up the OneWire library
sensors.begin();
// requestTemperatures() will not block current thread
sensors.setWaitForConversion(false);
// Startup and initialize MySensors library. Set callback for incoming messages.
gw.begin();
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Temperature Sensor", "1.1");
// Fetch the number of attached temperature sensors
numSensors = sensors.getDeviceCount();
// Present all sensors to controller
for (int i=A0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
gw.present(i, S_TEMP);
}
}
void loop(void) {
// Process incoming messages (like config from server)
gw.process();
// Fetch temperatures from sensor
sensors.requestTemperatures();
// query conversion time and sleep until conversion completed
int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
// sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
gw.sleep(conversionTime);
uint8_t i;
float average;
// take N samples in a row, with a slight delay
for (i=0; i< NUMSAMPLES; i++) {
samples[i] = analogRead(THERMISTORPIN);
delay(10);
}
// average all the samples out
average = 0;
for (i=0; i< NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;
Serial.print("Average analog reading ");
Serial.println(average);
// convert the value to resistance
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
Serial.print("Thermistor resistance ");
Serial.println(average);
float temperature;
temperature = average / THERMISTORNOMINAL; // (R/Ro)
temperature = log(temperature); // ln(R/Ro)
temperature /= BCOEFFICIENT; // 1/B * ln(R/Ro)
temperature += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
temperature = 1.0 / temperature; // Invert
temperature -= 258.95; // convert to C
Serial.print("Temperature ");
Serial.print(temperature);
Serial.println(" *C");
// Send in the new temperature
gw.send(msg.setSensor(i).set(temperature,1));
// Save new temperatures for next compare
lastTemperature[i]=temperature;
// delay(1000);
gw.sleep(SLEEP_TIME);
}
send: 254-254-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
send: 254-254-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
read: 0-0-254 s=255,c=3,t=6,pt=0,l=1,sg=0:M
read: 0-0-254 s=255,c=3,t=1,pt=0,l=10,sg=0:1442404204
sensor started, id=254, parent=0, distance=1
send: 254-254-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0,st=ok:Temperature Sensor
send: 254-254-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.1
Average analog reading 706.00
Thermistor resistance 22271.30
Temperature 22.21 *C
send: 254-254-0-0 s=5,c=1,t=0,pt=7,l=5,sg=0,st=ok:22.2
Average analog reading 707.00
Thermistor resistance 22373.42
Temperature 22.12 *C
send: 254-254-0-0 s=5,c=1,t=0,pt=7,l=5,sg=0,st=ok:22.1
Average analog reading 707.20
Thermistor resistance 22393.92
Temperature 22.10 *C
send: 254-254-0-0 s=5,c=1,t=0,pt=7,l=5,sg=0,st=ok:22.1
Average analog reading 708.00
Thermistor resistance 22476.19
Temperature 22.02 *C
send: 254-254-0-0 s=5,c=1,t=0,pt=7,l=5,sg=0,st=ok:22.0
Average analog reading 709.00
Thermistor resistance 22579.62
Temperature 21.93 *C
So the value that sends is rounded 21.93C = 22 and it looks like it sent that. I just cant figure out how the vera will pick it up.
Any ideas?
Hi,
How do I add the radio sketch to this simple sketch?
#include <MySensor.h>
#include <SPI.h>
// SPI Pins
#define CE_PIN 9
#define CS_PIN 10
// Wait times
#define LONG_WAIT 500
#define SHORT_WAIT 50
#define SKETCH_NAME "2 Wire Temp Probe"
#define SKETCH_VERSION "v0.1"// which analog pin to connect
#define ID_S_TEMP 007
#define THERMISTORPIN A0
// resistance at 25 degrees C
#define THERMISTORNOMINAL 10000
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3950
// the value of the 'other' resistor
#define SERIESRESISTOR 10000
// Global Vars
unsigned long SLEEP_TIME = 12000; // Sleep time between reads (in milliseconds)
boolean metric = true;
long randNumber;
// Instanciate MySersors Gateway
MySensor gw;
#ifdef ID_S_TEMP
MyMessage msg_S_TEMP(ID_S_TEMP,V_TEMP);
#endif
#ifdef ID_S_DISTANCE
MyMessage msg_S_DISTANCE(ID_S_DISTANCE,V_DISTANCE);
#endif
int samples[NUMSAMPLES];
void setup(void) {
Serial.begin(9600);
analogReference(EXTERNAL);
}
void loop(void) {
uint8_t i;
float average;
// take N samples in a row, with a slight delay
for (i=0; i< NUMSAMPLES; i++) {
samples[i] = analogRead(THERMISTORPIN);
delay(10);
}
// average all the samples out
average = 0;
for (i=0; i< NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;
Serial.print("Average analog reading ");
Serial.println(average);
// convert the value to resistance
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
Serial.print("Thermistor resistance ");
Serial.println(average);
float steinhart;
steinhart = average / THERMISTORNOMINAL; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 258.95; // convert to C
Serial.print("Temperature ");
Serial.print(steinhart);
Serial.println(" *C");
delay(1000);
}
Managed to get the serial gateway back, had something todo with the firmware update. Completed a 3rd restore and the reinstalled the firmware and another restore. Gave up on the Ethernet gateway, couldn't get it to work.
@hek help...... I was stupid and tried to get the Ethernet gateway up and running, the only thing I did was change the gateway and for some reason I could not get the Ethernet gateway working so I jumped back to the serial gateway. That no longer works, on top of this I changed fireware and had to revert back to a backup? Any suggestions? The Arduino Nano sketch didn't change and I reloaded all the U17 files again. The gateway doesn't give an error it just doesn't add the sensors. Any help would be greatly appreciated.
I did notice that the lib has no version, it did have 15.
The error I get is as follows; and I am using U17 and NRF24L01. I have power to the UNO as well.
MySensors plugin : Cannot send command - communications error
ERROR : Error in lua for scenes and events Not sure if this is related to this or my calendar issue.
Hi
Wondering if anyone has used an UNO for the gateway? Does anything change? I am using the ENC28J60 and made the change as follows;
#include <UIPEthernet.h> // Use this if you have attached a Ethernet ENC28J60 shields
I also used the default IP address and programed it into the vera, am I missing something?
I changed from the serial gateway and that worked perfect, I wanted to use the UNO as I have more of them and I was told the Ethernet gateway worked better.
Any help would be greatly appreciated.
T
Hi Hek, I tried everything and like any computer garbage in garbage out. The U17 files worked, THANKS VERY MUCH... I tried everything delete the files, uploaded, deleted uploaded over and over. Figured in must be the nano board, replaced that and did it all over again. It all came down to the wrong upload. All working go figure. Thanks
Hi and thanks for your help, it is well appreciated. I have deleted and installed this 100 times. Found that problem and still can't get the gateway to work. I have attached a few pics, maybe I have a simple mistake that I am missing.!
Hi
I built a Vera Serial Gateway, uploaded the sketch, received an error Device Not Ready. Tool the gateway apart rechecked the connections. Deleted the Arduino lib and reinstalled and have it all screwed up. The new sketch has an error on compile
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Nano, ATmega328"
In file included from SerialGateway.ino:42:0:
C:\Program Files (x86)\Arduino\libraries\MySensors/MyTransportRFM69.h:33:36: error: 'RFM69_FREQUENCY' was not declared in this scope
MyTransportRFM69(uint8_t freqBand=RFM69_FREQUENCY, uint8_t networkId=RFM69_NETWORKID, uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, uint8_t interruptNum=RF69_IRQ_NUM);
^
C:\Program Files (x86)\Arduino\libraries\MySensors/MyTransportRFM69.h:33:71: error: 'RFM69_NETWORKID' was not declared in this scope
MyTransportRFM69(uint8_t freqBand=RFM69_FREQUENCY, uint8_t networkId=RFM69_NETWORKID, uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, uint8_t interruptNum=RF69_IRQ_NUM);
^
In file included from SerialGateway.ino:43:0:
C:\Program Files (x86)\Arduino\libraries\MySensors/MyTransportNRF24.h:38:30: error: 'RF24_CE_PIN' was not declared in this scope
MyTransportNRF24(uint8_t ce=RF24_CE_PIN, uint8_t cs=RF24_CS_PIN, uint8_t paLevel=RF24_PA_LEVEL);
^
C:\Program Files (x86)\Arduino\libraries\MySensors/MyTransportNRF24.h:38:54: error: 'RF24_CS_PIN' was not declared in this scope
MyTransportNRF24(uint8_t ce=RF24_CE_PIN, uint8_t cs=RF24_CS_PIN, uint8_t paLevel=RF24_PA_LEVEL);
^
In file included from SerialGateway.ino:45:0:
C:\Program Files (x86)\Arduino\libraries\MySensors/MySigningAtsha204Soft.h:62:25: error: 'MY_RANDOMSEED_PIN' was not declared in this scope
uint8_t randomseedPin=MY_RANDOMSEED_PIN);
^
In file included from SerialGateway.ino:46:0:
C:\Program Files (x86)\Arduino\libraries\MySensors/MySigningAtsha204.h:53:20: error: 'MY_ATSHA204_PIN' was not declared in this scope
uint8_t atshaPin=MY_ATSHA204_PIN);
^
In file included from C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:27:0,
from SerialGateway.ino:50:
C:\Program Files (x86)\Arduino\libraries\MySensors/utility/LowPower.h:4:6: error: multiple definition of 'enum period_t'
enum period_t
^
In file included from SerialGateway.ino:44:0:
C:\Program Files (x86)\Arduino\libraries\MySensors/MyHwATMega328.h:80:6: error: previous definition here
enum period_t
^
In file included from SerialGateway.ino:50:0:
C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h: In function 'void parseAndSend(MySensor&, char*)':
C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:266:10: error: 'boolean MySensor::sendRoute(MyMessage&)' is protected
boolean sendRoute(MyMessage &message);
^
In file included from SerialGateway.ino:53:0:
GatewayUtil.h:118: error: within this context
ok = gw.sendRoute(msg);
^
SerialGateway.ino: At global scope:
SerialGateway:62: error: 'RF24_CE_PIN' was not declared in this scope
SerialGateway:62: error: 'RF24_CS_PIN' was not declared in this scope
SerialGateway:78: error: no matching function for call to 'MySensor::MySensor(MyTransportNRF24&, MyHwATMega328&)'
SerialGateway.ino:78:39: note: candidates are:
In file included from SerialGateway.ino:50:0:
C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:94:2: note: MySensor::MySensor(uint8_t, uint8_t)
MySensor(uint8_t _cepin=DEFAULT_CE_PIN, uint8_t _cspin=DEFAULT_CS_PIN);
^
C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:94:2: note: no known conversion for argument 1 from 'MyTransportNRF24' to 'uint8_t {aka unsigned char}'
C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:83:7: note: MySensor::MySensor(const MySensor&)
class MySensor : public RF24
^
C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:83:7: note: candidate expects 1 argument, 2 provided
within this context
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.