GoldenMotor.com Forum

General Category => Magic Pie & Smart Pie Discussions => Topic started by: MP3test on September 22, 2014, 02:49:21 AM

Title: MP3 + speedometer?
Post by: MP3test on September 22, 2014, 02:49:21 AM
Hello,

[ANSWER: open the controller; unsolder the yellow wire; solder it to the pin corresponding to the yellow wire from the hall sensors connector; as a result you will have hall sensor's 0V-5V ticks at your pedelec signal wire; VERIFY THE WIRES FIRST, READ THE DISCUSSION BELOW]

I'd like to build a speedometer/odometer for my MP3. Is there any way to catch the hall sensors' data? At the picture below there is "For meter display" connector, but I can't find anywhere description of what the two wires are - "Signal Receive", "Signal Transmission".

If MP III doesn't provide the hall sensor ticks trough its connectors is there anyway to get that from the controller without damaging it?

Any help?

(http://www.goldenmotor.com/e-Bike-DIY/MP3%20SmartPie%20Wiring%20Layout.jpg)
Title: Re: MP III + speedometer?
Post by: MP3test on September 22, 2014, 09:56:01 AM
I've got an answer from a golden motor representative, he said that the "Signal Receive", "Signal Transmission" are for some proproetary UART potocol and that the speed data is not transmitted out from the motor.

So I have two options - (a) somehow to get safely without breaking the controller the signals from the current hall sensors, or (b) to solder several new my own independently at the same radius, so the magnet there is trigering them as well.

Is there anyone that has done it that way succesfully?

How many are the original hall sensors inside the motor? Is it safe to get safely in paralles the ground signal and 5V coming out from them?
Title: Re: MP III + speedometer?
Post by: MP3test on September 22, 2014, 12:35:53 PM
P.S. Just to clarify - I will be using it with an Arduino board, which I/O ports drain 50mA.

So if I get out from the controller hall sensors' signals in parallel, will the controller handle the additional 50mA need?
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 22, 2014, 05:31:45 PM
Hi MP3test,

There is another way to get the signal you want, and that is to epoxy a magnet to the wheel near the controller cover, and a hall sensor on the controller cover, so you can sense each rotation.  You could then route the sensor wiring with the existing power/signal cables for a neat installation.  Really, you could place the magnet anywhere on the wheel, and the hall sensor at an appropriate radius/distance.  It may even be possible to sense the motor magnets with a hall device near the hub at the radius of the magnets. 

It has been a while since I've played with an Arduino, but I don't think the I/O ports must have 50 mA to function, but can function with up to 50 mA without damage.  A typical Input current would be in the nano/microAmp range,  while the Output can handle as much as 50 mA, depending on the impedance of the load.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 22, 2014, 05:50:22 PM
Thank you!

Yes I have a plan to use one of those two wires that nobody knows what are they supposed to do (Signal receive/transmission).

I've read the specs of the arduino, actually it says 40mA and yes this is the max. The good news is that you say this is the mAX and it needs far too low in reality for input connections. But doesn't that mean that I can connect this directly to the 5V output of the current hall sensor? The current will go to the controller as well to my wire but since it will drain out too low of electricity, it will not hurt the controller in any way?

So the simple plan is:
- to locate let say the "Signal Receive" wire coming out from controler
- to cut it
- to connect it to one of the hall sensors 5V output

Then to use the "For Meter Display" connector's:
- Signal Receive pin
- Ground pin
and to conect to the arduino's input pins.

Will this work?
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 22, 2014, 08:15:21 PM
Hi MP3test

I think I better take a fresh look at Arduino literature before I say anything about exactly what to connect where.

If I understand your plan, you intend to tie into the existing MP3 hall sensor for the input signal to the Arduino, and to the controller ground for the power/signal ground.  Where are you planning to get your  +5VDC supply for the Arduino?

I'll get back to you in the next day or so.  OK?

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 22, 2014, 08:44:31 PM
Hi MP3test

Hey, sometimes i'm old and stupid.  I don't know enough about your plans!    You have only mentioned getting signal input from the Hall sensor.  What are you planning to use as a display?  Have you thought about how to drive it? USB? parallel?   Where are you planning to physically place the Arduino and display?  How are you going to power it all?

I checked about the signal input requirement for the Arduino Uno, and when the pin is designated as an input, the probable current for that pin will be in the low nanoAmp range.  The Hall sensor will easily support this additional current requirement.  So your plan for that is reasonable.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 22, 2014, 09:36:08 PM
Thank you very much for the arduino input check! So the plan is doable without any new hall sensors.

I hope that after I cut the MP3's top secret "Signal Receive" wire to use it for the arduino communication I will not break something hidden there that noone knows about :)

Regarding your questions - I will power the arduino with 12V that I get trough a DC-DC converter. There will not be any display - my plan is to modify an analog speedometer to show speed, distance and battery capacity using some stepper motors. I need the retro look. If I do this successfully I will post some pics.

By the way, why there are three hall sensors in the motor - to calculate the speed faster by getting quickly 2 time intervals or there is another reason? For my needs I think I will need just one signal from any of the three hall sensors, but now I am thinking to get data from two of them (anyway there are two spare wires to use) so I will not have to wait for full 360 degree rotation but short time between the two triggers. (I am not sure how they work and will check practically - do they trigger once in 360 degrees, or multiple times by several magnets during the 36o degree rotation)
Title: Re: MP III + speedometer?
Post by: Bikemad on September 22, 2014, 10:19:02 PM
By the way, why there are three hall sensors in the motor - to calculate the speed faster by getting quickly 2 time intervals or there is another reason? For my needs I think I will need just one signal from any of the three hall sensors, but now I am thinking to get data from two of them (anyway there are two spare wires to use) so I will not have to wait for full 360 degree rotation but short time between the two triggers. (I am not sure how they work and will check practically - do they trigger once in 360 degrees, or multiple times by several magnets during the 36o degree rotation)

The hall sensors are used to sense the position of the rotating magnets in relation to the fixed phase windings, not to measure the speed.

There are three hall sensors because it is a three phase motor, so each hall sensor controls one of the three phase wires:

(http://www.arhservices.co.uk/GoldenMotor/BLDCMotorWiringDiagram.JPG)

(http://www.arhservices.co.uk/GoldenMotor/Startermination.JPG)

Here is the Hall sensor connector on the MPIII:
(http://www.arhservices.co.uk/GoldenMotor/Hallsensorplug.JPG)

The Magic Pie has 56 magnets, so there would be 28 +5V/0V pulses per revolution (360 degrees) from each of the Hall sensors.

Alan
 
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 23, 2014, 03:54:32 AM
Hi MP3test

Hey, I like the stepper motor speedo idea!  So are they bi-phase drive motors?  How many output pins do you need from the Arduino?   I'd love to see the package you envision.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 23, 2014, 12:26:57 PM
@Bikemad thank you very much for the input and pictures!

@Morgen 3Eman - everything started after I ordered a "48V" speedometer from China that after I connected everything blew up as it happened to be for 12 Volts. Then after I started to repair it I came with the idea to modify it and make it digital inside. That way there will not be a mechanical drive for it to count distance and speed and will be some fun for me (this will be the first arduino project). Each stepper motor has 4 wires, so to manipulate speedometer, odometer and voltmeter I will need 12 pins.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 23, 2014, 04:52:24 PM
Hi MP3test

That speedo story sounds familiar.  :( 

Something you might consider for powering your Arduino:  Use a USB power supply instead of a dedicated DC-DC convertor.  I have found that small switching supplies work just fine on 48 VDC. And they are super cheap and easy to find as used.   By powering the Ardunio through the USB rather than 12V you reduce the heating from the linear regulator on the board, and make the whole thing more efficient.  Of course, if you already have 12V steppers, rather than 5V steppers, it may not make economic sense.  Just something for you to think about.

Make sure to include freewheel diodes across each stepper winding.....

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 23, 2014, 06:10:06 PM
I've got a nice 15A 48V-12V converter with 10mA in idle which is good. I decided to have 12V bulbs as finding the right for 48V was also difficult, so every addon now I power with 12 Volts (like horn etc).

I will have a 48-5V converter as well, just to be able to charge my phone if needed. But arduino is OK with 12V - it requires 7-12V so 5 will not be sufficient I guess?
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 23, 2014, 06:41:41 PM
Hi MP3test,

The Arduino I worked with could be powered by 5VDC through the USB connector, or 7-12 VDC through the power input pin.  I use a 12VDC  game? oy? laptop? power supply for turn signals, lights, etc as well.  Mine is only good for 5 amps, but it only cost me 1$ US.  :)  I also have a 5VDC USB charger for some stuff. 

Hey, I think you have a really great idea here, with your retro/steam punk analog dials driven by digital.  What speedometer stuff are you planning on using?  I ask because when I'm happy with the drivability of my latest leaning trike I envision making a good looking one, and an analog dashboard would fit right in with my currently blurry vision of what it would look like. 

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 23, 2014, 08:33:17 PM
Hi MP3test

Hey, I had no idea these things even existed last week, and now I find out that they are cheap and easy to get.    I found some 5V GM replacements, with 6 costing $15 US!!!!  Thanks for the education.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: Bikemad on September 24, 2014, 10:32:43 AM
Hey, I had no idea these things even existed last week, and now I find out that they are cheap and easy to get.    I found some 5V GM replacements, with 6 costing $15 US!!!!  Thanks for the education.

Hi Dennis,

Unfortunately my psychic powers are not a good as they used to be, so could you please give me some more clues to help me determine which "these things" you are referring to?

Alan
 
Title: Re: MP III + speedometer?
Post by: MP3test on September 24, 2014, 04:12:19 PM
I think "These things" = stepper motors :)
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 24, 2014, 05:31:22 PM
Hi Alan

Sorry about the lack of specificity, we were talking about stepper motor speedometers.  I just never twigged to the fact that D'Arsonval meter movements have been replaced by digitally driven analog looking output displays.  The whole idea is just brilliant:  People get some information more quickly from analog displays, which is why digital display watches just never became popular, even tho watches became digital devices.  Digital  measurements can be made very repeatable and cheap, which is why watches became digital, and their accuracy improved by huge amounts. 

Hey, rack it up to me being old and foolish:)  But the concept makes economic and engineering sense.  Rugged, reliable, low power, cheap to build, cheap to change, high commonality across a wide range of packaging options.  Brilliant!  And I didn't even know how common it has become...

But MP3test has lodged an idea in my brain about some of the favorite dashboard instrumentation layouts. My favorite is two adjacent big dials with two smaller dials on the outside.  With a stepper motor to move the pointer, that idea becomes useable in a high vibration environment like a bike. It makes packaging trivial, as all you need do is a bit of graphic design work to change what info is displayed on what "gauge" face.  The drive software only needs to address a different output pin to change what is displayed where. 

 

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 24, 2014, 08:11:22 PM
The most important thing is that digital is better than analog (except sound amplifiers) in many reasons and is more accurate. For example - the battery capacity meter of the crap I bought - it shows always "MAX". Before the idea of Arduino + stepper motors (which I guess I can do myself) I was in a trouble to find someone to change something inside of this to make it correct (i.e. to move from MAX to MIN when the battery is empty) as I am completely newbie in electronics.

With digital it can be done that the scale is not linear. Here comes the question - in the linear scale from MIN to MAX of the battery voltage, how this is related to it's capacity. Mine is 56.9 Volts when fully charged and I guess it drops to 48 Volts when fully discharged (haven't measured it so far). Does anyone knows how the voltage is related to the available energy left in the battery? Is there a formula? I guess it is not linear.
Title: Re: MP III + speedometer?
Post by: MP3test on September 25, 2014, 12:31:47 AM
Gosh, I can't remove the first cover of the controller I think I even f**ed one of the screw's head. Anyone had that problem? Have you normally unscrewed these or some magic is needed here...
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 25, 2014, 05:21:31 AM
Hi MP3test

I have to disagree with your comment that digital is better than analog.  They are just different.   Digital CAN be more repeatable, but you have to remember that crap is crap.  And repeatability is not the same as accuracy.  As the old saying goes, a stopped watch is accurate twice a day.

If your analog meter is reading incorrectly, it is probable that a change in resistor value in series with the D"Arsonval movement would improve the accuracy. The analog meter I am using reads 60 volts full scale, and 48 volts at minimum scale.   If the software doing conversion is incorrectly written, the result will be crap as well.  Don't be fooled by the comments of "experts" , (or even genius's like me): When CD music first came out, a very respected editor of an audiophile magazine published his thought that the music from a CD was better when a green Sharpie was used to make a circle on the edge of the disc.......(The edge is not scanned by the laser doing the data recovery)

How is your speedo design coming along?  I'm going to try to talk my grandson into making an MP3 speedo his intro to engineering practical project

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 25, 2014, 10:12:39 AM
Waiting for components (stepper motors) but I stuck with the problem of removing the cover of the controller - can't remove the screws! :) Going to buy another tool now.
I will connect first an LCD screen to monitor the values and to be able to adjust the software.
Title: Re: MP III + speedometer?
Post by: Bikemad on September 25, 2014, 10:52:49 AM
Gosh, I can't remove the first cover of the controller I think I even f**ed one of the screw's head. Anyone had that problem? Have you normally unscrewed these or some magic is needed here...

I had the same problem removing one of the six screws from the fan/disc mount to access the controller because it was done up so tight that the hexagonal end of my Allen key was starting to turn inside the head of the bolt. After hammering on the end of the Allen key bit to "shock" the bolt loose I was able to undo it without causing further damage to the hexagon inside the head of the bolt:

(http://www.newark.com/productimages/standard/en_GB/1566734-40.jpg)

I find that repeated firm taps with a small hammer usually works best. ;)

If the hexagon is badly damaged, you might have to find a suitable Torx bit to hammer into the head and hopefully remove the damaged bolt.

If it's the actual screws in the controller you can try the same technique with one of these:

(http://www.gcsupplies.com.au/content/images/thumbs/0000992_ph1-phillips.jpeg)

If the shock treatment doesn't help, you may have to carefully drill out the offending bolts.

Alan
 

Title: Re: MP III + speedometer?
Post by: MP3test on September 25, 2014, 01:32:53 PM
Using WD40, and a hammer didn't help... I think some welding happened because of a corrosion. If I drill the heads I doubt I will be able to get out the bottom of the crews and I will end with no ability to put the cover back. I will try to solder the tool into the head but lead is weak then may be I have to go to a welder to weld iron to heads and to try to unscrew that way..
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 25, 2014, 04:37:06 PM
Hi MP3test
Hey, don't try to solder the hex bit into the screw. It will not get hot enough to bond.  I have had success using high strength epoxy to make the screw/tool bond.   You have to make sure that you clean all the WD-40, dirt, sweat, etc from everything.  Good luck

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 25, 2014, 08:07:04 PM
So far 2 screws are removed. The other 4 are killing me off. One is a little damaged as Bikemad's case. The epoxy is a good idea, I will try to clean all the wd40 now as everything is greasy. May be by heating it with a butane torch will burn it. :)
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 25, 2014, 10:35:16 PM
Hi MP3test

You have to have the screw head perfectly clean, or the epxoy will not adhere properly.  Burning probably wont do it.  Soap and water with a small brush will do it; let the water dry well.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 25, 2014, 10:54:40 PM
I did it with 99% alcohol :) Actually I think it doesn't have to stuck to the screw - the goal is to fill the gaps between the tool and the screw's hole - it doesn't fit exactly and that's why it damages it. I have 4 of them, all seems to be the same size, so these screws has a little larger holes (not sure if they are cheap and deffective, or all the holes in the world are not 3.00 milimeters but 3.30 or something). Or may be they are 3.50 and I am using wrong tools?

While the epoxy is drying, another question arised - I want to put a disk brake at this wheel (front MP3) but because of the fork it is supposed to be at the right side. The default for MP3 is left side. So the question - is there any difference (in torque, acceleration, regen, etc) if the MP3 is set in reverse mode so I can turn the wheel 180 degrees and the disk brake mount become at the right side?

Regarding the speedometer's battery capacity meter - I have a plan to create trough arduino a) voltmeter b) ammeter c) temperature measurement and while driving from full charge to full discharge to store all data once per second and then to analize it and create the relation between all of these data. The problem I found is that at some point the voltage is almost constant (between 10% and 90% of the capacity?) and it depends also on the temperature, so to show correctly the battery capacity (if possible at all) some maths and statistics has to be involved :)
Title: Re: MP III + speedometer?
Post by: MP3test on September 26, 2014, 01:07:20 PM
The epoxy didn't solve the problem... the tool got twisted (it is supposed to be strong), but the screw didn't get out!

Do you know if I can get out the big cover of the motor together with the controller and the small cover or the problematic screw tighten the big cover as well? Because I need access to the hall sensors not the controller itself this would be OK - the screws of the big cover can be removed easily.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 26, 2014, 06:42:18 PM
Hi MP3test,

Are we to understand that the tool you epoxied to the screw is now twisted by the torque you applied, the epoxy is still bonded, but the screw didn't rotate?  I have trouble believing that even a tiny Posi-Drive bit would twist without breaking the head off the screw.  They are really small, rather soft screws!   By the way, you are using a Posi-Drive, not a Phillips bit, aren't you?  Phillips bits are just about guaranteed to damage Posi-Drive screw heads.

I have no idea what you can do at this point, other than hiring a machine shop with an EDM tool to get the screws out. 


TTFN,
Dennis





Title: Re: MP III + speedometer?
Post by: MP3test on September 26, 2014, 10:22:28 PM
The epoxy got broken at some time, the tool's head is twisted let say 30 degrees. It's one of those with L shape, should be "chrome-vanadium" type. What I've noticed that it is 3mm exactly but it is a little loose in the screw's head, so the holes there are more than 3mm, like 3.2 or 3.3 which allows the tool if more force is applied to damage the hole... This may be is my fault because this type of tool doesn't apply force uniformely.

Anyway now I can try to put with force a torx bit to see if this would help. A last step before going to a welder :)
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 26, 2014, 10:39:10 PM
Hi MP3test

It sounds like the screws on your MP3 are a different type than on mine, or we are talking about different areas.  Good Luck with this mess.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 27, 2014, 02:49:41 AM
Here it is and the twisted tool: :)

