@rborer said:
Why not broadcast ? :)
Indeed something like a livestream would be great ! Also for the people somewhere else in the world ( or even closer the Dutch people with transporting / time problems like mine :) )
@rborer said:
Why not broadcast ? :)
Indeed something like a livestream would be great ! Also for the people somewhere else in the world ( or even closer the Dutch people with transporting / time problems like mine :) )
I planned to come over, but my son is sick so I'll had to take care of him ;(
@Yveaux said:
@the-cosmic-gate I don't know the sketch, so I don't know.
Why not just try it?
The sketch would be then:
/**
* 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
*
* DESCRIPTION
* Use this sensor to measure volume and flow of your house watermeter.
* You need to set the correct pulsefactor of your meter (pulses per m3).
* The sensor starts by fetching current volume reading from gateway (VAR 1).
* Reports both volume and flow back to gateway.
*
* Unfortunately millis() won't increment when the Arduino is in
* sleepmode. So we cannot make this sensor sleep if we also want
* to calculate/report flow.
* http://www.mysensors.org/build/pulse_water
*/
#include <SPI.h>
#include <MySensor.h>
#define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your sensor. (Only 2 and 3 generates interrupt!)
#define SENSOR_INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
#define PULSE_FACTOR 1000 // Nummber of blinks per m3 of your meter (One rotation/liter)
#define SLEEP_MODE false // flowvalue can only be reported when sleep mode is false.
#define MAX_FLOW 40 // Max flow (l/min) value to report. This filters outliers.
#define CHILD_ID 1 // Id of the sensor child
unsigned long SEND_FREQUENCY = 20000; // Minimum time between send (in milliseconds). We don't want to spam the gateway.
MySensor gw;
MyMessage flowMsg(CHILD_ID,V_FLOW);
MyMessage volumeMsg(CHILD_ID,V_VOLUME);
MyMessage lastCounterMsg(CHILD_ID,V_VAR1);
double ppl = ((double)PULSE_FACTOR)/1 // Pulses per liter
volatile unsigned long pulseCount = 0;
volatile unsigned long lastBlink = 0;
volatile double flow = 0;
boolean pcReceived = false;
unsigned long oldPulseCount = 0;
unsigned long newBlink = 0;
double oldflow = 0;
double volume =0;
double oldvolume =0;
unsigned long lastSend =0;
unsigned long lastPulse =0;
void setup()
{
gw.begin(incomingMessage);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Water Meter", "1.2");
// Register this device as Waterflow sensor
gw.present(CHILD_ID, S_WATER);
pulseCount = oldPulseCount = 0;
// Fetch last known pulse count value from gw
gw.request(CHILD_ID, V_VAR1);
lastSend = lastPulse = millis();
attachInterrupt(SENSOR_INTERRUPT, onPulse, RISING);
}
void loop()
{
gw.process();
unsigned long currentTime = millis();
// Only send values at a maximum frequency or woken up from sleep
if (SLEEP_MODE || (currentTime - lastSend > SEND_FREQUENCY))
{
lastSend=currentTime;
if (!pcReceived) {
//Last Pulsecount not yet received from controller, request it again
gw.request(CHILD_ID, V_VAR1);
return;
}
if (!SLEEP_MODE && flow != oldflow) {
oldflow = flow;
Serial.print("l/min:");
Serial.println(flow);
// Check that we dont get unresonable large flow value.
// could hapen when long wraps or false interrupt triggered
if (flow<((unsigned long)MAX_FLOW)) {
gw.send(flowMsg.set(flow, 2)); // Send flow value to gw
}
}
// No Pulse count received in 2min
if(currentTime - lastPulse > 120000){
flow = 0;
}
// Pulse count has changed
if (pulseCount != oldPulseCount) {
oldPulseCount = pulseCount;
Serial.print("pulsecount:");
Serial.println(pulseCount);
gw.send(lastCounterMsg.set(pulseCount)); // Send pulsecount value to gw in VAR1
double volume = ((double)pulseCount/((double)PULSE_FACTOR));
if (volume != oldvolume) {
oldvolume = volume;
Serial.print("volume:");
Serial.println(volume, 3);
gw.send(volumeMsg.set(volume, 3)); // Send volume value to gw
}
}
}
if (SLEEP_MODE) {
gw.sleep(SEND_FREQUENCY);
}
}
void incomingMessage(const MyMessage &message) {
if (message.type==V_VAR1) {
unsigned long gwPulseCount=message.getULong();
pulseCount += gwPulseCount;
Serial.print("Received last pulse count from gw:");
Serial.println(pulseCount);
pcReceived = true;
}
}
void onPulse()
{
if (!SLEEP_MODE)
{
unsigned long newBlink = micros();
unsigned long interval = newBlink-lastBlink;
if (interval!=0)
{
lastPulse = millis();
if (interval<500000L) {
// Sometimes we get interrupt on RISING, 500000 = 0.5sek debounce ( max 120 l/min)
return;
}
flow = (60000000.0 /interval) / ppl;
}
lastBlink = newBlink;
}
pulseCount++;
}
@the-cosmic-gate said:
So the pulse rule must be
double ppl = ((double)PULSE_FACTOR)/1?
Is this correct when I change this rule as above?
So the pulse rule must be
double ppl = ((double)PULSE_FACTOR)/1
?
@Yveaux
Seems to be easy 1 pulse every L
@Yveaux said:
@the-cosmic-gate ok, don't worry, I'll believe you :smirk:
Probably the meter itself generates more pulse during rotation then.
I think so , but with this movie "we" can think about the pulse per L
I will make a movie to show you the meter / pulse detection (led blinks) etc.
So you can see that there are luckily more pulses to measure
Some close up picture :

