How to add a throttle to a Carrera Vengeance E Spec

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
install a load resistor between the white wire of the throttle and GND.
It should stabilise the voltage reading.
Which pin on the arduino did you connect the throttle signal wire to?
Where can I source a load resister? Any specific types?

I am connecting the throttle signal wire to A1.
 

Woosh

Trade Member
May 19, 2012
20,370
16,870
Southend on Sea
wooshbikes.co.uk
remember the 1 kilo-Ohm resistors you bought?
Put one between A1 and GND.
Put the multitester on 20V, red probe on A1, black probe on GND, you should read a stable voltage when you use the throttle.
 

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
remember the 1 kilo-Ohm resistors you bought?
Put one between A1 and GND.
Put the multitester on 20V, red probe on A1, black probe on GND, you should read a stable voltage when you use the throttle.
This is comedic (on my part) shows my lack of knowledge on electrical engineering!

Turns out I was using the multimeter completely wrong!

So the output is all fine on the throttle. However the Torque output is going from 0 to 4.6v, does that sound ok? I know you mentioned 3v. If we need 3v max I would need to redo my coding to reduce the output.
 

Woosh

Trade Member
May 19, 2012
20,370
16,870
Southend on Sea
wooshbikes.co.uk
However the Torque output is going from 0 to 4.6v, does that sound ok?
No.
Check the voltage of the cadence wire from the sensor.
It could be that the yellow and green may be torque and cadence or cadence and torque.
 

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
No.
Check the voltage of the cadence wire from the sensor.
It could be that the yellow and green may be torque and cadence or cadence and torque.
So just to make sure we are aligned. Earlier we said we will set A4 as analog out, when the throttle is at a minimum, output 0V, when the throttle is at maximum, output 3V. So essentially we are synthesizing the output here to a specific Analog Pin regardless wether its cadence or torque (we are hoping its torque). So what ever voltage I am reading from the multimeter is the voltage I am synthesizing out while the throttle is being used.

Also all this is being done currently without the bike plugged in so there is nothing coming in from the PAS sensor.
 

Woosh

Trade Member
May 19, 2012
20,370
16,870
Southend on Sea
wooshbikes.co.uk
that is correct.
Your code synthesises the two outputs to replace the sensors.
 

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
that is correct.
Your code synthesises the two outputs to replace the sensors.
So I am essentially synthesising wrong torque value. So I need to change this so the max voltage is 3v outputting to the torque. Is that correct if so I’ll revisit my code where I synthesise the torque voltage.
 

Woosh

Trade Member
May 19, 2012
20,370
16,870
Southend on Sea
wooshbikes.co.uk
I need to know that you have identified correctly the torque and cadence wires from the sensor. Confirm these wires with your multitester.
The cadence outputs fixed voltage (eg 4V) pulses, the torque sensor outputs a proportional voltage 0V-3V to the pedalling force.
Your code will need to synthesise these two signals to control the motor with the throttle.
 

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
I need to know that you have identified correctly the torque and cadence wires from the sensor. Confirm these wires with your multitester.
The cadence outputs fixed voltage (eg 4V) pulses, the torque sensor outputs a proportional voltage 0V-3V to the pedalling force.
Your code will need to synthesise these two signals to control the motor with the throttle.
Ok got it to do that I’ll have to plug this into the bike and pedal see what readings I get from each wire. I think a few posts back someone pointed out what they were.

I think for now we should go with what we believe and at least get the right synthesised values being output then if we have the wrong wire it’s easy to just change the pin outputs in the code.

So I’ll work on the synthesis of the torque out to ensure I get a range of 0v to 3v
 

Evian1040

Pedelecer
Jul 7, 2020
75
9
I need to know that you have identified correctly the torque and cadence wires from the sensor. Confirm these wires with your multitester.
The cadence outputs fixed voltage (eg 4V) pulses, the torque sensor outputs a proportional voltage 0V-3V to the pedalling force.
Your code will need to synthesise these two signals to control the motor with the throttle.
Indeed we do, someone a while back posted the official suntour hesc pas pin layout and we identified from it the yellow wire is the Torque out and the green wire is the Cadence.
EDIT: I should also point out i confirmed the Torque out voltage indeed responds when supplied with 1.5v and if more than 4.3v the controller will think something is wrong with the PAS and will produce error 21
 
  • Informative
