#$%@$#@ <--- (insert favorite swearword here), IT WORKS !!!!

Electric Motors and Controllers

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby MitchJi » Sat Jan 28, 2012 7:01 pm

Hi

Lebowski wrote:Been very busy adding more and more menu options. So much in fact I'm starting to get lost :oops:

Some menu's have gotten so long that I've decided to switch all to letter instead of numbers.

Also every option is indicated by a ']', '}' or ')', the meaning is:
]: option only used for sensored
}: option only used for sensorless
): option used for both sensored and sensorless

Not very user friendly.

How about as a minimum?:
-S): option only used for Sensored
-N): option only used for Non-sensored
-B): option used for Both sensored and sensorless


this is the 'running modes' submenu
Code: Select all
a-B) sensored or sensorless: SENSORED
b-N) sensorless startup: PUSH START
c-N) e-rpm limit sensorless self start: 999
d-N) e-rpm reached before transition: 89 %
e-N) minimum current push start: 0.9 A
f-N) push start current, error allowed: 20 %
g-S) erpm sensored to sensorless transition: 500
h-S) transition time sensored to sensorless: 249 milli-sec
i-B) return to motor start below 200 erpm
j-B) motor maximum: 6.99 k-erpm
k-B) motor standstill voltage threshold: 1.49 V
z-B) return to main menu
Best Wishes!

Mitch
User avatar
MitchJi
100 MW
100 MW
 
Posts: 2667
Joined: Mon Jun 02, 2008 8:09 pm
Location: Marin County California

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Mon Jan 30, 2012 5:17 am

Just checked the battery current calculation / limiting part (it works). Since I only have
current sensors in the phase wires the battery current is calculated and this needed to be
checked.

I got road-rash on my thumb now, the skin got burned and is now hard (like it melted or something).

