Week12: Interface and Application Programming

For this week’s task I started to build the user interface for the cycling training/racing rollers I will be building for my final project. I am aiming to measure the distance covered and the speed of two riders competing and compare them in a computer application to determine a winner. I have already developed a speed measuring sensor based on the hall sensor in the input devices week.

I used Processing to develop the graphics. I want to include a clock which counts down the racing distance with a numerical indication of distance and speed. I found an example which illustrated how to draw a circle using Processing. I modified this to position the end point of a line, the other end of which is a fixed point. Progress towards the finishing distance is factored over the circumference of a circle and the end of the line is progressively moves producing the effect of a clock hand moving. A count down of distance to the end point of the race is added in text form alongside an instantaneous reading of speed.

The hall sensor circuit produces a count of revolutions as measured by the passing of a magnet each second. The count is written as an ASCII string to the serial port. I modified an example routine to read in a string and make it in to an integer, which is deducted from the race distance very second. This controls the position of the clock hand and is displayed on the distance counter. Speed is calculated by multiplying the revolutions per minute count by 60.The Sketch works well when tested with a magnet mounted on a drill.

Next I wanted to explore the possibility of the graphics comparing the distance and speeds of two remote riders connected via the internet. This requires the application to be based on the web and to receive data via two (or more) computer’s serial ports. Processing has a java script mode so I used this to export the processing script to an html page.  The next stage is to connect the html with serial data inputs. I am still currently working on this.

There are two avenues I am exploring. Seriality is a browser plug in which is being developed to allow interaction between physical devices and certain web browsers. I am also looking at developing a Chrome app. Chrome apps offer the possibility of being connected to usb, serial or bluetooth devices.

Useful Links

My Processing Sketch

Seriality

Accessing Hardware Devices with Chrome