Jump to content

Headache


esaj

Recommended Posts

1 hour ago, Pilotguy said:

My head hurts just looking at it ! I need another beer just to calm down ......... Maybe 2 ...... Or from my best in world Mai Tai pitcher  ?

 

5 minutes ago, Gimlet said:

Way past my limited abilities I'm afraid esaj.

I wasn't expecting anyone to make any sense of it any way, you can't see what's what and what connects where from that bad picture and tangled mess of wires :D It's two (out of three) half-bridges from the e-bike controller mystamo posted in the Firmware-topic:  http://forum.electricunicycle.org/applications/core/interface/file/attachment.php?id=2218

Incidentally, based on the conversation in that thread, at least the generics seem to use similarly built half-bridges for the motor driving. There are ICs (integrated circuits) available nowadays that can replace most of the components between the PWM-signal and the mosfet gates, but I wanted to try and see if I could build it from discrete components. Longer term goal is to build a two-wheeled self-balancing robot using small 12V 3-phase motors (two-wheeled, because the robot cannot balance side-to-side), basically it's pretty similar to how the EUCs work (balancing & motor driving), just on a smaller scale. A learning process to see what makes our wheels work...

With capacitors able to withstand higher voltages (mine are only up to 50V) and thicker wiring (and building it on a real PCB, the breadboards would probably melt with high currents), these bridges I've built could drive a 60V EUC motor (the mosfets are 75NF75's, same as older Ninebot mainboards, way overkill for my purposes ;)).

  • Upvote 2
Link to comment
Share on other sites

5 hours ago, esaj said:

BerSvgx.jpg

Just spent a couple of hours on and off trying to find what's wrong with my half-bridges... <_< My head hurts, but I finally found 2 missing wires and one misplaced resistor in total, that caused the 2nd bridge high-side not to open. Oscilloscope and signal generator would be nice, had to go with nothing but cheap multimeter and 555-timer circuit to produce 25kHz square(ish) PWM. :P  Yeah, nobody probably cares, but I just had to vent a bit ;)  Now, I still need to build a 3rd similar half-bridge before I can try to drive a motor...

God bless you Esaj..i wish i could be 10% as smart as you are...

Link to comment
Share on other sites

17 hours ago, Cloud said:

God bless you Esaj..i wish i could be 10% as smart as you are...

It isn't exactly nuclear physics, especially since I've pretty much just taken the design straight from the e-bike controller... not much more involved than making sure to use right components in the right places and the right way around :P 

I still haven't received the MPU-6050 gyro boards, which, according to the tracking, have entered the country almost a month ago, but I suspect our great postal service has lost the package  <_<  I've received lots of other stuff I've ordered much later on...  At least I can tinker with the motor driving, which in itself is a bit more involved after I get the bridges done. Next, I need to start reading the hall-sensors from the motors with the Arduino and start working on the commutation. The hall-sensors themselves seem to work ok:

It's a bit unnecessarily complicated way of lighting up a few leds to see the signals, but hey, it worked :D  The Arduino's there just to give me 5V voltage, I didn't have the breadboard-mountable power sources yet at that point, and didn't bother to set up a regulator. Probably should also sort out my second working desk now that I just got another component cabinet (the first one, with 60 boxes, is already full):

WArSlpi.jpg

What mess? It's a highly sophisticated organizing system, so advanced, that I don't get it myself... ;)  I also preach about being careful working with batteries, and there's an open Firewheel battery there in the middle of everything...

 

16 hours ago, SlowMo said:

Why is it that when I tinker with those sort of things I smell something burning?

Happens to me too from time to time... when making this, I actually put the 555-chip wrong way around the first time, and it started smelling burning while I had it powered and tried to figure why I wasn't getting any output :P But the chip still works, so no harm done ;)

  • Upvote 2
Link to comment
Share on other sites

Keep up the good work Esaj. 555's are almost as tough as cockroaches! That is what is on your left hand breadboard in the first picture I take it! 

I'm dying to know how you are going to use the PIR in that photo - your own take on a proximity sensor? :-)

One of Sod's laws states that the probability of working is inversely proportional to the number of jumpers you have on your breadboard so I reckon you got away lightly.

Link to comment
Share on other sites

36 minutes ago, Keith said:

Keep up the good work Esaj. 555's are almost as tough as cockroaches! That is what is on your left hand breadboard in the first picture I take it! 

Yup, like I said, I have no signal generator, and was too lazy to program an Arduino give me some PWM-output, so I used a good old 555 to get some PWM-type input into the high- and low-sides of the bridges to see that they work ;)

