Nicolas Villar sent me a sample of the PepperMill, a new sensor board he and Steve Hodges designed at Microsoft Research in Cambridge, UK. It’s a nifty little board. You attach a DC motor and the board can an output voltage when the motor is turned, and analog signals telling you the direction and speed of the motor. It turns a DC motor into a rotary encoder, of sorts.
Wiring is very simple. The motor connects to the two spring connectors at the top of the board. Direction and Speed pins connect to two analog inputs on your microcontroller. Ground connects to your microcontroller’s ground. The motor generates voltage when you spin it.
The direction pin outputs close to 2V when the motor’s going one direction, and 0V when it’s going the other direction. To read this, use an analog input and look for a value. If its 0, it’s going one direction, and if it’s above 0,it’s going in the other direction.
For more info or to get a board, contact Nic and Steve in Cambridge.
Here’s the circuit:
These images were made with Fritzing. Here’s the Fritzing sketch, here’s the part for the PepperMill, started by Nic, edited by me.
And here’s the code:
/*
Peppermill example
This example reads a motor's direction and speed using a
PepperMill sensor board. For more on the peppermill, see
http://research.microsoft.com/en-us/projects/peppermill/
The circuit:
* Speed pin connected to analog in 1
* Direction pin connected to analog in 0
* ground connected to ground
created 8 Feb 2010
by Tom Igoe
*/
void setup() {
// start serial communication:
Serial.begin(9600);
}
void loop() {
// read the motor speed pin:
int motorSpeed = analogRead(1);
Serial.print("speed: ");
Serial.print(motorSpeed, DEC);
// read the motor direction pin:
Serial.print("\t direction: ");
int motorDirection = analogRead(0);
// 0V means the motor's going one direction;
// 2V means it's going the other direction:
if (motorDirection > 0 ) {
Serial.println("this way");
}
else {
Serial.println("that way");
}
}


Pingback: Turning a motor into a sensor with the Peppermill | Products & Tech News
Pingback: Turning a motor into a sensor with the Peppermill
Pingback: Turning a motor into a sensor with the Peppermill | SquareCows