au :(

tip: use the brake if you ever want to run a test like this....
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Tue Jan 31, 2012 6:28 am

Just finished the schematic, will post it later today (somehow I think a 16 Mb .tiff is overdoing it :D so will need
to re-generate it later today). I'm busy typing the manual explaining all the options of the setup menu's (I will go for
a powerpoint type slide set, in .pdf). Chips will most probably be shipped to the people that PM-ed me this coming
Monday (I have 3 day weekends, mondays the post office is open)....
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby nieles » Tue Jan 31, 2012 7:09 am

could this be used for programming the parameters?

http://www.sparkfun.com/products/9716
nieles
1 kW
1 kW
 
Posts: 476
Joined: Mon Jul 14, 2008 5:39 pm
Location: The Netherlands

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Tue Jan 31, 2012 7:38 am

It looks like a standard USB <-> RS232 interface so yes, that can be used. Looking at its
schematic you need (from jp1) pins 1 (gnd), 4 (TX, connect to my RX) and 5 (RX, connect to
my TX).

Looking at pictures in this post

viewtopic.php?p=497791#p497791

this cable can also be used (EB2xx, EB3xx programming cable). I'm not sure
from the pictures but it looks like black is gnd, white is RX (connect to my TX)
and green is TX (connect to my RX).

I myself use a standard USB <-> RS232 cable which actually uses the same PL2303
chip as in the pictures of the post I mentioned.

You need to be able to set the speed to 115200 baud... (8 bits, 1 stopbit, no parity, no handshaking)
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Arlo1 » Tue Jan 31, 2012 10:09 am

I just checked my current sensors and they are U for unidirectional... :( Oh well I have one from burtie thats a B I only need to order 2 more. I will put an order in just in time for alll of this along with some irfp4468 fets for me a gordo to play with.
Thanks Justin of http://www.ebikes.ca/
Also a thanks to Methy at http://www.methtek.com/ :)
And Dave who has some good deals on STUFF Incl. Mosfets, Current sensors and Nomex paper.
RC lipo and most other types of Lithium batteries you MUST know your individual cell voltages while charging and discharging.
Batteries of all kinds need respect they can burn your house down, so don't sleep with them under your bed or any other were you cant afford smoke or fire!
Never above 4.2v never below 2.7v EVER!!!
User avatar
Arlo1
100 GW
100 GW
 
Posts: 5300
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Teh Stork » Tue Jan 31, 2012 10:37 am

Lebowski wrote:Just finished the schematic, will post it later today (somehow I think a 16 Mb .tiff is overdoing it :D so will need
to re-generate it later today). I'm busy typing the manual explaining all the options of the setup menu's (I will go for
a powerpoint type slide set, in .pdf). Chips will most probably be shipped to the people that PM-ed me this coming
Monday (I have 3 day weekends, mondays the post office is open)....


Just a suggestion, If you have borland builder - you can easily make a nice gui with values that can be exported to a text-file or similar. As for data-comm, going for a SD-solution (more code :twisted: ) would offer benefits in that you could both program, datalog and debug.

It's hard doing everything - being able to build a complete controller requires many skills, looks like you have it 8) Can't wait to see the result ;)
Teh Stork
1 kW
1 kW
 
Posts: 311
Joined: Wed May 25, 2011 8:02 am

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Tue Jan 31, 2012 10:46 am

Ok, before I'll start a new thread with all the documentation, this is version 1 of the schematic. The schematic itself
will 99% sure not change, maybe just some of the explanatory text... This text by the way is readable if you download
and save the file, and then zoom in.

Enjoy :D

schematic_v1.jpg
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby salty9 » Tue Jan 31, 2012 12:29 pm

Lebowski,

Would you recommend optoisolating your controller from the power board? It would be a shame for a downstream screw up to wreck the controller.
salty9
1 kW
1 kW
 
Posts: 487
Joined: Fri Aug 14, 2009 10:14 pm
Location: 42.6°N 122.71°W

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Tue Jan 31, 2012 12:57 pm

salty9 wrote:Lebowski,

Would you recommend optoisolating your controller from the power board? It would be a shame for a downstream screw up to wreck the controller.


It's possible to do this (the test power stage I'm using has this, I use hpcl2631 for opto-isolation and 4427 gate drivers)
but I don't want to recommend this as it's more costly and complex that other solutions. I want people to choose
for themselves what kind of output stage they want to use. The setup option that allows you to choose active high or
active low for the FET drivers gives a lot of flexibility in building the output stage, it makes it for instance possible
to re-use a china controller output stage.
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Arlo1 » Tue Jan 31, 2012 2:50 pm

salty9 wrote:Lebowski,

Would you recommend optoisolating your controller from the power board? It would be a shame for a downstream screw up to wreck the controller.

On the bench I have powered the controller from a seprate source to the powerstage... I am not sure what I will use for my end product.
Thanks Justin of http://www.ebikes.ca/
Also a thanks to Methy at http://www.methtek.com/ :)
And Dave who has some good deals on STUFF Incl. Mosfets, Current sensors and Nomex paper.
RC lipo and most other types of Lithium batteries you MUST know your individual cell voltages while charging and discharging.
Batteries of all kinds need respect they can burn your house down, so don't sleep with them under your bed or any other were you cant afford smoke or fire!
Never above 4.2v never below 2.7v EVER!!!
User avatar
Arlo1
100 GW
100 GW
 
Posts: 5300
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby fechter » Thu Feb 02, 2012 9:52 am

Wow, that is a very clean looking design. I think building one should not be too difficult.

Personally, I would try to reuse the output stage from a chinese controller as I have many of them.

Optocouplers are nice bulletproofing but it might be just as effective to use resistors and clamping diodes on the driver lines. If the driver blows, the resistors/diodes keep the outputs of the processor happy.
"One test is worth a thousand opinions"
User avatar
fechter
100 GW
100 GW
 
Posts: 9391
Joined: Sun Dec 31, 2006 3:23 pm
Location: California Bay Area, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Teh Stork » Thu Feb 02, 2012 1:21 pm

Just a question about the acs714; this seems to be limited to 30A peak. Are more powerful alternatives for measuring higher current - or is the old shunt resistor with op-amps just as good when upping the amps?
Teh Stork
1 kW
1 kW
 
Posts: 311
Joined: Wed May 25, 2011 8:02 am

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Thu Feb 02, 2012 1:38 pm

