04/03/2023

Node-RED Automation

By admin

Today we will see how to AVOID your OUTBOARD, or the auxiliary, or any VALUABLE accessory of our boat from being STOLEN. Because we are going to see how, in a very simple way, we can make our boat know that things and people are on board and that it notify us when something is missing or that it is ahead and do things like turn on the lights when we get on board. All this thanks to Node-RED, our Raspberry Pi or old laptop and some very cheap accessories from AliExpress. Do not miss it because it is a useful and entertaining episode.

🚤 Nautical fair http://ababor.eus at @ficoba9762 🚤

Algunos videos que os puede ser útil repasar:
✅ EP11 – The one with the Raspberry https://youtu.be/oqOyNPMbu5o
✅ EP22 – The one with the WiFi switch panel https://youtu.be/gdB2Zn-vVw0
✅ EP48 – The one with the old laptop https://youtu.be/N6zsLNhyhv8
✅ EP51 – The introduction to Node-RED https://youtu.be/BVBYoBYRZNs

Things you can buy from our episode:
✅ The combination lock
🔶 On AliExpress €5:
🔵 https://s.click.aliexpress.com/e/_DBEzbpj
🔶 On Amazon €6:
🔵 https://amzn.to/41SknUb
✅ Solar automatic focus
🔶 On AliExpress €10:
🔵 https://s.click.aliexpress.com/e/_DECrwdn
🔶 On Amazon €17:
🔵 https://amzn.to/41Dg52F
✅ Raspberry Pi
🔶 Cheap for patients http://rpilocator.com
🔶 In AliExpress €150 (2Gb):
🔵 https://s.click.aliexpress.com/e/_DB1vMZf
🔶 On Amazon €172 (4Gb):
🔵 https://amzn.to/3IGCnrL
✅ BLE (beacon) keychains
🔶 On AliExpress €7:
🔵 https://s.click.aliexpress.com/e/_DFe6NIz
🔶 On Amazon €12:
🔵 https://amzn.to/3EPkINa
✅ WiFi relays
🔶 On AliExpress €25:
🔵 https://s.click.aliexpress.com/e/_Dn3e2NB
🔶 On Amazon €30:
🔵 https://amzn.to/3y4VZRh
✅ Dokensip, a commercial product that does some of these things
🔶 https://dokensip.com/en/
🔶 Buy online: https://luna.r.lafamo.com/ts/i5034676/tsc?amc=socialpaid.blbn.503562.514546.14119793&smc=514546&rmd=3&trg=https%3A%2F%2Fwww.tradeinn.com%2Fwaveinn% 2Fes%2Fdokensip-wireless-sensory-system%2F136445853%2Fp

In the video we have visited the following very useful schemes:

Presence on board by WiFI:
We have seen how easy it can be to detect if we are on the boat or not through its Wi-Fi. If we assign a fixed address to our mobile in the router and we have the Wi-Fi network configured in it, whenever we are on the ship our mobile will connect to the Wi-Fi, with the same IP address. In this scenario, knowing if we are on the boat or not will be as simple as seeing if someone responds to the ping on said IP address, which is what the following scheme does. With his departure, we have decided to feed back a WhatsApp box so that each time we arrive at the ship he will send us a WhatsApp, and each time we leave another.

You have a file with the example flow here: https://www.thelowcostsailor.com/files2share/Presencia a bordo wifi.json

Control of switches with ewellink:
It is very easy to control our block of switches from Node-RED and make a virtual panel of them. I leave you two examples, one with direct control without feedback and the other with feedback. The difference is that the second one updates the status of the switch if, for example, you activate it from the mobile app instead of from the switch panel itself.

You have a file with the example flow here: https://www.thelowcostsailor.com/files2share/Control de interruptor simple y realimentado.json
And you can make a panel like this or better:

The following steps will require that you have an Ibeacon keychain (you have the purchase links above) bluetooth or that you simulate one with the Android Beacon Simulator APP that you can download here: https://play.google.com/store/ apps/details?id=net.alea.beaconsimulator&hl=es_419&gl=US
The Ble Scanner APP can also be very useful to see what devices you have nearby, you have the link here: https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner&hl=en_US

Light on by proximity:
The first scheme, and simpler, is to make the ship’s light turn on when we are on board, rather our Bluetooth keyring, and turn off when we are not. That is, to recognize us. For this you will need:

  • A bluetooth keychain of these https://s.click.aliexpress.com/e/_DFe6NIz
  • Find out your Major and Minor or your UID with the App Beacon Scanner or Beacon Simulator
  • Add to the Node-RED palette the component node-red-contrib-beacon-scanner
  • Run the following command in the terminal:
    • sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
    • sudo setcap cap_net_raw+eip $(eval readlink -f which node)
  • Reboot the Raspberry

With this you can implement the following scheme:

You have a file with the example flow here: https://www.thelowcostsailor.com/files2share/enciende con presencia.json

Scheme with time control
Adding the components: NODE-RED-CONTRIB-NIGHTTIME and node-red-contrib-boolean-logic-ultimate to the palette, you can add the pertinent restrictions to the previous scheme so that it only turns on if we are on the boat and it is night:

You have a file with the example flow here: https://www.thelowcostsailor.com/files2share/con soporte horario.json

Only when the ship is in port
We can even further restrict it so that this only happens when the ship is in port, simply by adding another condition with the GeoFence node:

You have a file with the example flow here: https://www.thelowcostsailor.com/files2share/Esquema completo.json

Warning if the outboard is stolen
Finally, with the same philosophy, it will be very easy for you to hide BLE key fobs in the valuable things you have on the boat and make diagrams like this one, which will notify you if they stop detecting the presence of the key fob on board and, therefore, of the outboard or the valuable object where we have hidden them (The input of this scheme is the same Beacon Scanner):

You have a file with the example flow here: https://www.thelowcostsailor.com/files2share/alarma robo fueraborda.json