# Writing an Android app for the HVACR market

Make it to the Right and Larger Audience

Blog

# Writing an Android app for the HVACR market

Background

With the advent of mobile devices many industries are now developing apps to help those in the field servicing various kinds of equipment. This is also true for the air conditioning and refrigeration market where manual calculations and paper charts are being replaced by electronic methods.

With that in mind I recently developed an Android app targeted at that market. The app is designed to calculate target superheat for fixed orifice expansion devices typically found in residential air conditioning systems.

Without delving too deeply into the theory of mechanical cooling and the vapor compression cycle which governs how air conditioning and refrigeration work, superheat is the excess heat picked up by the refrigerant once it has vaporized inside the cooling coil (evaporator) on its way back to the compressor. This heat is an important measure and can indicate if the system is charged and operating correctly or if there are possible problems.

The diagram below shows the superheat we are trying to measure. This is the temperature difference between point A and point B on the diagram. The direction of the refrigerant flow is from B to A.

In order to check if this parameter is correct the ac system is run until is stabilizes – typically after about 15 minutes. At that point two measurements are taken – a wet bulb reading inside the ac duct at the point where the air returns to the equipment and a dry bulb reading outside near the condenser unit. These readings help determine the target superheat.

The target superheat does not have a simple equation type solution and is typically provided by a table. This app works by generating a best fit higher order polynomial based curve as the basis for the necessary calculations. This avoids storing a table of values as well as providing a better estimation of in-between values not explicitly in the table.

The use of a best fit equation is a key difference between this app and others on the market which use a static table.
The user of the app (typically an HVAC service person) will input the indoor wet bulb and the outdoor dry blub reading taken by the appropriate test instruments and the app will display the target superheat.

Most other superheat apps only support Imperial units. This app also performs the calculations in SI units for non-US users.

Version 2.0 recently released also allows user to input data from pressure and temperature measurements of the refrigerant system in order to calculate the actual superheat. The actual superheat value depends on the refrigerant used. So in order to make the calculation the pressure temperature relationship of the refrigerant at saturation is needed. Typically this is done in the form of a chart and manufacturers of refrigerant like DuPont provide reference tables.

Again in a manner similar to the target superheat calculation the values in the calculation use a formula. The formula is a fifth order polynomial which best first the table data.

Currently R22 and R410a are the two supported refrigerants in the app. These refrigerants are popular in residential air conditioning systems. Based on user feedback other refrigerants (some of which are more popular in other applications like automotive ac as well as residential and commercial refrigeration) may be added in future releases.

The result of the second calculation (performed on a different page to the target superheat calculation) is the final difference between target and actual superheat which will help the service technician if everything is working correctly or if there are issues in the system that need to be resolved.

The App

Android apps when developed in the native environment typically use the Android SDK along with an appropriate development environment. In the past Eclipse was popular. Currently Android Studio based on the Intellij IDE is popular. Like many IDEs one can connect to the target device during testing and debug as needed with the debugger.

Android apps are developed in Java. However a good understanding of the underlying architecture is necessary along with the class APIs in order to develop correctly architected and functioning apps.

Version control and backup are important considerations when developing an app especially an app that is evolving like this one. Android Studio has built in features which allows the IDE to link to a variety of Version Control Systems (VCS). In this case Subversion is begin used for version control.

When an app is developed testing is important. Android Studio does have a built in simulator which simulates a device visually and then shows the app running on the device. In practice however the simulator requires a lot of processor power and graphics – as a result it can take a while for the simulator to begin running and model the app. Also the simulator is a not a good means to test apps that work with physical interfaces to the outside world such as Wi-Fi and Bluetooth. In most cases the desired functionality will just not be simulatable.

Where possible it is better to test the app using an actual device. The test device is usually connected to the development machine via a USB connection. After building, the IDE will load and run the app on the device and if in debug mode allows debugging to take place by setting breakpoints and monitoring values of variables and objects in the code etc.

In order to use a real device for testing it must be setup in developer mode to allow the IDE to access the device. This is done via the appropriate “settings” options on the device.

Other cross platform development environments are available for app development for mobile devices. While these allow you to target different operating systems from a single piece of code and IDE they very often do not result in the best implementation for the operating system at hand and issues may arise when dealing with low level hardware. Therefore it is generally recommended to use the native development environment for apps especially when interfacing to low level hardware.
The primary architecture of v 2.0 of the app uses two separate fragments to manage the views of the two pages and to perform the necessary calculations. An appropriate underlying adapter class is used to instantiate the two fragments.
The switching between the two views is managed by a ViewPager. The pages are scrolled by swiping horizontally.

Any key values between the two fragments needed by the other fragment is handled by passing the value though the underlying main activity managing the two fragments.

All calculations are handled with double precision values. The final results are truncated (with rounding) to the second decimal place. This level of accuracy exceeds that required by those in the field since many service technicians may still be using analog gauges responsible for measuring refrigerant pressures. Older gauges coupled with possible mechanical errors accumulated over the long term would result in inaccuracies exceeded by the calculations in the app.

The app starts up with default values in the data field which may then be modified by the users to the necessary vales.
This app is an evolving app and future versions are expected to add more functionality to aid HVACR service technicians in diagnosing and repairing HVAC equipment.

When the app is run for the first time the first screen displayed will be the one shown below. In order to provide something meaningful appropriate default values show up the input field which are then modified by the user as needed.
Entering the Indoor Wet Bulb and the Outdoor Dry Bulb values along with the correct temperature units and then pressing “Calculate” will display the correct result in the “Target Superheat” field.

This is a standalone calculation which may be performed by the user as needed.

However a second screen is also available to help the user check how far the target superheat is from the real superheat at the unit. In order to do this the user can swipe from right to left displaying the second page shown below.

In this screen the user can select the actual temperature measurement at point A in Fig 1. It is not possible to directly measure the temperature at point B. In refrigeration systems this temperature is determined by measuring the pressure on the refrigerant line using a pressure gauge (commonly referred to as a gauge manifold set) and then using a pressure-temperature chart (which show the pressure-temperature relationship of the refrigerant at saturation)

The second screen of the app allows this calculation to be performed without the use of a calculator and paper charts. As was described earlier the P-T relationship in the app is performed by a derived equation thereby not utilizing a table.
Since this relationship is dependent ton the refrigerant used the correct refrigerant is selected by selecting the correct graphic on that screen. The graphic depicts a typical 30lb refrigerant cylinder along with the type and color code. All refrigerants have a unique color designed by the ASHRAE.

Two refrigerants which are popular in domestic air conditioning systems – R-22 and R-410a – are supported. However the app may in the future include other refrigerants based on user feedback.

This app will continue to evolve and there will be future articles on the additional features added to the app as it evolves.

For any further information or questions please email Ravin at ravin@blue-mountain-consulting.com

Electrical Engineer
Author brief is empty
Groups:

## Industrial Control

1. vin12 3 years ago
0
-0

Hi – thanks for the suggestions.

0
2. RavP 3 years ago
0
-0

Hello vin12 – it depends to what extent you are interested in the subject. Just for theory there are plenty of resources online. If you want to get into design or engineering typically people with mechanical degrees go into HVACR although anyone from an engineering background such as electronics can get into it since it involves many different aspects including motors and electrical theory, thermodynamics and airflow. If you are more of a practical type of person there are courses at community colleges or trade school.

Hope that helps.

0
3. vin12 3 years ago
0
-0

0