Encoder and motor - PID control - with Arduino or MakeBlock Orion

Hello,

for my project I need PID control of speed / rpm of small DC motor.

I have these parts:

  1. MakeBlock Orion based on Arduino Uno - http://learn.makeblock.cc/orion/ and http://learn.makeblock.cc/learn/images/Makeblock_Orion_Pin.png . Or I can use Arduino, it is good solution for me, too. But I prefer MakeBlack Orion as its red ports support 12V.

  2. Motor with encoder - http://www.makeblock.cc/optical-encoder-motor-25-6v-185rpm/

  3. Encoder driver - http://www.makeblock.cc/me-encoder-motor-driver/ - it connects to red port of MakeBlock Orion, then it is possible to use this API for motor control - http://learn.makeblock.cc/api-documentation-of-me-encoder-motor/ - but I would like to make my own PID control, for example using this library http://playground.arduino.cc/Code/PIDLibrary . Maybe this encoder drive will not be needed.

Here is general library for MakeBlock - https://github.com/Makeblock-official/Makeblock-Library

So I need to read/detect rpm of the motor for feedback to provide appropriate output of controller. I would like to as how to start. Now I do not know to which pin should I supply PWM signal and how to read rpm of motor from encoder (this can be made using API for Me encoder motor which I mentioned).

Thank you for your help.

There are pins of the motor - http://i.snag.gy/6c8Y1.jpg

The correct program for speed measurement could be: http://forum.arduino.cc/index.php?topic=158385.0

I am a programmer and with Arduino I made only simpler projects. I do no know how to connect this motor to the Arduino. I think it will be simpler to connect it to Arduino than MakeBlock Orion. MakeBlock encoder driver is black box for me as the scheme is not available. It should be possible to find out it according to he MakeBlock library and API for motor ( http://learn.makeblock.cc/api-documentation-of-me-encoder-motor/ ) but I think it will be simpler with Arduino. Thank you for your help.

My vision is that for PID algorithm I need the correct pin for PWM and two pins from encoder to pins on Arduino that support interruptions. I need only one direction motion.