Protocol Documentation

@jlewallen Is there some documentation on the protocol to access the hardware using network sockets? I could dig around in the github codes but it may be quicker if I could have a few pointers on where to look!


1 Like

Hey there!

Unfortunately, documentation isn’t something I’ve got a lot of bandwidth for but I can definitely help to point out some resources for anybody feeling adventurous.

FieldKit uses Google’s Protocol Buffers to encode/decode to define the structure of its various messages and saved data.

GitHub - fieldkit/app-protocol: protocol buffers for hardware communications, primarily used by the mobile app. This repository contains the schema for communicating with the stations over WiFi. Stations create a web server that has various endpoints. It’s a good resource for seeing the kinds of things you can ask of stations, as well as the source code for the HTTP routing itself on the stations:

GitHub - fieldkit/fkc This is a golang client that can be run on a desktop and used to communicate with stations. Querying status, live readings, etc… You can also use curl to download data off of them.

GitHub - fieldkit/data-protocol: protocol buffers for stored/logged data and information. This repository contains the schema for persisted data. Any data you download off the device will have these messages.

I hope this is enough to get started!


1 Like

Thanks @jlewallen
This is good to start with. I’ll post here if any further queries.


fkc worked well. I could get the live readings. Now, I have to work out a shell script to read the weather parameters.

I could read the binary data file directly using http:///fk/v1/download/data but have to understand the format.

Looks like a good start though!

I worked out the following script to run as a cron job on a raspberry pi. It appends readings to a file in the format:
YYYYMMDD HH:mm:ss humidity temp1 pressure rain windspeed wind_dir

I had initially connected the FieldKit station to my desktop via my home wifi router. Seemed to be working fine except that it would lose connection once in a while. After making the FK as an AP and using a raspberry pi to access the data it is better.

. /home/pi/.bashrc

/usr/local/bin/fkc --address -get 2>&1 > /dev/null | awk -v d="date '+%Y%m%d%H%M%S'" ‘BEGIN{print d," \n { \n"}{if (NR > 5) print $0}END{print “\r\n”}’ | awk ‘{if (NR > 1) print $0}’ | jq ‘.liveReadings[0].modules[1].readings[0,1,2,4,5,6].value’ | tr -s ‘\n’ ‘\t’ |awk -v d="date '+%Y%m%d %H:%M:%S'" ‘{print d,$0}’ >> /home/pi/Instruments/FieldKit/sensor_data_fk.log

Planning to take the setup to our observatory now for deployment. Fingers crossed that I wouldn’t have issues there.

1 Like

Very cool! Please report back if you are able.