Final Report

Our project is complete now. We were even able to create a PCB using CircuitMaker for our switches, we originally had relays but the switches were more compact we got 4 switches in one chip. The chip we are using is the MAX4614, it is a quad, low voltage, high-speed, single-pole/single-throw (SPST) analog switches. The were easy to use they were like the relays we were using because the were also normally open.





We tried using the Raspberry Pi Zero but unfortunately we think we soldered it incorrectly and shorted the board. So we went back to the Raspberry Pi B+. We did not have time to add the LCD even though we had the pins for them, we don’t think our client really needed it either since they didn’t bring it up.

We were able to get everything working, we got readings from the ADC within a 1% error, we were able to send data to our server, and we displayed the data on a table and graph. To save the data offline we created a csv file for the month that goes in a year folder. Here is the link  to the website.


Here is what you would see on the website


Progress Report

We have talked to our client recently and have had to modify our relay setup. this is what each relay setup for each MFC will look like.


We have bought more relays for the other 3 MFCs that we need to read their values. We hope to reduce the amount of relays from 12, to just 10 relays.

We recently got our RTC chip and it was very easy to install, it uses I²C and just we had to use some Linux commands to get it to work. Now if the internet is down, the Raspberry Pi will still get the right time and date.

We are also looking into using a Raspberry Pi Zero instead of the Raspberry Pi B+ that we are currently using, because it is half the size and it can do everything our RPi  can do.

pins used

Here are the current pins we are using on the RPi, excluding some Ground and some DC Power pins . We have plenty of pins left over for the LCD that we want to use. We want it to have the date, time, and when the last sample was taken. We could possibly have it to show the user any errors that are occurring.

We are still working on the sending data to a flash drive and to our server. We want to organize the data in the flash drive by year, month and day, with the file being named after the day. The data we want will include the date, time and the voltages for the two stages of each MFC. The website will show the data in a table and have graphs for each stage.

Update 2

We bought a 12-bit ADC chip, MCP3204, to get better readings from the MFC, so we are not using our PIC18F45K20 anymore. Even though the MCP3204 only has 4 ADC channels and the PIC has 13, we do not need that many. For the MFC system we are testing with, it only has 4 MFCs on it. The chip interfaces with SPI and we were able to get readings from the chip. We are taking the average of 100 readings. The readings are off by a few mVolts. We have discussed it with our advisor, Dr. Kujoory, and he thinks it might be from the noise in the lab and/or the length of our wires.


Here is a reading from the program.


We have the voltage readings and are sending them to a text file and displaying the contents of it on the website. The program only does a finite amount of readings and won’t display the readings until the amount we set is finished. We want to be able to display the data all the time so the user doesn’t have wait for the program to finish executing.


Here is a table that is displayed on the website.

Our next stage, after we get better readings from the first relay,is to order more relays since we are only reading in one value in the MCP3204 chip, we want to read 4 values. We also want to get a Raspberry Pi 3 it should be faster than the Raspberry Pi B+ we currently have and it has built in Wi-Fi so we don’t need an adapter.
We also need to improve the website, right now it doesn’t display the readings in a graph. Jesse is going to look into it. We also need to have the website set up on an external server, that way you can be anywhere in the world and see the values from our system.

Update 1


Soon after school let out Jesse started working on developing the relay system using a SunFounder 8 channel relay. He got the module from Frank Monforte before leaving for winter break. The relay works with Arduino UNO 2560 1280, ARM, PIC, AVR,
STM32 and Raspberry Pi. We will be using the PIC18F45K20 to operate the
relays. We need the relays to accurately read in the values from the MFC. In
total, we will need three relays for each MFC. The relays will be connected to the MFC system as show in the figure below


First, relay two and three must be closed and relay one must be open. Before
reading the voltages from the MFC, the ADC pin will build up charge over time
and this charge must be sent to ground before closing relay one to avoid false
positives. Second, relay one and three must be open and relay two must be
closed. Jesse needs to do this to read in the values before reading the MFC. This
step has to be done to make sure the MFC is not giving off any voltages when
relay three is open. The last step is to close relay one and two, and open relay
three. At this point the MFC system is can be read and logged. The figure
below shows his code.

Code Snip 75-100Code Snip 101-122

At this point, the relay system is working with the DC power supply to take
in voltages. He is able to read the voltages after the relay has gone through the
cycle using a multimeter. The problem he has is that the voltages he’s sending are
not the same as the voltages he’s getting through the relays. After discussing the
problem with Frank, he told him that he needs to see if the relays have any internal
resistance. Jesse found out that they do. He is currently researching how to cancel
out the internal resistance. There are two options, either find a way to cancel out
the resistances or buy new relays that have smaller internal resistance.


Jesse needs the ADC in the PIC to convert the voltages into readable data for the
Raspberry Pi. As of now He is still having trouble with ADC conversation pro-
cesses. he’s gone over the data sheet several times and used previous labs but
something is still wrong with the processes. When he figures out the problem he
will be able to move on to the next step. He will then need to establish a Vref for
the MFC. He needs the Vref because the MFC only gives out small voltages and
will need a reference. He already created the Vref. All he need to do is add it into
the code. In the beginning, he was using a voltage divider to bring the 5V down
to 1.025V. After talking with Frank he advised me that it will not always be the
case. He now needs to get a voltage regulator to keep the reference voltage constant. He is looking at a few right now like the S-1172 Series and the PTH04000W
voltage regulator.

ADC picture


Omar has created a LAMP server on the Raspberry Pi. It can only be accessed from the local network. It needs to be able to connect to the Internet and a buying server space from a domain website could work. There was supposed to be any easy way to allow the Raspberry Pi to host the website, but Omar was not able to get it to work on campus and at his home, most likely because of the firewalls from each network. He has been learning HTML, some CSS, and PHP to create the website. He has the website able to read in a text file and display the contents. The text is not yet formatted but it is being worked on.

What’s Next

The next step is to connect the PIC to the RPi, the options available are USART, SPI, and I2C. Jesse is currently researching which option is best for us.



In an ever changing world their is always a need for improvement. In the 21st
century, the need for technology has exponentially increased due to consumer
needs. The only thing that has stayed the same throughout history is the need
for fuel. A very interesting way that biologists and engineers have developed is the use of bacteria to generate energy. The process is  called Microbial Fuel Cells (MFC). MFC is the use of bacteria to convert organic waste material into electrical energy. As these MFCs system continues
to grow over the years, the need to monitor them will become a demand. With our project, wineries will be able to continuously monitor the MFC process and view the operation status. We will closely monitor voltages, status, and collaboration of the MFC. The Data will be stored locally then sent
to a web page to be displayed. Our project will be the size of an internet modem, and will operate on a external power supply. The system will operate with the MFC system that already exists and take in desired information from the MFC. The data will be stored in a SD card locally first. The data needs to be saved locally first to avoid data lost during the transmission to the server.​