Xojo Enables Mac Developer to Expand the Market of Wind Speed and Direction Acquisition Application
Jeff O'Brien lives on a windy hill in Cape Cod, Massachusetts. One day he began a search for a software package that would measure and record wind speed and direction to a data file so he could determine if a wind turbine would be a viable source of energy. Much to his dismay, he was not able to find anything for the Mac. He did, however, discover Inspeed©, an affordable Windows-only software solution that did everything he required but lacked the wind direction component he was looking for. He contacted the owner who, coincidentally, was also in Massachusetts, and they started discussing the product and, more specificially, how Jeff could improve Inspeed by rewriting the application in Xojo, a development tool Jeff had been well-versed in for years.
Jeff had always been interested in learning how to program hardware and this seemed to be his chance to do it - a small project with a real purpose! Jeff wrote some embedded software that runs on a micro controller that collects data about wind speed and direction, and sends serial commands via USB. The Xojo application receives these messages, displays the realtime information on the screen and logs the data in memory and, based on a user defined interval, writes the data to a comma separated file. The data contains time stamps, Min, Max, Average wind speed, along with wind direction information both numerically and textually.
Writing his application in Xojo gave Jeff the ability to satisfy Inspeed's existing user base, which were all Windows users, but also added another segment of the market - the Mac users. They released the new software/hardware in June 2008.
"Xojo gives you the ability to write code on the platform you are most comfortable with and build applications for three platforms, while maintaining only one set of source code," commented Jeff. "Also, the community is a tremendous resource with guys like Joe Strout and Norman Palardy who have helped me out over the years."
Jeff started out using Xojo to create utilities for the electronic prepress industry. He created a program that helped streamline archiving and file organization with a particular workflow in the prepress industry. He has also made hotfoldering software that does many different tasks from file conversion. Jeff is also in the process of finishing up a home grown Print Management System front end that writes data to an OpenBase Database backend.
Jeff wrote the code for the device's micro-controller using a language for micro-controllers called Ardunio. The code sends out the wind direction, time between pulses (which is used to determine wind speed), the firmware version and a checksum as a comma-delimited packet once per second. The device connects to the computer via USB. Since most USB devices appear as regular serial devices to the OS, Jeff used Xojo's Serial class to listen for incoming data.
Because Xojo is not interpreted but compiles to machine code, its speed is more than fast enough to handle the amount of data coming in every second. Xojo includes a number of string parsing functions which made it easy for Jeff to slice up the data and update the application's user interface in real time. Xojo also includes classes for reading and writing files which Jeff uses to log the incoming data. Xojo's file I/O uses streams, very similar to Java. Jeff also used Xojo's HTTPSocket to provide an option to send the data to any URL on the Internet allowing web sites to log and/or display the data.
In the future, Jeff plans to make the device a network device. At that point he can easily switch his code over to using Xojo's TCPSocket to listen on the network for the incoming data.