Arduino implementation of Duff's device