-
Bumper Crop
09/27/2022 at 22:55 • 0 commentsBumper crop this year, thanks to the water system.
-
No RTC?
09/03/2022 at 18:59 • 1 commentThe Raspberry Pi does a great job keeping time as long as there is power. After a power failure, the Raspberry Pi's time will not be correct. Knowing the correct day/time is important for this project as the schedule determines when to turn on/off the system, so not having the correct time is a problem.
Two solutions come to mind:
- Add a $10 RTC (real time clock) hardware module to the Raspberry Pi to keep time in the event of a power failure.
- Use the first contact with a cell phone to set the time, from the cell phone's time.
The first option is easy but adds $10 to the system costs.
The second option works this way: After install, the Raspberry Pi comes up with some random day/time. On first connection by a cell phone, push down the current day/time (from the cell phone) to the Raspberry PI. As long as there is power, the Raspberry Pi will have the correct day/time. The assumption here is the cell phone has the correct time, which is a reasonable assumption since most phones should have the correct time due to NTP. In the event of a power failure (not likely since the system is off-grid and the battery/solar setup should keep the Raspberry Pi powered on 24/7), the Raspberry Pi's time will be messed up. This means the watering schedule is messed up. The system may water on the wrong day/times. But, it will still water. Once a cell phone reconnects to the system, the time will be corrected.
-
Zones?
09/03/2022 at 18:36 • 0 commentsThe Raspberry Pi relay hat I used for this project has four relays, each tied to a GPIO pin. I'm only using one relay to control a single ball valve. The project could be extended with zones, each zone on a relay, for up to four zones. Each zone would have its own schedule. We'd also need to have a flow meter for each zone, so we need to use additional GPIO pins for each flow meter.
Design changes:
- Modify UI with zone selector, 1-4. Each zone would have a start day/time schedule and a target gallons of water.
- Modify the core code to add the four zones to the state using an array. So turn this structure:
type garden struct { // omitted fields StartTime string StartDays [7]bool Gallons float64 GallonsGoal uint Running bool }
into this structure:
type zone struct { StartTime string StartDays [7]bool Gallons float64 GallonsGoal uint Running bool } type garden struct { // omitted fields Zones [4]zone }
There would be other modifications to pass the zone number (0-3 for zero-based math) in the JSON messages that are passed around. For example, the start time message would go from:
type msgStartTime struct { Msg string Time string }
to
type msgStartTime struct { Msg string Zone int Time string }
-
Hall of Mirrors
09/03/2022 at 02:47 • 0 commentsSomething interesting about this project is the UI view is shared by all who view it. For example, imagine two people (two gardeners :) both pull out their cell phones and connect to the WiFi access point and browse to http://10.0.0.1. Both users will see the same UI state. The real state is stored on the Raspberry Pi; the UI is just a view of the state of the system, so it makes sense both would see the same view. It's true for user input. If one user clicks a checkbox, both users see the update.
If you want to try this out without building the whole system, open the demo in multiple browser windows. You can do this from multiple systems, if you want. Now start pushing buttons and notice all views are synchronized.
-
Have Cell Coverage at Garden Location?
09/03/2022 at 02:34 • 0 commentsConnecting to the garden watering system with your phone over a private WiFi works wherever you are on the planet, even if there is no local cell phone coverage (LTE, 5G, etc). You can even use a tablet to interact with the system; just need a device that can connect over WiFi and present the UI in a browser.
But what if you do have a cell phone signal at your garden location? And you want to monitor/control the system remotely?
With a little bit more work we can use a cell modem hat with the Raspberry Pi to connect our watering system to the Internet via the cell modem. Cell modems (LTE/4G) for Raspberry Pis are available for the $125 price range. A SIM card is included for $2/month + data. In our case, the data is minimal. Network traffic is only generated when watering, or when the user makes some UI change. Other than that, the network traffic is quiet. So basically $2/month because data is negligible.
If we add a cell modem to our solution, then we can access the UI over the Internet, from anywhere. We see the same UI as before when we connected with the local WiFi connection.
How does this work?
The same software we're running on the Raspberry Pi can also be run on another system on the Internet as a proxy for the real device. In fact, the other system can be a hub, allowing multiple watering systems to connect to the hub, giving you one place to control multiple systems.
As I have time, I'll update this log entry with the steps to pull this off. The trick is we're using the Merle framework to write our application. Merle automatically provides support for this remote proxy model. Securely, I might add, since connecting anything to the Internet requires a strong security model. (Don't want Elves in Elveville hacking our watering system).
-
Custom OS image to make install/setup easier?
08/31/2022 at 22:53 • 5 commentsThinking about building a custom Raspberry Pi OS image with the garden system software already installed and configured. Once installed, the Raspberry Pi would boot up as an access point and the garden system will be running. This would make the installation of the system much quicker and easier.
Need to figure out how to pass configuration of system in the install image. Kind of like how other files like wpa_supplicant.conf are placed in the /boot dir of the image to connect to WiFi.
Things that need to be configured:
- SSid of access point
- (optional) Password of access point
- System locale and timezone
- SSH or not?
- ???
-
Pump or no Pump?
08/30/2022 at 23:43 • 0 commentsMy version of this project uses a 12v diaphragm pump to pressurize the water. It's an on-demand pump, which means it automatically turns on when there is a demand (ball valve opens), and turns off when there is no demand (ball valve closes).
If a pressurized water source is available, the pump is not needed. Just hook the ball valve directly to the water source.