(http://i.imgur.com/ZWcmWLy.jpg)

On almost all videos where they remove that cover I see one and the same "CLACK" sound like the screws are glued - may be because the screw and aluminum are from different metals and some type of corrosion happens there and they are micro welded who knows. Same happened with the two I removed successfully, but it seems the other 4 want me to commit suicide :)
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 27, 2014, 04:20:58 PM
That is just amazing.
Title: Re: MP III + speedometer?
Post by: MP3test on September 28, 2014, 03:08:25 AM
Hey Morgen,

I plan to use these stepper motors for the speedometer:
http://www.aliexpress.com/item/NEW-10pcs-Japan-Nidec-Mini-stepper-motor-micro-stepper-motor-2-phase-4-wire-D6mm-stepping/1590283900.html
They are just 6 millimeters, but I guess they will have enough power to rotate the arrow. Because they are so small I think I can connect them directly to the Arduino w/o using any driver - Arduino can provide up to 40mA to the output ports and I guess this is enough for the motors like these (I can't find any data sheet, this is the manufacturer's page http://www.nidec-sankyo.co.jp/cmi/english/product/stp_m_01.html )

But you mentioned not to forget to put diodes - as electricity can be generated in the motor and go back to Arduino and damage it. Is this possible to happen with so small motors? What kind of diode I should use (I guess I will need 4 diodes per motor - for every wire?)

Thank you!
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 28, 2014, 04:16:26 AM
Hi MP3test

I hope you haven't bought the motors yet,  because they are not a good choice.  At 5 volts, they will draw about 125 milliamps, which is way, way above the 50 mA limit of the Arduino.   They are also  4 wire, which means they need to be driven by H-switches, so the current flow can be reversed through the coil.

Regarding the diode, you need one across each winding that you drive.  I'll see if I can find a schematic that shows how to install them. 

I saw an a good choice for the steppers when I Googled something like "stepper motor speedometer GM"... and found 5 for $15?$20?..

If I get a chance I'll see if I can find it again.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 28, 2014, 12:06:00 PM
Hi,
I saw at the web a person has measured them and they have 20ohms resistance which should mean that at 5 volts they will draw 250mA. Yes too bad, yesterday when I got 0.25A I thought about it as 25mA :)
I found a schematic for the required diodes - they should be 8 not 4, there are some chips with 8 diodes compiled but any way it is a lot easier to get a stepper motors with a driver and not to scratch head about current, adding diodes etc :)
I haven't ordered these yet so I am looking at other options. But the "GM replacements" are way too big I'd like to get something in the "micro" range.
Thank you for your help.
Title: Re: MP III + speedometer?
Post by: MP3test on September 29, 2014, 02:54:42 AM
I finally decided what to order for the steppers - 10mm motors ($0.70 each) and a small driver ($2.30 each):