Quote

I'm dying to know how you are going to use the PIR in that photo - your own take on a proximity sensor? :-)

Actually, it's not related to this project in any way, it's there just because I was testing earlier that it works. You see, I got a bit (ok, a lot) carried away when ordering stuff from Aliexpress, and I've been receiving 1-8 packets per day for the last couple of weeks and taking trips to post office to get 5-10 packets that require signing. Basic components, connectors, buzzers, heat sinks, wires, ICs, all kinds of sensors, motors, PCBs, Arduinos, LCD & TFT displays, soldering equipment like fluxes... 10 dual op-amps for 23 cents? I'll take 50!  It never occurred to me how much time it takes to sort all that stuff out, check that everything I ordered is there, test that the stufff actually works and confirm the shipments as arrived or contact the sellers to get refund/sort out what happened and how to reimburse. :P  Only less than 60 packets to come anymore... ;)

 

Quote

One of Sod's laws states that the probability of working is inversely proportional to the number of jumpers you have on your breadboard so I reckon you got away lightly.

Yeah, in hindsight I was happy to get off that "easy" (just those couple of missing wires and one resistor in wrong place), although it did take a while to find the mistakes :D  The third bridge also seems to be ok, but as I don't have an oscilloscope, I can't be completely sure ;)

If I get the whole thing working at some point, I'll need to start planning how I can place the components on matrix-boards with as few jumper-wires as possible (I don't have equipment to "carve" or etch PCBs, although I have some full copper-clad PCBs, so have to go with matrix or strip PCBs).

Edited by esaj
  • Upvote 1
Link to comment
Share on other sites

Success! Well, sort of, anyway. It seems that 2 pieces of rechargeable 9V / 200mAh batteries in parallel can barely keep the motor turning (the PWM-outputs are at full 100% duty cycle). The motor needs to be "helped" with a finger a bit to get going, and that's not exactly easy since I have separate kill-switch that must be kept pushed or the PWM-outputs are killed (and I'm holding the camera on the other hand). But nevertheless, it  seems to make full turns, so the commuting should be ok (still might try with the phases in different order, in case I've got two of them switched the wrong way around). I'll see if I have the guts later on to try it with Firewheel-battery + DC-step down converter, that should give enough amperage... ;)

 

 

Edited by esaj
  • Upvote 1
Link to comment
Share on other sites

I just picked up on your thread.  Great work.  I see you put in the Arduino. :)

It seems odd that two 9V can't get the motor turning and keep it going.  Are you measuring current draw at all? 

The good thing about working with the low voltage stuff with your MOSFETs is that no matter what you do, you won't be blowing them!  lol

You can rig up another Arduino to measure the signals into the MOSFETs or motor to take the place of a Oscilloscope.  https://www.youtube.com/watch?v=5ky_N5-Fu6M

  

  • Upvote 1
Link to comment
Share on other sites

5 minutes ago, Cranium said:

I just picked up on your thread.  Great work.  I see you put in the Arduino. :)

It seems odd that two 9V can't get the motor turning and keep it going.

I'm not yet ruling out that my commutation sequence couldn't be out-of-whack somewhere. When I can use both my hands (ie. when not holding the camera in one), I could get the motor to keep turning about 5 seconds (and even start by itself without help, at least sometimes) by keeping it in the air with one hand and pushing the button with the other... but it is kinda jerky, the motor probably doesn't have that many coils and it could be that the 100% duty cycle is causing it to draw a lot of current (switch fast to the next position, then my simple dead time insertion (DTI) stops it for around 100µs and then it jerks fast to the next position)... Still needs more testing to be sure, better not wire it up to the 16S2P -battery yet :D 

Also, I'm using the default PWM-frequencies, which are fairly low and are actually different for some of the PWM-outputs (around 1kHz and 0.5kHz) . I've digged up the registers to tweak to change the frequency division, but it will also mess up millis() and micros() which share the timer with one of the pwm-port pairs, and I'm currently using those functions for (very simple) DTI. Not that it cannot be taken care of with proper scaling of the wait-values.

 

5 minutes ago, Cranium said:

Are you measuring current draw at all? 

No measuring yet, I don't even have alligator-clips in my multimeter, so it's kinda hard to measure anything, if I have to keep down the button, flip the motor to start turning and at the same time try to poke the measurement heads somewhere :D  Unless I tie them down or something... I do have some ACS712-based sensors (the 30A version, should have gone with 5A probably :D), those could work too. When I tested them I actually found out that they can be used to sense the current direction too (the "zero point" is in the middle of the 0...5V output, 2.5V = 0A, 0V = 30A in one direction, 5V = 30A in the opposite direction).

 

