Common signal cable for both speed and temp sensor

Get all your technical information about electric bikes here.
Post Reply
hias9   100 W

100 W
Posts: 233
Joined: Jul 11 2018 12:06pm

Common signal cable for both speed and temp sensor

Post by hias9 » Jan 05 2020 6:59pm

Is it somehow possible to wire a temperature sensor to a motor with an existing speed sensor without having to add an additional signal cable?
So that voltage between signal cable and GND would be some voltage (maybe 2.5-5V) which corresponds to a certain temperature when there is no pulse from the speed sensor. And voltage should be close to 0V when there is a pulse from the speed sensor, so the controller can still recognize it.

Could this be done with controllers like ASI or Phaserunner?

User avatar
amberwolf   100 GW

100 GW
Posts: 32239
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Common signal cable for both speed and temp sensor

Post by amberwolf » Jan 05 2020 7:53pm

those are two different types of signals. one is an analog resistance measurement, detected as an analog voltage change at the other end, and the other is a digital periodic grounding of a voltage supplied by the ohter end.

if you just connect them together direclty, you're basically jsut grounding out the thermal sensor's resistance completely whenever a speed signal occurs, and your'e always at least partly grounding the speed signal based on the thermal sensor's resistance, assuming common ntc or ptc wired from thermal signal output to ground, as is common.

without knwoing the input side design at the controler end, i couldn't tlel you what happens there, but that's what happens with the motor end.

so the other end woudn't see the signals it expects.