Teh Stork wrote:Just a question about the acs714; this seems to be limited to 30A peak. Are more powerful alternatives for measuring higher current - or is the old shunt resistor with op-amps just as good when upping the amps?


The ACS714 is shown as an example (I use the 20A version as I want a maximum phase current of around 10A), there are
different sensors available. This is a 200A version

http://canada.newark.com/allegro-micros ... %20Sensors

Just make sure you get a bi-directional one and that it's output is conform the comments in the schematic.
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Sat Feb 04, 2012 3:47 am

Screenshot_memuse.jpg
Screenshot_memuse.jpg (16.27 KiB) Viewed 269 times


20661 bytes filled using assembly :shock:

at 3 bytes per instruction thats almost 7000 instructions...
with 50 lines per page that's 140 pages of code...
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby salty9 » Sat Feb 04, 2012 4:14 am

Lebowski wrote:
20661 bytes filled using assembly :shock:

.


And how many megabytes if you had coded in C? :D
salty9
1 kW
1 kW
 
Posts: 487
Joined: Fri Aug 14, 2009 10:14 pm
Location: 42.6°N 122.71°W

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Alan B » Sat Feb 04, 2012 7:27 am

And how much work to port it to the ARM CPU?
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3906
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Sat Feb 04, 2012 9:06 am

Alan B wrote:And how much work to port it to the ARM CPU?


I would actually like to port it to ARM, I would like to learn ARM assembly.
Problem is that I have a soldering station from the 1960's and cannot
deal with SMD's or very small chips. Maybe an SOIC would work
in combination with a breakout board but that's the absolute limit.
I should look for a new soldering station maybe.

A 32 bit ARM would be nice (as some stuff is calculated with 32 bit precision)
especially as ARM has lot's of conditional instructions... At the
moment the 30F is capable of making ADC measurements, doing 32 bit computations
and writing fresh output to the PWM at a rate of 100kHz. Can you imagine how
fast an ARM would be :D

First lets see what the beta testers have to say :D
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Alan B » Sat Feb 04, 2012 10:08 am

Lots of small boards with ARMs aready mounted that will piggyback onto your board for the rest of the logic. Techniques are available to solder fine pitch SMTs with 1960's soldering equipment. Adequate soldering equipment is also available for less than the cost of a moderate Lipo battery. :)
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3906
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby ctirad » Sat Feb 04, 2012 2:15 pm

Lebowski wrote:I would actually like to port it to ARM, I would like to learn ARM assembly.


You should consider to write in C. It will make the code much more transparent and portable. The speed loss is minimal and you allways can inline assebly routines for better speed when needed.

BTW, I'm not sure, the ARM is generally better option than dsPIC or another MCU/DSP dedicated for motor controll tasks. However, If you want to try ARM, look at STM32 line of chips.

Problem is that I have a soldering station from the 1960's and cannot
deal with SMD's or very small chips.


Don't worry, SMD is easy to handle even with a plain micro soldering iron. I commonly use mine even for FPGAs, bigger MCUs and so. The real problem is BGA.
Erider VK2008 4kW electric scooter
Guewer Classic 2kW electric scooter (modded)
User avatar
ctirad
10 W
10 W
 
Posts: 65
Joined: Wed May 04, 2011 4:50 pm
Location: Prague, Czech Republic

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Arlo1 » Sat Feb 04, 2012 3:11 pm

ctirad wrote:
Lebowski wrote:I would actually like to port it to ARM, I would like to learn ARM assembly.


You should consider to write in C. It will make the code much more transparent and portable. The speed loss is minimal and you allways can inline assebly routines for better speed when needed.

BTW, I'm not sure, the ARM is generally better option than dsPIC or another MCU/DSP dedicated for motor controll tasks. However, If you want to try ARM, look at STM32 line of chips.

Problem is that I have a soldering station from the 1960's and cannot
deal with SMD's or very small chips.


Don't worry, SMD is easy to handle even with a plain micro soldering iron. I commonly use mine even for FPGAs, bigger MCUs and so. The real problem is BGA.

