Task

Describe your projects in details.

Abstract of Project:

INDIA is the Agricultural Country. We need go for geen house automation for sustainable farming.
But other hand we were also facing problem of drinking water. So, we should have need to work on basic needs for people. i.e. Drinking water.
I decided I'll go one by one. So, now at this stage I want to experiment on "Greay water". That's why, I choose "Monitoring for Grey water recycling system".

Fig. Water situation in INDIA.

Monitoring for Grey Water Recycling System :

A primary benefit of using a greywater system is lowered water usage. Because it makes use of recycled water, it can significantly reduce your overall water consumption and your water bill.

In "Vigyan Ashram", we were facing water problem form many years, So we were installed grey water tratment plant. But because of some reasons we were not getting good results:
1. Electricity cut off.
2. Recycling water pump failure.

Problem Statement:

It was observed that many of the times the motor is not turned ON, and there is no reliable source to find out when this happens.
In such situations the areation ia adversely affected. This harms the whole grey water recycling system.

Sketch of Project:

Fig. Grey Water system at Vigyan Ashram.



Fig. Sketch of Grey Water system at Vigyan Ashram.


Grey Water system at Vigyan Ashram:




Fig. Sketch of final project.

Project Gantt Chart:

A Gantt chart is a type of bar chart that illustrates a project schedule. This chart lists the tasks to be performed on the vertical axis, and time intervals on the horizontal axis. The width of the horizontal bars in the graph shows the duration of each activity.

Fig. 'Monitoring of Grey Water System' Project Gantt Chart.

Techical Details:

Two of the main components of my project are Float sensor and WIFI module. Also, the cloud “Thingspeak” for recording the data from the device.

Project consists of:

1. Float Sensor:
A float switch is a device used to sense the level of liquid within a tank, it may actuate a pump, an indicator, an alarm, or other device.
I'm going to use 'water float sensor' in water pipeline, because I want ankonwledge about water pump is ON or OFF OR how many times water pump ON and OFF. This sensor is working on 5 volt dc supply and it requires very low current. Also cheap in cost.

Fig. Float Sensor.

2. WiFi Module(ESP8266):
The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor.
I'm using this wifi module in my project, because I want to share data on cloud.

Fig. WiFi Module: ESP8266.

3. Buzzer:
A buzzer or beeper is an audio signalling device, which may be mechanical, electromechanical, or piezoelectric (piezo for short). I'm using 5 volt DC buzzer in my project for alarm purpose.

Fig. Buzzer.

4. Micro-controller(Atmega 328 P):
For selecting the microcontroller for the board I read and understood the datasheet of microcntrollers and decided to use Atmega 328p. ATmega328 microcontrollers are from the 8-bit AVR microcontroller family.
Atmega328p microcontroller for my final project board, because of it's features are listed down below:

A. Pin Out of Atmega328p:

i. VCC: Digital Supply Voltage
ii. GND: Connected to Ground
iii. PC6/Reset: Pin by default is used as RESET pin. PC6 can only be used as I/O pin when RSTDISBL Fuse is programmed.
iv. AVcc: Power for Internal ADC Converter.
v.AREF: Analog reference pin for the A/D Converter
vi. Port B(PB7:0): Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability.
vii. Port C(PC5:0): Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The PC5 to 0 output buffers have symmetrical drive characteristics with both high sink and source capability. viii. Port D(PD7:0):Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability.

Fig. Pin Out Diagram of Atmega328p.(Source: google image)

B. Memory Size: Atmega328P has “Flash” 32K type memory.

C.EEPROM: It supports a real Read-While-Write Self-Programming mechanism and 1Kbytes of electrically erasable programmable read-only memory.

D.Internal SRAM: 2Kbytes Internal Static Random Access Memory (SRAM).