the only way you can send those two signals on the same wire is to build (or buy, if it's available) a circuit with it's own battery, or powered from the hall sensor power, that digitizes and then multiplexes any number of signals digital and analog. then another circuit at the other end that demultiplexes those signals, and recreates them on it's outputs as separate signals of the same characteristics again.

withotu modifying the controller/etc internals for those that are measuring the resistance, the hardest part would be recreating the resistance of the thermal sensor signal, if it's a typical ptc or ntc thermistor. there are voltage-to-resistance converters out there, so you would jsut have to program your demultiplexer to have this emulate the correct resistance that was seen at the other end.

if the motor thermal signal output is just an analog voltage from a sensor like lm35, etc., then it's easier, but the controller has to be able to read that already.

hias9   100 W

100 W
Posts: 233
Joined: Jul 11 2018 12:06pm

Re: Common signal cable for both speed and temp sensor

Post by hias9 » Jan 05 2020 9:18pm

On the ASI I have tested to wire a resistance in series with the signal cable.
What happens is that while there is no speed sensor pulse, the voltage is the same as without the resistance in series (a bit less than 5V).
While there is a speed sensor pulse, voltage is higher than without the resistance (e.g. 1.5V instead of 0.2V).
The pulse seems to be recognized as one by the ASI controller if voltage goes below approximately 1.8V.
To measure the motor temp, it uses the analog voltage of the signal cable to GND.
If I could tell the ASI to ignore voltages above 4.8V, it could work, but I don’t think that’s possible.

Regarding the circuit, that sounds complicated and it would have to be inside the motor.
I would prefer a simplier solution. Motor temp does not have to be very exact. Only enough to detect overheating.

User avatar
amberwolf   100 GW

100 GW
Posts: 32239
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Common signal cable for both speed and temp sensor

Post by amberwolf » Jan 05 2020 9:42pm

hias9 wrote:
Jan 05 2020 9:18pm
On the ASI I have tested to wire a resistance in series with the signal cable.
that's not how it would be wired in your idea, assumign the resistance is intended to simulate the thermal sensor.

you'd be directly wiring the resistance of the thermal sensor in parallel with the speed signal to ground.

if you don't, then the temperature sensor input can't read the sensor, since that's how most of them are designed to work--with the sensor from signal to ground. unless the asi is different, in which case you must find out how it works.

if you really want to know if it would work the way you want, you would literally short the controlelrs' speed sensor input and thermal sensor input, and also short the motor's speed sensor output and it's thermal sensor output, and connect those two signal wire sets together.

the internal electronics (pullups, pulldowns, residual voltages, etc) on each controller input affect the circuit, as do the actual thermal sensor and speed sensor used, as well as how long the sensor stays grounded on each rotation and how many times it is grounded per rotation,

either way, the temperature sensors resistance will be affected, so you would have to determine experimentally what the reading the controller will see and then calculate what to program the controller to expect from the sensor (assuming it has a way to do that, and doesn't just expect a certain specific sensor range).

the same is true of the voltage from a thermal sensor like lm35--it won't read quite the same as it would otherwise, so to get correct readings you have to experimentally calibrate the controller to read correctly, assuming it has that capability.

the speed sensor may or may not work at all, depending on how well the thermal senosr grounds the signal, at the temperature ranges you expect to see in the motor, and how much voltage the controller requires to see during a non-pulse state. (since it reads a pulse anytime it's below 1.8v, it proably has a similar type of threshold for a non-pulse state, more toward the 5v end of things, and likely wont' read another pulse until it has transitioned above that level for whatever amount of time, depending on it's noise-rejection software/hardware setup.


To measure the motor temp, it uses the analog voltage of the signal cable to GND.
then that means you must have a sensor inside the motor like the lm35 that outputs a voltage. is that what you have? or do you have a resistance to ground that varies with temperature (much more common).

Regarding the circuit, that sounds complicated and it would have to be inside the motor.
yes. half would be inside the motor (multiplexer) and half would be outside the motor (demultiplexer). requires both to work. and yes, it would be complicated.

I would prefer a simplier solution. Motor temp does not have to be very exact. Only enough to detect overheating.
drill a hole in the motor case and use laser-ir sensor with a fast enough reaction time to read teh temperature while the hole is in line with it. ;)


personally i'd rather just take the speed sensor wire in the motor already, and use it for the thermal sensor exclusively.

then stick a magnet on the wheel itself, or a series of them, and use an external speed sensor, to completely avoid the whole complicated mess.

is there a reason you won't or can't do that?

hias9   100 W

100 W
Posts: 233
Joined: Jul 11 2018 12:06pm

Re: Common signal cable for both speed and temp sensor

Post by hias9 » Jan 05 2020 10:52pm

Yes, the alternative if I cannot get it working is to use an external speed sensor and use the signal cable for the temp sensor instead of the speed sensor. Just wondering if it can be done without an external speed sensor.
I have used kty and ntc sensors (resistances that vary with temperature) so far and plan to add whatever sensor is suitable.
I can program the temperature map (like 50 degrees = 1.5V, 75 degrees = 2.1V, etc.), but I think I cannot change the threshold for pulse/no pulse and I cannot tell it to ignore values above 4.8V or similar.

I will put a potentiometer between the signal cable and GND tomorrow and see what happens.

By the way, the motor is a Bafang G310.
And the controller input for the speed sensor / temp sensor is pull-up.

hias9   100 W

100 W
Posts: 233
Joined: Jul 11 2018 12:06pm

Re: Common signal cable for both speed and temp sensor

Post by hias9 » Jan 06 2020 5:40pm

If the resistance (wired between signal and GND) of the thermistor is always higher than about 4kOhm, the speed sensor works fine. It should also be a thermistor which has increasing resistance with increasing temperature (like Kty, not like 10k ntc).

Are there any thermistors that meet those requirements? (If resistance is a bit too low I could wire 2 of them in series)

User avatar
amberwolf   100 GW

100 GW
Posts: 32239
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Common signal cable for both speed and temp sensor

Post by amberwolf » Jan 06 2020 5:44pm

if ntc doesnt' work, then ptc is the type you're after.
https://www.google.com/search?q=ptc+thermistor

User avatar
amberwolf   100 GW

100 GW
Posts: 32239
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Common signal cable for both speed and temp sensor

Post by amberwolf » Jan 06 2020 5:46pm

hias9 wrote:
Jan 05 2020 10:52pm
I cannot tell it to ignore values above 4.8V or similar.
you can build a circuit that "chops off" any value above that voltage, if necessary. not sure of the specifics, but probably opamps or transistors could do this easily enough.

hias9   100 W

100 W
Posts: 233
Joined: Jul 11 2018 12:06pm

Re: Common signal cable for both speed and temp sensor

Post by hias9 » Jan 06 2020 7:21pm

Thanks. There are some 10k PTC thermistors available and these should do the job.

hias9   100 W

100 W
Posts: 233
Joined: Jul 11 2018 12:06pm

Re: Common signal cable for both speed and temp sensor

Post by hias9 » Jan 08 2020 10:55pm

On all controllers with a temp sensor input I tried so far, the shown motor temperature was lower when the motor is turning. Could anybody explain why?

Usually the temperature will not be more than 10 degrees celsius lower, but with this setup using a 5k or 10k PTC thermistor, the temperature would be about 50 degrees celsius lower than when the motor is not turning.

User avatar
amberwolf   100 GW

100 GW
Posts: 32239
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Common signal cable for both speed and temp sensor

Post by amberwolf » Jan 08 2020 11:09pm

when you have the speed sensor connected in parallel, it shorts the temperature signal to ground, which lowers the average voltage the temperature signal in the controller sees.

since there are more pulses the faster the motor goes, the more time the voltage is shorted to ground and so the lower the average voltage will be.

if lower voltage means lower temperature to the controller, then you'll see a lower reading,

if lower voltage menas higher temperature, you'll see a higher reading.

how much lower or higher depends on the average voltage.

there are other effects i cna't predict based on the internal controller circuitry; the above is only for the motor end.



that's part of why i said originally that you'd need a signal multiplexer at motor and demultiplexer at controller to do this and get correct data.

hias9   100 W

100 W
Posts: 233
Joined: Jul 11 2018 12:06pm

Re: Common signal cable for both speed and temp sensor

Post by hias9 » Jan 08 2020 11:17pm

Thanks, but this also happens when there is only a thermistor and no speed sensor at all.
I have this effect also on my direct drive motors.
Also it does not seem to be much related to how fast the motor is turning.

User avatar
amberwolf   100 GW

100 GW
Posts: 32239
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Common signal cable for both speed and temp sensor

Post by amberwolf » Jan 08 2020 11:33pm

ah, then i don't know what's causing it for sure, but hte most likely thing is induced electrical noise from the phase wires into the sensor wire or into the ground of the sensor wire, which is shared with the hall wires, and could also be induced from the hall sensors.

you could try putting a small 0.1uf capacitor across the thermal sensor input of hte controller, from signal to ground. that should absorb some of the spkes and at least change the problem, if this is thecase. if it works, then increase or decrease capacitance by paralleling small and large caps until the problem goes away or at least minimizes.

also add one from 5v to ground on the hall sensor power output from the controller.

hias9   100 W

100 W
Posts: 233
Joined: Jul 11 2018 12:06pm

Re: Common signal cable for both speed and temp sensor

Post by hias9 » Jan 09 2020 12:23am

Thanks a lot. I will get some small capacitors and try it soon.

It behaves like this:

0 rpm, sensor voltage: 2.45V
Motor turning, no-load: 2.3V (with load it would be the same)
Motor stops turning: 2,2V for a split-second
0 rpm: 2.45V

Post Reply