Académique Documents
Professionnel Documents
Culture Documents
1
ELG4139
Automated Fish Tank Project
TA Supervisor:
Name Email
Houman hghor044@uottawa.ca
2
ELG4139
Automated Fish Tank Project
Table of Contents
Table of Contents 3
3
ELG4139
Automated Fish Tank Project
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.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
Item YES or NO
Prototype Yes
Presentation yes
Demonstration of Prototype yes
Video No
6
ELG4139
Automated Fish Tank Project
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.
8
ELG4139
Automated Fish Tank Project
9
ELG4139
Automated Fish Tank Project
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.
Both the DC supply and the USB source are connected to a low dropout 3V regulator,
which has a pin of its own.
11
ELG4139
Automated Fish Tank Project
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
13
ELG4139
Automated Fish Tank Project
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
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.
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.1 Software
Before building the circuit we tested out our circuit using Multisim.
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
3.2 Hardware
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.
19
ELG4139
Automated Fish Tank Project
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