Fruit & Veggie Butler

by SpiesInOrbit in Circuits > Raspberry Pi

51 Views, 0 Favorites, 0 Comments

Fruit & Veggie Butler

Piquadic09Pic.jpg
Screenshot from 2024-09-13 15-47-49.png

I am a programmer and hobbyist who likes to garden. I would like it more if I didn't have to do the routine things, like watering every day. I enjoy watching the plants grow; I'm not gifted with the consistency required for healthy plants. I love a good challenge and also like gardening, so I decided it would be fun to build a simple tool to help me manage the mundane parts of gardening.

I had a few requirements for it to be useful. It needed to be accessible from my phone, have some visual capability, as well as, be simple enough not to get lost in the weeds. :)

WARNING: This project involves the use of electricity, which can cause injury or even DEATH. Be extremely cautious when using electronics and electrical devices.

Supplies

20240616_120558.jpg

Materials Needed:

  1. Raspberry Pi (model 3B+ with GPIO pins)
  2. Raspberry Pi Camera Model 2
  3. Arducam for Raspberry Pi Camera Module 3 Case (fits 2 as well)
  4. I2C 4-Channel 120V AC Relay Switch
  5. DHT22 Temperature and Humidity Sensor
  6. 5V Power supply for the Raspberry Pi
  7. Panel Mount Plug Adapter
  8. Plastic container/box
  9. 2-inch Cable Hole Cover
  10. 1/4 inch plywood board of at least 1 square foot.
  11. Mounting screws and standoffs
  12. 120V PC power cord
  13. 35A 120VAC Rocker Switch
  14. Female 3 Prong Extension Cord Ends x 4
  15. 15A 3 Wire Cord x 4
  16. 16 AWG Stranded Wire (about 3 feet total)
  17. Wire connectors 16 AWG x 26
  18. 6 Terminal Wire connection strips x 4
  19. Breadboard
  20. Jumper wires x 7
  21. Ethernet cable

Additional plugin items:

  1. LED light fixture
  2. Hydroponic Tube system w/pump
  3. Fan
  4. Air Pump

Software Needed:

  1. MicroSD card (with Raspbian OS installed)
  2. NodeJS (v20+)
  3. ReactJS (v18+)
  4. NestJS (v10+)
  5. SQLite3
  6. Web browser (Google Chrome)

Tools Needed:

  1. Screwdriver Flat and Philips
  2. Ruler or Measuring Caliper
  3. Power Drill
  4. 2" hole saw
  5. 1" drill bit
  6. 1/4" drill bit
  7. 1/8" drill bit
  8. 12"x12"x1/4" plywood
  9. Circular Power Saw (hand saw would work)
  10. Razor blade or precision knife
  11. Wire Cutters
  12. Wire Crimpers (optional)
  13. Wire Strippers (optional)
  14. Soldering iron and solder (optional for better connections)
  15. Heat Gun (optional)

This is not a precise list. Improvisation is encouraged, especially when it comes to containers and mounting materials.

Preparing You Raspberry Pi Computer

20240529_153806.jpg

See the Raspbian instructions to install the Raspbian OS

Install node js using NVM see instructions here.

Install Git on the Raspberry Pi once logged in with:

sudo apt update
sudo apt install git


Install Sqlite3:

sudo apt install sqlite3

Use git to download the admin UI and install

git clone https://github.com/PiQuadic/simpleadminui.git
cd simpleadminui
npm install
cd ..


Install the API with git as well

git clone https://github.com/PiQuadic/simpleapi.git
cd simpleapi
npm install
npm run start:dev

You can leave this running in the terminal to see the logs.


Once you have the API running now, we can boot the UI.

Open a second terminal window and log in

cd simpleadminui
npm run dev

This will start the UI, which you can access via http://{IP ADDRESS of you raspberry PI}

If you don't know for sure, you can run the following and find your Raspberry Pi's IP address.

ifconfig -a

If on WIFI it will be the "inet" address under "wlan0".

If it is connected with an ethernet cable it will be the "inet" address on "eth0"

Build a Wire Test

Test-System.png
Instructable-Wire-Schema.png

This part is to get the basics working before we start putting it together. You will want to test your Raspberry Pi and components while they are easy to adjust.

Items list:

  1. Raspberry Pi
  2. Raspberry Pi Camera Model 2
  3. Perfboard
  4. 8 jumper wires
  5. DHT-22 sensor
  6. 10KΩ resistor
  7. 4 switch i2c relay board
  8. Ada Fruit Pi Cobbler (optional)


Connecting Raspberry Pi, sensor, and i2c relay. UNPLUG the Raspberry Pi.


Connect the DHT-22 Sensor

  1. Plugin Pi Cobbler to Raspberry Pi and breadboard
  2. Add the DHT-22 Sensor to the other side of the breadboard, as shown in the wiring diagram.
  3. Add a jumper wire (black) to connect the ground pins. Connect the sensor pin, typically on the right side, to the far right bottom-row pin on the Raspberry Pi.

The sensor usually comes with markings or labels; (be sure the pin function matches the markings or specifications on the sensor purchased).

  1. Connect the 10KΩ resistor to a separate side of the board.

Direction does not matter on most resistors.

  1. With a jumper wire, connect the 1st sensor pin (light blue) to either side of the resistor.
  2. With a second jumper wire, connect the other side of the resister to the 2nd sensor pin (purple).
  3. Use a third jumper wire to connect the 3v3 pin on the GPIO to the 1st pin on the sensor (red).
  4. Use a fourth jumper wire to connect the GPIO 4th pin from the top on the right side to the 2nd sensor pin(black).
  5. Finally, connect the sensor's 2nd pin to the 4th pin on the GPIO.

