Posts Tagged ‘Node js’
Raspberry Pi controlled Aeroponic System V2
Last one and half months I was working on my Aeroponic System V2. In this post I will dissect the system and will see each component and what it does. I would like to thank my wife for her tremendous support for helping me in every phase of the development, also she takes care of the germination process and replanting to the system.
Working of the Aeroponic system (video)
Vertical Growing Medium
Here the plants root are growing in Air and the nutrient mixed water will flow through the pipe in periodic intervals. As of now we are growing Spinach and Amaranth.
Irrigation pipes
I fixed a valve to control the water flow. Without this valve the first outlet receives more water because of gravitation and subsequent outlet receives less and the last one receives none. With this valve I can adjust the water flow and helps to get water to each outlet equally.
Reservoir
Normal hydroponic systems use water tanks to hold the nutrient mixed water. I decided to buy one tank as well but the tank is 1 feet tall, that means the vertical growing medium must be place above the tank level and I will loose 1.5 feet from each growing medium. I have total 6 towers and in total I will loose 9 feet of growing medium and will reduce around 30 cups.
After a lot of thoughts I come up an idea to use 6 inch pipe as the reservoir. With simple math I realize that I could store more than 50 lts of water in a 10 feet 6” pipe.
The reservoir has a Submersible pump that can pump 12000 liters per hour. It also have a wave maker to mix Nutrients or pH modifier agents.
Nutrient Feeder
Controller System
The controller system has different components, I numbered each component for ease of explanation.
1. Water Pump switch: Water pump will run in a periodic interval controlled by application running in Rasbperry pi. In some situation I wanted to run the pump immediately without waiting for the interval. With this switch I could run the motor immediately. I can also activate pump from my mobile application as well.
2. Wave Maker switch: As I said earlier the reservoir is equipped with Wave maker to mix Nutrients or pH modifiers. I could activate Wave maker any time by pressing the push button. I used this mostly after adding pH modifiers. Nutrient feeding system will automatically switch on Wave maker after adding nutrients.
3. Nutrients Feeder switch: This push button switch will add 10 ml of nutrients to the reservoir. If I wanted to add more nutrients I could do that via the mobile application.
4. Raspberry pi: The brain of my Aeroponic system. Each and every component is connected to this device. The controller program is written in Node js.
5. Relays: component to switch on/off each hardware like Water pump, Wave maker, etc.
The system is powered with a 12v DC and 240v AC. Each power source can be switched off separately by the two buttons below the Raspberry pi.
After the success of my aeroponic system and it’s controller, I did several modifications to the controlling system. See this post for the updated controller based on Arduino
Distributed Raspberry pi based Hydroponic Controller
Last couple of weeks I was building a Hydroponic system controlled by Raspberry pi. As of yesterday night my system was based on a single Raspberry pi that control one or more water pumps. It was one of my design goal to add more Pi’s based controllers to the network with zero configuration.
Why more Controllers?
As I am living in an apartment and the hydroponic system is going to be installed in the balconies. Connecting the motors installed in different balconies to a single Raspberry controller will make things ugly, I don’t want wires hanging here and there. So one option is, add another Raspberry pi controller. It’s easily doable, just install the controller software I created and plug the water pump.
As I explained in my last post, this system is controlled via mobile devices. So when ever I add a controller to my hydroponic network I have to create an entry in each of the device in which my mobile app installed. Also I have to assign a static ip to each Raspberry controller or keep track of the host name. When I start thinking about it, I see a system with some complications. Yesterday night I modified my controller application, this is what I come up with.
Unifying server and Controllers with self advertisement
I created a Unifying server in node js. The controller system running in different Raspberry pi’s advertise about it when ever it joins to my wifi network. This Unifying server will get notification whenever a new controller joins. I use Node Discovery module for service discovery and publishing. In this scenario I don’t have to worry about any configuration of the controllers. Just install my controller software in each raspberry pi and plug it into my hydroponic system.
My mobile app connects to this unifying server instead of individual controller system. All the commands to the controllers will be routed via this unifying server to respective controller. Below is the routing function I come up with.
app.use('/', router);
router.use(function (req, res, next) { options.host = req.headers.hostid; options.path = req.originalUrl; options.method = req.method; var request = http.request(options, function (response) { response.on('data', function (data) { res.setHeader('content-type', 'application/json'); res.send(data); }); }); if (req.method === 'POST') { request.setHeader('content-type', 'application/json'); request.write(JSON.stringify(req.body)); } request.end(); });
This unifying server is a very light weight system and can run in a Raspberry pi or in my computer. On of my design goal is that Controller should be self sufficient and should run in any circumstances even if there is no connection to unifying server.
The Unifying server and the Controller system is based on Node js. It’s a beautiful platform and I learned a lot about node js while building this system. Also become a huge fan of Javascript.
Next post I will go through the mobile app I created.
Happy coding…
![]() |
Scan using your mobile phone and access/share the post from your phone. |