Add WiFi to Kettler Cardio Fitness models with RS232
I own a Kettler Marathon HS treadmill which has an RS232 interface to remote control it. But actually, I don't care about the remote control aspect but it can output the current status like heartrate, speed, overall distance, time to complete the current exercise etc.
The suggestion of Kettler is to buy software and an interface cable (rs232 to usb) for 200EUR and then you can see in the computer monitor a scenary while you are exercising.
My approach was to use the Flyport Wifi to stream the RS232 data to somewhere and then analyze and compare each run. Easiest was to use the Serial Nest with the Flyport Wifi and as this board has no additional features like SD Card, neither fancy web applications were possible nor saving the data locally. No big deal, I have a Linux server running an ftp server to stream the data to it. Using the excellent Wiki I was able to click together the complete application.
FlyPort Wifiv RS232 1:1 cable male on both sides
RS232 crossover plug male/female
Connect to the Home WLAN (connection information entered in the wizard)
Check if connected and DHCP is valid while (WFStatus != CONNECTED); while (DHCPAssigned == FALSE);
Get the current time from the internet
Connect to the FTP server (connection information in the source code)
Create a file with the current time as filename
Read line by line from the RS232 bus (Use \n as line terminator)
Parse the data and convert it properly
Make the data available via the web server
Write the line with the parsed data to the ftp server in csv format so it can be imported into Excel easily
If no changed data was found (stopped the exercise) do not add the same row over and over again
If the connection was lost for whatever reason wait for up to 2 minutes and then try to reconnect, creating a new file
This program can be easily adjusted to other use cases where RS232 data needs to be parsed and streamed to a FTP server line by line or made available to a web server. Even other Kettler equipment can be used, all you need to adjust is the parsing process as each device is using a slightly different format, e.g. a bike might have a column break power but no Incline column.
Thanks to Werner