Arduino-Based Pasteurization Scanner 2.0

This post is much overdue.

As I worked on the original Arduino-Based Pasteurization Scanner (I will now refer to it as the 1.0), I began to realize that many of the components I was adding could possibly be integrated onto one PCB board.  When I first began the 1.0, I really had no knowledge about PCB design, so I sort of pushed the thought off to the side for a good year or so.  It just so happened that some of my father’s friends in the cider-brewing community got word of the work I had done, and were possibly interested in having one of their own.

For those of you with less technical knowledge about electrical design, a PCB stands for Printed Circuit Board, which are the “chips” that are inside pretty much of sort of electronic you use daily.  They generally contain only the minimum amount of hardware necessary in order to cut down on cost.  And since a PCB can be designed once, and printed as many times as the designer wants, it is a good way to mass-produce your design for an electronic.

I soon discovered that PCB design is sort of like carpentry where the mantra of “measure twice, and cut once” rules over everything.  All the parts that you intend to use get laid out in software, but the designer has to double check that each part that is necessary in the design matches the physical dimensions in the software, or else the parts won’t fit and a new board will need to be fabricated.

Messy first design

At first, I wanted my PCB to be exactly the same size as the screen I was using, so that the screw holes on the LCD would match the screw holes on my PCB.  Then the PCB could just rest directly behind the screen (and when looking straight on, you wouldn’t even know there was anything there).  The pins on the right side of the screenshot above match up to the LCD screen inputs, so a vertical header could be used to directly plug in the screen to the PCB.

Getting slightly better…

As I went on in my design, I tried to minimize the amount of traces (which are the electrical connections between parts on the board), and vias (which are when the traces switch from the top side of the PCB to the bottom, so that two different traces don’t intersect).  I also added something extra, a WiFi module that prints out data when the user connects to it through a web browser (that’s the big rectangular thing in the upper left on the below screenshot).  I also added a 4-axis joystick button, another thermometer port, and a speaker.

Final design

Eventually, I scrapped the idea of making the PCB have the same size footprint as the screen and made it even smaller, since I was being charged by the square inch of my design.  I also tried to optimize the pins I was using on the microcontroller so that the traces needed could be simpler and require fewer vias.

Once the PCB came in, all I needed to do was solder all the parts on and hope they all fit!

They didn’t.  In fact there were a couple errors in my design, which you can’t see since I fixed them on the backside.  Also my barrel plug footprint did not match up with the ones I ordered, so I had to break it out with some wires.

I plan to have a complete final design done by the time I graduate.

Final Project for ECE 2524 is Finished!

For our final project for this class, my group decided to do an Assembly language compiler/interpreter.  Basically, it takes in 11 standard Assembly different commands, (ie LOAD, STORE, etc), and compiles them.  It is kind of a big extension to what we had to do in ECE 2504, when we already worked with Assembly language.

The code was written using the models of the Unix decision philosophy, so that most the functions had a clear purpose and only did one thing.  So needless to say, there were a lot of functions.

Additionally, we added in breakpoints, an input file text editor, and an output to the command line of the valuein from the Accumulator every time the Accumulator value changes.

A full README follows:

NAME: Ben Schoeler & Thomas Yu & Luke Spieler
DATE: 12/12/2012
TITLE: Unix Final Project (Assembly Compiler/Simulator/Interpreter/Assembler)

* g++
* pandoc (for pdf)
* markdown (for html)
* texlive-latex3 (for pdf)

ex: “sudo apt-get install g++ pandoc markdown textlive-latex3″
cd to the directory that contains this file.

there are several options for making the readme:

1) ‘make html’ will produce an html version of the readme

2) ‘make pdf’ will produce a pdf version of the readme
3) ‘make preview’ will preview the readme in whatever editor is
defined in the
EDITOR environment variable

4) ‘make all’ or ‘make’ will make both the html file and the PDF

1) cd to the working directory that contains the “” file
2) >> “qmake”
3) >> “make”
4) >> ./computerSim
This program is a ‘pseudo’ Assembly Language Compiler/Simulator/Interpreter/Assembler.
It recognizes many different Assembly Language commands. They are listed below:

