[HW] Getting started: Speed measurement


To measure speed we will use an Aimar ST650 connected to an Arduino.

The Aimar ST650 has a paddleweel with four asymmetrical, hydrodynamic blades and hall-effect magnetic sensor for high-level pulse output.

Connecting ST650 to an Arduino Board:

  • Bare cable to GND.
  • Red cable to +5V.
  • Green cable to pin A0.


This first  basilar sketch will count paddlewheel’s complete rotations:


int sensorPin = A0;    // select the input pin
int sensorValue = 0;      //variable to store the value coming from the sensor
int count = 0;     // variable to store the variation's count
int sensorValuePrec = 0;  //variable to store the previous value of  sensorValue


void setup() {

void loop() {
  sensorValuePrec = sensorValue; //stores the previous value
  sensorValue = analogRead(sensorPin); // read the value from the sensor:
  sensorValue = sensorValue/800; //value is 1 if>800
  if(sensorValue != sensorValuePrec)

  {count = count + 1;  } //if there was a variation of value the wheel has spun so count grows up

  Serial.print(count/4);  //effective number of complete rotation is obtained dividing count by 4