I am familiar with XOD basic nodes, however I bought this Air pressure sensor module board 3.3-5V on amazon. This board has 4 pins (GND, SCK, OUT, VCC), and a pressure sensor connected to a HX710B ADC chip. So I would guess I just need to interpret the data from the ADC and I will have the given pressure. I plan on using it to measure water depth.
I have been completely through XOD’s built in tutorial, however it didn’t cover bits & bytes. Would love to see more tutorials.
I have yet to work with bits and bytes in XOD and don’t know where to start
Can anyone give some advise or point me to answers.
Interfacing HX710 Differential ADC with Arduino has IDE code that shows you need to switch the input pin on the board HIGH, then LOW, then read one bit of data. To get the full value, you repeat this 24 times to get all 24 bits.
The IDE code presented toggles input pin of the board high, then low. Left-shift current value (The same as multiply by 2, but more efficient). Read the output pin of the board; if it is high, then add 1 to the current value. Repeat 24 times.
You could build a single node in XOD implementing this in C++ code, or you could build it using built-in XOD nodes chained together to give same functionality (but there will be a lot more overhead in the translated code).
Coding using XOD nodes must be converted to C++ code and then compiled for Arduino. Coding directly in C++ will almost always be more efficient. XOD is not meant to be the most efficient way to program, it is designed to be an easy way to program without needing to understand C++ code. The designers of XOD have done a good job at eliminating gross inefficiencies, but higher-level code to handle generic cases that have to be converted to another language will seldom be the most efficient solution.
If you can figure out how to make a single node to read the sensor using C++ code, it will probably be more efficient. If you don’t want to deal with C++ code & you can get it working using XOD nodes and your Arduino board is able to handle all the code you need, then there is no problem with just using XOD nodes. The smaller and slower your Arduino board and the larger (or more time-critical) your code is, the more likely you are to run into problems using generic nodes to do specific tasks like this. Simple DIY projects for a single task are not likely to run into issues where you NEED to do things more efficiently.
I have tried to come up with a way to use the not-implemented node in xod. I was able to get it to work on the example Creating Nodes for XOD in C++.
I just don’t understand C++ enough to get it to work. My XOD program is complex and as mentioned using nodes to accomplish the reading can cause problems in how it all runs. I need 3 air pressure sensors all together for measuring the water levels.
Any coding help would be wonderful.
Thanks in advance
Scope of project. in case your interested. I enjoy hydroponic gardening and am making an automated Nutrient Solution batch maker. I have 2 reservoirs and 1 mix tank. I am using a Diner theme to accomplish these tasks. The diners are the plants the Table is the reservoirs, the waiter takes and delivers orders (NS) and the cook makes the batch. the Chef is the main patch which runs all the other patches. I have tried hall effect sensors with floats and the sensor value drifts, Water sensors detecting the water level by conductive operation and I got electrolysis.
My concern with air pressure sensors using a tube going into the water is that if the sensor leaks air the value will drift.
If you are mixing known quantities each time, a series of floats with on/off switches would be the simplest and most robust method. Even if you only need larger changes, you could change which float you are checking. If you want to be able to dynamically change quantities without moving floats, then sensors like you are using is probably the way to go.
I guess if the air pressure sensor leaks, you might be able to coat the whole thing in hot glue or something similar to seal it…
Another option for checking fluid level is an ultrasonic range finder. Code already exists for using these in XOD. I don’t know if it will be accurate enough for your application.