Quite popular project after all..
https://www.kickstarter.com/projects/pokitmeter/pokit-pro/posts/2691302
Quite popular project after all..
https://www.kickstarter.com/projects/pokitmeter/pokit-pro/posts/2691302
btw, did anyone here back their previous project the pokit meter?
I would love to hear some comments about how the previous campaign project was handled and general information about the product quality this company produces.
Hi all, just wanted to let you know about this kickstarter project and if you find it interesting and decided to back it please do so via my referral link ;)
@sparky60 yes, 4 inputs and 4 outputs. It should be easy to modify if you need a different amount.
@sparky60
Yes it is possible to run I/O on a Ethernet Gateway without radio unit
Yes it is possible to have multiple Gateways connected to the same Vera, you just add another plugin device and use different IP for it. Remember to also use different MAC address for each GW in the sketch.
Not sure how up to date this example is because I have not updated my devices for a year or 2 but I think you get the idea.
Example sketch:
/**
* 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
* 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 WITH_LEDS_BLINKING in MyConfig.h
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
* - ERR (red) - fast blink on error during transmission error or recieve crc error
*
* See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
*
*/
// Enable debug prints to serial monitor
//#define MY_DEBUG
#define SN "EthGW/RFM69 Rele Button"
#define SV "1.1"
// Enable and select radio type attached
//#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
#define MY_RFM69_FREQUENCY RF69_433MHZ
#define MY_IS_RFM69HW
#define MY_RF69_SPI_CS 4 //try changeing this to 9
// 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 10
// 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.
// Enable to UDP
//#define MY_USE_UDP
#define MY_IP_ADDRESS 192,168,1,100 // If this is disabled, DHCP is used to retrieve address
// 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
// 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 Ardunio examples use "DEAD BEEF FEED" for the MAC address.
#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xED, 0xED
// Flash leds on rx/tx/err
//#define MY_LEDS_BLINKING_FEATURE
// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300
// 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
// Uncomment to override default HW configurations
//#define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin
//#define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin
//#define MY_DEFAULT_TX_LED_PIN 9 // the PCB, on board LED
#include <SPI.h>
#if defined(MY_USE_UDP)
#include <EthernetUdp.h>
#endif
#include <Ethernet.h>
#include <MySensors.h>
#include <Bounce2.h>
#define RELAY_ON 0 // switch around for ACTIVE LOW / ACTIVE HIGH relay
#define RELAY_OFF 1
//
#define noRelays 4 //2-4
const int relayPin[] = {14, 15, 16, 17}; // switch around pins to your desire
const int buttonPin[] = {7, 8, 5, 6}; // switch around pins to your desire
class Relay // relay class, store all relevant data (equivalent to struct)
{
public:
int buttonPin; // physical pin number of button
int relayPin; // physical pin number of relay
boolean relayState; // relay status (also stored in EEPROM)
};
Relay Relays[noRelays];
Bounce debouncer[noRelays];
MyMessage msg[noRelays];
void setup() {
wait(100);
// Initialize Relays with corresponding buttons
for (int i = 0; i < noRelays; i++) {
Relays[i].buttonPin = buttonPin[i]; // assign physical pins
Relays[i].relayPin = relayPin[i];
msg[i].sensor = i; // initialize messages
msg[i].type = V_LIGHT;
pinMode(Relays[i].buttonPin, INPUT_PULLUP);
wait(100);
pinMode(Relays[i].relayPin, OUTPUT);
Relays[i].relayState = loadState(i); // retrieve last values from EEPROM
digitalWrite(Relays[i].relayPin, Relays[i].relayState ? RELAY_ON : RELAY_OFF); // and set relays accordingly
send(msg[i].set(Relays[i].relayState ? true : false)); // make controller aware of last status
wait(50);
debouncer[i] = Bounce(); // initialize debouncer
debouncer[i].attach(buttonPin[i]);
debouncer[i].interval(30);
wait(50);
}
}
void presentation()
{
// Send the sketch version information to the gateway and Controller
sendSketchInfo(SN, SV);
wait(100);
for (int i = 0; i < noRelays; i++)
present(i, S_LIGHT); // present sensor to gateway
wait(100);
}
void loop()
{
for (byte i = 0; i < noRelays; i++) {
if (debouncer[i].update()) {
int value = debouncer[i].read();
if ( value == LOW) {
Relays[i].relayState = !Relays[i].relayState;
digitalWrite(Relays[i].relayPin, Relays[i].relayState ? RELAY_ON : RELAY_OFF);
send(msg[i].set(Relays[i].relayState ? true : false));
// save sensor state in EEPROM (location == sensor number)
saveState( i, Relays[i].relayState );
}
}
}
//wait(20);
}
void receive(const MyMessage &message) {
if (message.sender == 0) {
if (message.type == V_LIGHT) {
if (message.sensor < noRelays) { // check if message is valid for relays..... previous line [[[ if (message.sensor <=noRelays){ ]]]
Relays[message.sensor].relayState = message.getBool();
digitalWrite(Relays[message.sensor].relayPin, Relays[message.sensor].relayState ? RELAY_ON : RELAY_OFF); // and set relays accordingly
saveState( message.sensor, Relays[message.sensor].relayState ); // save sensor state in EEPROM (location == sensor number)
}
}
}
wait(20);
}
@royzone Your code is a bit incomplete because you did not include the entire line but I think that you are comparing some boolean variable to the value "HIGH" and if it is HIGH then you send the value "1" with ack (acknowledgement).
If an experienced coder see that my asumption is incorrect please correct me ;)
Just add LUA as a Logic Action triggered by a cyclic condition in PLEG
Using Lua just get the value from the temp sensor variable and set the variable on the thermostat:
local PipeTemp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 42)
luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",PipeTemp,44)
I have noticed that in the latest Vera firmware if a variable has no value it does not show up in the Advanced -> Variables tab.
Try writing some value manually from Apps -> Develop apps -> test loop code (here is an example):
luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_4", value=1}, 24)
24 in the example is the Id of the MySensors plugin Main device.
11;3 in the example is altid of the sensor node device.
After writing and refreshing of browser (Ctrl + F5) you should see the variables under Advanced -> Variables tab
The command should also send the value to your child node.
@gohan said in Which dust sensor do you use and why?:
@korttoma if you have a library that can read the values from the sensor, you can easily add the mysensors code
yeah I know, I just thought that if @NeverDie already made a MySensors sketch I would not have to invent the wheel again.
@NeverDie what lib are you using and how? I2C?
Just received an Plantower PMS5003 allso, do you have a "MySensors" sketch that you could share?
@vladimir there is an example for using rotary encoder on this page:
Yeah, my 6075 device is also still working fine on the 2xAA batteries I put in it a year ago.
@madelle-kamois This has been done before. For some inspiration -> https://forum.mysensors.org/topic/157/diy-blind-control-motor
I found an ESP-07 so I uploaded the ESP8266 WiFi Gateway sketch to it an tested inclusion mode in Vera (MySensors plugin version 1.5) and it seems to work just fine for me. I used esp8266 Community version 2.4.1 in Arduino IDE 1.8.5 and MySensors version 2.2.1 -alpha. I'm really out of ideas why this is not working for you.
@mntlvr I got it from GitHub but it seems like the development version is now 2.3.0-alpha, not sure what has changed since I downloaded it.
@mntlvr sorry I do not have much experience with MySensors Library version 2.2. My 2 Gateways I run at home use 2.0.0 and 2.1.1. And my test GW (SensebenderGW) is running 2.2.1-alpha since there were some issue using RFM69 on the 2.2 version. Maybe you should try the development version also (2.2.1-alpha)? Unfortunately I ho not have any ESP8266 Gateways at the moment but I can see if I have one laying around so that I can test.
@nca78 I have now measured the current consumption of the small bluetooth beacon device (N51822 QFABC0) using your code and the results are encouraging.
With your code I get around 4uA sleep current compared to 800-4000uA with my old code :D
Measurements done with an Micro (nano) ampere meter (double) that has not been calibrated against a reliable meter so do not take the measured values so seriously but more as a comparison.
1.8.4 of the IDE should be just fine, I'm using 1.8.5. But you need to check the AVR Boards definition you are using. 1.6.11 is know to work but newer versions are known to cause reboots in Ethernet GW and this is what seems to be happening for you.

I'm not sure I understand in what situation you get the above. Is it when you try to start inclusion from Vera?
If it is then it seems like your GW is restarting and this is something that happens with some versions of the Arduino AVR Boards definition. Please check that you are using version 1.6.11 from the IDE Boards Manager (I think this is something that I have already mentioned to you in one of your other threads but lets check again).