@OldSurferDude :D that's the smell of experience !
Even though things come eventually to an end (with great sadness i'm afraid) this had to be addressed.
What kind of flow do you measure then ?
@OldSurferDude :D that's the smell of experience !
Even though things come eventually to an end (with great sadness i'm afraid) this had to be addressed.
What kind of flow do you measure then ?
I have a bunch of teenagers at home... showers can be (are in fact) endless.
This can be analysed from different points of view : waste of money, waste of precious resources, waste of energy to heat that water, ...
One could simply "lock" the amount of water allowed for one shower, by using a flow meter and an electric valve.
Let's try a more civilised approch first: a visual way of knowing instantly the amount of water used.
We shall use :
FlowMeter is connected to INT0. Once calibrated it gives "X pusles per minutes" which is the base for the whole program.
LED will be glowing from blue to red. Quantity of water used can be modifed by user.
Water flow can be paused and resumed during the wash.
If a certain amount of time (user modified) is elapsed, the arduino goes to deep sleep and timers/counters are reset.
This project has not been "MySensorised" yet but it might be.
I am also willing to integrate the whole lot into the shower head and replace the flow-meter with a water-powered generator (to charge a supercap) and some hall effect sensor (to get pulses from the generator's magnets). An ATTiny85 would do the job!
Here is the code, comments welcome to make it more efficient :
#include <Adafruit_NeoPixel.h>
#include <avr/interrupt.h> //libraires to manage sleep mode
#include <avr/sleep.h> //libraires to manage sleep mode
#define FLOW_PIN 2 //waterflow sensor pin
#define LED_PIN A0 //neopixel data pin
#define LED_COUNT 1
/***********************
* user defined values *
***********************/
uint32_t maxLitres = 50; // max water quantity. led goes RED !
const float pulsesPerLiter = 570.0; // pulses per litre (adjust after calibration)
unsigned long delayBeforeReset = 120000; // delay between last pulse and going to sleep
uint32_t startHue = 43690; // hue of blue ( 65536*2/3 )
uint32_t endHue = 0; // hue of red ( 0 )
/***********************
/* end */
***********************/
uint32_t hueNow;
float hueIncrementPerPulse; // = ( startHue - endHue ) / ( pulsesPerLiter * maxLitres
float litres = 0; // total water consumption given by "pulses" and "pulse per liter"
volatile unsigned long totalPulses = 0; //
volatile unsigned long prevTotalPulses = 0; // last total of pulses before next pulse
unsigned long timeOfLastPulse = 0; // when the last pulse occured
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); //data sequence GRBW
void setup() {
Serial.begin(115200);
strip.begin();
delay(200);
strip.clear();
strip.show(); // Initialize pixel to 'off'
pinMode(FLOW_PIN, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(FLOW_PIN), flowISR, RISING);
hueIncrementPerPulse = ( startHue - endHue ) / ( pulsesPerLiter * maxLitres );
Serial.print("hueIncrementPerPulse:");
Serial.println(hueIncrementPerPulse); // 3 decimals
}
void loop() {
/****************************
water volume management
****************************/
static unsigned long lastPrintMs = 0;
unsigned long now = millis();
if (now - lastPrintMs >= 1000) {
noInterrupts();
unsigned long pulses = totalPulses;
interrupts();
litres = pulses / pulsesPerLiter;
}
showHue();
/********************
sleep management
********************/
if ( (millis() - timeOfLastPulse >= delayBeforeReset) && (totalPulses == prevTotalPulses)) {
delay(200);
enterSleep();
}
prevTotalPulses = totalPulses;
}
void flowISR() {
totalPulses++;
timeOfLastPulse = millis();
}
void showHue() {
if( litres >= maxLitres ) {
hueNow = 0;
}
else {
hueNow = startHue - (totalPulses * hueIncrementPerPulse ) ;
}
uint32_t rgbcolor = strip.ColorHSV(hueNow);
strip.setPixelColor(0, rgbcolor);
strip.show();
}
void enterSleep(void)
{
sleep_enable();
attachInterrupt(digitalPinToInterrupt(FLOW_PIN), pin2Interrupt, LOW); // Setup pin2 as an interrupt and attach handler
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
strip.clear();
strip.show(); // Initialize pixel to 'off'
totalPulses = 0;
litres = 0;
timeOfLastPulse = millis();
delay(1000);
sleep_cpu();
/* Program will start from here on after wake up */
sleep_disable();
}
void pin2Interrupt(void)
{
Serial.println("Exiting sleep"); // This will bring us back from sleep
detachInterrupt(0); // We detach the interrupt to stop it from continuously firing while the interrupt pin is low.
attachInterrupt(digitalPinToInterrupt(FLOW_PIN), flowISR, RISING);
}
I am using "Hue" instead of "RGB" as it simplifies a lot the process of following a ranibow !
@TheoL thanks a lot for your suggestions
Unfortunately this is way above my league
And i'm not brainy enough to modify his design
I am using that same transistor mentionned in @Anticimex 's post
My question was very general : does a transistor leak and by how much (is that a figure even given is the specs sheet?)
Thanks you anyway for replies
Next step is to measure battery voltage on a daily basis.
Current setup is as follow:
My reference for this part of the project is this post :
@Anticimex said in New library to read Arduino VCC supply level without resistors for battery powered sensor nodes that do not use a voltage regulator but connect directly to the batteries ;-)
I would like to activate the voltage divider on demand, via a transistor (NDP6020P as per previous link) as to not draw voltage 24/7 on a permanent divider.
I am also considering using AVR's internal 1.1V reference to measure the voltage.
Simulation gives this: link to falstad

As one looks at the "live" simulation one can notice that the transistor leaks a bit... a few mV.. that's the bit that worries me.
Is this a flaw from the calculation or does a transistor leak anyway ?
Thanks a lot for your suggestions !
back at it !
I got my LCD microscope out and tried to reverse-engineer the original board. I should have done that to start with.
I drew that circuit on www.falstad.com (this link takes you to my actual circuit) and got several kV out of the simulation lol.
I used the original transformer: i could only measure resistance, so 5,5ohms on primary side, and 195ohms on secondary.
First transistor hooked to wave generator is J3Y. I replaced it with a BC547 (the "copy-paste" engineer hidden inside my head told me it's fairly close lol).
Second transistor is labeled J41CG and seems pretty strong to me so i replaced it with TIP120 .

Next I put all these components onto the breadboard, and load my favourite Nano with this sketch :
const int buzzerPin = 9;
int i = 0;
unsigned long duration = 1000;
void setup() {
pinMode(buzzerPin, OUTPUT);
}
void loop() {
for (i = 1000; i < 5000; i++) {
tone(buzzerPin, i, duration);
}
for (i = 5000; i > 1000; i--) {
tone(buzzerPin, i, duration);
}
}
That is ever so LOUD !!
So this is plenty good enough for my little project !
@OldSurferDude as long as we’re using nRFs this project is still relevant :D
Great little tool to check for efficiency of modules
I can even « aim » a pcb antenna to get the best result !
I might be able to answer that myself !
Looks like i have forgotten to "combine" a .ino file (CharLcdMenu.ino) with the main one (nRF24DoctorNode.ino), which seems to be a bit like a sub-program.
edit: that's it. Just had to create a second TAB with that sub-program, compile and success.
Please forgive my lack of vocabulary and knowldge, i am a "copy-paste" engineer :D
Sorry to necro this old post :(
I have just uploaded @yveaux's version of nRF24 doctor to a Nano.
@Yveaux said in nRF24Doctor:
https://github.com/TechNovation01/nRF24Doctor/blob/master/pcb/nRFDoctor_1.1_sch.pdf
I got all the right libraries installed into IDE (especially LCDMenuLib2.h version 1.2.7, i also tried several other versions close to 1.2.7 just to be sure).
But when compiling i get the following errors :
/tmp/ccMpih6l.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_nRF24QualityMeter03.ino.cpp.o.3416':
<artificial>:(.text.startup+0x19a): undefined reference to `lcdml_menu_display()'
<artificial>:(.text.startup+0x19c): undefined reference to `lcdml_menu_display()'
<artificial>:(.text.startup+0x1a6): undefined reference to `lcdml_menu_clear()'
<artificial>:(.text.startup+0x1a8): undefined reference to `lcdml_menu_clear()'
collect2: error: ld returned 1 exit status
exit status 1
Erreur de compilation pour la carte Arduino Nano
That is a bit above my knowledge. Could someone please point me into the right direction? Could it be just a case of "wrong naming" of variables ?
@OldSurferDude sorry i got you in the wrong direction !
I am just building my own alarm unit for home protection. I bought a unit from aliX and salvaged enclosure, solar pannel and a few components (LEDs, piezzo, ...). I am no finalizing the PCB.
Back to your project : please share your knowledge as i am in deep thinking about an off-grid capable solar system. It would make sense to have capability for external inputs such as ethanol-powered generator and wind turbine on top of solar panels. I also want a fairly big battery pack (for peace of mind and also to preserve it from deep discharge).
Can't you find any serial-data connector somewhere on your power panel ?
@monte thanks a lot for your answer
That suits me perfectly :)
Size matters ?
My question is about one specific point : does a bigger package consume more power ?
I am in the process of replicating a solar/battery circuit and adapting it to my needs (and mysensors of course).
I won't be able to solder tiny SMDs... so i chose bigger SMDs and even through-hole components (mainly resistors and transistors).
Will selecting the exact same component but in a bigger package affect overall power consumtion ?
Or are internal bits dimensioned identical ?
Thanks a lot
Quick update: i wanted to hide and protect the Nano in a housing.
Aliexpress supplies very nice enclosures that fits on Din rails.
https://fr.aliexpress.com/item/1005005505247992.html
They fit in electrical cabinets thanks to standard dimensions.


One 3Dprinted part later (glued inside enclosure) and the Arduino is safely held in place!



stl file of adapter :
dinRailEnclosureMountForNano-revE.stl
@OldSurferDude
Thanks a lot for your time. I am very impressed by the amount of research !!
In the end I still can not confirm whether this relay is noiseless/mechanical or just based on electronic components (triacs).
Good news is that this Legrand noiseless relay can be driven by a mechanical relay or by a tiny SSR. I chose a SSR unit with a DinRail mount. Looks all very professional in the electrical cabinet.

I have also added an optocoupler to check the state of the light and sent it back to openHab: input is connected to lightbulb wires and signal is connected to Arduino. Works all fine!!

Next step is to receive optocoupler with DinRail mount !!

@OldSurferDude thanks a lot for your input.
You are right. I remember reading this as well. SSRs need a minimal load on output side in order to latch properly
I chose these relays because of noise: the electric cabinet for circuit breakers and relays is located next to the bedroom. At first cabinet was filed with mechanical 240V AC relays 😂 🤯
I will have a second try with the tiny Omron Chinese clones, in case they need much less load to latch properly.
Thanks a lot for you help 👍🏻
I’ll come back here to conclude (either Omron SSRs or mech style relays).
I need a bit of advice here please.
Long story short : what are the limitations for driving an SSR with an SSR ?
Long story : I have an AC ceiling light powered by a DinRail Relay (latching relay module ?). That relay is driven by numerous 240V AC wall switches as per following drawing.

Then enters MySensors!! Arduino and chineese SSR (input 3 to 32V DC, output AC 240V).

DinRail relay still reacts with wall switches but not with Arduino+SSR...
Fun fact : multimeter reads 150V at wall switch contacts (between orange and red line). This setup has been working flawlessly until now so i guess it is normal behaviour.
I have read somewhere that these SSRs (based on triacs) only switch on when load voltage gets to zero... i'm not sure i fully understand and i am here asking you whether that's the reason why it doesn't work as expected and what would be the way to get this right.
Thanks a lot for your input !
@TheoL 805 package measures 2x1.2mm... :D depends on your visual acuity !!
Two netwoks with seperate GW ?
@TheoL thanks for reporting back.
In case you haven't ordered RFM modules yet i could send you a handful of capacitors to update your nRF modules... how about that ?
I have ordered a hundred... well over a lifetime of 1pF capacitors for me :D
@TheoL thanks a lot for your message.
But i guess you are talking about the additional capacitor, in between 3.3V and ground ?
What i would like to know is if these modules you're using do have a 1pF capacitor as per picture :

Please let me know !
@Honk thanks a lot for your input
I'm building @AWI 's "connection quality meter" so i can quantify any change. Being a 10 year's experienced noob in MySensors, it takes me for ever to get it right :D
Please share your experience with faulty modules in possible connection with that missing capacitor.
Hello Everyone,
I love my MySensors + openHab setup but it gets really frustrating when a node just stops working for a while... and then comes back on track a few hours later.
So, long story short : i was just about to switch to (and order some) RFM69 modules last night when i discovered the "magic finger trick" (as i was looking for power consumption nRF vs RFM).
Looks like a pretty high number of nRF modules left the factory with a missing capacitor...
https://ncrmnt.org/2021/01/03/nrf24l01-fixing-the-magic-finger-problem/
Is it just me and everyone else knew ? ALL mt nRF24s from various suppliers are missing that capacitor... no wonder then (if that's the real culprit) !
So I have just ordered a batch of smd capacitor... i'll let you know.