(http://i00.i.aliimg.com/wsphoto/v0/1653570714_1/Wholesale-10PCS-DC-Mini-motor-Micro-stepper-motor-10MM-stepper-motor-with-division-bar-free-posting.jpg)

(http://i01.i.aliimg.com/wsphoto/v0/1505186325/Free-shipping-5pcs-Reprap-Stepper-Driver-A4988-stepper-motor-driver-5pcs-Heat-Sink.jpg_350x350.jpg)
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 29, 2014, 03:36:08 AM
Hi MP3test,

It looks like you found a bargain!  I was wondering why having them so small was important?  I'd like to see your proposed layout. 

Have you started figuring out your flowchart/ scheme for data acquisition and translation yet? 

Have fun.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 29, 2014, 03:53:10 AM
Arrows are extremely light so I don't need much power, but I wanted to be sure that I will be able to put two motors in the speedometer - one for the speed and another which will rotate the odometer...
I am almost ready to start collecting data (I will collect voltage, ampers, speed and temperature) for the statistics - after I read that these batteries produce almost constant voltage in 80% of the time the measurement should be very well calibrated (if possible at all) - this is for the battery capacity meter to have linear conversion of its voltage.
BUT before that I have to open that cover!!!
I'll try some other things tomorrow before I break it :)

By the way no one suggested if this will be OK:
Quote
I want to put a disk brake at this wheel (front MP3) but because of the fork it is supposed to be at the right side. The default for MP III is left side. So the question - is there any difference (in torque, acceleration, regen, etc) if the MP III is set in reverse mode so I can turn the wheel 180 degrees and the disk brake mount become at the right side?
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on September 29, 2014, 05:33:19 AM
Hi MP3test,

I will tell you that from a hardware point of view, electric motors don't care which way they rotate.  The software may change things a bit, but the actual motor will give exactly the same performance, no matter which way you spin them.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on September 29, 2014, 05:34:44 PM
Thanks! But this motor has 3 hall sensors to detect motion and to manipulate it and from that point it's up to the motor's designers if they did it in a way that it is reversable?

Good news! I finally got that cover out! Nothing worked but this method - (I don't know the word in English) but a "chisel" (a metal bar that is sharpened at the end) nailed at the end of the screw's head, hit several times with a hammer to the direction to unscrew it and it worked finally!

Now where are those cables... :)
Title: Re: MP III + speedometer?
Post by: MP3test on September 29, 2014, 11:16:26 PM
OK, the bad news is that the so secret "For meter display" connector has nothing but ground and battery+, the other 3 wires don't go to the controller; the good news is that I'm not using the pedelec, and for the speedometer signal I will use it's wire! Pfew.

I did some pics and marked all the wire colors and relation between a wire in the controller <-> a wire from the connectors. Plus added Bikemad's hall sensors info - the wires in the controller are A,B,C etc, the wires in the conectors are 1,2,3, etc:

(http://i.imgur.com/dLWxVtw.jpg)
Title: Re: MP III + speedometer? [SOLVED]
Post by: MP3test on September 30, 2014, 12:52:33 AM
Finally the solution is:

- open the controller
- unsolder the yellow wire
- solder it to the pin corresponding to the yellow wire from the hall sensors connector

As a result you will have hall sensor's 0V-5V ticks at your pedelec signal wire.

Of course this is if you don't use the pedelec.


My yellow wire was exactly the length needed to be soldered to the desired pin. I forgot to take a picture and already assembled the controller...
Title: Re: MP III + speedometer?
Post by: MP3test on September 30, 2014, 08:35:32 PM
OK now the signal problem has been solved, come the problems with phisics and Ohm's law I guess :) So please help...

So far I can measure the value in Volts of the hall sensor with the Arduino. I can see when I rotate the wheel BY HAND that the value goes from 0 to 4.5V. But this is so if I rotate it by hand!!!

When I try to rotate it trough the throttle - nothing happens. Even if I disconnect all the wires of Arduino! So some fuse or any protection switches ON there as I guess I am draining all the power of the +5V measuring the voltage of that line? As earlier I was concerned by specs Arduino can (will?) drain up to 40mA trough the input pins while MP3 has 50mA for the +5V circuit to work. And if I drain all of it, it stops working as it shuts itself down.

To fix the problem I have to switch the main power off, wait 2 seconds and switch it ON - and the MP3 is resurrected. Good I didn't blew it.

But now comes the new question - how I can make a connection to Arduino that will drain just small part of MP3's 50mA +5V of electricity trough it's hall sensor? To add a resistor or it should be more complex?
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman 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


Title: Re: MP III + speedometer?
Post by: MP3test 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.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman 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
Title: Re: MP III + speedometer?
Post by: MP3test 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.
Title: Re: MP III + speedometer?
Post by: MP3test 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
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman 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
Title: Re: MP III throttle problem
Post by: Bikemad 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
 
Title: Re: MP III + speedometer?
Post by: MP3test 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.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman 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
Title: Re: MP III + speedometer?
Post by: MP3test 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. :)
Title: Re: MP III + speedometer?
Post by: MP3test 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.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman 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
 
Title: Re: MP III + speedometer?
Post by: MP3test 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.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman 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
Title: Re: MP III + speedometer?
Post by: MP3test 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..
Title: Re: MP III + speedometer?
Post by: MP3test on October 04, 2014, 08:49:32 PM
One more thing - even if I put my own hall sensor the problem will be the same.
I just put the regular 5V wire from the motor in the interrupt pin and it produces as well too much oscillation. May be this is because of the way they produce the 5 Volts...
So the new question is - how with a capacitor (which one and how to calculate), diode (which one) to prevent current to go back to the hall sensor and to mess with the controller and possibly a resistor to create flatten the signal coming from the hall sensor?
Title: Re: MP III + speedometer?
Post by: MP3test on October 05, 2014, 12:06:00 AM
A new discovery. I said "One more thing - even if I put my own hall sensor the problem will be the same."
So I wanted to verify that :) And blew three of my hall sensors (not of the bike) to discover that 5V from the controller are some other kind of 5 volts :)
What I did:
- I made my own circuity with 1 hall sensor and 10K resistor
- while the arduino is connected to 12V DC, I get 5V out from arduino to feed the hall sensor
- everything is working OK - a magnet changes the hall sensor's state
- now I disconnected the 5V feed from arduino and fed the hall sensor with "5V" wire from the controller (I measured with a multimeter that it really is 5 Volts)
- when I turned everything ON - the hall sensor stopped working - the magnet wasn't changing his state
- then I fed it again with arduino's 5 volts just to prove that the hall sensor is not working anymore - even with arduino's 5V now it wasn't changing its state.

