update arduino server with averaging and slighty better factorization