Author Topic: MP3 + speedometer?  (Read 36841 times)

Offline Morgen 3Eman

  • Confirmed
  • PhD. Magic
  • ******
  • Posts: 620
Re: MP III + speedometer?
« Reply #45 on: October 01, 2014, 03:49:59 AM »
Hi MP3 test.

First off, if the pin you have wired from the Hall device to the Arduino is designated as an Arduino input, it will only draw nano amps.  No correctly working  input pin will draw 40 MA. 


As I understand it, you have measured the Hall sensor input at the Arduino, and found it to change from about 0 to about 5 VDC.  This tells me the Hall device is working, and the Arduino is not loading the sensor, and the wiring from the Hall device to the Arduino is not shorted to ground or +5VDC.  That is good.

Then you get confusing.  in your third paragraph, you state that nothing happens when you rotate the throttle.  Then you say you disconnect all the wires to the Arudino.   In the fourth paragraph you say the  MP3 is resurrected.    What exactly do you mean?  Does the MP3 run or not.?  How did  you disconnect the Arduino? 

Addtionally, a common cause of the MP3 not responding to the throttle is due to having the brake engaged.

TTFN,
Dennis



Offline MP3test

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 54
Re: MP III + speedometer?
« Reply #46 on: October 01, 2014, 09:13:19 AM »
Here are the steps:
1. did that work and got the yellow hall sensor wire to the pedelec wire so I have it safely outside the motor - this is OK when I measure it with voltmeter as well with arduino it has 4.5Volts <-> 0Volts as expected on rotation (by hand)
2. I have a DC-DC converter from 48 to 12V (they have common ground as everything in the bike)
3. I connect the arduino to the 12Volts and the pedelec wire to one of the analog inputs + a srcipt that monitors the voltage and prints it at the LCD screen.
4. Again - it measures the voltage OK, but the throttle doesn't work - the wheel doesn't even try to move
5. The strange part - I disconnect the arduino, and still the wheel doesn't rotate trough the throttle (now at this stage I thought the MP3 died)
6. But if I turn off the main current from the battery's key and turn it on again, the MP3 is OK and can be rotated with the throttle. So I guess there is some safety scheme in the MP3's controller that turns itself on for some reason until the motor is shut down?

Thank you.

Offline Morgen 3Eman

  • Confirmed
  • PhD. Magic
  • ******
  • Posts: 620
Re: MP III + speedometer?
« Reply #47 on: October 01, 2014, 05:09:25 PM »
So  what happens if you now reconnect the Arduino, and then cycle the main power?   Your description of events tells me that the Arduino wiring is not directly part of the problem. You have confirmed the wiring change is working by voltmeter testing and by Arduino logic testing.  Which implies that there is another cause of the motor not running under throttle control.   Was it hard to turn the wheel during the time the motor would not respond to the throttle?  Is the Hall sesnor wiring the only change you made?

Have you been connecting/disconnecting wiring with main power switched on?  That is not a  good practice.

Dennis

Offline MP3test

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 54
Re: MP III + speedometer?
« Reply #48 on: October 01, 2014, 05:57:51 PM »
I always turn the main power off when I do somethng to the motor :)
I will do now more tests and will measure the current at the wire going to the arduino to be sure how much is it...

Everything is OK (I guess) without arduino. But with simple words - when I connect the arduino to the yellow hall sensor wire and try to push the throttle - nothing happens and the MP3 goes to coma state. To get it off of it I have to turn off the main battery (and something is cleared inside the controller I guess).