Is there any explanation of this? What is so strange with the 5V coming from the controller that a) it is oscilating invisibly with 2500-5000Hz (only arduino detects that but a multimeter shows constant 5V) and b) it burns hall sensors?
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 05, 2014, 01:04:48 AM
Static electricity damage from handling is often the culprit when devices fail during handling.   Were you wearing a grounding strap, etc?

When your Arduino shows an oscillation, measure your input pin with your voltmeter set to AC.  What is the voltage displayed when a 5 or GND vdc signal is present? 

What happens when you connect the Arduino pin you are using for your input to +5 or GND with a resistor?  Does is read a frequency?  Again, are you using edge interrupts or level interrups?   

Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on October 05, 2014, 02:12:26 PM
I guess it is not static electricity caused the death of the hall sensors as I repeated that 3 times and every time everything was switched off. Turn on -> a dead.

Actually I've put for a test a 100K resistor before the connection to the arduino. Well that fixed both problems, however I don't know a) why the problems happened at all, at least the one with thousands of interrupts and b) why the resistor fixed both of them :)

So with a 100K resistor:
- when arduino is switched off, the controller is not messed up and is still working
- also interrupts started to work correctly and arduino counts correctly when a magnet passes trough the hall sensor.

(http://i.imgur.com/2DfnEoF.jpg)
Title: Re: MP III + speedometer?
Post by: MP3test on October 06, 2014, 01:57:40 AM
Another problem discovered - 5-10 times per full rotation the arduino generates two instead of one interrupts (the time difference between them is in the range of 12-16 MICRO seconds!) as well instead only in case of RISING it does it in case of FALLING (while I haven't set any interrupt catch for FALLING).
The solution is to create interrupts on "CHANGE" and then to ignore all of them that happened in less that 100 microseconds after the last one (this method works for speeds less than 1300km/h).
Now FINALLY I have the correct values for speed and distance at the LCD screen!
:)
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 06, 2014, 02:20:08 AM
So, are you telling us that you are now using an edge to generate the interrupt?  And it works?  Or is this another problem?

Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on October 06, 2014, 09:26:44 AM
Yes, using the signal from the MP3's hall sensor, routed trough the pedelec's signal cable which I don't used before, connected trough 100K resistor to the interrupt pin of the arduino works well finally. For some reason it generates double interrupts sometimes, but as explained I filter those at software level and as a result now I measure exactly 58 ticks per 360 degrees precisely.
The software displays speed and distance correctly. Now I am waiting to receive the stepper motors to use them instead of the LCD screen.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 06, 2014, 05:43:30 PM
Hi MP3test

I'm an old electronic problem solver, and I'm trying to understand exactly what solved the problem.  So would you please state exactly, were you using a level interrupt to start, and the did the oscillation problem go away when you changed to an edge interrupt, like "Rising" or "Falling"?  Or were you using the same interrupt the whole time, and the oscillation went away when you inserted the resistor in the input circuit? Or did you have the pin you used as a input  configured as an output?  What scheme was it? Please explain it to me. 

I don't mean to be a pain in the neck about this, but I really want to learn from this episode so I can be helpful on the next problem.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on October 06, 2014, 07:25:02 PM
Yes, I am not as well someone that just find a solution and leave it that way without understanding but in this case the problem is my electronics knowledge is close to 0 (I personally had a feeling that after a resistor the voltage should drop; when nothing worked I started just to experiment with a multimeter in hands; so I discovered that after the resistor the voltage was exactly the same 4.5V and tried what will happen if I put it before the arduino; I am feeling like experimentators 1000 yers ago :)
I am sure this is pretty simple to calculate anyway.

But the interesting question is where the oscilations come, why after the resistor Arduino sometimes had double interrupts with a delay of just 12-16 micro seconds; and for me - why 100K Ohms? I just tried with 300 K - it is still working. I guess at some point of increase it will start losing the signal so I'd like to know:
How to calculate the right resistor's value, so the signal is still strong for Arduino, while the current is the smaller, so it doesn't mess when going back into Arduino when it is switched off and panic the controller at the same time.

So the scheme was the same all the time:
- I've got the yellow wire of one of the hall sensors from the motor
- soldered it to an unused wire of the pedelec signal to get it out of motor
- in the beginning - just put it in the INT0 of arduino (this is a digital input that can be used to triger interrupts)
- then the only change I did is to add the resistor (the red one)
- all the time I was using the setting "RISING" for the interrupts which should mean that an interrupt should be generated only when the voltage changes from low level (I guess under 2.5V) to high level

Without the resistor the know problems were 3:
- on switched off Arduino, the voltage of the hall sensor dropped to 1.35V and so the MP3 was panicked
- many people told me that it can damage the Arduino as back current goes into it's scheme
- and the strange oscillations - when the current was 4.5V Arduino was generating for some reason 2500-5000 interrupts; even more strange - when the signal from hall sensor was 0V, Arduino generated 200-300,000 interrupts

With the resistor the 3 problems were fixed:
- on switched off Arduino, MP3 now works
- I guess as just a small portion of the current now goes into Arduino it can't be damaged
- oscillations disappeared like with a magic
BUT I discovered new 2 problems:
a) rarely interrupt has been generating not on RISING but when the voltages drops to 0 (i.e. FALLING)
b) rarely when the voltage goes from 0 to 4.5V Arduino generated 2 consecutive interrupts; I measured the time difference and it was 12-16 micro (not milli) seconds
I fixed these by changing the interrupt setting to "CHANGE", so my function is called on any change - that way I fixed problem a), and then I started to measure the time between interrupts and if an interrupt happens too fast (I set it < 1000 microsenods to be sure) I just ignore it.
As a result I am increasing the counter just once per any change of the state of the hall sensor's signal.

