A quick introduction. I just switched from the Basic Stamp to the Arduino, so I am just starting the learning curve. I am creating a traction control program for a slow moving (up to 14mph) hydraulically driven vehicle. The hydraulic motors are driven in a parallel configuration which allows some differential action when turning allow tight radius turns. However if you lose traction on one tire it allows one tire to spin freely while the other tire remains stopped.
To deal with this I am installing a flow control valve (electrically controlled by a solenoid) which will meter the hydraulic oil to each motor in equal portions when activated. This valve forces both tires to turn at the same speed. I will be using the traction control to monitor each wheel speed and compare the speed ratio of the two tires. If the ratio exceeds a user selected value *and* the speed is within a predetermined safe range it will engage the flow control valve.
I have most of the logic and control scheme documented and am looking for some feedback on how I am planning to allow the user to select between different predefined slip ratios (i.e. 30% 35%, 40%, 45%, 50%, 55%). I am going to use a rotary switch with 6 positions and use increasing resistor values on each pin of the switch. Using the analog input I will be able to decode the various switch positions using approriate logic with a +/- tolerance for each expected resistance.
I believe the desired place to read the switch and set up the corresponding value is within the setup loop. This way it is read once at initialization and does not read the switch position during each execution of the program. This approach would require me to add a reset button so that after any change in the switch position it can be updated while running setup. Once the traction control unit is setup and dialed in the switch would probably remain at the same setting and only changed if traction conditions change (mud, etc). Does this sound like a reasonable approach?
PS. Here is a picture of the vehicle
Yes, it is a motorized bar that seats 8.