5. Thingspeak:
ThingSpeak is an IoT analytics platform service that allows you to aggregate, visualize and analyze live data streams in the cloud. ThingSpeak provides instant visualizations of data posted by your devices to ThingSpeak. With the ability to execute MATLAB® code in ThingSpeak we can perform online analysis and processing of the data as it comes in. ThingSpeak is often used for prototyping and proof of concept IoT systems that require analytics.
On Thingspeak we have to sign up and create channel which gives us details of channel ID and wifi key. This is to be used in the wifi code.

Fig. Sign Up on Thingspeak.

Fig. Created new channel for recording data.

Bill of Material:

Fig. Bill of material of Final project.

Electronic Design:

The next step is to design the project board in EAGLE software. I'm going to use Atmega328p microcontroller for my final project board, because of it's features are listed as above section:

Fig. Final schematic of the Project.

Fig. Board of Final project.

Electronic Production:

Now the design file from the EAGLE is ready. Next step is to mill the circuit board on SRM 20.

Fig. Fixing the 1/64 bit for milling traces.

Fig. During milling.

Fig. During milling.

PCB Milling Final Project:



Once the milling is done components are supposed to be soldered on the board. Soldering is being done.

Fig. Final project board after soldering.

Electronic PCB fixing inside the laser-cutted box:
For electronics to fit in the case, I have designed my PCB and body of the project with holes at 4 corners. The electronics board fits perfectly into the body and to keep it intact I have used spacers with nut-bolts. The design is perfect to fit all the components of the project in the case. Same is shown in below:

Fig. Electronic PCB fixing inside the laser-cutted box.

Device where to be install ? or any environmental conditions would be affect to device?
My device will be installed inside the electrical panel of Grey water system, So not needed worry about any environmental conditions. The device is small and compact which makes it easy to carry it anywhere. The device with all the electronics intact is water proof with acrylic body from outside. Moreover, there are no vibrations while working so the device can be installed easily near the system without much efforts. It functions well and doesn’t need a lot of attention.

Programming:

Now the soldered board is ready. Next step is to program the board.

/*
Created 2019
Jaydip Sarode
Fab academy
*/

#include 

#define SSID "Good guy"     // "WiFi Name" (This is my personal mobile hotspot. It will chage when other user want to run this code for his application)
#define PASS "goodguys"       // "Password"
#define IP "184.106.153.149"// thingspeak.com ip(Thingspeak > Account > Jaydip sarode > Channel 1 > IP)

// this constant won't change:

const int  f_switch = 3;    // the pin that the float sensor switch is attached to
const int buzzer = 5;       // the pin that the buzzer is attached to
const int led = 2;

// Variables will change:

int buttonPushCounter = -1;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button
unsigned long time;
int empty = 0;
int one = 0;
int difference = 0;
 int pumpoff = 0;

String msg = "GET /update?key=OE153QO2YLTV5X3I"; //change it with your key...


String motorON;
String motorOFF;

int error;

void setup()

{
 
  pinMode(f_switch, INPUT); // initialize the Float switch pin as a input:
  
  pinMode(buzzer, OUTPUT); // initialize the buzzer pin as an output:

  time = micros();
empty = time/60000000;


// All "Serial" commonds are is required for the getting connection between wifi module with your hotspot.


//  Serial.println(empty); //prints time since program started
           // wait a second so as not to send massive amounts of data

  Serial.begin(115200); // use default 115200.
  
  Serial.println("AT");
  delay(5000);
  if(Serial.find("OK"))
  {
  connectWiFi();
  }

}

