Raspberry Pi Zero with Node-Red as webserver over WiFi?

Hi all,

I have a previous project where I use a Raspberry Pi Zero W running headless as a SoftAP web server, it reads serial data and pushes data to a webpage when requested by Client connected over Ethernet or WiFi. I put this together before learning about Node-Red.

I am wondering if it is possible to go back and redo my original project with Node-Red. Can I run Node-Red on a Raspberry Pi Zero in headless mode, use it to measure serial data and have it act as a softAP over WiFi or Ethernet and serve up webpages when requested by the client? Can the Webpages be designed in the Dashboard tool or do you need to code the raw index/css files yourself.

Thanks for any tips.

While NR will certainly run on a headless Zero W, depending on your requirements, performance may not be that great. Theoretically you can achieve what you want though.

My advice would be to set up a headless Zero with NR and try pushing some of your serial data to it and see if the performance is acceptable to you. If it is then worry about whether you use the dashboard or set up a separate web server for the front end (which of course will add to performance degradation).

Thankyou. Regarding performance, you say this because the Pi Zero is not very powerful? My serial sensor data is only being read every second, and Client is also only being updated every second.

If I understand your comment, you are saying it is possible to use the dashboard toolkit to serve up webpages over WiFi or Ethernet?

Yes, the Pi Zero is no speed demon, by design. But you may find it is adequate for your need.

Yes, you can serve up html via the dashboard ui_template node for example. Or you could design your own dashboard using existing dashboard nodes to display your output, without the need for html. Then make this available through any web browser on the local network.

If you choose to run NR on a Raspberry Pi Zero, I can give you a few suggestions, I have several Pi Zeros running NR. This is a bit over kill, in that I did and could have continued to run python scripts (services based) that communicate to a centralized NR instance via MQTT.

You should consider the following:

  1. Avoid leveraging SWAP space on Pi devices, there is a long justification for this, if you are not familar with how SWAP space on any SD file system is rather ugly, ping me and I can give you more information.

  2. Consider running the NR instance, headless, no editor instance. This does not save that much on resources, but on a Pi Zero every bit helps.

  3. Consolidate configuration nodes, this can be complex to do, but as you reduce the total number of nodes, the better on resource management.

  4. Reduce the number of node/module libraries that you import to the minimum to run the flows you plan to run.

  5. Reconsider actual flow design, of off load anything possible to the centralized NR instance.

  6. Never IMHO run a MQTT broker on a Pi Zero.

  7. This is a bit off topic, but consider using ESP modules or Arduinos to control sensor (data) inputs. I do use Pi Zeros at times to do direct control of sensors, but many like to use ESP or Arduinos for such tasking.

As a complete side note, I wish they would release a Pi Zero with 1GB RAM, IMHO, that would be nice to have.

Thanks for your input. Sounds like Node-Red on Pi Zero might be more issues that its worth.

Yes I looked into ESP32. I actually replicated my entire design using an ESP32. Problem is Android 10 devices dont seem to connect to the SoftAP, which makes it kind of useless as I need the device to act like a web server. Very, very annoying!

The current Pi Zero design I have uses Python / C / Java with MQTT broker and SQlite database. Im getting devices that are failing for unknown reasons, everything was compiled with debug off so I can't figure out what is going on, webpages are being served but data is not flowing from serial to websockets, I suspect something is up with MQTT broker, probably a combination of heat and uncontrolled power shut downs are corrupting the SD card.

Maybe Node-Red running on the Pi 4 compute module released yesterday is the way forward :slight_smile:

In short, I would say move broker and the SQLite database off the PiZero. Then make sure you are not using SWAP space. If you can get these implemented, I think you will be ok. I run NR on my Pi Zero devices, I just make sure I run as lean and mean flows as possible.

I suspect your are abusing the SD media in general given what you have noted in your design. I do run a database on my central Pi instance, but it has a 32GB SD card, and I am using a fraction of its capacity even with the database seldom written many times reading mode of use.

Long term database data I offload to traditional media (i.e. disk) to my 'NAS' server, again with automated flows to do a SQL export, file migration, then SQL import. I do this data shipping either once per 24 hours or once a week based on the data applicable.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.