Вы находитесь на странице: 1из 21

ELG4139 Journaling Project

This journaling document contains several tasks related to the ELG4139


project.
Each task will be submitted and graded individually and according to the
dates indicated.

1
ELG4139
Automated Fish Tank Project

ELG4139 Project Proposal

Proposed Title of the Project:


Automated fish tank system

Electrical Engineering Team:


Name Email
John-Martins Ogbonna jogbo082@uottawa.ca
Steven Souksanh steven.souksanh@gmail.com
Sohaib​ Mahmood smahm006@uottawa.ca

TA Supervisor:
Name Email
Houman hghor044@uottawa.ca

Engineering design is the application of math, science and engineering principles


to the creation and development of systems components and processes.

2
ELG4139
Automated Fish Tank Project

Table of Contents
Table of Contents 3

1 Project Details and Brief Design 4


1.1 Problem Statement 4
1.2 Brief Design Build Statement 4
1.3 Constraints 5
1.4 Generated Concept 5
1.5 Required Facilities 6
1.6 Knowledge Areas and Simulation Tools Needed for Project 7
1.7 Estimated Budget 7
2 Electronic Architecture 8
2.1 Design Statement 8
2.1.1 Context and Scale 8
2.1.2 Solving The Problem 8
2.1.3 Approaches to the Problem 9
2.2 Sensors and Microcontroller used 10
2.3 Micro-controller Design Criteria and Drawing 10
2.3.1 Power 10
2.3.2 USB Bridge 11
2.3.4 Microcontroller 12
2.3.5 LED Strip 15
2.4 High Level Block Diagram 16
3 Power : Boost Circuit and Multisim 17
3.1 Software 17
3.2 Hardware 18
4 Conclusion 21

3
ELG4139
Automated Fish Tank Project

1 Project Details and Brief Design

1.1 Problem Statement


Humans love to have fish. They make good pets and even better meals, however, keeping fish
alive in a confined environment requires maintenance and care. Some of us just don’t have the
time to give, while others are just bad caretakers altogether.
Fish must be fed enough food; some of us forget to feed our pets. Fish tanks must be properly
maintained and the water must be changed/treated; some of us don’t know a darn thing about fish
water.
Moreover, it can difficult to tell the condition of water just by looking at it, without the help of
special sensors. Worst of all, fish may die and because of your busy schedule, you may not
notice until days later. By that time, the decaying fish’s body could corrupt the water, possibly
causing other fish to suffer the same fate! Some sort of notification is needed in case of such an
event. The Automated fish tank seeks to solve all these problems making, life easier for fish
owners!

You have to control a list of things. Your lighting needs to be timed and even mimicking natural
light cycles can be beneficial for cultivating some more difficult plants. One common practice to
promote explosive plant growth is to introduce higher ​levels of C02 to the water -- this too can
be done in cycles to optimize the effects -- as well as ​water temperature and flow​. Mimicking
temperature drops or rainfall can have positive effects on some fish. ​Feeding and additional
nutrients can also be automated.
With all of these variables for automation, you can imagine that there are already existing
automation systems available. Unfortunately these systems are quite expensive, and often
closed-source. With the popularity of open-source development platforms like the Arduino,
Raspberry Pi, and BeagleBone, we have all of the necessary tools to create this control system.
There are a surprising amount of things that people can automate in a complex aquarium.

4
ELG4139
Automated Fish Tank Project

1.2 Brief Design Build Statement


The challenge is to automate all of the necessary tasks to run a fish tank. To do so, we will need
to control multiple sensors and outputs. We will be keeping a log of things such as temperature,
lighting, water quality etc… We will also have different outputs that include but are not limited
to water propellers, lighting system, and dosing systems to change water quality.
This is an IoT project, the main constraint is usually the accuracy of the sensors. Using ​PID
concepts, we will be able to minimize the errors in our system that were introduced by the cheap
sensors and motors.

Sensors: Thermometer, light, ammonia level, nitrate level, sulfur level


Output: wave maker, led lighting, heater, dosing system

1.3 Constraints
These are guidelines that must be followed. Examples include time, budget, aesthetics, codes,
safety, and physical attributes.
1 $200 budget max
2 Time: project to be completed by December
3 PID design code
4 GUI must be comprehensive
5 Power source must be designed safely
6
7