Now:
- why the Arduino was generating so much interrupts?
- why the resistor fixed that
- why anyway sometimes there were double interrupts
- why anyway sometimes an interrupt rised on signal drop while it was set to catch the rising signal
- is the 100K resistor OK, or I can/have to replace it with 300 or more K Ohms? And how to decide which is the best?

The connection are those that I have already posted:
(http://i.imgur.com/2DfnEoF.jpg)
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 06, 2014, 08:18:27 PM
Hi MP3test

Since the resistor cured the oscillation problem, my GUESS would be that the Arduino was drawing so much current from the MP3 circuitry that the MP3 power supply or the Hall sensor was going into a short circuit protection mode, where power is shut off for a period, then allowed back on to see  if the short circuit has cleared.  (Sometimes that scheme is called "over-current foldback"). And that is an educated guess, but still just a guess. 

The addition of the resistor limited the amount of current the Arduino could draw from the MP3 to a low enough level to get away from the over-current foldback regime or what ever was oscillating.  It reduced the max current draw from something probably over 20 milliAmps  (The max the Hall sensor can deal with)  to something about 50 microAmps.

Regarding the resistor sizing, the input current drawn by FETs is in the nanoAmp range, so you could probably use a MegOhm resistor and still have the circuit work.  But the smaller  R makes the circuit more noise resistant. 

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on October 07, 2014, 02:00:56 AM
I think I measured how much Arduino draws from the hall sensor and it was below 1mA (but I'm not 100% sure now I forgot the value). But I remember it was too low (I knew that MP3 has 50mA or something).

Do you have an explanation how 0V (measured with Arduino - analog input and multimeter) when connected to the digital input could generate RISING interrupts? :) For the 4.5V there may be an explanation, but for 0V it is kind of weird.

Just from the math standpoint my personal explanation is that the MP3's DC-DC converter does the conversion somehow by impulses. The 48V if divided 2500 times per second to small impulses may produce those 5V average measured with multimeter. If it divides 48V 200K times per second, it goes down like 0V when measured with multimeter, but in fact those are just tiny impulses of 48 Volts. Is it working that way, or my fantasy is more than needed? :)

Because the other question is why my hall sensors all died when I connected them to the "5V" wire coming from the MP3? That happened to 3 of them the same way. For me this is not a real 5V current but something else.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 07, 2014, 04:31:22 AM
Hi MP3test

Switching power supplies typically run a 20-200 KHz, and if the current draw was enough to bring the output to zero, then you might see that frequency when the load was shorted enough to drain the filter capacitor to zero volts.  But I would expect there to be some diode drop voltage showing up somewhere, like your earlier reading of 1.3 V, which is what I would expect from two diodes in series.... But just flat 0 Volts?  Mighty peculiar in my experience, except for electro mechanical shorting. 

However, my MP3 has a linear 5 VDC regulator, not a switching supply.....So that doesn't make sense either.  Maybe your 12VDC supply is a switcher?  Maybe your MP3 is a later version and has a 5 V switcher?  I have no idea.

Give me access to your problem with an  oscilloscope, and I'll tell you what is causing the symptoms, but from where I stand right now, I don't have any good ideas.   

Regarding the rising interrupt question, I have to assume the Arduino saw a rising signal on the line from the unknown cause above.

My experience makes me think you inadvertantly did something wrong with the sensors, and you killed them.  (I have had trained technicians install circuit board backwards.  People do things wrong, me included. Did I tell you about the time I set fire to a semiconductor manufacturing  plasma deposition  machine I designed and built?)  (In a clean room!)

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on October 07, 2014, 05:44:55 PM
As now I am proceeding with the voltmeter, to avoid the same problem that when arduino is off no (significant) power should be attached to its inputs, I did a voltage divider and added another 100K resistor at its end. However there is small voltage drop with it compared to the circuit without it. So I need help here - how the V2 is calculated in the following circuit:

(http://i.imgur.com/C1rgrBs.jpg)

And now I am feeling ever more stupid as yesterday I discovered that by adding a simple resistor it doesn't change the voltage (but lower the current entering the arduino) a text I am reading says just the opposite. Can you help me?

(http://i.imgur.com/GxXfjIV.jpg)

When measured with a multimeter, the voltage with or without the resistor was the same and as everyone agreed by adding that resistor I drop the current which goes into arduino.

While this text says "the current is the same in each resistor" (and so it should be the same with or without the resistor) and that the voltage is proportional to the resistor and so there should be a voltage drop after the resistor.

Seems the difference comes from the different standpoitns but this is not common sense at all for me, so I will be grateful if someone enlightens me!

(http://i.imgur.com/2gRe14e.png)

Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 07, 2014, 07:01:07 PM
Hi MP3test

First off, R3 is not needed, and is a bad idea to include it.  R1 by itself is enough to prevent loading the MP3 when the Arduino is powered off.   

Regarding the resistor value choice, I like to use round numbers, so I'm going to use 60VDC for the supply voltage, ok? I have no idea why you picked the 52V you used…..It is a good idea to have the max probable analog input voltage  to be less than the A/D rated input max of 5VDC.

At 60 Volts, 220KOhms will allow .273 mA current.  The voltage developed at the junction of the resistors will be 5.5 volts.  That is above the Arduino Vcc of 5Vdc, so that isn't a good choice.  If we change the 200K for a 300K, we than have 320K Ohms total, and the current drops the draw to about 190 MicroAmp       By why draw even 190 microAmps?  It just wastes power! How about something in the 10 microamp range?  That implies a resistor chain value about 5 MOhms.  The closest standard value is 4.7 MegOhms, so lets use that for R1.  For R2 lets guess that it needs to be about 400 KOhms, (which is not a standard value, but it is a round number) and do the math.  the total R will be 5.10 MegOhms, which gives us a current of about 12 microAmp,  and a junction voltage of 4.7 Vdc.  So that is a prettty close guess.  The standard value resistors close to 400 K are 390 K and 430 K if I remember correctly.  They would give a junction voltage of  4.59 Vdc, which is pretty good,  and  5.03 Vdc, which is too high.  So using the 4.7 Meg/390 K combination will give you low power loss, and resolution of about 50 milliVolts/step for the A/D. 

So with that combination we can read 0-60 volts to within a few milliVolts.  But if we are measuring a"48v"  LiPo battery we aren't very interested in anything outside the 60V max to 48Vmin. 

It turns out there is  device called a Zener Diode, which will drop a constant voltage when operated within limits. If we install a 48V Zener between V1 and R1, the voltage at the top of R1 will only be 12 Volts.  And now the A/D steps will be about 12 millivolts.  Probably more resolution that we really need, but is that bad? 

I have no idea if a 48V zener is available, but you can Google for close values, and make the calculations for yourself.

I hope that helps. 

TTFN,
Dennis


Title: Re: MP III + speedometer?
Post by: MP3test on October 07, 2014, 08:30:14 PM
Thank you!
At the picture I've put example numbers just for the calculations, as I still have my question - suppose there are 3 resistors as shown, how can I calculate the V2? I know the math if only R1 and R2 are present, but with R3 - just don't know what to think. Following the example of adding a single resistor before the connector this should lead us that the voltage will be the same with R3 as without it but this is not the case. So what am I missing?

As for the reality, all the resistors are +/- some %. So I've got some and measured them with a good multimeter, so I have the exact values.

I used so far 98.7K and 8.11K which gives 4.32V when the battery is at 56.9V (measured at full charge) down to 3.64V (if the battery goes to 48V at full discharge, not sure if it goes so low). Arduino has a scale of 1024 per 5V, so I'll have about 140 different values for the 4.32-3.64V interval (the corresponding of 56.9-48V of the battery). I hope this will be sufficient to show the battery "capacity" as there is no linear relation between the capacity and voltage but we will see what will happen.

So using your advice I'll forget about the third resistor (but please tell me how to calculate V2 in case of R3, just for curiosity) and I will use just megaohm for R1 and corresponding for R2. Actually as in a bad knowledge situation like mine, I will set up 3-4 combinations of R1 and R2 at the same time to see if they will give equal results in practice, or we have some omited unknown variables that we ignore and not only the Ohm's law apply but some other's as well (like omitting the friction when calculating movement or something) :)

Regarding the Zener diode - is it working in a linear way? I mean that it always drops constant voltage or it depends on the V1? Adding more errors or non linearity in the circuit will make it more difficult to guess the battery's capacity.
Title: Re: Zener diodes
Post by: Bikemad on October 08, 2014, 02:20:12 AM

(http://i.imgur.com/C1rgrBs.jpg)

Please tell me how to calculate V2 in case of R3, just for curiosity

V2 will be ~4.7V (52V/11) until you put a load on it.
Under load, the voltage drop across R3 would then be determined by the current flowing through it.
If V2 was shorted to ground you would have a 4V drop across R3 (and also R2 as it would be in parallel) and the current flowing through R3 would be 0.04mA (and the current flowing through R2 would be 0.2mA, and R1 would be 0.24mA)

The voltage measured at the junction between R1 and R2 will vary between 5.2V with no load and 4.0V under maximum load, therefore the voltage measured at V2 could be anywhere between 5.2V and 0V according to the load on the output of R3.

Using two readily available 24V zener diodes in series (or one 48V) as Dennis suggested, would require two 20k resistors to half the remaining voltage output, this would give you a measurable range of between ~4.45V and ~0V dependant upon the exact voltage drop across the zener diodes, which should give you over 900 different values to work with. ;)

I used a 100V zener diode for a similar purpose so that I could use a 18-80V voltmeter on a 125V battery pack on my Vectrix scooter:

(http://www.arhservices.co.uk/GoldenMotor/Vectrix/Voltmeter_zps4152dab0.JPG)

I could have used a 0-200V four wire meter to give a true voltage reading, but as I was only really interested in monitoring the usable voltage range (between ~125V and 153V) I decided to use a zener diode, which meant I could use a two wire digital meter that did not require a separate isolated power supply, and it also produces a much finer display resolution of 0.1V instead of 1V.
Fully charged it can go up to 53V (153V) and when it is reading near 25V (125V) I know it's almost empty.

The battery gauge on the Vectrix is pretty useless, as it doesn't allow for the high self discharge of the NiMh battery pack, and after running out of juice while the battery gauge was still indicating well over half the capacity still remaining, I have no confidence whatsoever in either the estimated range or the number of bars showing on the battery gauge:

(https://i.imgur.com/DodcB5z.jpg)

As far as I'm concerned, the voltage reading is a much better indicator of the battery's available capacity. ;)

Incidentally, the speedometer needle on the Vectrix is driven by a stepper motor and also displays the charging current (https://www.youtube.com/watch?v=ZQMl554LWPg) (100km/h = 10Amps) while charging, as well as functioning as an indicator for calibrating the throttle (https://www.youtube.com/watch?v=v5BvS2UeSrk) while the kill switch is off and the rear brake lever is operated.

Alan
 
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 08, 2014, 02:23:03 AM
Hi MP3test

You do not want to use R3!   Because you do not know the value of the input impedance of the Arduino, which makes another voltage drop to worry about.   Since you ask, the current value  through R1 would be V1 /R1 + (R2+(R3+Rx)
                                                                                                          R2X(R3+Rx)

(Or at least that is how I remember how to do it:)

Since I do not really know what the Arduino analog imnput circuit looks like, I have to assume it is some kind of op amp buffered circuit.  When op amp buffers are properly used, the current drawn from the junction of R1-R2 would be zero.  And of course I can be wrong...


I think the 140 values between 57-48 volts is adequate.  I only included the Zener diode scheme to let you know there are differnt ways to achieve things.  I personally have an analog Volt meter on my trike with a Zener in series so the meter reads 60-50 VDC.   Zeners are very uniform and repeatable  when they are operated in the correct manner. 

TTFN
Dennis

Title: Re: MP III + speedometer?
Post by: Supchrgamx on October 08, 2014, 03:06:30 AM
from what I read from this,  is that the input has a zenier input,  the higher the voltage applied above 5 volts the more the input will sink current to reduce the voltage to 5 volts input , I think and this is only a guess that if you reduce the input voltage to 4.9 volts  the only current you will take is the amount to switch the input , once you have that current you can calculate the single  resister  needed to drop your input voltage to 4.9 volts from what ever voltage you want. keeping in mind as the main  voltage drops so will your 4.9 volts also drop .but I think ttl stuff has a switching volt of 3.5 volts or higher and that would give you a bit of a range on your main voltage
I have not played with a Arduino so this might all be crap

Laurence
Title: Re: MP III + speedometer?
Post by: MP3test on October 08, 2014, 03:57:22 AM
I have set up two sets of resistors for now:
8.11K and 93.6K
and
24.285K and 300.9K
Connected to two analog ports of Arduino plus a regular voltmeter (in the highest price range).

Then there is a remark that Arduino's internal voltage reference is not exactly 5.00 Volts as it depends on the its input voltage. So I did a calibration based on the voltmeter's value.

Now both sets and the voltmeter show one and the same value with 0.01V-0.02V precision.

The next test will be to charge the battery to see if both sets will show again the same value and will compare with the voltmeter as well. At the end I will try to discharge it to see what will happen at the low end.
Title: Re: Zener diodes
Post by: Bikemad on October 08, 2014, 12:21:49 PM
The higher the voltage applied above 5 volts the more the input will sink current to reduce the voltage to 5 volts input

Laurence, if a 5V zener diode was wired as shown in the diagram below, it would work as you described.
The resistor needs to be used to prevent excessive current from damaging the zener diode.

(http://www.arhservices.co.uk/GoldenMotor/Vectrix/Zenerdiode_zps94703388.JPG)

If R1 was replaced with a 10W 470 ohm resistor, the maximum current available at the 4.7V output would be ~100mA (I = V/R = (52V - 4.7V)/470 = 47.3/470 = 0.1006382A) but if the output was shorted directly to ground the maximum current would rise to just over 110mA (I = V/R = 52/470 = 0.1106382A).

The maximum current going through the zener diode would be 100mA if nothing was connected to the output, but this would reduce as the output load was increased. If the output load was 75mA then the zener diode would sink the remaining 25mA to maintain a steady output of 4.7V. If the output current exceeded 100mA, then no current would flow through the zener diode as the voltage across it would have fallen below its rated breakdown voltage.

I hope this hasn't confused you too much.

Alan
 
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 08, 2014, 05:28:51 PM
Hi Guys,

Please note that Alans' circuit is a design for a constant voltage power supply, not for a meter input circuit.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: Bikemad on October 08, 2014, 07:56:25 PM
At least I didn't confuse you, Dennis.

I was just trying to show Laurence how a zener diode works :-[

Alan
 
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 10, 2014, 05:43:43 AM
Hi MP3test.

Got your stepper motors yet?   How are you handling the software drivers for the stepper?  I'd like to see how you handle the  drivers.

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on October 10, 2014, 09:02:21 PM
Hi,

waiting for the drivers and motors - I ordered them from China it takes 20-30 days for delivery to Europe.

I've got a DC-DC converter 9-60V to 5V now I think it will be better to power the arduino trough usb port. Anyway I will check if the voltmeter cirtuit and software will depend on the power source.

Also I haven't completed the testing with different resistor combinations but the large resistors (like 1M and 1.5M) give strange results at first look. I will see that in more details.

I also got ampermeter (but a prebuild board as it is more complicated that voltage splitter) and will test that as well. My goal is to collect as much info as I can (temperature as well) and then to analize it in the computer and to create a good relativity between all of them to show the battery capacity.

I noticed that the voltage I measure goes up and down depending on the motor speed (at full speed it drops down 0.7-0.8V) but this shouldn't affect the batter capacity meter so it will be more complicated than I thought in the beginning. I should compensate the voltage meter with the ampermeter values i.e more power is going to the motor, more correction of the voltage.

Or if there is some law here that applies and I can calculate this without doing stats, would be nice.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on October 10, 2014, 09:57:14 PM
Hi MP3test

It is quite common for battery output Voltage to sag under high current loads.  It occurs because of the internal impedance of the battery.   Alan (Bikemad) is very knowledgable about the subject, so pay attention to what ever he says.  (I'm better on submarine batteries)

I ran Arduinos off the USB power most of the time.  No worries.  I am using 100-240 VAC USB power supplies to power the lights on my trike just now.  They are really cheap, durable, and small.   I got a  2 Amp Apple USB power supply for $2 at a charity shop.:)

Are you buying an Arduino shield for the stepper motor driver?   Or is it just the IC?

TTFN,
Dennis
Title: Re: MP III + speedometer?
Post by: MP3test on October 10, 2014, 11:02:13 PM
This is what I have ordered:
http://www.aliexpress.com/item/Free-shipping-5pcs-Reprap-Stepper-Driver-A4988-stepper-motor-driver-5pcs-Heat-Sink/1505186325.html

Here are the specs (not sure this is exactly the same)
http://www.pololu.com/product/1182
Title: Re: MP III + speedometer?
Post by: Dan77062 on November 02, 2014, 09:19:55 PM
I got this working nicely on a Smart Pie 4 controller, so I thought others may find the photos useful.

As mentioned in an earlier post, the yellow wire normally used for pedelec is a convenient one to use.

In the images the red arrow points to the pedelec yellow wire that goes into the wire harness and comes out along with the blue reverse wire (as well as a red power and black ground wire).  The yellow arrow points to the output from the hall sensor that is connected to the yellow wire.  All I had to do was add a connection so that the hall sensor signal feeds into the wire that was previously used for the pedelec signal in the wire harness.  Of course, be sure to also keep the original hall sensor connection to the controller!

In one photo you see the wires cut and stripped.  In another you see them soldered and with heat shrink.  The oscilloscope image shows a nice clean hall sensor signal.  Based on the advice in an earlier post, I isolated the hall sensor with a 100 Kohm resistor before putting the signal into the oscilloscope and later into an arduino.

I am using this signal as an encoder for the motor.  Note that if you use an additional hall sensor (either the blue or green wires) you can get quadrature encoding, so that you know which direction the wheel is spinning, in addition to the speed.
Title: Re: MP III + speedometer?
Post by: Morgen 3Eman on December 04, 2014, 08:49:55 PM
I was just wondering how your speedo project was progressing

TTFN,
Dennis