I have designed a tank level system for my camper that utilises Pi zero as the master and two other zeros as remote indicators in various parts of the van using a inboard wifi network not connected to the internet. works fine with PIGPIO
My questions is, is it possible to use pico w as the remote unit rather than a zero. The pico w would be ideal as the satellite unit, its small, has a smaller power footprint and doesnt need an operating system as such.
Master Zero - has the sensors from both tanks connected. - sends commands to satellite units listed below.
Satellite 1 - Pi 3 with touchscreen that switches all the electric lights etc. Utilizes unused gpio pins connected to tank level LEDS mounted next to the touch screen controlled by Master Zero,
Satellite 2 - Pi Zero - in the rear of the van with LED tank level indicators connected to GPIO’s controlled by Master Zero
Satellite 3 - Pi Zero - in the van side door at the tank fill point with LED tank level indicators connected to GPIO’s controlled by Master Zero
Satellites 1 and 3 also have an I2C 16 x 2 led screen with data from Master Zero.
I have the system set up in the shed and operating correctly ready to be installed into the van, But would really like to swap the two satellite zero’s with pico w’s but cannot find a way of doing it THAT does not include Internet access.
Great to hear you’ve got a system already up and running. Switching the Pi Zeros for Pi Pico Ws should be possible, it will just be a matter of finding an equivalent micropython library to replace the existing library that’s handling those communications.
Was it the PIGPIO library that was handling the communication between the Pis? Or was that just reading your sensors and a different part of the program handles the data exchange between the Pi SBCs?
@john151441 You can certainly use MQTT locally - but you will need to set up a broker on your own network
One of the Pis can be set up as the MQTT broker, which is like the server than facilitates communication on each topic.
We have a guide that comes close - the difference is the connection end point (a local server rather than a remote one). Have a look for setting up a local broker with a raspberry pi
best of luck with your project!
PIGPIIO is a library for Python that when a pin on the master is set to high by the sensor, it sends a message to the satellites to set the same pin on there to high and that then light s the led.,
So Pin12 on master goes high, the led on pin 12 on the satellites turn on. Its a very simple code to right that doesnt require lots of code to work.
This is a simple code where as button on Pi 1 turns on an LED on pi 2
from gpiozero import Button, LED
from gpiozero.pins.pigpio import PiGPIOFactory
from signal import pause
factory = PiGPIOFactory(host='192.168.1.3')
button = Button(2)
led = LED(17, pin_factory=factory)
led.source = button
I expanded this to have three satellites all with leds and then they in turn ran their own local python code that monitors individual pins that when high, wrote a message on the LCD screen or have a buzzer go off if the fresh water tank is nearly empty or the waste tank is nearly full
I also have all the pins and screens negative lines running through an optocoupler that only allows them to be visible while the camper water pump for the sink is turned on, or a switch on each satellite is pressed that then allows the negative to be connected for 10 minutes. I hate having LEDS and screens one especially while im trying to sleep (i like it dark when I sleep LOL)
When I have it all finished, I will be sending it in to Core’s as a project.
Here is a link to pigpio and remote gpiozero
Ive never delved into MQTT becasue I thought you needed internet. Will have a look and see how easy it will be to modify my system to work.
I don’t think you need to add another messaging protocol. The PigPIOFactory library addresses devices by their network address, so that means that the library is managing the communication across the netowrok. All that should be needed is to install the library and the code on Pico W in the same way that you have it installed on the Z, and then connect the W as a wireless node on the network. The PigPIO library seems to refer to W and Z as equivalent.
There should be no difficulty in finding examples of using the pico W on the local network - If you can point to an example that requires the internet then it may be possible to show the changes required for use with a LAN.
Thats what I thought till I found out PigzPioFactory doesnt run on Pico. (I found out after I designed mine). I havent found anyone who has successfully installed it. At this stage I will just install the zeros for now. It just seems a waste of resources though
Yes - that would be a problem . I can now see that little bit of additional detail in the docs, probably where you eventually found it.
In the past I have been using Pi Zero’s but I am increasingly swapping to the Pico W. The Pi Zero has an OS so is complex to install/maintain and the processor power is usually overkill. By contrast the Pico W has no OS, needs little configuration and has the advantage of RTC, ADC, timer etc. It is annoying the Pico W has no SSH but there are work arounds.
For connection of devices without using WiFi/Internet I am warming to the use of Bluetooth Low Energy (BLE). The only thing slowing me down is I am not familiar with the protocol but the documentation is good and the sample MicroPython code actually runs without error.
With BLE you usually have a central device and multiple peripherals e.g. sensors and all can be Pico W’s. The peripherals can either broadcast (for insensitive data) or directly connect (pair) to the central device. So a weather station for example can broadcast to whoever is listening.
BLE allows the mobile phone to be introduced into the mix. A trivial example but the tank water levels could be monitored on the phone sitting in the car.
John, I don’t expect you will want to start your project from scratch so happy for you to treat this as a thought bubble.
Thanks for your insight. My van currently has numerous pi’s running on an internal network. My new system for the tank levels etc is also designed and runs on Zeros, but as the zeros are far over the top for the purpose they are being used for, I wanted to introduce the Pico’s for the statellite units that control the level LED displays as they dont require any processing or computing needs, simply turn on the leds when the master unit tells them to. The problem is, there is no simple way of communicating between pi’s and pico’s to control pins like there is with pi’s.
My current van system is also controllable by laptop, ipad or phone for switching on lights or fans or locking/unlocking doors.
All I need now is a way for a pi to tell a pico to turn on the LED in one line of code.
I found MQTT to be hit and miss on the Pi Pico W using libraries like umqtt.simple/robust and their async variants.
The most reliable client library I found was this one: https://github.com/peterhinch/micropython-mqtt, which wraps around mqtt_as and handles some of the error handling in the background.
MQTT requires you run a broker on a computer in your network (A Pi other than a Pico is fine for this).