├── README.md └── DigitalThrottle └── DigitalThrottle.ino /README.md: -------------------------------------------------------------------------------- 1 | # DigitalThrottle 2 | 3 | An interface for the Leadrise Motor Controller which allows the use of 0-5V throttles instead of requiring (more expensive) 5K throttles. 4 | 5 | We use a Microchip Technologies MCP4131-104E/P Digital Potentiometer controlled by an Arduino to emulate the resistive throttle. 6 | 7 | --- 8 | 9 | Pete Prodoehl 10 | 11 | 12 | 13 | http://rasterweb.net/raster/ 14 | 15 | -------------------------------------------------------------------------------- /DigitalThrottle/DigitalThrottle.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * DigitalThrottle.ino 3 | * 4 | * An interface for the Leadrise Motor Controller which allows the use 5 | * of 0-5V throttles instead of requiring (more expensive) 5K throttles. 6 | * 7 | * We use a Microchip Technologies MCP4131-104E/P Digital Potentiometer 8 | * controlled by an Arduino to emulate the resistive throttle. 9 | * 10 | * 11 | * Pete Prodoehl 12 | * 13 | */ 14 | 15 | 16 | #include 17 | 18 | 19 | byte address = 0x00; 20 | int CS = 10; 21 | int throttlePin = 0; 22 | int throttleVal = 0; 23 | int resistVal = 0; 24 | 25 | int LEDpin = 2; 26 | 27 | int debug = 1; 28 | 29 | void setup() { 30 | pinMode(CS, OUTPUT); 31 | SPI.begin(); 32 | 33 | if (debug > 0) { 34 | Serial.begin(9600); 35 | } 36 | pinMode(LEDpin, OUTPUT); 37 | digitalWrite(LEDpin, HIGH); 38 | } 39 | 40 | void loop() { 41 | 42 | throttleVal = analogRead(throttlePin); 43 | resistVal = constrain(map(throttleVal, 500, 700, 0, 255), 0, 255); 44 | digitalPotWrite(resistVal); 45 | 46 | if (debug > 0) { 47 | Serial.print(throttleVal); 48 | Serial.print("\t"); 49 | Serial.println(resistVal); 50 | } 51 | 52 | } 53 | 54 | int digitalPotWrite(int value) { 55 | digitalWrite(CS, LOW); 56 | SPI.transfer(address); 57 | SPI.transfer(value); 58 | digitalWrite(CS, HIGH); 59 | } 60 | 61 | 62 | 63 | --------------------------------------------------------------------------------