Arduebot

I followed the plan and played with DAC1➫A11 connection on Arduino Due as basis for a PID controller.

DAC1 can only produce voltages between (1/6)*3.3V and (5/6)*3.3V:
http://forum.arduino.cc/index.php?topic=129765.msg992632#msg992632

I did measure the complete range for "analogWriteResolution(12)" in steps of 100, and I did measure just a cable as well as 1KΩ and 10kΩ resistors between DAC1 and A11. These are the resulting curves:

I wanted to start simple in determining the PID constants with "Manual Tuning":

To my surprise I found no use for the proportional component in DAC1➫A11 scenario, a simple "I" controller (Ki=50, Kp=Kd=0) achieved good results already (PID Sampletime was 40ms). I passed a "void (*)(void)" callback function to PID constriuctor that got called at each real compute step of PID controller (every 40ms). That callback function updated the display with Setpoint (yellow) and Input (blue) curves (1 measurement every 3 pixels):

So I did my first steps with Arduino PID Library and if you want to play with PID yourself, you should really read the detailed article series explaning the many design decisions for Arduino PID Library.

Next step will be to do PID controller for Arduebot driving quickly with constant distance to a long, dentless wall. I will use the Sharp 4-30cm distance sensor with curves mentioned above. PID relies on some kind of symmetry which that raw measurements in above diagram don't have. I found a nice solution to get more symmetric measurements (around the planned Arduebot to wall distance), just take the natural logarithm instead of the raw measurements(!);

Now adding a constant resulting in value 0 for the planned distance should be a good basis for PID controller.

I read that controlling two motors of Arduebot with a single PID Output value can be done by driving both motor controllers at a specified speed value and just subtract the absolute vale of Output from the left/right in case of positive/negative Output value. The PID magic will also deal with slight speed differences between both motors.

For the distance sensors perhaps just adding both distances as PID Input is possible. But it is also important whether the front or back sensor shows the minimal distance value, at least for the action needed (turn right/turn left). So the plan is to use PID library "SetTunings()" function to switch between two (or maybe three) sets of PID controller constants on whether Arduebot is direction front to wall or front away from wall (or inside a small band around Setpoint distance where no corrections are needed).

I have not found articles dealing with "two distance sensors, drive parallel to wall" specifically. I will appreciate any pointer.

Hermann.