@NeverDie I am happy to report that my batteries arrived yesterday!
OldSurferDude
@OldSurferDude
Best posts made by OldSurferDude
-
RE: What's a good power bank for use with IoT?
-
RE: What's a good power bank for use with IoT?
@NeverDie
I'm going to dissipate the energy through a 25 ohm resistor. It will take about 24 hours to perform one capacity test. Often times I read that the full capacity won't be available until after a few charge-discharge cycles. 2 resistors, 4 batteries, 3 tests each. Assuming that I stay on top of it, it will take at least a week of testing which won't start until I get my 25 ohm resistors. I'll post a link to my full write up. -
RE: What's a good power bank for use with IoT?
OK, I did my battery test. @NeverDie @Nca78 @mfalkvidd
You can find it hereThe batteries from Newegg and Fullbattery are good ones.
If you going to buy a large quantity and looking for a low price, then you should buy 1 or two and test them as I have done here. You might have to "kiss a lot of toads" before you find a good vendor, though.
OSD
-
RE: Beginner concept question for serial communication
@hubertus I'm not getting the description of you setup. Perhaps a sketch would be good?
Wen I need serial communication, with the Arduino, I use SoftwareSerial on two other I/O lines. That way I can debug real time, SoftwareSerial is slower but you're only doing temperature so 9600BAUD would be fin
Also, don't try to do too much at once. Break the task down into small, manageable sections. You have a lot of different things going on, get one thing going at a time.
OSD
-
RE: What's a good power bank for use with IoT?
@NeverDie I like your suggestion for solar panels, though my application only requires 1x 5W panel. And I like the idea of dismantling the power packs.
I think we differ in our approaches, though. I seem to enjoy living on the "bleeding edge", that is, I'm more of a risk taker. My first house solar system, 2.8kW, was installed in 2004. When I upgraded to 4.2kW, I took the 14 panels and installed them on my hillside, so now I'm a net energy exporter. The 2.8kW portion is still producing at 85% of nameplate, shows little environmental degradation (sealant, too), and has paid for itself. The reward outweighed the risk.
In taking risks, I learn much. Yes, I have a quite a few scars, actually and metaphorically. I have discovered a philosophy: Everything is an experiment. The point of an experiment is to learn something. So every experiment is a successful, just that sometimes the desired results are not realized. Eg. leaving an Arduino outdoors results in a short useful life. Spraying on a sealant extends the outdoor life.
Good discussion. Thanks for the ideas
OSD
-
RE: Where did everyone go?
I'm new-ish to MySensors. I came here because I was looking for a gateway from RF24 to MQTT and I'm well on my way to getting the MySensors version to work.
Why isn't MySensors working? I find two things really frustrating. The documentation is spotty at best. It's taking me days to get as far as I have. When I write up my own procedure for my own documentation, I find it's maybe just 20 steps, but each step needs a detailed explanation. For example, through a lot of trial and error, I found that to turn on the relay in the relay with button example I had to publish a message of 1 to the MQTT topic mysensors-in/13/1/V_LIGHT/0/2. Only later did I find the Serial Protocol 2.x. But it does't show a V_LIGHT nor S_LIGHT. Yes, I figured out that example is out of date, but that's part of the point I'm trying to make. And how did my node ID become 13 and stay 13 when I press reset on the Arduino?
You can see more detail on my frustrations in the MQTT gateway discussion
Which segues into my other frustration. about documentation. Many members offering advice do not provide links to their statements. For example, in the MQTT gateway discussion:
gohangohan MOD 3 Sept 2017, 13:15
(at)Richard-van-der-Plas "Just clone the 2.2 dev instead of the stable, the rest is the same
(emphasis mine)How does one do that? Particularly in a world where case is important and there are three different quote marks, (excuse me, one is sometimes known as a gravé) all with different meanings.
There are many like you @NeverDie who know MySensors in-and-out. I am an experienced hardware and software engineer, retired (one of the engineers that developed ink jet printing and one of the engineers that developed a navigation system for the 747) It's not like I don't have a fundamental understanding of what's going on here. I have yet to find a way to search the forum other than using google search.
Don't get me wrong, the MySensors concept is great and functions pretty well, but if it's not well documented, then it is useless. Then when someone asks a simple questions only to get an answer with no explanation of the how, the newbie and experienced alike don't bother with the forum because the forum offers no help, either.
We had a poster at HP (when it was a great company) "No job is done until the paperwork is complete" (image of person sitting on the toilet)
-
RE: What did you build today (Pictures) ?
@NeverDie It is my understanding, though I can't wrap my head around it, that it is the length of the conductor that makes the antenna tuned to a certain frequency. If this is the case, you could run your antenna around the edge of your circular pcb which would make the effective radius only slightly bigger.
-
RE: How to optimise a code (95% memory used)
I found that timelib.h uses a tremendous amount of memory. You avoid using it by getting time string from the controller.
I have also found that when you're using that amount of memory that bad things happen, as you noted. I use global variables to avoid the transient nature of function variables.
I'll be looking forward to other comments as, I, too, do not know all the tricks;)
OSD
-
RE: What I must buy in order to measure mAh please
@DenisJ Are you measuring a USB device? Look at something like this https://www.aliexpress.com/item/33019457512.html?gps-id=pcDetail404&scm=1007.16891.96945.0&scm_id=1007.16891.96945.0&scm-url=1007.16891.96945.0&pvid=824c24fa-034b-4801-b51d-50b2ad877945&_t=gps-id:pcDetail404,scm-url:1007.16891.96945.0,pvid:824c24fa-034b-4801-b51d-50b2ad877945,tpp_buckets:668%230%23131923%2330_668%230%23131923%2330_668%23888%233325%239_668%23888%233325%239_668%232846%238110%231995_668%232717%237561%23332__668%233374%2315176%2335_668%232846%238110%231995_668%232717%237561%23332_668%233164%239976%23761_668%233374%2315176%2335
(AliExpress: Cheap prices and one could question the quality, but for the most part they work. Shipping takes about a month. rarely faster)
Latest posts made by OldSurferDude
-
RE: nano & E01-ML01SP4 gateway
I believe that what @monte is saying that there will probably be little future support for the nRF24 at MySensors. Having tried a different solution using the nano and the RF24 I am very impressed at the MySensors implementation.
I am uncertain if MySensors utilizes the IRQ capability of the nano/RF24. I assume not and I have found no need for it. That said, you do not want to connect the IRQ because doing so draws an extra 10-20mA! Doesn't sound like much, but in battery operations, people go to great effort to get rid of unnecessary circuitry (remove power LED, and 5V regulator, etc.)
@monte is saying to use both capacitors 4.7μF electrolytic and 0.1μF ceramic. I use only a 10μF and am having good success, though if I were doing a circuit board, and going for robustness, I'd used both. Put them as close as you can to the radio. I would also seriously consider a ground plane layer.
I would recommend a socket for the radio. There is some variability in the RF24, mostly depending on manufacturer (particularly if you're getting them from AliExpress!) If your application is extreme, you'll want to sort through to find the one that works the best. (look for the one with the fewest NAKs),
I have tried put the nano in a socket and have had zero real success at having the radio work with it. I put shielding around it and had some pathetic improvement. I suspect that if you did put a socket for the nano on your board, you would need a ground plane.
You might want to bring out RX & TX which is handy in looking at the output when you're running off of a battery. I use this and connect the grounds and then nano RX to adapter TX.
Good luck with your project
OSD
-
Home Assistant "The notify.mysensors service will be removed"
OK fine (grrrrr) below you'll my implementation of an HA work around
But I find that the data is sent to a slightly different topic
mysensorsor-in/0/1/1/0/47
vs
mysensorsor-in/0/1/1/1/47
The data is still received because the code is looking for the sensor, but what's the difference?
MySensors device code (snippet)
#define CHILD_ID_ZONE 1 . . . void presentation(){ present(CHILD_ID_ZONE,S_INFO,"Zone"); } . . . void receive(const MyMessage &message){ if (message.getSender() == 0 ) { // Only listen to messages for device on gateway if (message.getSensor() == 1 ) { ZoneToWater = (int8_t)(message.getLong()); } } . . .}
Home Assistant script
alias: SendCustomToArduino description: >- notify.mysensors is deprecated Sends to topic mysensorsor-in/0/1/1/0/47 How to do the same thing using text.set_value service Sends to topic mysensorsor-in/0/1/1/1/47 sequence: - service: text.set_value target: entity_id: text.zone data: value: "12" - service: notify.mysensors data: message: 13 target: Zone mode: single
-
RE: ESP32 with LoRa
I am unfamiliar with an ESP32 as a MySensors sensor; though it certainly looks do-able.
Only because you won't be using the WiFi of the ESP32, I'd recommend an Arduino. The ESP32 requires 600mA.
Your radio will use up to 120mA (range of about 2km).
Of course, these power consideration aren't important if you have power at this remote location.
There are a couple of well documented hoops in getting the ESP32 board into the Arduino IDE.
On your RPi, I recommend using the MQTT interface with the MySensors Gateway. This will require an MQTT broker. You could use a public one (not recommended) or set up one on the computer that will be receiving the data into the database.
I use Home Assistant to receive data. MySensors integrates well into it. I admit that I don't know how to extract data from its database, but it provides an easy way to graph the data.
So it goes like this
-
Get the Arduino IDE
Load the ESP32 board
Select the ESP32 board
Using the library manager, download the MySensors library
Start with the example EnergyMeterPulseSensor because your wind speed sensor probably uses pulses. -
On the RPi you'll download the gateway files. The instructions here are pretty good
There are three steps,
configuration (which takes some thought)
compiling (make) (you can run the gateway at this point)
installing (make install) This makes the program run on boot -
Instructions for getting the MQTT broker installed and running are found by searching for "install MQTT broker" You'll need to know the the machine name and/or the IP address of the broker for both MySensors and Home Assistant
-
The learning curve for Home Assistant is tough. Don't be intimidated, you can do it.
Come back here if you need more help.
-
-
RE: make erring out on raspberry pi 2 b
@mrhutchinsonmn I'm not an expert on this code and when I get into a situation like yours, I suspect a corrupted file. So I download the MySensors code again.
Yeah it's a pain because you have it all configured. To minimize that pain, I create shell script to run the the configure program. I also keep my source files in a different directory from MySensors. When I go to compile the code, I copy the source(s) to the directory(ies) to where "make" expects it(them).
Sometimes, for me, I've bolluxed things so badly that I reimage the RPi and really start over! I try to document exactly how to start over.
I admit, it's not efficient nor elegant, but I eventually I get a configuration with which I can live. Documenting what I do is key!
-
testing with different controllers (mqtt brokers)
I run mysensors (ms) to an MQTT broker to Home Assistant (HA). My experience with MQTT has been great; it's simple and it's a easy way (using MQTT Explorer) to see the communication between ms and HA. ms has a reasonable way to watch the data flow. HA is another story, steep in necromancy, YAML, double secret persistence files, etc.
So once I get an HA configuration working, I don't want to mess with it. I have a "production" version of HA running devices and a "lab" version when I'm trying to integrate a new device. When I'm satisfied with how the device works in "the lab", I switch it over to "production".
Right now, what I do to change the MQTT broker for ms is to run the configure program, then "make" mysgw, just to change the MQTT broker. Is there an easier way, like changing an entry in a file?
-
RE: RFM95W sleep() directly after send() often doesn't sleep radio
@prawnpie This does not surprise me. I was losing data doing multiple sends in a row (node has multiple sensors). Putting a 500mS wait after each send() allowed the data to get through.
Also, 5mA for 1mS is not a significant draw on any battery (5mA * 1mS = 0.000002 mAh).
You could experiment with shorter wait times with
for (unsigned n = 1000;n>0;n--);
then keep lowering n until you find the threshold
And finally, assuming that the radio does have a flag to indicate that it is not ready to be put to sleep, it would be a real effort to put that into the libraries of all radios and the sleep command.
Waiting a milliSecond is actually the best solution and I am duly impressed you found it!
OSD
-
RE: Need a Guide to debug MySensor and Home Assistant
@esa1966
Sounds similar to the problems I was having. See if what I did works for you.Also, I think I remember seeing a variable that limits the number of connections to the gateway. MY_GATEWAY_MAX_CLIENTS ?
OSD
-
RE: Send/update Value from HA to Node
@esa1966 I make the assumption you're node is an Arduino
Are you using an interrupt to capture pulses? With this code, you might lose a count from time to time but that would be insignificant:
volatile uint32_t timeOfPulse = 0; volatile uint32_t pulseCount = 0; // a 32 bit number is good for about 70 years uint32_t pulseCountCurrent = 0; // for flow rate calculation uint32_t pulsePeriodThreshholdForFlowing = 150; // pulse period greater than 150 mSec is not flowing. #define FLOW_SAMPLING_TIME 1000 unsigned long flowSampleTimeStart = 0; bool flowing = true; volatile double flow = 0; volatile uint32_t flowCountStart = 0; volatile unsigned long flowPeriodStart = 0; #define DIGITAL_INPUT_SENSOR 3 // The digital input to which you attached your sensor. (Only 2 and 3 generates interrupt!) double countsPerLiter = 400.0; // double and float are the same on most arduinos /* DIGITEN G3/4" Brass Water Flow Sensor, Hall Effect Liquid Flow Meter Flowmeter Counter 1-30L/min * n = 6.6 * F=nQ L/M (from meter specs) * n * 60 is pulses (counts) per liter yeilds 400 pulse per leter * * flow rate 1-30 L/min (from specs) * * if time between pulses is greater than 0.15 seconds, there is no flow * * // Pulses per liter //-----------------------------------------------------------------------------------ISR onPulse void IRQ_HANDLER_ATTR onPulse(){ timeOfPulse=millis(); pulseCount++; } // make ISR as short as possible. //-----------------------------------------------------------------------------------setup void setup(){ pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, FALLING); } //-----------------------------------------------------------------------------------loop void loop() { uint32_t currentTime = millis(); // determine if water is flowing // if the time at this moment less than the spec threshhold, water is flowing flowing = (currentTime-timeOfPulse < pulsePeriodThreshholdForFlowing) ; // determine flow during this period and set maximum flow for all periods if ((currentTime - flowPeriodStart > FLOW_SAMPLING_TIME) && flowing ){ pulseCountCurrent = pulseCount; flow = double(pulseCountCurrent - flowCountStart)*1000.0/double(currentTime-flowPeriodStart)/countsPerLiter; flowCountStart = pulseCountCurrent; flowPeriodStart = currentTime; if (flow > maxFlow) maxFlow = flow; } if (SLEEP_MODE || (currentTime - previousSendTime > SEND_FREQUENCY)) { previousSendTime = currentTime; pulseCountCurrent = pulseCount; // MySensors sends here if (flowing) Serial.print(" "); else Serial.print("NOT"); Serial.print(F("Flowing")); Serial.print(F(" Pulse Count: ")); Serial.print(pulseCountCurrent); Serial.print(F(" volume:")); Serial.print(volume, 3); Serial.print(F(" Maxium flow: ")); Serial.print(maxFlow); maxFlow = 0.0; // reset max flow. Serial.println(); } }
Having HA send data is not so trivial
On your Arduino you'll have something like this code:
#define CHILD_ID1 1 MyMessage msgCustom(CHILD_ID1, V_TEXT); #define DELAY_AFTER_SENDS 500 bool initialValueSent = false; int msgCount =0; //--------------------------------------------------------------------------------setup void setup(void) { } //--------------------------------------------------------------------------------presentation void presentation() { // Send the sketch version information to the gateway sendSketchInfo( "PROGRAM_NAME",1.0 ); delay(DELAY_AFTER_SENDS); present(CHILD_ID1, S_INFO, "CustomSensor1"); /* TextSensor1 will be used as the target. YAML script sends "Data from script" to actuator alias: SendToArduino sequence: - service: notify.mysensors data: message: Data from script target: CustomSensor1 mode: single */ } //--------------------------------------------------------------------------------loop void loop() { if (!initialValueSent) { Serial.println("Sending initial value"); // Send initial message as per Home Assistant docs. send(msgCustom.set(0)); delay(DELAY_AFTER_SENDS); } } //--------------------------------------------------------------------------------receive void receive(const MyMessage &message) { if (message.type == V_TEXT) { if (!initialValueSent) { Serial.println("Receiving initial value from controller"); initialValueSent = true; } // Dummy print Serial.print("Message: "); Serial.print(message.sensor); Serial.print(", Message: "); Serial.println(message.getString()); // Send message to controller send(msgText.set(message.getString())); delay(DELAY_AFTER_SENDS); } Serial.print(F("count: "));Serial.println(++msgCount); Serial.print(F("Type: "));Serial.println(message.getType()); Serial.print(F("Data: "));Serial.println(message.data); Serial.print(F("Long: "));Serial.println(message.getLong()); Serial.print(F("Float: "));Serial.println(message.getFloat()); Serial.print(F("Sensor: "));Serial.println(message.getSensor()); Serial.print(F("isAck: "));Serial.println(message.isAck()); }
The commented out code starting with "alias" is the YAML script that will be used to send your data. Note that in this example, "Data from script" is the data that will be sent.
One annoying thing is that the service "notify.mysensors" can't be found until after you've run the Arduino code. But then, now that you know what the service is, you can probably just put it in your code and see what happens.
Good luck
OSD
-
RE: Local Sensors on Raspberry Pi Gateway
I finally got it to work. Look at my post on the Home Assistant forum.
There is an amazing thing that someone in the MySensors world did that makes RPi I/O very easy! Just like the Arduino, one uses the code:
pinMode(MphysicalPin, OUTPUT);
I couldn't believe my eyes when I saw that. And then got double flabbergasted when I discovered that pin is the physical pin of the RPi! No mapping of GPIOi to the pins.
Whew!So the I/O was easier than both of us could have imagined! @mfalkvidd if you know who did this, send them praise and thanks.
OSD
-
RE: completely remove MySensors integration for HA and start over
@OldSurferDude I posted this question in the Home Assistant forum, too. I figured it out! See my post in HA
OSD