5 minutes ago, Cranium said:

The good thing about working with the low voltage stuff with your MOSFETs is that no matter what you do, you won't be blowing them!  lol

Yeah, I don't think the mosfets are going to be the first components to give in, don't know about the rest of the stuff ;)  I did put 10k 1W power resistors for the phase-pulldowns, although the power dissipation with around 9V max shouldn't be much.

 

5 minutes ago, Cranium said:

You can rig up another Arduino to measure the signals into the MOSFETs or motor to take the place of a Oscilloscope.  https://www.youtube.com/watch?v=5ky_N5-Fu6M

An oscilloscope would certainly help a lot... It looks like that one still needs a their "UnoProLogic"-shield to work (I didn't watch the entire video ;))? I did order one of these:  http://www.aliexpress.com/item/DSO138-2-4-TFT-Digital-Oscilloscope-DIY-Kit-DIY-Parts-for-Oscilloscope-Making-Pocket-size-Handheld/32539344119.html

Just today got the notice it has arrived in the post office for pick up, of course I haven't picked it up yet and with the christmas, it might take a while... just popped there yesterday, wish it had arrived just one day earlier. Don't know if I can even get it together without breaking anything (it seems the SMD-components are already in place, so shouldn't be that hard). Probably not that good quality, but better than nothing and I do need only fairly low frequencies (<30kHz), at least for now.

Also a friend of mine said he has an "extra" cheap oscilloscope somewhere that has no display, but is instead connected to a PC and has it's own software to show the graphs, that would help too.

Link to comment
Share on other sites

31 minutes ago, OliverH said:

Cool stuff. @esaj: Do you document your project open source (link?)? 

In general: Cool stuff. I like :)

 

Thanks, but there are people here in these forums that are far, far ahead of me when it comes to this stuff (just check out the firmware- and euc open source controller board-topics in the Mods & Repairs-section)... this is a learning project for me.

As for the documentation, nothing at least yet. The bridges & hall-sensor reading circuitry is blatantly stolen from here: http://forum.electricunicycle.org/applications/core/interface/file/attachment.php?id=2218  (originally posted by @Mystamo in the firmware-topic). The components I used were 75NF75 n-channel mosfets, S9014 for NPN BJTs, S9012 for PNP BJTs, a mix of 0.25W / 1% and 0.125W / 5% resistors (except the 10k resistors bypassing the low-side mosfets are 1W / 5%) and diodes are 1N4148's for the charge pump in the high-side of the bridges and FR107 coming from the rail. Small capacitors are 50V ceramics, the 47uF capacitors are some 50V electrolytics. I use 5V from the arduino for the base of the NPNs on the low-side (Q17, Q19, Q21). No separate higher voltage rails (like in the original schematic with 14V/36V), both the mosfet-drain and the diodes going to the charge pump circuits come from the same rail (9V batteries currently, meant to be replaced by "something" giving 12V later on).

The Arduino is wired as follows: A4 and A5 for the LCD (I2C), pins 2, 4 and 7 are for hall-inputs, all the PWM pins are in use (5&6, 9&10, 3&11) for the high-side and low-side driving of the mosfet gates. Pin 12 is used as pullup-type input for the kill-switch (so the kill-switch must connect to ground when pressed).

The source code is something I cobbled together in about couple of hours over some beers, first time I've actually written some code for Arduino and not just used some libraries to test some sensors that have arrived :D  Here it is:  http://pastebin.com/ZgSWVtwH

Edited by esaj
Link to comment
Share on other sites

 

Hi esaj,

Looks like you are really enjoying to build a BL motor driver now :).

Take a look this site. Which is an open source forum to build sensorless BL motors drivers for RC airplane.  

Instead make your own, you can simply buy a $10 20A ESC, which includes two voltage regulators, a hex MOSFET bridge, MOSFET drivers and a microcontroller.  I did not spend much time to read the schematics, it probably has extra IOs to let you connect a Hall sensor.  You can modify the control code (quite amount of code can be shared) and do whatever you want, saving lots of time (funds too).

http://www.rcgroups.com/forums/showthread.php?t=2136895

This site has all ESC choices, from 3A weight 2g, to more than 100A.

http://www.hobbyking.com/hobbyking/store/uh_listCategoriesAndProducts.asp?cwhl=XX&idCategory=61&v=&sortlist=W&LiPoConfig=&CatSortOrder=asc

 