5
ELG4139
Automated Fish Tank Project

1.4 Generated Concept


Brainstorming and ​preliminary​ sketches

Item YES or NO
Prototype Yes
Presentation yes
Demonstration of Prototype yes
Video No

1.5 Required Facilities


1 Lab
2 Makerspace
3 Woodshop
4 Clear area for fish tank

6
ELG4139
Automated Fish Tank Project

1.6 Knowledge Areas and Simulation Tools Needed for


Project
1 Raspberry Pi knowledge
2 Arduino knowledge
3 Power electronics knowledge
4 Multisim

1.7 Estimated Budget


Item Cost
Raspberry Pi kit (with sensors etc.) $100
Arduino Uno kit (for testing and sensors) $40
LED strip $20
Motors $5
i/o simulator N/A
miscellaneous sensors (light, temp, etc.) $30

7
ELG4139
Automated Fish Tank Project

2 Electronic Architecture
2.1 Design Statement
2.1.1 Context and Scale
To build on what was discussed above, with this project, we are trying to make it easier for
inexperienced or busy people to keep and take care of fish. This will be done by creating an
automated fish tank system.
We will be using the Raspberry Pi microcontroller ​and​ an Arduino for building and automation.
Please see Section 2.4 for the block diagram of the Automated Fish Tank.
We know fish tanks are a large market and we anticipate a large number of users of our control
system in the future. We are using a Raspberry Pi to act as the master controller and an Arduino
to act as the slave.
By importing the Slave GPIO library into the master’s ide, we are able to control the GPIO in the
slave via the master micro controller. This design was used with modularity in mind. Using
Software development life cycle principles we will be organizing all the development in sections
or modules.
The master controller will support a GUI application that users can interact with via a connected
monitor. As seen in the block diagram in Section 2.4, we have two microcontrollers connected to
each other. The connection between the Raspberry Pi master and the Arduino Controller will be
done via a serial connection.
Basically, the Raspberry Pi runs the web server while the arduino is responsible for all of the
electronic GPIO to the sensors and outputs.

2.1.2 Solving The Problem


Various sensors will be connected to Arduino, such as light sensors, temperature sensors, motors,
etc. Each of these sensors will play a part in automation. The light sensor will sense how much
light is available and if it is too dark, the LED strip will be turned on. The motors will be
responsible for generating waves and also rotating an apparatus in order to dispense food into the
tank and feed the fish.
We will also assemble a stable AC to DC power converter in order to ensure that the tank will be
able to be plugged in to a regular wall outlet. The system will also make use of a data acquisition
structure. The wifi or bluetooth capabilities of the Raspberry Pi will also be utilized to do this.
This system will connect to a computer or smartphone via an app, or GUI that will be designed
using python. The various measurements and the status of the tank system will be shown and the
user will be able to control some functions remotely.

8
ELG4139
Automated Fish Tank Project

2.1.3 Approaches to the Problem


We follow a modular approach to project design. We begin by first creating all of the code to
read sensors and control outputs in the Arduino IDE. Then we separately create the Web server
on the Raspberry Pi. This webserver is created by importing already built libraries and functions.
We will be displaying all of the controls done on the Arduino onto the GUI. This would allow
users to control any Arduino GPIO wirelessly. All that is required is that Users connect to the
web server by being on the same router as the webserver.

A screenshot of our web server and GUI is below:

9
ELG4139
Automated Fish Tank Project

2.2 Sensors and Microcontroller used


Sensors:
● DHT11 digital temperature and humidity sensor
○ Temperature measurement range: 0 - 50°C Humidity measuring range: 20 - 95% RH
○ Humidity measurement error: + / -5% Temperature measurement error: + / -2°C
○ Output type: Digital output
○ Signal transmission range: 20m
○ Dimensions: 14mm x 32mm x 6.4mm
● RoboJax Light Intensity Sensor
○ (based LM393)
○ 3.3 to 5V
● All chemical sensors are controlled by an I/O input
Microcontrollers:
● Arduino Uno
● Raspberry-Pi 2
Outputs:
● Light Strip

2.3 Micro-controller Design Criteria and Drawing