@sincze said:
@the-cosmic-gate great stuff :) on more from the 'local' area. 10 minutes away.. Mmm Teteringen???
hahah almost : Etten-Leur / Hoeven :P ( i drive a bit faster then normal :P )
This is the log when i used %blinds in Domoticz
send: 1-1-0-0 s=10,c=2,t=3,pt=0,l=0,sg=0,st=fail:
read: 0-0-1 s=10,c=1,t=29,pt=0,l=0,sg=0:
Servo UP command
send: 1-1-0-0 s=10,c=1,t=3,pt=2,l=2,sg=0,st=ok:100
read: 0-0-1 s=10,c=1,t=30,pt=0,l=0,sg=0:
Servo DOWN command
send: 1-1-0-0 s=10,c=1,t=3,pt=2,l=2,sg=0,st=ok:0
This is the log when set to dimmer %
read: 0-0-1 s=10,c=1,t=29,pt=0,l=0,sg=0:
Servo UP command
send: 1-1-0-0 s=10,c=1,t=3,pt=2,l=2,sg=0,st=ok:100
read: 0-0-1 s=10,c=1,t=30,pt=0,l=0,sg=0:
Servo DOWN command
send: 1-1-0-0 s=10,c=1,t=3,pt=2,l=2,sg=0,st=ok:0
read: 0-0-1 s=10,c=1,t=29,pt=0,l=0,sg=0:
Servo UP command
send: 1-1-0-0 s=10,c=1,t=3,pt=2,l=2,sg=0,st=ok:100
read: 0-0-1 s=10,c=1,t=30,pt=0,l=0,sg=0:
Servo DOWN command
send: 1-1-0-0 s=10,c=1,t=3,pt=2,l=2,sg=0,st=ok:0```
The % bar doesnt function at all , cant use them

only on/off ( 0 - 100% ) works
Busy using / building a sensor like :
The sensor ( inductive) i use :LJ12A3-4-Z/BY as seen on the picture.
I use the standaard water sensor sketch as found mysensors water sensor
When i tested everything it seems to work together with domoticz ( after i changed this bij "hand" to: water).
But how to find out about the pulses , or how to calculate this ?
By default in the sketch it says:
double ppl = ((double)PULSE_FACTOR)/1000; // Pulses per liter
But i want to know if this i right (or not)
And the next thing to think about because this sensors is 10cm from the mysensors gateway : is it possible to connect this to the gateway so i dont have to build/use the extra arduino and radio as used now .
Short: is it possible to combine this watersensor sketch with the gateway sketch and aruindo + RF radio
@Yveaux said:
@the-cosmic-gate great! Hardware designs are always appreciated :+1:
Don't forget to register upfront BTW!
Sure, and it's @CM i read .... ( NAC Breda sponsor :) )
The idea is that some people who designed some open hardeware PCB's like @GertSanders en off course @TheoL can bring or show there hardware .
And people can buy it for example
COOOOOL just 10 min driving for me !And maybe can arrange some people to take some home made (open-hardware) PCB's
Then it should be faster/ easier to order some working/ approved screens for some quick solution, and take some extra time to get this screens team work
@alexsh1 said:
@the-cosmic-gate said:
https://github.com/Smoke-And-Wires/TFT-Shield-Example-Code/tree/master/SWTFT-Shield
You do not need any sketches for now. Did you identify the chip model and number? I would suggest you go on Arduino forum and start reading about it - there are many threads over there depending on your screen make and model. You need to get the correct
pinout diagram and library, which you may need to correct.I did spent a few days trying to make a cheap Aliexpress TFT screen work. It took me hours and hours. That screen was returned and now I have the screen from Itead Studio guys. It works like a charm as all pins are standard, i.e. used by libraries like UTFT.
Additionally, you may want to try this library:
https://forum.arduino.cc/index.php?topic=366304.0There are some example sketches included including a possible screen pinout.
yesterday late in the evening got this lib ( https://github.com/Smoke-And-Wires/TFT-Shield-Example-Code/tree/master/SWTFT-Shield ) running, and displayed the rotation and graphic test ( touch doesn't work :S )
Try to find out the right pin's for this mysensors scene controller
anybody who's got a complete kit for sale ? Want to test build one (single relay is enough)
(or maybe nicer: a 3in1 solution : Motion detection , relais , DHT of other temp sensor)
@mfalkvidd said:
All screens can be used with enough effort. I got a screen working that needed 20 pins, see https://forum.mysensors.org/topic/3438/physical-mood-light-color-and-brightness-selector-based-on-lcd-touchscreen-with-demo-video/
I think the screen in the MySensors store is an ili9341, which should support spi which means you can use 4 pins to connect it. http://www.aliexpress.com/item/2-4-inch-LCD-module-SPI-serial-module-2-4-inch-TFT-module-ILI9341-only-9/32526066165.html might be a better choice since it says which screen it is.
You can move the radio by using softspi, see https://www.mysensors.org/build/ethernet_gateway for instructions on how to do that.
i own one of these 2.4" aliexpress screens and trying to get this work with mysensors.
But at the moment without any result . Could you share the sketch you uses and works ?
Got the screen running using : this test lib: https://github.com/Smoke-And-Wires/TFT-Shield-Example-Code/tree/master/SWTFT-Shield
It seems to be that some pin's must be changed , but on the 2.4 inch display this :
are not direct on this display visible , what are these
What did I do wrong:) ?
@AWI said:
@the-cosmic-gate you should set it to dimmer or "blinds %" in Domoticz. That is how domoticz works. Then look at the serial port of the node if changes come in.
That's exactly what I did :) but the %slide doesn't do anything.