Which kind of sensors "could" become supported #51
Replies: 5 comments 5 replies
-
Hello Bart,
Thus there's a valid chance to implement all of this via |
Beta Was this translation helpful? Give feedback.
-
@bartbutenaers, welcome!
Thank you! It has been an interesting adventure to learn Node-RED by trying to reimplement parts of it. ;) I agree with @ralphwetzel's overall sentiment: what you describe should be possible. Of course, there is some work involved. I won't try to provide detailed answers to each of your questions, because eEach of the topics is probably its own discussion thread to cover the details. Instead, I'll provide some background and guidance.
At a baseline level, the Moddable SDK works with most ESP32 boards out there by compiling to the generic
If it works with Arduino, we can make it work too. ;) It looks like the PZEM-004t communicates over serial, which is well supported in the Moddable SDK thanks to our ECMA-419 I/O work. I will note that @andycarle has a standing offer: if you send him a sensor, he'll write a basic Ecma-419 Sensor driver for it. Feel free to take him up on it. ;)
Yes, mostly the same answer as the PZEM-004t above.
All the sensor work should be in JavaScript. While you have the option to use C, it is seldom necessary. All of our ECMA-419 Sensor implementations are 100% JavaScript. You can take a look at a suite of them in $MODDABLE/modules/drivers/sensors to get a sense of how they are written, their relative complexity (generally pretty low), and the Sensor Class pattern. Seems like a great project, realistic in scope and possible to approach step-by-step . The result would be useful to many others. I'd be happy to support that. You'll almost certainly end up teaching me a few things about Node-RED along the way too. |
Beta Was this translation helpful? Give feedback.
-
@phoddie, @ralphwetzel, This is VERY encouraging to get started with node-red-mcu, to say the least. Since most of my own free time goes to Node-RED development already, I have taken the liberty to ask on Discourse if some folks can test this module and share their feedback. I really hope that some volunteers popup. E.g. a page per sensor (like e.g. used by EspEasy) with a description of the sensor and an example Node-RED flow would be really helpful for people (like) me to get started. But that is all easier said than done of course... My sensors have not been shipped yet by Aliexpress, so I have some time to think about how I will get started with this ;-) If @andycarle should have some time/interest to have a look at implementing the above sensors, that would be very welcome! Not because I am to lazy to contribute to this project, but at the moment this ESP32/ESP8266 related development stuff is rather far away from my comfort zone. Some extra implementations from various sensor types might help to gain some insights. Is there some easy way I can pay Andy to buy such sensors? I assume that might be more convenient/faster instead of me buying the sensor and sending it to him? About the statement "the LAN8720A, is supported by the ESP-IDF so should be straightforward to get working". Could you explain a bit what "straightforward" means? I have the impression that it won't be so straightforward for me ;-) |
Beta Was this translation helpful? Give feedback.
-
I started working on these sensors a bit this week, leading off with the HC-SR04. I have that working now and will plan to get the relevant pieces moved over to the Moddable SDK early next week. The HC-SR04 was an interesting addition to our lineup, as it needs an input type that was not previously covered by either the Moddable SDK or ECMA-419: pulse width measurement. I've put together an ECMA-419 IO implementation for pulse width on ESP32, a basic HC-SR04 driver that conforms to the ECMA-419 Next on my desk is the PZEM-004t. Once I have that going I'll also contemplate options for ganging them up, as discussed above. |
Beta Was this translation helpful? Give feedback.
-
@andycarle, That example code of yours is really nice. I will create a new discussion about my installation issues, to keep things here focussed on sensors, to make sure future readers are not getting confused. And meanwhile @ralphwetzel is helping me with some of my noob questions on the Node-RED forum. As soon as I have time to have something running, I will report back here. |
Beta Was this translation helpful? Give feedback.
-
Hi @phoddie,
I am a Node-RED contributor, and this project is kind of mindblowing. Very cool stuff!!
Being able to replace EspEasy on my mcu's by node-red-mcu in the near future (and running Node-RED on all my devices) would be awesome. I assume node-red-mcu doesn't support yet what I need, but just want to get a feeling whether it 'could' be possible in the future. It is not very clear to me how it works under the cover, so I would appreciate a lot if you could give some (noob level ;-) ) background information to my questions below.
Last week we had a nice discussion on Discourse about monitoring energy via Node-RED. Got a lot of useful feedback from the community. The result was a setup with a series of PZEM-004t sensors, that are connected to one of my WT32-ETH01 (which I try to use as much as possible, because I like to have things wired).
I don't see the WT32-ETH01 in the list of models supported by Moddable, and of course you cannot support all kind of boards. But do you think it will never be possible to run node-red-mcu on such devices, e.g. due to some technical limitations (regarding ethernet libraries or something alike)?
The PZEM-004t is also not on your list of supported sensors. Do you think sensors like these could ever become accessible via node-red-mcu? Or will this never be possible due to some limitations e.g. with interfacing such sensors?
I did some experiments recently both with node-red-node-pisrf and also with EspEasy to read ultrasonic distance sensors like HC-SR04 and the waterproof alternative JSN-SR04T-2.0. Again the question if sensors like this could become supported one day in the future?
Hopefully I don't give you the impression of being greedy. Just wondering which kind of stuff could be possible from a technical point of view. Not sure which kind of stuff (like Js or C or ... libraries and so on) is required to support new sensors. Of course I completely understand that free time might be one of your biggest limitations...
Thanks for reading!!
Bart
Beta Was this translation helpful? Give feedback.
All reactions