The Raspberry Pi in our system is mostly used for its web connection services. Most or if not all
of our data collection and signal control will be done by the Arduino Uno, which will be a slave
to our Raspberry Pi. Due to this, we will mention the design criteria of the Arduino Uno and not
the Pi.

There are 3 main sections of the Arduino that we will be looking at will be the power source, the
USB bridge and the microcontroller sections. The design question specifically asks to design an
amplifier, filter, multiplexer, and analog to digital converter. The amplifier is mentioned in the
power section, the multiplexer, filter and ADC are mentioned in the USB Bridge and
microcontroller sections.

2.3.1 Power
There are two ways to power an Arduino Uno, using an external DC supply or using a
USB. Looking at Figure 2 below, we can see the DC supply block on the bottom left. It is
connected to the M7 Diode which belongs to the 1N4007 family. The purpose of this
diode is to provide reverse-polarity protection. Next the diode is connected to
NCP1117ST50T3G which is a 5V low dropout regulator. Low dropout means that it can

10
ELG4139
Automated Fish Tank Project

regulate voltage even if the input voltage is close to the output voltage. The capacitors
C1,C2 and C3 are placed to smooth out any ripples during regulation.

Another source of 5V is USBVCC which is connected to the drain of an FDN340P, a


P-channel MOSFET, and the source is connected to the 5V net as we can see in Figure 2.
The gate of the MOSFET is connected to the output of the LMV358 op-amp. The op-amp
is used as a comparator between 3V3 and Vin. If both the DC Supply and the USB source
are connected then the op-amp compares both voltages and since the DC supply has a
greater voltage, the P-channel MOSFET will be turned off and only the DC supply will
be used. If the USB is connected without a DC supply then Vin will be grounded by the
resistors RN1B and the MOSFET will turn on.

Both the DC supply and the USB source are connected to a low dropout 3V regulator,
which has a pin of its own.

Figure 1: Power block diagram

2.3.2 USB Bridge


The role of the USB bridge is to convert the signals of USB interface to the UART interface,
which the ATmega328 can understand. To do this it uses a ATmega16U2 transceiver which is
coded with the proper firmware. From an electronics perspective we can see that there are two
resistor in series connected to D+ and D- which serve to terminate the USB signals. Z1 and Z2
are voltage-dependent resistors and are used to protect the USB lines against any electrostatic
discharges. Lastly we can see the 100nF capacitor connected in series with the reset line allows
the Atmega16U2 to send a reset pulse to the Atmega328.

11
ELG4139
Automated Fish Tank Project

Figure 2: USB bridge block diagram

2.3.4 Microcontroller
The Arduino Uno uses the ATmega328 microcontroller as a main controller and is part
the AVR family of microcontrollers. The MCU accepts input voltages from 1.8V to 5.5V
and has a maximum clock frequency of 20MHz. It has 28 pins each connected to a port
on the arduino. The pins vary from digital to analog with some pins from ground or VCC,
the exact pin configuration can be seen on Figure 4.2 below. As for the electronics of the
ATmega328 we can see some components on Figure 4.1. The reset pin is pulled down
with a 10K resistor which, according to the AVR Hardware Design Considerations[1],
helps prevent spurious resets in noisy environments. Capacitors C4 and C6 are 100nF and
are added to filter the supply noise.

12
ELG4139
Automated Fish Tank Project

Figure 3.1: ATmega328 on Arduino Uno

Figure 3.2: ATmega328 pin configuration

13
ELG4139
Automated Fish Tank Project

An example of how our circuit will looks like is as shown below:

An example of the system we use If we would like to measure temperature, the thermistor would
send a digital signal to the ATmega328 microcontroller. This signal would then be filtered using
a low pass filter and be sent from AVcc to the the usb bridge. The bridge (which uses a
ATmega16U2 transceiver) sends the signal through the USB to the Raspberry Pi and back to our
computer where we can see the value of the current temperature being displayed.

14
ELG4139
Automated Fish Tank Project

2.3.5 LED Strip


Before we start connecting the Arduino to a LED strip, let’s deal with the power source. LED
strip is usually run off 12 volts, Arduino works on 5 volts. Most Arduinos have a Vin pin that
can be connected to bigger voltages, with 9 volts recommended and 12 volts a safe maximum
that, according to some, should be generally avoided. The LED power strip will be connected to
the arduino to get data that turns it on or off, but we must also connect an external power supply
to power the Strip.

