{"id":361,"date":"2021-04-05T13:35:46","date_gmt":"2021-04-05T13:35:46","guid":{"rendered":"https:\/\/andrejacobs.org\/?p=361"},"modified":"2022-04-11T20:22:59","modified_gmt":"2022-04-11T20:22:59","slug":"100-days-of-learning-day-28-growing-plants-using-the-pimoroni-grow-hat-mini-and-a-raspberry-pi-zero-w","status":"publish","type":"post","link":"https:\/\/andrejacobs.org\/100-days-challenge\/100-days-of-learning-day-28-growing-plants-using-the-pimoroni-grow-hat-mini-and-a-raspberry-pi-zero-w\/","title":{"rendered":"100 Days of Learning: Day 28 \u2013 Growing Plants using the Pimoroni Grow HAT Mini and a Raspberry Pi Zero W"},"content":{"rendered":"\n
Photo by Markus Spiske<\/a> on Unsplash<\/a><\/p>\n\n\n\n Here is my Log book<\/a><\/p>\n I have always had a love and interest in aquariums and kept tropical fish for many many years. This also made me dabble with aquatic plants and at some point I started getting an interest in Aquaponics and Hydroponics.<\/p>\n During the start of the pandemic last year I wanted to get more involved in learning how to grow my own herbs and vegetables and finally try my hand at Hydroponics. Unfortunately so did everybody else and supplies was near to non existent. By the time I did get supplies the season for growing plants already ended.<\/p>\n Now a year later and the growing bug is starting again.<\/p>\n Pimoroni is running an Easter sale where you can get 20% off items and their Grow kit really attracted my attention. So today I will start exploring setting this up.<\/p>\n I will be following Pimoroni’s guide on how to Getting Started with Grow<\/a> and Auto-Watering with Grow<\/a>.<\/p>\n TL;DR; At the moment I having issues with the Grow HAT Mini and will update this post once I have a resolution on it.<\/p>\n UPDATE:<\/strong> The Grow HAT Mini is faulty. I bought another one and did more testing on Day 32<\/a>.<\/p>\n UPDATE: Pimoroni sent me a replacement Grow HAT Mini<\/strong> and I tested it on Day 36. It works as expected and shows none of the same glitches as the faulty one. They have excellent customer service and I highly recommend them.<\/p>\n <\/p>\n Please see my guide<\/a> on how I have setup a Raspberry Pi Zero W to run in headless mode.<\/p>\n I attached the Grow HAT Mini to the Raspberry Pi Zero using the M2.5 standoffs.<\/p>\n <\/p>\n <\/p>\n <\/p>\n The soil moisture sensors need to be removed from each other using a side cutter. I then attached the JST cables to the sensors.<\/p>\n SSH into the Raspberry Pi.<\/p>\n The installer script is located at: https:\/\/get.pimoroni.com\/grow<\/a>.<\/p>\n First visit that URL (download) and read through the script. Never just download and run scripts because the instructions tell you to do so.<\/p>\n Run the Pimoroni installer.<\/p>\n <\/p>\n <\/p>\n The Raspberry Pi will now be rebooting and the screen should come up and display the sensor levels etc.<\/p>\n However for me, the screen is powered (a slight sign of light to the LCD) but no rendering. Also the Piezo buzzer started sounding off.<\/p>\n So I stopped the service and will need to troubleshoot first what is going on.<\/p>\n I carefully unplugged the moisture sensors from the Grow HAT Mini. Never pull on the cable but instead carefully jiggle and remove by the JST plug.<\/p>\n Everything looks good and the Grow HAT Mini is aligned correctly and pushed well enough onto the Pi’s GPIO pins.<\/p>\n Powered the Raspberry Pi back up without any of the sensors attached and the LCD is rendering now as well as no more alarm bells going off.<\/p>\n I plugged in a sensor on S1 port and the buzzer starts sounding (as expected). To get a sensor reading I placed the sensor in a closed hand and the reading start showing on the LCD. Open my hand and the buzzer starts sounding again.<\/p>\n Ok this is now working as expected. Time to plug the other 2 sensors in and test.<\/p>\n Note:<\/strong> You can mute the buzzer by pressing the B button (next to the bell icon).<\/p>\n I tested all three sensors and they worked.<\/p>\n Then I started pressing the buttons on the Grow HAT Mini and somehow got the LCD \/ Software glitching where the LCD never updates.<\/p>\n This persisted even through a So I rebooted the Pi.<\/p>\n Nope LCD is still stuck on rendering the exact same thing.<\/p>\n Did you try switching it off and on again? P.S. You can view logs<\/a> from the Switching off the Pi did work … for a while and then the LCD got stuck again. I noticed that the sensor would still respond to my hand by letting the alarm go off when I hold the sensor and the alarm go back on when I let go. However the LCD rendering software is still stuck \/ crashed. After a minute or so the device stops responding completely.<\/p>\n I am going to dig a bit deeper but first need to disable the service from starting by itself when the Pi is booted up.<\/p>\n After running the install script for grow-python it also stored files here: Inside is a directory called I ran the LCD demo a couple of times.<\/p>\n <\/p>\n Followed by the moisture example.<\/p>\n However when I run the I shut down the Pi again and switched it back on again with the goal of running only the monitor.py code from the start and see what the LCD outputs.<\/p>\n Running just the monitor.py still results in odd behaviour. For example the sensor will take readings and the LCD will update "correctly" but the alarm will be sounding when it should not etc.<\/p>\n\n
Hardware used<\/h2>\n
\n
Setting up a Headless Raspberry Pi Zero W<\/h2>\n
Attaching Grow HAT Mini and soil moisture sensors<\/h2>\n
Setting up the software<\/h2>\n
$ ssh -p 8204 pi@growpi.local\npi@growpi:~ $\n<\/code><\/pre>\n
pi@growpi:~ $ curl -sSL https:\/\/get.pimoroni.com\/grow | bash\n...\nDo you wish to continue? [y\/N]\n# type y and enter\n<\/code><\/pre>\n
...\nSetting up i2c and SPI..\nBacking up \/boot\/config.txt to \/boot\/config.preinstall-growhat-2021-04-04-20-17-47.txt\n\nAdding dtoverlay=spi0-cs,cs0_pin=14 # Re-assign CS0 from BCM 8 so that Grow can use it to \/boot\/config.txt\n\nWould you like to copy examples to \/home\/pi\/Pimoroni\/growhat? [y\/N]\n# type y and enter\nCopying examples to \/home\/pi\/Pimoroni\/growhat\nGrow includes a service that runs on boot and monitors your plants.\nWould you like to install the service? [y\/N]\n# type y and enter\n...\n...\nWould you like to reboot now? [y\/N]\n# type y and enter\n<\/code><\/pre>\n
Troubleshooting and Testing<\/h2>\n
pi@growpi:~ $ sudo systemctl stop grow-monitor.service\n\n# Also switching off the Raspberry Pi\npi@growpi:~ $ sudo shutdown -h now\n<\/code><\/pre>\n
sudo systemctl restart grow-monitor.service<\/code> or stop\/start.<\/p>\n
pi@growpi:~ $ sudo reboot now\n<\/code><\/pre>\n
sudo shutdown -h now<\/code>.<\/p>\n
grow-monitor<\/code> service.<\/p>\n
pi@growpi:~ $ journalctl --no-pager --unit grow-monitor\n<\/code><\/pre>\n
Stop and Disable the service<\/h3>\n
pi@growpi:~ $ sudo systemctl stop grow-monitor.service\npi@growpi:~ $ sudo systemctl disable grow-monitor.service\n<\/code><\/pre>\n
Running the example programs<\/h3>\n
~\/Pimoroni\/growhat<\/code><\/p>\n
examples<\/code><\/p>\n
pi@growpi:~ $ cd ~\/Pimoroni\/growhat\/examples\/advanced\n\n# Run the LCD test\npi@growpi:...$ sudo python3 lcd-demo.py\n\n2021-04-05 12:24:09.851 INFO lcd.py - Hello, World! example on the 0.96" LCD.\n\nPress Ctrl+C to exit!\n<\/code><\/pre>\n
pi@growpi:...$ sudo python3 moisture.py\nmoisture.py - Print out sensor reading in Hz\n\nPress Ctrl+C to exit!\n\n1: 0\n2: 0\n3: 0\n\n1: 26.929605437750936\n2: 0\n3: 0\n\n1: 27.29001016632101\n2: 0\n3: 0\n\n1: 27.29001016632101\n2: 0\n3: 0\n<\/code><\/pre>\n
growhat\/examples\/monitor.py<\/code> it does output the sensor data to the terminal but the LCD will display the Hello World still.<\/p>\n