By the way at the first try I could do the above (pusing throttle while the arduino is connected and it correctly measured the 4.5-0-4.5-0 voltage switches. But later happened the problem I am describing.

Offline MP3test

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 54
Re: MP III + speedometer?
« Reply #49 on: October 01, 2014, 08:17:51 PM »
OK, I did several tests and passed trough all the combinations of on/off of the devices and I think I found a problem but now I don't know how to solve it as my electronics knowledge is close to 0.

1. I checked that the "GND" is common for everything (everything on the bike, the 12V DC-DC converter, the arduino
2. The input of the DC-DC converter that makes 12V is connected to the lights switch so I can turn it on/off easily
3. The hall sensor signal is directed outside the motor after I unsolded a wire that is not used (the pedelec one) and soldered it to the signal pin of the "yellow hall sensor" inside the motor - this is checked that is good with a multimeter.
4. The hall sensor gives either 0V or 4.5V depending on the magnets inside the motor
5. The hall sensor signal is connected to A0 (analog) pin of the arduino to gather the voltage info from the sensor. I set up a script that converts the data and displays it on an LCD screen in volts and this workd correctly - it shows 4.5 volts as the multimeter.

Now the tests and the important info I collected.
There is a major difference between the on/off state of the arduino board!
a) arduino is turned ON and main power is turned ON
- the voltage of the hall sensor is 4.5V as usual
- arduino draws 0.01mA which is 10nA which sounds good as I had concerns here
- when running the wheel trough the throttle, the wheel rotates and arduino displays correctly the voltage (changing 0 to 4.5 to 0 etc)
b) arduino is turned OFF and main power is turned ON - here is the problem. Normally this should be the same as no arduino is present BUT this is not the case
- the voltage of the hall sensor drops do 1.35V (note the arduino's A0 is connected to the hall sensor but is switched OFF)
- arduino (while OFF) is drawing 1.5mA
- when trying to push the throttle nothing happens or it rotates just an inch and stops again (Haven't checked this exactly but I guess this depends on the state of the hall sensor if it was at 0V position and not yet affected by the current drawing problem); ALSO even if I disconnect the wire going to arduino from the hall sensor's signal, the throttle is still not working - which means some protection has been activated in the motor
- to get off of this state I have to switch the main power OFF and turn ON and everything is good again.

So the problem happens ONLY while the hall sensor's signal wire is connected to a switched off arduino which for some reason draws 1.5mA at 1.5V and makes the voltage to drop from 4.5V to 1.3V and some protection is switched on in the MP3 and it stops to operate at all (even if the arduino is disconnected after that). I see that the current flows from the 4.5V halls sensor signal to the ground (which is common).

Can this be fixed?

The fix of the problem is to have arduino to be switched ON all the time the bike is ON. Another fix is to have a switch to turn on/off arduino which cuts both its +12V and GND wires. But anyway something (bad) happens when it is OFF which is better to be fixed so it works the same with arduino on or off while connected to the hall sensor.

Thank you for your help

Offline Morgen 3Eman

  • Confirmed
  • PhD. Magic
  • ******
  • Posts: 620
Re: MP III + speedometer?
« Reply #50 on: October 01, 2014, 08:40:12 PM »
Do you have space to put a resistor in series with the Arduino input?  I have to remind you it has been a long time since I used an Arduino, and I have no experience troubleshooting power off problems.  That said, I think the powered off Arduino is pulling down the Hall sensor output, and by using a 10K? 20K? 100K? resistor in series with the input you will limit that current draw.  Perhaps you can put it where you soldered the pedelec wire to the sensor wire?

Dennis

Offline Bikemad

  • Global Moderator
  • Professor
  • PhD. Magic
  • ******
  • Posts: 5,506
Re: MP III throttle problem
« Reply #51 on: October 01, 2014, 10:10:55 PM »
Your description of events tells me that the Arduino wiring is not directly part of the problem. You have confirmed the wiring change is working by voltmeter testing and by Arduino logic testing.  Which implies that there is another cause of the motor not running under throttle control.   

1. I checked that the "GND" is common for everything (everything on the bike, the 12V DC-DC converter, the arduino
2. The input of the DC-DC converter that makes 12V is connected to the lights switch so I can turn it on/off easily


I think your DC-DC converter is putting too much load on the tiny common ground and battery feed wires in the main harness. These thin wires will work like a resistor and will have a voltage drop along their entire length which will vary according to the current they are carrying. The voltage drop will be equal to the current flowing through the wire, multiplied by the resistance of wire.

If you measure the voltage at the battery and then measure the voltage at the inverter connections (while it's switched on) you will probably see a noticeable difference in the meter readings.

If you have 54V at the battery, but only 50V at the  inverter connections, it means there will be ~2V drop on the thin battery feed wire in the harness and ~ 2V rise above 0V on the common ground wire in the harness. :o

I had a similar problem when I wired a 3w LED light (with a built in inverter accepting 12-80V input voltage) directly to the lighting feed and ground wires of my MP4 wiring harness.
In my case the current draw from the LED was only 85mA, but when the light was switched on, it was enough to cause a significant voltage drop on the battery feed to the LED battery gauge (causing The three LEDs to dim slightly) as well as a corresponding voltage rise on the ground wire which effectively caused the motor to run without the throttle being touched.

The voltage drop on the feed wire could affect the gauge operation, but it should not have affected the throttle operation.
But the increase in voltage along the common ground wire meant that the throttle hall sensor had +5V on one side and probably +1~2V  on the ground wire instead of 0V. Therefore the signal output voltage could also be 1~2V higher when measured in relation to the ground connection on the controller.

On the MPIII, if the controller is switched on while the throttle is operated, there is a safety feature which prevents the motor from running until the throttle signal voltage returns below~1V. I suspect your DC-DC converter is causing an increase in the throttle signal voltage, which could activate this safety feature.

Disconnect your DC-DC converter from the lighting wires and connect it directly to the battery wires (to avoid overloading the thin wires in the main harness) and I think you will find that the throttle will then work normally.

Alan
 
« Last Edit: April 16, 2024, 10:56:40 PM by Bikemad »

Offline MP3test

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 54
Re: MP III + speedometer?
« Reply #52 on: October 01, 2014, 11:12:43 PM »
Hm, that sounds as a good reason.

Can I do the following test - I will disconnect totally the dc-dc converter, will attach the GND of arduino to the GND somewhere (let say again the lights wire) and +4.5V wire from the hall sensor to the analog input of arduino (I guess this is safe) to see if the problem repeats.

I did it and it is the same, so the problem is not the DC-DC converter...

What I think happens is that when arduino is turned off, a wire is connected to GND, and +4.5V to the input the current flows trough arduino and its elements and this is why the voltage drops and MP3 gets panicked.

Because when the arduino is turned ON, everything is OK. If the larger wire of the DC-DC converter was the problem it should be the same whenever the arduino is ON or OFF, isn't it?

Also as far as I know there is a pull-up resistors connected between the arduino's inputs and GND (20-50K), is it possible that this is the problem? That means that when arduino is OFF, in fact just this resistor is there and I short the hall sensor's wire with GND trough that resistor.


I think this is a missing part in the hardware of the arduino - by default the input ports should have some protection and to be in some disconnected state, and when on - to connect them to the rest of the board. Now seems the current can pass-trough the board when it is switched off.

Offline Morgen 3Eman

  • Confirmed
  • PhD. Magic
  • ******
  • Posts: 620
Re: MP III + speedometer?
« Reply #53 on: October 02, 2014, 03:31:11 AM »
Or you can power the Arudino with a 9 VDC battery.....But 10 microAmps isnt much current to sag a 48 V supply.  (.01 Ma isn't 10 nanoAmps)  Do you have a ghost load? 

If the Arduino input has a 20K resistor to B+  or GND, it would only have an addition 250 microAmps.   I would expect the sensor to push milliAmps without sagging the output of the sensor.    You can look up the sensor specs to see.  I've never seen an Arduino schematic, so I have no other ideas for you.

Let us know what you find out.

Dennis

Offline MP3test

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 54
Re: MP III + speedometer?
« Reply #54 on: October 02, 2014, 10:57:04 AM »
I think the solution here is to use a transistor as a switch - when there is +5V power in the Arduino board, to open the transistor so the hall sensor signal passes in. When there is no power in the board - the transistor will be closed and so the board will not draw any current. And I'm curious why this is not done by default for every input port of the Arduino...

But my knowledge of electronics ends here - what transistor to use and I guess some resistors should be put as well to control the current flow correctly - I don't know how to calculate them. Seems I have to read a book about electronics to fill that missing knowledge. :)

Offline MP3test

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 54
Re: MP III + speedometer?
« Reply #55 on: October 02, 2014, 02:52:40 PM »
At the arduino board they told me that it is absolutely wrong to connect input to the input pin while the arduino is switched off (yes as I guessed the current flow in the opposite direction and who knows what is going on with the board).

So I have to find the exact scheme to add a transistor as a swicth, but first I will have to edacte myself in electronics :)

Or if someone can calculate the resistors required to tune correctly the tranistor.

The problem is:
by a control signal of +5V, trough a transistor to be able to switch on/off passing signal of 0/4.5 volts - when there is not +5V in the control pin of the transistor, the signal wire should be disconnected; when there is +5V in the control pin the signal wire should be connected, so the signal goes w/o any change to the input pin of the arduino board.

Offline Morgen 3Eman

  • Confirmed
  • PhD. Magic
  • ******
  • Posts: 620
Re: MP III + speedometer?
« Reply #56 on: October 02, 2014, 04:48:03 PM »
Or you could simply try the resistor in series with the Arduino input to limit the current drawn by the Arduino while it is off.  If that doesn't work,(If you do it right, it will)  then go to school and  learn all the stuff you need to know to put the series transistor into the line. 

Or you could come up with a way to power up  the Arduino before the MP3.  If that doesn't work...etc

Let us know how it works out.

Dennis
 

Offline MP3test

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 54
Re: MP III + speedometer?
« Reply #57 on: October 02, 2014, 07:50:50 PM »
The next step and disappointment happened when I connected the hall sensor's wire to the interrupt pin only to discover that the idea of using the motor's hall sensor will not work at all - I get exactly 2550 interrupts per second without moving the wheel, when the hall sensor has 4.5 Volts on line. For some reason it is not a constant voltage, but goes up and down 2550 times per second. May be this can be fixed easily with a capacitor but again I am missing this knowledge and have to go to school first, plus this capacitor again will interfere with MP3's controller :)

So I'am going to plan B (instead of messing with the MP3's controller and eventually blowing it up) - I will open the motor and will put my own hall sensor, will use only motor's ground and +5V current (at least it is constant +5V) and the unsoldered pedelec's wire for it's signal. That way it will be more independent and I will not need any transistors or capacitors, just a 10K resistor between +5V and data wires.

Offline Morgen 3Eman

  • Confirmed
  • PhD. Magic
  • ******
  • Posts: 620
Re: MP III + speedometer?
« Reply #58 on: October 02, 2014, 10:35:22 PM »
Long time, yada yada,.... Are you using an edge driven interrupt ?   The Hall sensor should not be oscillating.  What happens to the interrupt when you rotate the wheel so the Hall outputs 0VDC?

Dennis

Offline MP3test

  • Confirmed
  • Magic Undergrad
  • ***
  • Posts: 54
Re: MP III + speedometer?
« Reply #59 on: October 04, 2014, 05:47:08 PM »
Yes I've got more funny news.

First I couldn't open the motor's cover (I mean I don't want to break it bend it but haven't found a picture or video what/how to get it off), so I moved again to the signal from its hall sensor I already have.

And the funny part is that the supposed "0V" - it is kind of 0, but when connected to the interrupt pin it goes crazy and generates 200KHz interrupts. They are so fast that it is almost impossible to update the LCD screen (as it works trough interrupts as well and arduino ignores an interrupt if the current one is not completed). So this is the mystery now. At "4.5V" the interrupts vary between 2500-5000Hz, at "0V" they vary 100-300KHz.

This problem and the other one (that when arduino is switched off, nothing should be attached to it's ports as back current goes inside arduino and can damage it) definitely have to be fixed and just a single resistor wouldn't help..