Connect the i2c Relay

  1. connect the 2nd GPIO pin to the SDA pin on the i2c Relay (red).
  2. connect the 5th GPIO pin to the ground pin on the i2c Relay (black).
  3. connect the 9th GPIO pin to the VCC pin on the i2c Relay (orange).
  4. finally, connect the 3rd GPIO pin to the serial clock(SCL) pin (yellow)


Prepare the Box

20240609_132010.jpg
20240602_174912.jpg
20240602_182008.jpg
20240609_132347.jpg
20240609_132340.jpg
  • Cut a 2" hole for the switch cables.

Be sure the hole matches the layout of your board when you mount it in the box

  • Drill a 1/4" hole in the side of the box for the camera case (be sure the camera cable can reach from where the Raspberry Pi will be mounted.

I used a piece of 2-sided tape to hold it in place, and I could be more secure with a glue gun or silicon sealer.

  • Measure your main power rocker switch and AC PC power cord inlet.

I feel it's best to keep them near each other to cut down on wire clutter.

  • Trace a box for each that is big enough for them to fit but small enough so that the fittings will hold them in place.

Be sure to leave enough space between to keep the box structure sound, but not so far the wires don't reach. Also, having a caliper made it easy to trace the sides of these by tightening the screw and using the points to mark.

  • Use the heat gun to warm the plastic and cut out your traced boxes for each.

The warm plastic is easier to cut but not necessary. Be certain to cut away from yourself and place something that can be cut or scratched, like a piece of scrap wood.

  • Once cooled, insert the power inlet and rocker switch.

They should pop into place and be fairly stable. You could add some silicon sealant to help shore up the seal.

  • Layout placement stand-offs.

The best approach to drill the mounting holes is to wait until the board is laid out and cut. Then, use the board with holes as a template for the holes. I attached them to the mounting board individually while marking the holes. This took additional time but could have gone much faster with the previously described method.

  • Mark the holes in the box to match the board

Use a nail or pin to mark the spot in the plastic.

  • Drill holes in the bottom of the box for stand-offs where you marked.

Marking the hole with a nail tap is advised to prevent bit drift or slippage.

  • Push a screw through a washer and into the bottom of the box, and then screw it into a standoff.

Once the board is finished, screw it to these waiting stand-offs.

Prepare the Mounting Board

20240603_211052.jpg
20240603_232619.jpg
  1. Position the components on the board.

Think about where the holes for the outlet wires, power inlet, and main power switch will go. Be sure to leave space for wiring or connectors (if used).

  1. Once you have a layout that works and fits on your board and box.

Notice the drawing didn't match the final. Play with a design that works for your aesthetic but is also functional for your wiring schema. Be sure power wires are long enough to reach. Always err on the side of leaving a little slack for manipulating things into place, etc.

  1. Use a pencil to trace each part as you have them arranged.
  2. Clear off the board and mark the mounting points for each component.

This is where you will drill the 1/8" holes to mount your components. Also, remember to leave space for mounts if you decide to mount it in the box. This step is unnecessary but makes the box and components board more durable.

  1. Cut the board to size.

Be sure not to cut the mounting holes until you've laid out everything and positioned the connection boxes

Leave room for your fingers to work.

  1. Connect the connection boxes with screws to the board
  2. Screw the relay to the board with standoffs


Connect the Power

20240602_152745.jpg
20240603_213641.jpg
20240604_220516.jpg
20240603_222223.jpg
20240603_222218.jpg
20240603_213304.jpg

Connect the Power


  1. Push the rocker switch and power plug into the exterior of the box.
  2. Connect the hot or positive wire input plug to the rocker switch.
  3. Connect the other side of the rocker switch to the hot connection box.
  4. Connect the neutral wire from the power to the neutral connection box.
  5. Connect all the neutral box connections with the comb-looking connector.
  6. Connect the ground wires to the matching ground connector box, which should be shorted with a second comb-looking connector.
  7. Connect the hot wire from the plug to the hot connection box, which can also be shorted across all terminals.
  8. Connect the relays' neutral wires to the individual connection box that connects to the extension plugs.
  9. Push the connection wires through the hole in the box and through the hole in the board. Then...
  10. Connect the extension wires from the relay connections on the other side of the connection box.
  11. Connect all the neutral wires from the extensions (usually the big socket) to the neutral block
  12. Finally, connect the ground wires to the ground connection box.

Create a power outlet for the Raspberry Pi

  1. Connect a 2 socket outlet to the hot and neutral connection boxes.
  2. You can plug the Raspberry Pi DC connection into this outlet. (mounting it on the board somewhere would be a nice touch).


Connect the Pi to Power

Note: Please review your wire schema to ensure it makes sense and that your wire tests before connecting the board were successful.

Connect the Raspberry Pi


  1. Using the screw mounts on the bottom of the Raspberry Pi box, slide it onto the screws in the board.
  2. Mount the camera on the side of the box (I used a small strip of double-sided tape) and connect the ribbon to the Raspberry Pi.
  3. Connect the Pi GPIO pins if you have not already (See above)
  4. If it all seems connected and ready, connect the USB end of the DC convert of the Raspberry Pi to its power USB outlet.

Plug the main power outlet to an outlet

Flip the rocker switch to "ON"

If everything is connected correctly, you can see the UI through your local private network.