I've had several posts about using NodeRed for home automation, communicating with various nodes over MQTT. Could I do the same in the airplane? I think I could, and there would be some benefits to it. Certainly less wiring, and maybe more reliable and customizable.
The whole point of this blog originally was to use an Arduino and be able to monitor the engine status. Originally, I was going to use a Mega, and a bunch of shields. The old eco-system caused me to lean that way. Mega on the bottom, a custom shield next, and a Bluetooth shield on top. The world has moved on, and now I can use ESP-32 and 8266's with built in Wifi and Bluetooth. The boards only cost about $10, instead of the $20+ for the Mega and Bluetooth shield.
The sensors can mostly be wired to the ESP-8266 board with SPI (3 wire) communications, through adapter boards. If I need an analog or digital input, it is available on the board as well. There are very inexpensive thermocouple modules available, that would take care of the CHT and EGT measurements. The oil pressure and temperature would be analog inputs if I stick with the stock probes, but there is the Dallas18b20 probe that could be used to measure temperature, but there only one temperature measuring point on the engine. The Dallas 18B20 can be used for OAT measuring.
The oil pressure transducer is off on a flex pipe, with a manifold for to hold the hobbs switch. (theoretically, the oil pressure measurement could be combined in the computer somewhere to enable the hobbs timing measurements). There are nice solid state pressure sensors that may be appropriate for fuel and oil pressure, I need to do additional research.
Volt and Amp measurements can be done using the analog inputs, using the existing shunt for current measurements, or adding another shunt. There are also hall effect sensors that could be used to measure current. Using various current sensors would allow measuring all the important values at once, charge rate, drain rate, etc.
The tach measurement can come off the mag or EI unit. A transistor or optoisolator should work when connected to a pin that accepts interrupts.
Other sensors could be added or deleted anytime using additional nodes. If I want to measure the airflow through the baffles, I could add a node with multiple pitot tubes to see where the air might be leaking.
Then the question becomes, how many nodes should I use? It would be tempting to build one for each sensor, I want to limit the nodes to one function (I've said that before). How gray to I want that idea, one function could be all the thermocouples. Another node for all the oil information (pressure, temperature). Another for the fuel pressure, levels. Convenience may dictate some other arrangement, like thermocouples left side, thermocouples right side, that way the wires don't have to be so long.
Each node will still need 5V or 3V connected. It would be tempting to use the micro-USB connectors on the boards to feed the power. I think, the constant vibration would make the connectors fatigue very quickly, and the power would be falling out. It would probably be best to solder the power to the boards.
A $10 raspberry PI zero could be the NodeRed/MQTT hub. The raspberryPI should be mounted inside the cockpit. I am sure the WiFi signal can get around the firewall on a plastic airplane. Even a metal aircraft should have WiFi from the engine compartment to the cockpit. I'd have to try it out though.
In the cockpit, PLA printed enclosures should work fine. In the engine compartment, there may be problems with PLA or printed enclosures (constant vibration, heat, and rain). 3D printing my own enclosures may be compromised quickly. It may take some experimenting, certainly to make appropriate mounting choices, considering the sensor wiring stresses and heat.
NodeRed should allow nice cockpit displays of the instruments, and allow logging in various formats including CSV. Using the same CSV layout as the COTS instruments (like J.P Instruments) would allow people to analyze engine performance using off the shelf tools (excel, etc). The file could be scp'd from the Arduino, right to a tablet or phone, taken home and analyzed.
I don't know. I see a few worrying things, but nothing that is really scary about doing it. Can you talk me out of it?
Process of building an Airplane Engine monitor. It will connect a Arduino to an Android phone or Tablet.
Showing posts with label MQTT agent. Show all posts
Showing posts with label MQTT agent. Show all posts
Tuesday, March 24, 2020
Monday, March 18, 2019
More Node-Red
Node-Red is amazingly powerful, and flexible. Maybe in a future post, I set some recipies, including recurring timers, Google Assistant integration and notifications.
Dedicated System Setup
One advantage of using Node-Red in your home is you don't have to worry about security too much. You aren't publishing your daily habits to anyone in the cloud. One disadvantage, you need to give the system all it's smarts. It doesn't mean you can't integrate with the cloud, but it doesn't happen automatically.
Using a RaspberryPI as the dedicated controller will allow the 'PI to be the WiFi hub, DHCP server, MQTT server agent, and provide all the flows without worrying about tying up another machine (home office computer), or having that system walk out the door (laptop).
In my example ESP8266 nodes, I always hard coded the IP address of the server. That works great, since the RaspberryPI is providing all the DHCP and WiFi for the various nodes in the house. If I want to move the system somewhere else, I don't have to worry about reprogramming the nodes server IP address.
The above diagram shows how the home WiFi is separate from the IoT WiFi. To connect to the rest of the internet, a wired connection can be made to the home Cable Mode. Connecting the RaspberryPI to the internet will allow updates and other features to be easier. It doesn't have to be connected to the internet, it is up to you. Since the RaspberryPi connected to the modem will NAT all internet traffic, unless routes are set up in the modem, the RaspberryPI is not visible from the outside network.
For my network, I run the IoT network on WiFi Channel 11 since my home network is on channel 1. Keeping them on separate channels should prevent IoT traffic from being picked up on the home WiFi devices theoretically making things faster. Radio is radio, so if the devices are close enough, they may interfere anyway. (For some reason the Sony PS4 seems to interfere with WiFi devices near it, so if the kids bring the PS4 into the sun room, the IoT devices perform poorly).
My WiFi config file on the RaspberryPI looks like:
pi@raspberrypi:~ $ cat /etc/hostapd/hostapd.conf
driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
beacon_int=100
auth_algs=1
wpa_key_mgmt=WPA-PSK
ssid=raspi-webgui
channel=11
wpa=2
hw_mode=g
wpa_passphrase=XXXXXXXX
interface=wlan0
#wpa_pairwise=TKIP
rsn_pairwise=CCMP
country_code=US
The dns config file is the default, really no changes.
Node-Red Dashboard
This will be a gentle introduction, just barely covering what it is capable of. This is really the big win for Node-Red.
First there you need to install the dashboard nodes. From the Node-Red main window, hamburger menu on the far right. Left click on that to bring up the configuration menu. Select the "Manage Palette". A dialog with two tabs will appear, select the "Install" tab. Type in "dashboard" in the "Filter nodes box" There will be a list of dashboard items available. For now, we only want the default "node-red-dashboard". Select "install" and give it a couple minutes. After the update completes, scroll toward the bottom of the nodes on the left.
There will be a section of nodes labled "dashboard" with nodes like "button", "slider", "dropdown", etc. These items can be added to a flow, and used to set settings or view values available in the flow. The updated garage flow with simple outputs for the garage state and temperature graph looks like:
The light blue nodes are dashboard nodes. The garage door ones are the current state as text (open/closed) and the temperature is a graph showing the current trend, with degrees in Fahrenheit. To set the node display, use the payload to get the value:
Create a group, as you wish. For my house these nodes are in the Garage, so I created a Garage group. I also have a Sunroom Group and a Basement group. They are all part of the House, as a hidden group. The payload is enclosed in "{{" and "}}" I'll expand on why that later. Alignment can be changed as desired, the top row above is left, center and right aligned. The next is fill, and the bottom right is label over value. The look that this allows is:
The temperature trend for the last 20 minutes or so is shown, getting colder. Both doors are closed. Pretty simple, but a quick look and you can see it. Note the URL. I chose the home network, since my RaspberryPI is plugged into the home network. Node Red is running on port 1880, the default. But after that there is a /ui, so I don't see the whole Node Red flow builder, but just the dashboard.
How about if you want to see this on your phone? No problem, that is built in:
Enter the same url (like 192.168.0.35:1880/ui in chrome, safari or whatever browser you prefer. All the dashboard features are there. No special apps, or knowledge of programming needed.
There is so much more that can be done in Node-Red. Start playing, and you should find ideas that I never thought of. More next time.
Subscribe to:
Posts (Atom)






