Maybe are you thinking "Still another watering system? Really?", and to some extent... you are totally right!! We know that there are already many watering system projects using Arduino or Raspberry, but with this one, we wanted to create something that you can easily build and use, something fun and stylish to integrate into your home, not just a bundle of wires connected to visible electronic cards.
So we decided to create this LEGO gardener who will move nicely along your planter to water your plants and who will send you SMS when the tank is almost empty.
This project is powered by a Raspberry Pi Zero and a node.js server developed with our low-code platform Hackeet.
About HackeetHackeet is a low-code visual programming tool that allows you to connect hardware or software components together to create Web Applications and Micro-services for Microsoft Windows, Raspberry Pi and Arduino / ESP8266 devices. Designed for makers, small businesses, developers and anyone that is interested in technology, Hackeet allows you to create your own apps easily and at an incredible speed by connecting boxes instead of writing tons of code. As we value privacy, Hackeet is not another "platform as a service" offering and does not use any hidden cloud architecture. Applications built with Hackeet run directly on your own hardware as regular private application.Check out our website to get more details!
Hardware AssemblyThe schematic for the whole system is described below :
The communication between the 28BYJ-48 stepper motor and the Raspberry Pi is handled by a ULN2003 driver board connected to the GPIO ports of the Pi Zero while the relay is activated/deactivated by signals sent to port BCM2.
All the electronic parts are fixed on a wood structure that is hidden in the planter :
For this project, we used LEGO bricks of course, but also two planters : one for embedding the whole watering system (the pump, the relay, the Pi Zero and the tank), the second one to plant flowers, as shown below:
We cut a plank of wood to cover the greatest planter in order to hide all the watering system and to support the planter that holds the plants to be watered :
On this wooden board, we also installed using standard screws the LEGO rails and the stepper motor that will move the platform on which the LEGO gardener will be fixed.
At last, we used glue pads to stick the LEGO decor on our plank.
In order to move our gardener, we fixed him (as well as his dog) on a cart that is pulled on rails using wheels and ropes. This cart is animated thanks to the stepper motor, as described below.
Wheels used for the cart come from LEGO motorbikes such like this one for example.
Software InstallationOkay, so good so far! Let's now install Hackeet on your Raspberry Pi.
To install Hackeet and get a free trial license, follow the directions described at the page hereafter : Hackeet : Get Started.
When Hackeet is installed and is up and running, open a terminal window on your Raspberry Pi and copy paste the following command to finally install the application that will actually manage the LEGO Gardener :
hpm package https://cloud.nitenslux.com LEGOGardener.2.1.5
This command will install the application that will actually operate the watering system and all its dependencies on your Raspberry Pi. Upon successful completion, you should have a the following icon installed on your Raspberry Pi's desktop
Now that the software has been installed, we need to perform some configuration steps to have watering system running properly.
To do this, edit the configuration file stored on your Raspberry Pi at the following location :/home/pi/Hackeet/applications/LEGOGardener/server_configuration.json.
This file is the following one :
{
"documentation":
{
"version":"1.0.0",
"title":"Hackeet LEGO Gardener",
"description":"Connected gardener made from LEGO bricks",
"license":"https://www.hackeet.com"
},
"server":
{
"server_name":"LEGOGardener",
"api":"1.1",
"root":".",
"bot_file":"application.lego.raspberry.gardener.server.bot",
"index":"/themes/default/index.html",
"login":"/themes/default/login.html",
"http_port":8100,
"auth":"Auth",
"application_directory":"C:/Hackeet/",
"pages":{}
},
"settings":
{
"StepsByRevolution":512,
"Pump": 3,
"Pin1":37,
"Pin2":38,
"Pin3":35,
"Pin4":36,
"Frequency":300,
"StartDirection":-1,
"Cycles" : 3,
"CycleDurationMs" : 10000,
"CycleMotorSteps" : 2400,
"CycleCheck":5,
"AutomaticWateringPeriodHour" : 120,
"ClockPeriodSecond" : 300,
"TwilioNumber" : "33688888888",
"TwilioSid" : "Your Twilio application SID",
"TwilioToken" : "You Twilio application token",
"Manager" : "Your phone number"
},
"interface":
{
"screens":
[
{
"id": "test_panel",
"title": "Tests",
"widgets":
[
{
"id": "widget_pump",
"io": "Pump",
"field": "Active",
"type": "switch",
"on": "Active",
"off": "Disabled",
"label": "Pump",
"persistent": true,
"synchronized": true
},
{
"id": "widget_motor",
"io": "Motor",
"field": "Steps",
"type": "number",
"label": "Steps",
"placeholder": "25",
"persistent": true
}
],
"button": { "label": "Submit", "reset": false }
},
{
"id": "water_panel",
"title": "Water",
"widgets":
[
{
"id": "water_plants",
"io": "WaterPlants",
"field": "test",
"type": "switch",
"on": "Start Cycle",
"off": "Start Cycle",
"label": "Water Plants",
"persistent": true,
"synchronized": true
}
]
}
]
}
}
Edit the StepsByRevolution parameter to set the number of steps by revolution for your stepper motor. In our case, our stepper motor has 512 steps per revolution.
Update the Frequency parameter to specify the frequency (in Hertz) at which the motor will operate (typically between 200 and 500). If you set a value that is too high, your engine may miss events and may not work properly.
If your cart does not move the right way when starting the system, change the StartDirection value (set either 1 or -1).
Change the CycleMotorSteps parameter to change the distance traveled by the gardener when watering the plants. Try several values to fit the length of your planter.
You can also create a Twilio application and change the Twilioxxx settings to receive SMS each time CycleCheck watering cycles have been performed.
At last, the watering system will water your plants every AutomaticWateringPeriodHour hour(s) by performing Cycles round trip each time. For example, with the current configuration, the gardener will water the plants every 5 days (120 hours), making 3 round trips each time.
About Low-Code ProgrammingA few words on programming with Hackeet. As mentioned earlier, Hackeet aims to allow more people to start programming by partially replacing traditional hand coding with a visual programming approach. So, instead of having the traditional C ++, Javascript or Java code, the entire application we developed for the LEGO gardener is just the following diagram :
We will not go into details on how to program with Hackeet. If you want more information on this topic, we recommend you visit our website for documents and tutorials. You can also check out our Hackster tutorial project that describes the basics of programing with Hackeet.
The Hackeet schema of the application has been installed on your Raspberry Pi at the same time as the application itself. If you want to edit it in order to study it or to hack it, start Hackeet and open the following file:
/home/pi/Hackeet/applications/LEGOGardener/design/raspberry/application.lego.raspberry.gardener.server.design
There are several ways to start the application:
- by double-cliking on the desktop icon,
- by using a terminal window and typing the following command:/home/pi/Hackeet/applications/LEGOGardener/bin/hackeet.lego.gardener.sh
You can also use the crontab to start the application automatically each time the Raspberry Pi boots. If you choose this method, you may find the Cron Gui tool very useful.
Watering of plants is automated but if you want to test the application or water plants on demand, as a node.js server is running on the Pi Zero, pick its IP address (let say for example 192.168.0.15), open your favorite web browser and navigate to : http://192.168.0.15:8100. A very basic web application will allow you to start and test the gardener.
Final ResultLike our project ? Discover our other LEGO project with voice recognition capabilities.
Feel free to leave us a comment, we would love to hear from you!
Comments