SamRich
100 W
I couldn't find a good solution for speed modulation with dropbars. I tried installing a throttle but it won't fit on the bars and even if it did the ergonomics wouldn't be great.
There was a good discussion here: http://endless-sphere.com/forums/viewtopic.php?f=3&t=25334
I have some experience using Arduinos so I bought a Nano version and programmed it to control the speed of the motor. The throttle input to most BLDC controllers is a continuous value between 0 and 5V (usually more like 1V-3.5V) - proportional to the desired speed. The Arduino can be used to output a 5V PWM signal and low pass filtered using an RC filter to generate a DC signal.
Here's the wiring diagram:
Here are the buttons on the right side held temporarily with tape:
I used phone wire which is thin and flat. Should be able to easily tuck it under the griptape.
Here are the 4 button functions:
Left hand
Button 1 - Power: Needs to be pressed to have the motor run. I thought it would be a good safety feature.
Button 2 - Reset: Stops everything and resets the speed to 0 since toggling the power button only turns the motor on and off at what ever speed is set with the right hand. This should be useful to accelerate from a stop slowly.
Right hand
Button 1 UP: Increases the speed one step. If held pressed the speed is increased every 250ms.
Button 2 Down: Decreases the speed one step. If held pressed the speed is increased every 250ms.
10 steps total.
Here it is in action (in the workshop):
[youtube]uIlfj8H-W_8[/youtube]
Here's the code for the arduino:
There was a good discussion here: http://endless-sphere.com/forums/viewtopic.php?f=3&t=25334
I have some experience using Arduinos so I bought a Nano version and programmed it to control the speed of the motor. The throttle input to most BLDC controllers is a continuous value between 0 and 5V (usually more like 1V-3.5V) - proportional to the desired speed. The Arduino can be used to output a 5V PWM signal and low pass filtered using an RC filter to generate a DC signal.

Here's the wiring diagram:

Here are the buttons on the right side held temporarily with tape:

I used phone wire which is thin and flat. Should be able to easily tuck it under the griptape.
Here are the 4 button functions:
Left hand
Button 1 - Power: Needs to be pressed to have the motor run. I thought it would be a good safety feature.
Button 2 - Reset: Stops everything and resets the speed to 0 since toggling the power button only turns the motor on and off at what ever speed is set with the right hand. This should be useful to accelerate from a stop slowly.
Right hand
Button 1 UP: Increases the speed one step. If held pressed the speed is increased every 250ms.
Button 2 Down: Decreases the speed one step. If held pressed the speed is increased every 250ms.
10 steps total.
Here it is in action (in the workshop):
[youtube]uIlfj8H-W_8[/youtube]
Here's the code for the arduino:
Code:
String inputString;
String Temp;
char buffer[100];
char type;
const char SET_INPUT = 'I';
const char SET_DOWN = 'D';
const char SET_UP = 'U';
int voltage;
int pinT=3;
int DOWN=0;
int UP=50;
int STEP=10;
int MINVAL=70;
int MAXVAL=170;
int power=0;
int reset=0;
int DOWNCOM=0;
int UPCOM=0;
void setup() {
Serial.begin(9600);
analogWrite(pinT, 0);
pinMode(6, OUTPUT);//RESET/power
digitalWrite(A0, HIGH);
digitalWrite(A1, HIGH);
digitalWrite(A2, HIGH);
digitalWrite(A3, HIGH);
inputString.reserve(100);
}
//A0 Right Green - UP
//A1 Left Green - Power
//A2 Right Yellow - Down
//A3 Left Yellow - Reset
void loop() {
processSerial();
power=analogRead(A1);
reset=analogRead(A3);
DOWNCOM=analogRead(A2);
UPCOM=analogRead(A0);
if(power<128&reset>128){
if ((UP-DOWN)<MINVAL){
UP=MINVAL;
DOWN=0;
}
if ((UP-DOWN)>MAXVAL){
UP=MAXVAL;
DOWN=0;
}
voltage=max(UP-DOWN,MINVAL);
analogWrite(pinT,voltage);
if(UPCOM<128){
UP=UP+STEP;
if ((UP-DOWN)<MINVAL){
UP=MINVAL;
DOWN=0;
}
if ((UP-DOWN)>MAXVAL){
UP=MAXVAL;
DOWN=0;
}
voltage=max(UP-DOWN,MINVAL);
analogWrite(pinT,voltage);
delay(250);
}
if(DOWNCOM<128){
DOWN=DOWN+STEP;
if ((UP-DOWN)<MINVAL){
UP=MINVAL;
DOWN=0;
}
if ((UP-DOWN)>MAXVAL){
UP=MAXVAL;
DOWN=0;
}
voltage=max(UP-DOWN,MINVAL);
analogWrite(pinT,voltage);
delay(250);
}
//Serial.println(voltage);
}
else if(reset<128){
analogWrite(pinT,0);
UP=MINVAL;
DOWN=0;
}
else{
analogWrite(pinT,0);
}
}
void processSerial(){
if ( Serial.available()>0){
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == '\n') {
//Serial.println(inputString);
if(inputString.charAt(0)==SET_INPUT){
Temp=inputString.substring(1,2);
Temp.toCharArray(buffer, 10);
power=atoi(buffer);//compensate for system response
Serial.println(power);
}
if(inputString.charAt(0)==SET_DOWN){
Temp=inputString.substring(1,1);
Temp.toCharArray(buffer, 10);
DOWN=DOWN+STEP;
}
if(inputString.charAt(0)==SET_UP){
Temp=inputString.substring(1,1);
Temp.toCharArray(buffer, 10);
UP=UP+STEP;
}
inputString="";//Clear inputstring
}
}
}