About ESC hardware

https://github.com/sim-/tgy/wiki/Identifying-ESC-pin-configuration

Have fun!

Edited by Jimicycle
  • Upvote 1
Link to comment
Share on other sites

11 hours ago, Cranium said:

My workbench area should make you feel a bit better about yours. :)

Nice, you got a good set of tools I see (couple of oscilloscopes, bench power supplies, several multimeters...) :)  

10 hours ago, Jimicycle said:

 

Hi esaj,

Looks like you are really enjoying to build a BL motor driver now :).

Take a look this site. Which is an open source forum to build sensorless BL motors drivers for RC airplane.  

Instead make your own, you can simply buy a $10 20A ESC, which includes two voltage regulators, a hex MOSFET bridge, MOSFET drivers and a microcontroller.  I did not spend much time to read the schematics, it probably has extra IOs to let you connect a Hall sensor.  You can modify the control code (quite amount of code can be shared) and do whatever you want, saving lots of time (funds too).

http://www.rcgroups.com/forums/showthread.php?t=2136895

This site has all ESC choices, from 3A weight 2g, to more than 100A.

http://www.hobbyking.com/hobbyking/store/uh_listCategoriesAndProducts.asp?cwhl=XX&idCategory=61&v=&sortlist=W&LiPoConfig=&CatSortOrder=asc

 

About ESC hardware

https://github.com/sim-/tgy/wiki/Identifying-ESC-pin-configuration

Have fun!

Thanks, I'll check those out later, I've been aware that there are ESCs/BLDC-drivers available, as well as ICs to drive the mosfets. Might have to go with ICs in the longer run, seeing how much space the gate driving circuits take (especially since I use through-hole components and TO/DIP -packages and not SMDs).

One thing that occurred to me (related to the jerkiness and seeming lack of torque of the motor) is that it could also be caused by the low-frequency PWM. The high-side charge pumps have small capacitors (10nF), so it might be that they discharge quickly, and cannot keep the gate voltage high enough for the mosfet to conduct. So even though the duty cycle of the PWM is 100%, the mosfets might be conducting only a fraction of the time when the signal is high... Another case where an oscilloscope would be handy. I could try just using bigger capacitors, when I got the time to play around with it again.

EDIT: Oh, and the 100% PWM duty-cycle is probably also a stupid idea... if the pulse never goes down (don't know if there's a small dip between cycles or not at 100%), how could the voltage pumping work? :rolleyes:

Edited by esaj
Link to comment
Share on other sites

What are you using to down convert the 5V needed for the logic control? 

The Ninebot uses a LM2596-50 (capable of 3A) step-down buck converter to step it down to 5V.  The schematic you are referencing is using an LM317T (capable of 1.5A) to drop it to 14V and then a 78L05 to drop it to 5V (capable of a measly 100mA).  These converters have an operating voltage of up to 40V (35V for the 78L05) so I'm not sure what they are doing on the Ninebot to get the voltage down from battery voltage.  In the schematic you have, it is only using a 36V power source so isn't an issue but with your 16S2P battery this would certainly be a concern.

 

  • Upvote 1
Link to comment
Share on other sites

24 minutes ago, Cranium said:

What are you using to down convert the 5V needed for the logic control? 

The Ninebot uses a LM2596-50 (capable of 3A) step-down buck converter to step it down to 5V.  The schematic you are referencing is using an LM317T (capable of 1.5A) to drop it to 14V and then a 78L05 to drop it to 5V (capable of a measly 100mA).  These converters have an operating voltage of up to 40V (35V for the 78L05) so I'm not sure what they are doing on the Ninebot to get the voltage down from battery voltage.  In the schematic you have, it is only using a 36V power source so isn't an issue but with your 16S2P battery this would certainly be a concern.

 

The 5V input in my test circuit comes directly from the Arduino... I've also got some 7805's,LM2596T's (3.3V, 5.0V, and adjustable up to around 30V?), and DC-DC buck converters (adjustable to something like 2V-36V from a "couple of volts" up to 45V input or so) but haven't used them yet. For the 16S2P I've meant to use a separate (e-bike) step-down switching transformer I have (36...72V to 12V / 10A).

 

13 minutes ago, Jimicycle said:

You may want to use 9V directly instead of pump it up to 12V, it should be enough to drive a MOSFET. Most FET starts on from about 4V, there are very little differences between 9V and 12V gate voltage. 

 

