We need a software to write our code for Arduino uno. The software used for this purpose is called Arduino Ide. Sketch Up for 3D designing
Go to https://www.arduino.cc/en/Main/Software and download the latest Arduino ide depending on the operating system used from the site.Open the downloaded setup file and follow the instructions.
Download sketch up 3 d designing software from www.sketchup.com
Before writing the code,lets connect all the components together
The Soil moisture sensor outputs analog value,therefore connect the output pin of soil moisture sensor to any analog pin of the arduino uno(A0,A1,…,A5).
The relay module input pin is to be connected to any of the Digital pin of arduino(D0 to D13).
The positive wire of pump is connected of NO pin of relay and negative is connected to Ground.The common pin of relay is connected to +5V.
Remember to connect the VCC and ground wire of relay and soil moisture sensor to +5V pin and Ground pin respectively of arduino uno
The code or instruction which the arduino should follow is to be written
open a new file in Arduino ide. Now two functions will be there Void setup(); and Void main();.First we need to initialize the output pins and input pins in setup function.For initializing a output we use the command “pinMode(pin,OUTPUT);”.The ‘pin’ should be replaced with the input pin of relay.
analogRead(pin) command is used to read sensor value from soil moisture sensor.The pin should be replaced with pin to which sensor is connected to Uno.Using “if” condition we can check the threshold and if the water is less than a particular value then relay pin is made high which will in turn turn on the pump.To turn on a pin we use the command digitalWrite(pin,HIGH);
After some time pump can be turned off using the command digitalWrite(pin,LOW);
After writing the code the code should be checked if it have any error and after that the code can be uploaded to arduino uno
In arduino IDE on top left side there is an ‘tick’ symbol in blue,press this button to compile the code.If there is any syntax error in the code,the error will be displayed in the bottom box.After clearing that error code should be compiled again and the process is to be repeated till the code is clear of all the error.After compiling the code can be uploaded to our board.For this connect the board to system via USB cable and select the port in Arduino ide.Now press the ‘left arrow’ button on top left of arduino ide and the code will be uploaded.
for creating a 3D model to 3D print
Using Sketchup you can create a 3d model of casing that can used to insert all electronic component , power sources. Depending upon your requirement and 3d drawing skills you can fix the size and shape. Save your drawing in stl. , obj. file.
refer 3d designing tutorials for more details
how to 3d print your model
upload you cad drawing in slicing software convert it to machine code and upload the same to 3d prinetr and completing the preparation steps you can start printing the object. Please refer 3d printing tutorials for more details
Assemble all components inside the casing printed by 3d printer
Use your skills to insert all electronic components inside your casing. place the sensors, pumps and other parts outside the casing
Now you can present the product in appealing way.