1) LOAD <hex-data-address> [loads the value from the memory address <hex-data-address> to the accumulator]
2) STORE <hex-data-address> [stores the value in the accumulator to the memory address <hex-data-address>]
3) ADDV <decimal-number> [adds the number to the value currently stored in the accumulator]
4) ADD <hex-data-address> [adds the value stored at the address specified to the value in the accumulator]
5) BGTZ <decimal-instruction-address> [sets the PC to the value given by the <instruction address> to the value currently in the accumulator only if the value in the accumulator is > 0. If the value is not > 0, then the PC is incremented by 1]
6) NOP [does nothing but increment the PC by 1]
7) CLEAR [sets the value in the accumulator to 0]
8) HALT [halts the Compiler/Simulator/Interpreter/Assembler. This should usually be the last instruction of a program]
9) OUT [outputs a string to the output box in the GUI. %A represents the value in the accumulator. For example if the value in the accumulator was 20, the instruction OUT "The value in the accumulator is %A" would print out "The value in the accumulator is 20."
10) LOADA [this takes the value in the accumulator to be an address in data memory and loads the value at said address into the accumulator]
11) STOREA <hex-data-address> [this takes the value stored at the data address specifies and treats it as another address. It then stores the value in the accumulator at the address given by the second address]


1) Single Breakpoint

Set a breakpoint at any line of the instruction memory.
First, use the arrows to select the line desired. Then click the ‘click to set’ button.
When Run is clicked next, the program will run to the desired Breakpoint that was set.
The BP can then we set again in the same manner. The BP will reset on clear or reset buttons.
The BP must be in a valid range in program memory for it to work in a correct manner.

2) Reset Button

Reinitializes the PC, ACC, and data memory to 0. Also, if a HALT instruction has been run, it takes it out of the HALT’ed state. The user can then rerun the program already loaded.

3) Clear BUtton

Does the same as the reset button but also resets the instruction memory.

4) Interpreter

Allows the user to input assembly function one-by-one if an input file is not provided. The instruction must be valid in order to be run. By pressing return or enter, the instruction will be sent to the compiler.



And the program can be downloaded here:

Final Project for ECE 3574 is finished!

After 3 days of hard work, our SSL threaded chat server and and client programs have been completed.

The programs allow clients to connect to a server and chat to each other.  One person has to host the server application, which will display a port and IP address. Then, as long as another person is on the same network, he can connect to the server using that same port and IP address.  If two or more clients are connected to the server, they can then open a chat box and communicate to each other via text.

Basically the biggest hurdle in the project was getting the basic communication protocol down.  Qt has some nice functions to handle SSL communication, but once we figured out how to send/receive information the rest of the work dealt with how to handle the information being passed.  We ended up only being able to send one string to and from a client and server at a time, so we had some rather complex code words and message formats in order to not get both ourselves and our programs confused.

If we had more time, we would have liked to have implement functionality for a client to talk to more than one other client at a time, but given that we fulfilled the project specifications and the fact that we had other projects to complete before the semester ended, this was not possible.

UPDATE EDIT:  Apparently what we accomplished was really hard in the time frame allotted considering we were one of the two groups who actually fulfilled the project specification requirements completely.

You can download the program here: (g++ is required to recompile)

Unix Haiku & Limerick

My Dad used to say

“Ben, keep it simple stupid.”

Linux says so too.


There once was a boy named Unix

Whose hobbies included coding and electronics.

He programmed all day

Having fun with arrays

Until root demanded he solve some conics.


ECE 2524 – Make a Makefile

Before this assignment for ECE 2524, I thought that a Makefile was some sort of magic that was needed to compile files for C++, but was created by a C++ compiler itself.  I had no idea that it was originally meant to be made by programmers.  I guess this because when using QtCreator, it will create a Makefile for you.  This left me feeling kind of anxious because if it is something that is automated, it must be fairly time consuming in the first place.

At first glance, I really had no idea where to start but after looking through the notes it was fairly easy to figure out.  The format of a Makefile is honestly pretty simple: if a file depends on another file, it must exist, and if it does not exist, you must specify how to make it exist and whether or not is also had any dependencies.  So it really puts some logic and order to the way things must be created in order for the end product to be made.

However, after this assignment, I felt fairly confident in my abilities to create a Makefile for an applications that has more than a few files and dependencies.

Arduino-Based Pasteurization Scanner

My father is a bit of an English-cider making enthusiast and he generally looks to maximize what he gets out of paying for my Virginia Tech tuition.

When he realized that he would like to be able to have a system that would automatically measure how well pasteurized his cider is while in the pasteurization tank, he came to me.  Naturally, I obliged.

One Pasteurization Unit (PU) is defined as 1 minute of heating at 60 degrees Celsius.  The equation is as follows:

Using interrupts, every 1000000 microseconds (or 1 second), the temperature is read from a waterproof thermometer sensor, which is then sent to the Arduino which plugs that value into this cumulative PU equation:

PU = PU + pow(10,((C-TEMP_REF)/Z))/60; where C = the current temperature, TEMP_REF and Z are user-defined constants respective to the liquid being pasteurized.  As you can see, because this equation is effectively called every second we must divide by 60 because this equation is meant for every minute.  This results in a very accurate cumulative PU reading since the temperature is being read so actively.

