You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uncomment SUPPORT_MOTOR_SERVO if you have an RC motor controller
connected to the motor output. Do not forget to remove capacitor from
the low pass filter of the motor output.
Copy file name to clipboardExpand all lines: Arduino_Pedelec_Controller/Arduino_Pedelec_Controller.ino
+14-6Lines changed: 14 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,11 @@ Features:
38
38
#include"menu.h"//on the go menu
39
39
#include"serial_command.h"//serial (bluetooth) communication stuff
40
40
41
+
#ifdef SUPPORT_MOTOR_SERVO //RC motor controller connected to motor output
42
+
#include<Servo.h>
43
+
Servo motorservo;
44
+
#endif
45
+
41
46
#ifdef SUPPORT_BMP085
42
47
#include<Wire.h>
43
48
#include"BMP085.h"//library for altitude and temperature measurement using http://www.watterott.com/de/Breakout-Board-mit-dem-BMP085-absoluten-Drucksensor
@@ -452,6 +457,10 @@ void setup()
452
457
torque_zero=analogRead_noISR(option_pin);
453
458
#endif
454
459
460
+
#ifdef SUPPORT_MOTOR_SERVO
461
+
motorservo.attach(throttle_out);
462
+
#endif
463
+
455
464
#ifdef DEBUG_MEMORY_USAGE
456
465
Serial.print(MY_F("memFree after setup:"));
457
466
Serial.print(memFree());
@@ -590,12 +599,6 @@ void loop()
590
599
}
591
600
firstrun=false; //first loop run done (ok, up to this line :))
Copy file name to clipboardExpand all lines: Arduino_Pedelec_Controller/config.h
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,7 @@ const int fixed_throttle_in_watts = 250; //number of watts to set as thr
133
133
#defineCONTROL_MODE_TORQUE 2 //power = x*power of the biker, see also description of power_poti_max!
134
134
#defineCONTROL_MODE CONTROL_MODE_NORMAL //Set your control mode here
135
135
136
+
//#define SUPPORT_MOTOR_SERVO //RC Motor controller with PWM input is used. Do not forget to remove capacitor from the low pass filter of the output to the motor controller.
136
137
//#define SUPPORT_MOTOR_GUESS //enable guess of motor drive depending on current speed. Usefull for motor controllers with speed-throttle to optimize response behaviour
137
138
#defineSUPPORT_BATTERY_CHARGE_DETECTION//support detection if the battery was charged -> reset wh / trip km / mah counters if detected.
138
139
constbytebattery_charged_min_voltage=20; //minimum battery voltage to consider it charged. Useful to prevent "false positives".
@@ -148,8 +149,8 @@ const int throttle_offset=196; //Offset voltage of throttle control wh
148
149
constintthrottle_max=832; //Offset voltage of throttle control when in "MAX" position (0..1023 = 0..5V)
149
150
constintpoti_offset=0; //Offset voltage of poti when in "0" position (0..1023 = 0..5V)
150
151
constintpoti_max=1023; //Offset voltage of poti when in "MAX" position (0..1023 = 0..5V)
151
-
constintmotor_offset=50; //Offset for throttle output where Motor starts to spin (0..255 = 0..5V)
152
-
constintmotor_max=200; //Maximum input value for motor driver (0..255 = 0..5V)
152
+
constintmotor_offset=50; //Offset for throttle output where Motor starts to spin (0..255 = 0..5V). Default: 50. In Servo mode this value is about 1000
153
+
constintmotor_max=200; //Maximum input value for motor driver (0..255 = 0..5V). Default: 200. In Servo mode this value is about 2000
153
154
constintspd_idle=55; //idle speed of motor in km/h - may be much higher than real idle speed (depending on controller)
0 commit comments