Correct me if I'm wrong, but I've always thought that the voltage DIFFERENCE between the gate and source (or is it drain?) should be that around 4V... so if the high-side drain(/source?) is at 9V (or 12V), the gate should be around 13V (or 16V) for fully "opening" the mosfet? I don't have anything to actually measure the peak voltages with, but the LTSpice simulations I've done of the circuit seem to show that it pushes the voltage up to (roughly) 45V for the 14V/36V input.

Link to comment
Share on other sites

I just found a LCT3810 switching regulator that can handle input voltages up to 100V and operate at >90% efficiency with good amp output capabilities.

http://www.linear.com/product/LTC3810

I still want to figure out what the Ninebot uses to step it down for the LM2596.  

 

Found the missing piece for the Ninebot.  It uses a LM5005 High Voltage 2.5 Amp Buck Regulator.   Accepts up to 75V.

The LM5005 reduces the voltage to 13.46V and the LM2596-50 reduces the voltage down to 5V.

  • Upvote 1
Link to comment
Share on other sites

17 hours ago, Cranium said:

I just found a LCT3810 switching regulator that can handle input voltages up to 100V and operate at >90% efficiency with good amp output capabilities.

http://www.linear.com/product/LTC3810

I still want to figure out what the Ninebot uses to step it down for the LM2596.  

 

Found the missing piece for the Ninebot.  It uses a LM5005 High Voltage 2.5 Amp Buck Regulator.   Accepts up to 75V.

The LM5005 reduces the voltage to 13.46V and the LM2596-50 reduces the voltage down to 5V.

Nice find... I did check out Aliexpress for the LM5005's, but all I could find were SMD-packages and the cheapest ones were around 5.15€ a piece.

In other news, I just tested the motor controller with PWM duty cycle lowered to 50% (128). I earlier upped it to 100% (255), because the motor wouldn't start turning at all, but later on found that I was missing the +5V -inputs to the low-side after I had done some other changes :rolleyes:  Anyway, the motor now does start almost every time (say, 9 out of 10 tries or so) without any help (just pressing down the button), and keeps running as long as I keep the button pressed, at least when I hold it up in the air. Since only the PWM-duty cycle was changed, I do believe it is due to the charge pumps not working with "full on" duty cycle, as they need to be cycled high and low for the capacitor to be in series/parallel alternately. It is still clearly missing torque, as if it's on the table, I can hear a silent "whirrr"-sound, but the motor doesn't turn without helping it to start with my finger. Next step is to try to use larger capacitors for the pumps.

Edit: Added 100nF capacitors in parallel with the existing 10nF in the high side gates... net result: the motor now has enough torque to start turning even if the axel gear is grinding against the surface, so the torque did go up a bit:

 

Edited by esaj
  • Upvote 1
Link to comment
Share on other sites

Note to self: after having measured currents, remember to move the measurement wire back to voltage/resistance measuring connector... I measured the voltages and currents, and found out that the 9V batteries sag down to almost 3V and the current from them while running the motor is between 1 and 1.5A! :o And then decided I should use the 16S2P-battery... well, that didn't work out so good.

MVubVBq.png

I just plugged the measurement heads into 16S2P-battery connector to measure the voltage, but had left the red wire in the 10A current-measuring position (very low resistance). ZAP! As you can see from the picture, the metallic head actually MELTED inside the connector. Looks like I'll have to replace it... And get new measurement head(s). Probably also burned the 10A fuse from the meter.

Link to comment
Share on other sites

  • 2 weeks later...

Had this on the backburner, as I was waiting for my cheapo-DIY-oscilloscope -kit, which was then of course missing one critical component (a TL084 -op amp in SOIC-package), which I don't have... Kind of hard to get on with it without being able to measure the signals and phases. I did finally get my gyros today, which seem to work fine, except I ordered 4 and got only 2, will have to request a refund. But, at least now I can get started on the self-balancing robot with stepper motors.

On the topic of oscilloscopes, can anyone tell me if this is good or not (for the price):  http://www.batronix.com/shop/oscilloscopes/Rigol-DS1054Z.html  Been eyeing on this for a while, but still around 400€ (with the VAT) isn't exactly cheap (well, I guess it is for an oscilloscope, but I'm Scrooge McDuck ;)). It has "only" 50MHz bandwidth but with 4 channels and 4 * 150MHz probes that come with it, and if I've understood right, it can be software-modded to full 100MHz (not sure if I actually ever even need that high bandwidth). I could get higher bandwidth models but with only 2 channels for about the same price, and being able to monitor all phases in a 3-phase motor could be useful.

Edited by esaj
Woops, wrong price
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...