However, the specs of a voltage regulator onboard the Arduino is a variation of a 1117 5v
regulator. This is perfectly capable of dealing with 12 volts. Its power rating usually states 20
volts as a maximum (such as the MC33269 from ON Semiconductor that is installed on most
genuine Arduinos), but almost never less (one exception I found is Torex XB1117 that has a
rating of 10 volts, but you won’t see it on a Duino board, genuine or not).

The strips +12V line MUST be connected directly to the power supply. There’s one thing
however that we are careful of: the heat. Voltage regulators tend to heat a lot and their heatsink
has a rather small footprint, so it’s better to check its temperature after some working time, to be
on the safe side.

We determined that we may also connect the Arduino to 5v and the power line of the LED strip
to 12 volts. We had to add 3 N-Channel MOSFETs to the 12v circuit to be able to disconnect the
LED strip without disconnecting the power (say, with an IR remote).

The N-Channel MOSFET is ideal for our purpose, because it sinks current, is placed after the
load, so the connection is extremely simple: Source to Ground, Gate to Arduino pin, Drain to a

15
ELG4139
Automated Fish Tank Project

color channel of the LED strip. Since we are only dealing with about 12V max, we use 6
‘IRF740 N-Channel Power MOSFET TO-220 ‘. These are rated for 400V and 10A.
A resistor of 220 Ohm is placed between the Arduino pin and Gate.

2.4 High Level Block Diagram

Since the Raspberry Pi will be acting as a master to the Arduino slave and through the slave, the
Arduino will control the outputs.
In the Raspberry Pi, we contain all of the logic of the system. Using the ​python programming
language, we are able to import a Micro server called ‘Flask’.
Through the micro server GUI, we will be able to customize the lighting for the fish and
maintain all of its parameters.
The Arduino will control all of the GPIO outputs and inputs so it is responsible for all of the
electronic control.

16
ELG4139
Automated Fish Tank Project

3 Power : Boost Circuit and Multisim


For the power side of the project we are planning to boost the 5V coming out of an Arduino Uno
and using boost converter to increase the voltage to 12V to run a fan.

3.1 Software
Before building the circuit we tested out our circuit using Multisim.

Figure 5: Multisim implementation of our boost converter

As we can see from the figure above we can theoretically get around 34.5V DC from our circuit.
All the values used for each component is accurate.

We will use a breadboard to connect all the components together, a virtual view of this can be
seen below

17
ELG4139
Automated Fish Tank Project

Figure 6: Simulation of the boost converter on a breadboard

3.2 Hardware

Figure 7: Boost Circuit with no load

18
ELG4139
Automated Fish Tank Project

When creating and testing our circuit we get a no load constant voltage of 72.5V, which is
almost double what we saw using Multisim. This could be because our 555 timer can provide a
larger duty cycle.

When connecting a 1k Ohm resistor this is what we see:

Figure 8: Boost Circuit with 1k Ohm load

Which gives us a voltage of around 12.9V DC.

19
ELG4139
Automated Fish Tank Project

When going up to a 22k Ohm load we see:

Figure 9: Boost Circuit with 22k Ohm load

Around 60V DC.

In general we can say that the larger the load resistance the higher the voltage. This can be
attributed to Ohm's law V = I*R and so increasing the total resistance will increase the voltage.
Unfortunately our fan requires a minimum of 180mA to run and we can only get around 90mA
using our setup above. The Arduino Uno actually provides up to 500mA of current but a boost
circuit works by increasing the voltage at the expense of decreasing the current. The only
solution to our problem would be having a larger supply current.

20
ELG4139
Automated Fish Tank Project

4 Conclusion
Our final report demonstrates our progress in the research and understanding of how we can
design a system by manipulating inputs from sensory components, and create master slave
relationship between a Raspberry Pi and Arduino.
W
e have successfully created a web page that users can access through their own devices
wirelessly. Their device can control any GPIO pin on the arduino. They can control the PWM
and boost circuits all from the personal device.
Lastly we created a boost circuit that would boost our voltage from 5V to 12V DC. We were
successful in creating and testing our boost circuit with resistor loads but could not get a fan
motor to run due to the decreased current coming out of the boost circuit.

21

Вам также может понравиться