We have been bugging lebowski to write in C for months and he is to stubborn lol. Im learning it its not easy but it does seem better in the long run!
Thanks Justin of http://www.ebikes.ca/
Also a thanks to Methy at http://www.methtek.com/ :)
And Dave who has some good deals on STUFF Incl. Mosfets, Current sensors and Nomex paper.
RC lipo and most other types of Lithium batteries you MUST know your individual cell voltages while charging and discharging.
Batteries of all kinds need respect they can burn your house down, so don't sleep with them under your bed or any other were you cant afford smoke or fire!
Never above 4.2v never below 2.7v EVER!!!
User avatar
Arlo1
100 GW
100 GW
 
Posts: 5300
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Kingfish » Sat Feb 04, 2012 10:42 pm

Arlo1 wrote:We have been bugging lebowski to write in C for months and he is to stubborn lol. Im learning it its not easy but it does seem better in the long run!

I wished it was written in .NET - then I could be of some actual use... instead of useless :wink:
Great work, KF
* My 2WD Garden Wall
* Current ride: 2WD Disc EBikeKit (9C 2806-equivalent) / Dual Lyen 12FET / 15S6P LiPo when commuting.
* Going to California: 2011: Trip completed 8)
* Club Member: 40-mph & 101. 10k-Club: 9683 miles-to-date, 4193 as 2WD.

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed.
The hands acquire shakes, the shakes become a warning.
It is by caffeine alone I set my mind in motion.
User avatar
Kingfish
1.21 GW
1.21 GW
 
Posts: 3611
Joined: Wed Feb 03, 2010 11:23 am
Location: Redmond, WA-USA, Earth, Sol, Orion–Cygnus Arm, Milky Way. Age: > yesterday < tomorrow

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Alan B » Sat Feb 04, 2012 11:35 pm

Lebowski has chosen assembler, it is too late for a change here.

But for other realtime projects C is the most supported portable embedded language that gets to the performance of the hardware.

Dot Net is for another application space. Software engineering requires more than one language. Some are more suited than others for a purpose. Dot Net is well suited for Microsoft's purpose.

I've used many languages over the years. C was a mainstay many years ago, but for most purposes we have moved on. But, for getting close to the hardware and coaxing the maximum performance from a chip, C still reigns supreme if you can manipulate the force. Many old languages we would never use again, but C is the one that keeps on keepin on. Some of the bolted on plusplus features awake the behemoth and warp into bloatspace, but the efficient functional machine is still inside there and it will do amazing things in small time and code space if you avoid waking the wrong objects. :)
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3906
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Sun Feb 05, 2012 4:39 am

My preference for assembly comes from it's simplicity, there's only a handful of simple instructions and that's it.
I dislike C because I still remember, back in the day I tried to write programs for the Commodore Amiga
90% of the program lines were procedure and function definitions and only 10% of the program did something useful.

I don't know about C being so portable... Let's say I want to port the whole thing to a 33F device (+30 % speed, jay :D ),
the main problem I see is figuring out how to operate all the peripherals. Rewriting the algorithm is easy and not
that much work, but figuring out how to access the 33F's ADC's and PWM outputs, that's where I see the main task...
And this would not be any different for C.

And yes, it's too late to change now :D I just programmed the devices to send around, going in the mail tomorrow.
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Alan B » Sun Feb 05, 2012 9:24 am

You are right about hardware related software not being portable, but that is language independent.

Some of the new processors have hundreds of assembler instructions to learn, and very complicated behavior. Especially the reduced instruction set architectures with delayed branching and overlapping execution and multiple execution units.

PIC assembler has a very low instruction count. AVR and ARM are much larger.

It takes some time to learn C. But when you move to the next CPU you still know C. You have to learn its hardware. If you use ASM you also have to relearn that. If you move from PDP8 to 8080 to 6800 to 8086 to PDP11 to Sparc to PowerPC to PIC to AVR to ARM you will not want to use ASM anymore.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3906
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

PreviousNext

Return to Motor Technology

Who is online

Users browsing this forum: No registered users and 2 guests