Loading...
 



The electronics unit was constructed using Arduino UNO which allows computerized control of the solenoid valves. This unit; consisting of Arduino, a soldering board, and relays, is connected to a computer to provide a visual interface for user input. This interface contains manual and automatic control for selecting a mode and duration, along with a feedback section for analysis of the ongoing experiments.

Constructing the Electronic Circuit

Figure 1: Connections for one solenoid valve between Arduino, the relay, and the valve

The circuit was first tested with one solenoid valve. The valve is connected to both the relay and the battery while the relay connects to Arduino. Relay functions as a switch to regulate the flow of power from the battery to the solenoid valve. Figure 1 shows the connection between the Arduino, battery, and valve in a certain manner. A detailed explanation of this connection can be found below.

  • Arduino signal: Pin for controlling relay
  • VCC: Connects to 5V in Arduino UNO
  • Ground: Connects to the ground pin
  • NC: Short for "Normally Closed"; the relay is activated with an active high signal meaning that the solenoid valve would be closed when the relay is powered.
  • C: Short for "Common"; it is the terminal for connecting load
  • NO: Short for "Normally Open", the relay is activated with an active low signal meaning that the solenoid valve would be closed when the relay is not powered.

Enhancing the Circuit


After connecting one solenoid valve and making it work successfully, we added three more solenoid valves. A relay is used for each solenoid valve and additional solenoid valves are all connected the same way as the first one.

Figure 2: Connections for two solenoid valves between Arduino, the relay, and the valve

Electronic Setup in Final Design

Connecting 4 solenoid valves


Here we present the user interface (UI) for our custom-made olfactometer. The interface is intended to be used while being connected to the device.

Implementing Manual Mode and Duration Selection


This UI allows the user to control the delivery of two different odors using four different modes: Resting, Purging, Odor 1, and Odor 2. Delivery of these odors is mutually exclusive, meaning that only one odor can be delivered at a time. Therefore, purging between experiments is necessary to make sure that there is no odor from the previous experiment. The users can also set the duration for each selected mode.

Implementing Automatic Mode


After adding a manual mode, an automatic mode was added to allow .csv file selection containing certain modes and their durations. This would allow the user to start a series of operations with one click in the desired order.

Modifications of our code


During our weekly meeting with our supervisor and PhD students, they requested two additional features for our interface:

  • A stop button that can stop any ongoing experiment
  • A real-time feedback system for the olfactometer's state.


As we anticipated an increase in the complexity of our interface over time, we decided to improve its overall organization to address this issue. After some research, we decided to change our code according to an MVC model.

MVC (Model-View-Controller)

MVC is an architectural pattern that separates an application into three main logical components which are the Model, the View, and the Controller. As we can see in the picture above, the model interacts with the controller, the view interacts with the controller and the controller interacts with both.

  • Model: Manages data and business logic.

  • View: Manages layout and display. The interface part is therefore only coded in view.

  • Controller: Routes commands to the model and view parts, it is able to update both model and view


Since the modifiability of the model is one of the goals of this project, the code for the interface should be relatively easy to change as well. Better code organization would allow a better understanding of certain functions, hence it would be easier to add or remove something if needed.


Final code & Interface

This interface contains manual and automatic control for selecting a mode and a duration, along with a feedback section for analysis of the ongoing experiments. In the feedback section, there are circles that represent the valves and show the currently activated mode, accompanying a plot representing the progress of the experiment. There is also a button for an emergency stop which activates Purging for 10 seconds to clean the tube and then stops. Additionally, information regarding odor names, protocol names, and mouse IDs could be saved on the computer. When an experiment is started using either Manual or Excel Control, the program automatically saves the experiment in the code editor under a protocol name. This happens when the program is closed.


Take a look at our GitHub page to have full access to our code and find more information: http://github.com/eezgiinan/OlfactoMeter


Video of the interface in use