Top Logo Sp Logo
Create an Electronic Garden for Spring with Raspberry Pi

Create an Electronic Garden for Spring with Raspberry Pi

Create an Electronic Garden for Spring with Raspberry Pi

Spring is the season of beautiful gardens – and in this project you can create your own electronic garden using Raspberry Pi! Your electronic garden will be filled with flowers that spin…and you can even add some bees to complete the effect! Get ready to blossom!

Some of our team members here at Vilros have gardens they love to tend. So, they were especially excited by this project inspired by Geek Gurl Diaries. Now you too can join in on the gardening fun 21st century style, without the need to get down in the dirt. Just follow these 5 steps:

1. Parts You Will Need

  • Software
  • Python 3 for Explorer HAT (Just type into the Terminal window: “sudo apt-get install python3-explorerhat”)
  • Hardware
  • Explorer HAT Pro
  • Wheel
  • Geared Motor (12V 80RPM)
  • Jumper Leads (male X female)
  • Craft Supplies
  • Brightly Colored Construction Paper or Felt
  • Markers, Crayons and/or any Additional Elements for Decoration (Stickers, Stamps, etc.)
  • Scissors
  • Adhesive (just a small piece of Blu Tack or Glue, etc.)
  • Push Pin

 2. Attach Explorer HAT to Raspberry Pi and Get Your Motor Ready

Before you begin, make sure your Raspberry Pi is in Off mode. Then push the Explorer HAT into the GPIO pins of your Raspberry Pi.  Connect your micro USB power supply, and you are ready to get started. 

(You can make sure that your Explorer HAT is correctly installed by running this command: “python3 -c "import explorerhat")

Now that you’re up and running, your first step is to get the motor ready. You want to push the shaft of the motor until it is about halfway into the wheel. Then attach the female ends of 2 jumper leads on to the prongs of the motor. The male ends will connect to your Explorer HAT – into Motor 1+ and Motor 1-

3. Decorate the Wheel for Beautiful Garden Imagery

Next, it’s time to decorate you motor with garden imagery.

You can cut flower shapes out of colorful pieces of construction paper or felt. You may even want to make your own paper origami pinwheel. Create your own fanciful designs using any drawing tools or extra decorative elements.  You may even want to draw a bee to visit your flower!

Once your decorative garden elements are ready, you can set them in place using an adhesive and then secure your paper in place with a push pin.

 Don’t forget: your wheel is going to spin.  Can you think of creative ways to do your design so that it will be enhanced by the spinning movement?


4. Write Your Code

Now, it’s time to write the code to make your garden spin – to do this you’ll use Python 3.

Open up Python 3 (IDLE) from the Programming menu. Then begin to code by importing the Explorer HAT Python library. You’ll also want to import the sleep function so your program can include time delays (you’ll find this in the Time library.)

Next, add these instructions that will control the motor and spin the wheel for 10 seconds:



5. Get Spinning

Now you’re ready to get spinning!

You may even want to use a button to start your program. You can do this in Python by adding a line of code to direct Explorer HAT to run your function when a button you designate is pushed.

For example: “” 

(Don’t forget: you’ll need to make sure this line of code is all the way to the left and not indented)

Now you should have a bright and beautiful spinning flower electronic garden!  For next steps, see if you can vary your code to slow the speed or duration of time the flowers spin. You may even want to try to add more motors for more flowers – this will create a full blooming garden indeed!  

For more information on this project, be sure to check out this guide from Raspberry Pi.

Everybody here at Vilros hopes you’re enjoying Spring with your fun new electronic garden.  If you’d like to check out more project ideas, bookmark our Vilros Projects blog and be sure to come back for more Raspberry Pi and Arduino project inspiration.