Reactions: Woosh

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
OK an update.

So I have been experimenting with the code and I now have the synthesised values for Torque outputting values that don't exceed 4v.

When I debug using the serial monitor I see a constant value at full throttle however when i check the pin with the multimeter the values I get are constantly going up and down between 1.8v and 2.3v, why would the multimeter be displaying changing voltages when the actual value I'm synthesising is a constant value. I am suspecting its because I have the code running in a loop within an IF statement so each time the loop fires and the IF fires its triggering a change (I think! but I could be wrong).

Any thoughts?
 

Woosh

Trade Member
May 19, 2012
20,370
16,870
Southend on Sea
wooshbikes.co.uk
don't rely only on the debugger. You can unintentionally give us the wrong impression.
As I said before, you need to program the blinking rate as a visual feedback.
Try to do that first, otherwise, your only other reliable tool is the multitester.
 

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
don't rely only on the debugger. You can unintentionally give us the wrong impression.
As I said before, you need to program the blinking rate as a visual feedback.
Try to do that first, otherwise, your only other reliable tool is the multitester.
OK got it. The visual feedback is always there.

So at the moment I'm only getting 8 blinks a second on full throttle.
 

Woosh

Trade Member
May 19, 2012
20,370
16,870
Southend on Sea
wooshbikes.co.uk
make sure you can control the blinking rate with your throttle.
 

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
make sure you can control the blinking rate with your throttle.
I can 100% control the blinking rate with the throttle that’s the easy part done.

The only challenge at the moment is outputting the correct synthesised value for the torque. Although it’s coded correctly just needs testing on the actual bike I am having doubts because I’ve done some reading on the Arduino Nano board and it can’t output a voltage value via the analog pins it’s just not designed to do that.

I’ll try and test on the bike tomorrow.
 

vfr400

Esteemed Pedelecer
Jun 12, 2011
9,822
3,993
Basildon
The controller starts responding to the torque sensor at 1.5v, and it gives maximum power at 4.3v. Think about a non-linear output. Adding a bit of exponential might be better to get better control at low speed.
 
Last edited:

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
OK an update.

So I have been experimenting with the code and I now have the synthesised values for Torque outputting values that don't exceed 4v.

When I debug using the serial monitor I see a constant value at full throttle however when i check the pin with the multimeter the values I get are constantly going up and down between 1.8v and 2.3v, why would the multimeter be displaying changing voltages when the actual value I'm synthesising is a constant value. I am suspecting its because I have the code running in a loop within an IF statement so each time the loop fires and the IF fires its triggering a change (I think! but I could be wrong).

Any thoughts?
Ok after further reading looks like the multimeter was correct. This is by design correct behaviour of analogwrite(PIN number, value between 0-255), it will oscillate the voltage between 0v - 5v or (3.3v).
 

Woosh

Trade Member
May 19, 2012
20,370
16,870
Southend on Sea
wooshbikes.co.uk
after you can control the synthesised torque output, synthesise the cadence output, 0V to 4V, 25% duty cycle, at 6Hz.
 

rajeshtailor

Pedelecer
Jun 5, 2020
170
3
So just an update on progress.

I’ve been doing some testing (on the bike). After running the throttle for approx 5 secs on full throttle I get an error 22 on the display unit. The same happens when pedalling.

I suspect somewhere the voltage is exceeding 4.3v also wanted to ask, as I increase the throttle should the torque be increasing in proportion? For example if I increase throttle by 20% should torque be increasing by 20%?
 

Woosh

Trade Member
May 19, 2012
20,370
16,870
Southend on Sea
wooshbikes.co.uk
Post your code, I'll check it for you.
 

Advertisers