void loop(){

  start: 
  error=0;
  
  delay(2000);
  
  char buffer[10];
  motorON = dtostrf(buttonPushCounter, 4, 1, buffer);
  motorOFF = dtostrf(pumpoff, 4, 1, buffer);
  
  updateWater_Pump_Data();


  if (error==1){

   goto start;

  }
  delay(5000);
  {
 
  buttonState = digitalRead(f_switch);  // read the float switch input pin

  if (buttonState != lastButtonState)   // compare the buttonState to its previous state
  {
   
    if (buttonState == HIGH)  // if the current state is HIGH then the button went from off to on:
    {
     
      buttonPushCounter++;      // if the state has changed, increment the counter
      
     Serial.print("number of motor ON and OFF: ");
     Serial.println(buttonPushCounter);
      
    }
    
    delay(50); // Delay a little bit to avoid bouncing
  }
 
  lastButtonState = buttonState;   // save the current state as the last state, for next time through the loop


  // turns on the LED every four button pushes by checking the modulo of the
  // button push counter. the modulo function gives you the remainder of the
  // division of two numbers:
 
  time = micros();
 one = time/60000000;


difference = one - empty;

  delay(1000);

  
   if 
   (difference > 1)
   {
    digitalWrite(buzzer, LOW);
    int pumpoff = 0;
   pumpoff++;
    
   Serial.println("Water pump was not turn on from last 1 hour");
   }
  else 
  {
    digitalWrite(buzzer, HIGH);
  }

}


}

void updateWater_Pump_Data(){

  String cmd = "AT+CIPSTART=\"TCP\",\"";

  cmd += IP;

  cmd += "\",80";

 Serial.println(cmd);

  delay(2000);
  

 if(Serial.find("Error")){

    return;

  }

  cmd = msg ;

  cmd += "&field1=";  

  cmd += motorON;

  cmd += "&field2="; 

  cmd += motorOFF;

  cmd += "\r\n";

//  Serial.print("AT+CIPSEND=");

  //Serial.println(cmd.length());

 if(Serial.find(">")){

    Serial.print(cmd);

  }

  else{

   Serial.println("AT+CIPCLOSE");

    //Resend...

    error=1;

  }

}

  boolean connectWiFi(){

 Serial.println("AT+CWMODE=1");

  delay(2000);

  String cmd="AT+CWJAP=\"";

  cmd+=SSID;

  cmd+="\",\"";

  cmd+=PASS;

  cmd+="\"";

 Serial.println(cmd);

  delay(5000);

  if(Serial.find("OK")){

    return true;

  }else{

    return false;

  }

}


Programming to Final Project uC Bopard:



Code Description:
A. To communicate microcontroller with the ESP8266 wifi module have used set of AT commands.
B. Microcontroller communicates with ESP8266-01 wifi module using UART having specified Baud rate 115200.
C. The library included is 'stdlib'.
D. The SSID and Password of the internet connection to which the wifi module will connect have been defined.
E. IP of Thingspeak has been defined to the channel which will recieve the data from the wifi.
F. Button state is the Float sensor NO/NC position.

Additive Manufacturing-3D printing:

For the float sensor there was a need to design a 3D printed part (case) as the sensor could not be mounted directly.
Designed float sensor case in 'solidworks' software. Design is shown in below:

Fig. Designed case for 'float sensor'.

Fig. 3D printed 'Float sensor' case.

Fig. Float sensor fixed in water pipeline with case.

Fig. Designed PCB casing in 'solidworks' software.

3D Printing: Float Sensor Case





Subtractive Manufacturing-Laser Cut:

For the PCB of final projectt there was a need to design a 'Laser cut' part to encaspulate PCB board.
Designed PCB casing in 'solidworks' software. Design is shown in below:

Fig. Designed PCB casing in 'solidworks' software.

Fig. Setting Power and Speed in 'rdworks'.

Fig. Completed laser cut design.

Laser Cutting: PCB encaspulation casing





Assembly of Project:

Now, only thing is remaining, all parts to be asseble are as follows:
1. PCB board
2. 3D printed case fixing to Sensor
3. Float sensor connect to PCB board

License:

As part of Week 19-Invention, Intellectual Property and Income I got Creative Commons license for my project.

Fig. License.

Presentation:

Used the skills of Computer Aided Design Week to edit and make final slide in Photoshop. In movie maker software,compiled images and short videos/gifs of processes to make a minute video of entire project.



Porject Slide Presentation:

Fig. Project Presentation.

Original files download:

Click here