The PU value is then sent to a screen (I elected to use a graphical LCD instead of a text-based screen since it is much larger and allows for bigger text) and displayed along with a timer since the scanner has been active.

A switch was constructed to have an active and inactive mode (the LED changes color from red [inactive] to blue [active] depending on the state).

An enclosure was constructed to make the system as waterproof as possible, although the thermometer cord itself has a fairly long waterproof cable which should prevent any possible damage to the system.

Using a bigger screen caused some more complexity to the project which I did not expect.  This was because the screen runs on 3.3v, and since the Arduino runs on 5V logic all the signals sent from the Arduino to the screen must be reduced to 3.3v.  Using a 4050 level-converter, we can do just that:

I forgot to get a picture before we closed it up but the 4050 can be seen at the top of this picture:

Happy brewing!

Source Code

Some thoughts on Debugging C++ using QtCreator in Ubuntu

As of right now, we haven’t covered Unit testing so I don’t have much to say about that although I have heard from CS friends that it is a very important tool.

However I have noticed a few things from doing C++ programming in QtCreator.

1) The compiler will usually spit out an error that pertains to what you did wrong, and should be a big enough hint fix it

2) The program compile, but exit with no error code

Having 2 happen is very frustrating, but after several months of working with Qt I can now confidently say that this usually only happens when some sort of memory is attempting to be accessed that does not exist or has not been initialized.

For example, for most projects in Qt some sort of List (QList) will need to be used.  In order to use a QList, the type of data members stored in the List must be specified (i.e. QList<QString>).  However, one must be very careful not to try to members in a List if they do not exist.

If a QList called listName exists, it is always preferable to used either listName.front() or listName.back() if there aren’t many things in the list and you just need one or two things.  If you need to cycle through the list, and get everything out of it, it can be helpful to make a temporary list, and pop_front() within a while loop that runs only while listName.size() > 0.

Before I figuerd this out, I would just use array-like functions to get to the data I wanted (ie listName[0] for the front).  However this is not good code because there can be unforseen consequences when you exist the list to have at least 2 or 3 members at all times.  By doing what I mentioned above, at least the program won’t quit on you without telling you what went wrong.

Past experiences with Unix (Linux)

To be honest, my past experiences before this semester with Unix were probably even more hurried than they have been this semester.

About 5-6 years ago when I was just beginning high school, I had the idea of creating a file server that my family could use to store files to because both my father and mother had laptops and they were always emailing files back and forth to eachother.  Also, we only had one printer hooked up to one computer so I figured it would also be cool if I could just hook the printer  up to this file server as well so any computer connected through our network would be able to print and share files.

I looked into it and found that it would be possible to use samba to do the file sharing.  I wanted things to be as user-friendly as possible so I decided to use xubuntu which seemed to be one of the more popular flavors of Linux at the time.  It had a GUI but was still kind of hard to understand after growing up on windows.

Even though it had a GUI, it wasn’t too much help because samba still needed to be configured in the CL.  Unfortunately, after I had samba working and files could be shared between computers, it just stopped working after a few weeks.  The only cure I could find was to uninstall and reinstall samba and configure it the same way as before to get it working again.

I think it’s understandable that after a few weeks I got very tired of having to constantly reinstall this software to get a file server that was not used very often to work.  So it remained broken…

So therefore my initial experience with Unix and Linux was not the greatest.  I went back to using Windows for everything in my daily life.

Some thoughts on using Qt in C++ with Ubuntu

In ECE 3574, we are required to use a special library for C++ called Qt.

Qt is really great, and I like it a lot.  I have been told that it makes C++ more like Java, in that it can do a lot of same things and have similar functionality, especially when it comes to GUIs.  We’ve learned that Qt is really extensible because it can be run on Mac, Windows, and Unix, and there is no real need to worry about something being different on any 3 of them–everything will be pretty much the same.

After doing some research on how Qt was actually used in  Autodesk MayaThe Foundry’s NukeAdobe Photoshop ElementsSkypeVLC media playerVirtualBox, and Mathematica so I was glad to realize that what we are learning is what is used by many popular programs today.

Using Python in Ubuntu

I’ve begun to have to use Python for this class, and since I had no prior experience in this language, its been a bit of a challenge.

I guess when you use Python, you don’t really think about how you would do things in C++, simply because Python was built to do things for you.  For example, the lack of distinct file types was nice, since it would take care of that for you.  However, I was sort of used to having to think about having to do every little single step involved in a programming assignment whereas with Python if you know how to use the function correctly it could be much less code.

Also, since a python compiler is already installed on Ubuntu without doing anything extra, I can see why writing a Python script could be beneficial because then anyone running some sort of Linux should be able to compile/use it without having to download anything else (however it would be surprising if a Linux user did not have g++ installed or did not know how to access it).