Hey , this is probably out of my league, but when I think of something I tend to dwell on it.
So some know I'm doing different steps in Node red to control my brewery.
I am now working on setting up Pressure transducers connected to my ESP8266's.
I am using an ads1115. So while sitting here doing my math calculations I realized after searching of course.
There really isn't a node for specifically for pressure transducers.
How difficult is it to create a custom node. Is there plenty of tutorials out there for such.
I do know there are a few variables for the basic math formula. so depending on if your using an analog pin on an arduino for the data, and esp8266 directly, a Raspberry pi( which i highly discourage because the transducers are 5 v and pi is 3.3v tollerance)
My node should include input fields for.
what bit range is the ADC (8, 16, etc)
what is the working voltage of transducer.
what is the psi range of transducer.
Any nudges in the right direction would be awesome,
Yes I know i can use a function node to do my calculations.
but I also know that others use them as well , so why not make a node that does that and allows you to input the variables that are unit specific to simplify it for others.
I am going through the node red example on doing such and question this.
Creating a simple node
This example will show how to create a node that converts message payloads to all lower-case characters.
Ensure you have the current LTS version of Node.js installed on your system. At the time of writing this is 10.x.
Create a directory where you will develop your code. Within that directory, create the following files:
can I create those files locally on computer I'm working on or does it need to be on the Pi I am actually running node red on?
You need to write some front-end code to work with the Editor and some back-end code to integrate your node's runtime with Node-RED. In many simple cases, the code for both can be quite simple.
However, you do need a reasonable understanding of the order things happen in and you certainly need to understand how node.js modules work and have a decent understanding of node.js async programming.
I've not actually looked since I got going with writing nodes relatively early on.
Don't forget that was written a long time ago now. The current recommended version has just moved to v16 which is the latest LTS.
Well personally, I develop on my Windows PC but my main deployment is on Linux. I have a dev installation of Node-RED on my PC. I run that using PM2.
Roughly, here is the workflow I use:
- Create a new GitHub repo to hold your node
- clone the repo to your dev PC
- Edit the code locally and create the minimal package
- Install the local package into your local dev instance of Node-RED.
- Reconfigure PM2 so that changes to your code will automatically restart Node-RED - you don't have to do that of course but it saves a LOT of time messing with Node-RED restarts as you develop your code. Noting, of course, that you still need to reload the Editor page if you have made changes to the front-end code.
- Once you've tested your code and updated the GitHub repo, create a git tag and release then publish to npmjs.org.
In order to make life easier in the long-term (but perhaps only really desirable for more complex nodes), I:
- Don't use the "standard" code structure for my node's runtime. Rather I use a deconstructed layout which - to me at least - greatly simplifies how the different parts of the runtime work together. See the uibuilder nodes as an example.
- Break the front-end html file into its 3 component parts (script, config panel and help panel) and use Gulp to reconstitute the full html file on changes to the components. This lets me more easily work on the 3 different parts in different windows and saves a lot of scrolling. It can also help with code linting.
- Make good use of separate functions and variables "outside" the standard front-end code that the simple examples on the web show. Again, the uibuilder nodes are a good example. This is much easier to manage if your html file gets complex.
As I say, a simple node maybe doesn't warrant that attention though.
So I'll probably put that on a back burner and use a function node for now to do what i need to do.
- I honestly don't have Node.js completely down.
- I have very little knowledge in Html, and Java script.
so my order of things will be:
- finish having a stable and reliable controls for brewhouse and fermenter room.
- learn enough with svg node to have a more desired look for my ui dashboard.
then finally 4. attempt to make my own node.
oh crap somewhere in there was drink beer. guess I'll do that before and after each step to make sure I don't forget.
Sounds like a good plan. Always get to something useful early and worry about finessing it later. That's what I did with the Wiser automation node.
Well if you read singe of my earlier threads mine may be," less the wiser node" lol
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.