Simple BLDC controller

Electric Motors and Controllers

Re: Simple BLDC controller

Postby incememed » Tue Aug 09, 2011 12:26 pm

Arlo1 wrote:
hardym wrote: I switched to making a brain using a PIC18F2431, which is DESIGNED to run a BLDC motor (figure that!)

I just ordered a couple of these what do you think the max e-rpm we can run them at is?


Haven't explored its limits, but that PIC should be all you'll ever need to run a sensored drive, erpm-wise. I was using its smaller brother - the PIC16F690 - on my bike at 14,000 rpm with one of the smaller Turnigy outrunners. That's almost 100k erpm, and the 16F690 is limited to half the CPU clock speed of the PIC you're referring to.

BR/Mattias

(14,000 rpm with a 1:38 reduction :))
http://www.youtube.com/user/i95matra?fe ... CQjhLfQIvo
YouTube
"Simplify, then add lightness." - Colin Chapman
User avatar
incememed
100 mW
100 mW
 
Posts: 35
Joined: Sun Feb 14, 2010 4:25 am
Location: Vasteras, Sweden

Re: Simple BLDC controller

Postby Arlo1 » Tue Aug 09, 2011 12:28 pm

incememed wrote:
Arlo1 wrote:
hardym wrote: I switched to making a brain using a PIC18F2431, which is DESIGNED to run a BLDC motor (figure that!)

I just ordered a couple of these what do you think the max e-rpm we can run them at is?


Haven't explored its limits, but that PIC should be all you'll ever need to run a sensored drive, erpm-wise. I was using its smaller brother - the PIC16F690 - on my bike at 14,000 rpm with one of the smaller Turnigy outrunners. That's almost 100k erpm, and the 16F690 is limited to half the CPU clock speed of the PIC you're referring to.

BR/Mattias

(14,000 rpm with a 1:38 reduction :))
http://www.youtube.com/user/i95matra?fe ... CQjhLfQIvo

Im planning for ~100,000 erpm! Collossus is 10 erpm per rpm and I plan to run it ~150 volts & Its a 75 kv motor!
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby incememed » Tue Aug 09, 2011 2:03 pm

OK, should be a walk in the park for your PIC.

Homemade controller tuning burns a lot of FETs (I think you know), so just make sure you are well protected. Do NOT rely on the processor Analog-to-Digital Converter for emergency overcurrent protection, it will never be fast enough.

Consider having a comparator sniffing the shunt/sensor voltage continuously. The output of this comparator should be connected to the highest priority interrupt on your processor. This interrupt routine should open all FETs, and keep them open. This way you'll have <10us fault clearing, and your FETs will almost always survive.

Implementing this is fairly straightforward for anyone who made the rest of the code, it may already be in there, just wanted to give heads up for a trouble free tuning period.

BR/Mattias
YouTube
"Simplify, then add lightness." - Colin Chapman
User avatar
incememed
100 mW
100 mW
 
Posts: 35
Joined: Sun Feb 14, 2010 4:25 am
Location: Vasteras, Sweden

Re: Simple BLDC controller

Postby Arlo1 » Tue Aug 09, 2011 3:04 pm

incememed wrote:OK, should be a walk in the park for your PIC.

Homemade controller tuning burns a lot of FETs (I think you know), so just make sure you are well protected. Do NOT rely on the processor Analog-to-Digital Converter for emergency overcurrent protection, it will never be fast enough.

Consider having a comparator sniffing the shunt/sensor voltage continuously. The output of this comparator should be connected to the highest priority interrupt on your processor. This interrupt routine should open all FETs, and keep them open. This way you'll have <10us fault clearing, and your FETs will almost always survive.

Implementing this is fairly straightforward for anyone who made the rest of the code, it may already be in there, just wanted to give heads up for a trouble free tuning period.

BR/Mattias

Very good info thank you. For testing I have some SKM400GAL12E4 IGBT's comming for a good pirce and they have a "high short curcuit protection" So it would be nice if I can build a bad ass controller with them.
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby mauimart » Tue Aug 09, 2011 4:59 pm

I agree with incememed. Make sure that you are measuring phase current in at least two of the legs for the ability to shut it down in over-current situations. You could use a shunt or hall-based Allegro type current sensor - I believe the response time is good enough and it provides isolation from the power board. I should have added this capability to the board I blew-up from hardym. The PIC18F2431 should be able to handle erpm of the collosus.
over
User avatar
mauimart
100 W
100 W
 
Posts: 187
Joined: Tue Nov 10, 2009 2:08 pm
Location: maui

Re: Simple BLDC controller

Postby mauimart » Tue Aug 09, 2011 7:35 pm

incememed wrote:
Haven't explored its limits, but that PIC should be all you'll ever need to run a sensored drive, erpm-wise. I was using its smaller brother - the PIC16F690 - on my bike at 14,000 rpm with one of the smaller Turnigy outrunners. That's almost 100k erpm, and the 16F690 is limited to half the CPU clock speed of the PIC you're referring to.

BR/Mattias

(14,000 rpm with a 1:38 reduction :))
http://www.youtube.com/user/i95matra?fe ... CQjhLfQIvo


Just checked out your video - that's one fast spinning outrunner. Would you care to share any additional details on your home made controller? Which FET and how many are you using? What type of gate drive circuitry? Is the power board isolated from the controller board? What kind of heat are you generating at 2kW? BTW I think the cycle analyst uses the PIC16F690. Maybe we could request BLDC commutation in the next CA revision. :D
Thanks.
Martin
User avatar
mauimart
100 W
100 W
 
Posts: 187
Joined: Tue Nov 10, 2009 2:08 pm
Location: maui

Re: Simple BLDC controller

Postby incememed » Wed Aug 10, 2011 3:03 am

I have used a 6 FET, TO-247 size power stage. Drive current paths laid out as alu busbars. A current sensor where the battery connects.

FETS and gate drivers were considered the most fix parts of the design, they were put on PCB. 12V and 5V supply and processor were put on breadboard. They communicate through the thick grey wire.

1.JPG
Overview
(183.93 KiB) Downloaded 222 times

2.JPG
PCB top
(148.69 KiB) Downloaded 222 times

3.JPG
PCB bottom
(163.81 KiB) Downloaded 222 times

4.JPG
PCB close-up
(160.47 KiB) Downloaded 222 times


This power stage has been through one sensored drive development, advanced timing experiments and one sensorless drive development, and has seen its share of smoke, transplants and band-aid soldering. Some history:

- Whatever millimeters of drive current trace that weren't alu reinforced have melted, almost no matter how wide the trace.
- Melted traces led to the need to use the drain tab of the FET, hence the chopping up of the heat sink bar behind the FETs
- Somewhere along the electronics learing curve, the importance of proper bypass capacitors was unveiled. Such were retrofitted.
- Traces to the main caps burned up, these were instead screwed directly to the main busbar.
- Gate drivers have been replaced quite a few times, mostly due to 12V instability problems, but also due to shorted gates, connecting main voltage to the gate driver pin.

A well deserved retirement is in the pipe for this power stage. Next revision will include
- Onboard 12V and 5V conversions
- Thicker heat sink, with temp sensor
- Slimmer busbars stretching all the way to the FET.

Heat generated: Having the motor enclosed, this was a bit of concern, and a temp sensor was implanted in the motor onto the copper. It was set to trigger the fan at some 60C, and to trip the drive at some 100C. The fan came on quite frequently, but the trip level was never reached. The power stage gets warm to the touch. Nowadays I just leave the fan on, and don't monitor motor temp.

For any detail value, model, reasoning, etc, pls post.

BR/Mattias
YouTube
"Simplify, then add lightness." - Colin Chapman
User avatar
incememed
100 mW
100 mW
 
Posts: 35
Joined: Sun Feb 14, 2010 4:25 am
Location: Vasteras, Sweden

Re: Simple BLDC controller

Postby mauimart » Wed Aug 10, 2011 1:18 pm

Thanks for the update - nice, simple design. I especially like the bus bars bolted to the PCB. I was under the impression that you were monitoring phase current yet from the pictures and description it appears that you only use battery current to determine an over-current condition. Do you have plans to monitor phase current in your next revision? Also, what gate drive IC are you using?
Thanks.
Martin
User avatar
mauimart
100 W
100 W
 
Posts: 187
Joined: Tue Nov 10, 2009 2:08 pm
Location: maui

Re: Simple BLDC controller

Postby incememed » Thu Aug 11, 2011 1:34 am

No, I'm sticking with the ole
I_motor = I_batt / duty cycle
using the average battery current from the last few PWM-cycles, works fine for now. Too many other things with priority to worry about; gearbox update, making the chain stick for more than 10 min in rough terrain, refining the overcurrent protection, refining the sensorless startup sequence, exploring thermal and current limits of drive, allowing for freewheeling (motor standstill, rear wheel spinning) when throttle off, water and dust proofing. I'm still walking home from the trail 50% of the time... :x It's on the list, though.

Gate driver is IRS2186, to be used with a 4ohm gate resistor, which should produce peak charge currents way below rated value.

BR/Mattias

PS That's a very impressive motor wind in your sig!
YouTube
"Simplify, then add lightness." - Colin Chapman
User avatar
incememed
100 mW
100 mW
 
Posts: 35
Joined: Sun Feb 14, 2010 4:25 am
Location: Vasteras, Sweden

Re: Simple BLDC controller

Postby Arlo1 » Thu Aug 11, 2011 9:49 am

MitchJi wrote:Hi,

liveforphysics wrote:The LoBo brain with isolated floating DC/DC fet driver power could control a bank of 6 of these sexy little monsters:

http://ixdev.ixys.com/DataSheet/DS100264(MMIX1G320N60B3).pdf

Build yourself a >100kw HV brushless controller for a hundred bucks in parts.

Fixed the link (parentheses messed it up).

ANy of you know where we can get these?
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby Arlo1 » Fri Aug 12, 2011 12:55 am

OK so who wants to hold my hand and help me through the steps of programing the PIC18F2431 I will have it soon and I think I have everything on order I should need. So now is the time for me to read about programing and writing code.
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby Lebowski » Fri Aug 12, 2011 1:08 am

Arlo1 wrote:OK so who wants to hold my hand and help me through the steps of programing the PIC18F2431 I will have it soon and I think I have everything on order I should need. So now is the time for me to read about programing and writing code.


One of the reasons I got into this ebike building stuff is that I wanted to mess around with PIC processors
and wanted a cool application to put my PIC's in :D So ask away !

First step: download MPLAB from http://www.microchip.com/stellent/idcpl ... t=SW007002
and have a look at its manual. Do you have some sort of programmer like a PICKIT2 or (much better) a PICKIT3 ?
Also it's usefull to have a RS232 port on your computer (or some sort of USB<->RS232 cable) 'cause then
you can output data from your running PIC processor to your PC.

You know about hexadecimal and binary and stuff like that ?
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: Simple BLDC controller

Postby Arlo1 » Fri Aug 12, 2011 1:14 am

Lebowski wrote:
Arlo1 wrote:OK so who wants to hold my hand and help me through the steps of programing the PIC18F2431 I will have it soon and I think I have everything on order I should need. So now is the time for me to read about programing and writing code.


One of the reasons I got into this ebike building stuff is that I wanted to mess around with PIC processors
and wanted a cool application to put my PIC's in :D So ask away !

First step: download MPLAB from http://www.microchip.com/stellent/idcpl ... t=SW007002
and have a look at its manual. Do you have some sort of programmer like a PICKIT2 or (much better) a PICKIT3 ?
Also it's usefull to have a RS232 port on your computer (or some sort of USB<->RS232 cable) 'cause then
you can output data from your running PIC processor to your PC.

You know about hexadecimal an binary and stuff like that ?

LOL nope. I played around a bit with code for my megasquirt2 a couple years ago. But now its time to do the real lerning. I will read and download that all in the morning. I don't have a programer yet but.... Can we build it too? I maybe in over my head but I always find my way to the top. I am done with trying to reverse engineer some china controller its time to build my own!
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby Lebowski » Fri Aug 12, 2011 1:38 am

Arlo1 wrote:LOL nope. I played around a bit with code for my megasquirt2 a couple years ago. But now its time to do the real lerning. I will read and download that all in the morning. I don't have a programer yet but.... Can we build it too? I maybe in over my head but I always find my way to the top. I am done with trying to reverse engineer some china controller its time to build my own!


About binary and hexadecimal, this should be enough of an intro:
http://www.swansontec.com/binary.html

I build my own programmer but it's not something I want to do again. The issue is that each PIC processor is
different as far as the programmer is concerned, PIC12F needs a different sequence from a PIC16F etc etc.
So every time I wanted to use a new type of PIC I had to re-write my programmer, I got totally fed up with
this.

A PICKIT2 is a low cost programmer: http://www.microchipdirect.com/products ... s=PG164120
but I wouldn't get that one as it can only program 5V PIc's (afaik).
The more advanced stuff runs on 3.3 V for which you need a PICKIT3.
You can get just the programmer: http://www.microchipdirect.com/products ... s=PG164130
or combined with 12 lessons on programming in assembly: http://www.microchipdirect.com/ProductS ... s=DV164131

Oh, I don't know anything about programming this stuff in C, I only use assembly. What language do you intend to use ?
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: Simple BLDC controller

Postby Arlo1 » Fri Aug 12, 2011 8:12 am

I've used C just a bit before but I really don't care what I use I just need to learn what I can, this has been something holding me back for a long time from my projects.
Thanks for all the links now its time to read them over my morning coffee. I found you can get knock off china Pickit3 programmers for ~$30 and the real thing for ~$50 so that's not to bad considering Ive blew up well over $500 worth of electronics so far on collossus.
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby Njay » Fri Aug 12, 2011 9:11 am

Take a look at arduino too, it's cheap, and although it doesn't have any special hardware to deal with tri-phase motors but it has a simple C/C++ library and you'll find lots and lots of code and community support.
Njay
10 kW
10 kW
 
Posts: 559
Joined: Thu Sep 09, 2010 10:43 am
Location: Portugal

Re: Simple BLDC controller

Postby Arlo1 » Fri Aug 12, 2011 9:33 am

Njay wrote:Take a look at arduino too, it's cheap, and although it doesn't have any special hardware to deal with tri-phase motors but it has a simple C/C++ library and you'll find lots and lots of code and community support.

Whats the chances we could use the arduino programing for the PIC18F2431?
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby Njay » Fri Aug 12, 2011 9:48 am

Maybe someone built an arduino-like base library for PICs, but you'll find alot more code to deal with other devices that doesn't make part of the base library. arduino is very plug&play, and you can use your code later in a custom-board made with the same AVR chip, there's no special hw support needed to run it.

Anyways, this is just an advice to take a look at it too.
Njay
10 kW
10 kW
 
Posts: 559
Joined: Thu Sep 09, 2010 10:43 am
Location: Portugal

Re: Simple BLDC controller

Postby Arlo1 » Fri Aug 12, 2011 10:36 am

Njay wrote:Maybe someone built an arduino-like base library for PICs, but you'll find alot more code to deal with other devices that doesn't make part of the base library. arduino is very plug&play, and you can use your code later in a custom-board made with the same AVR chip, there's no special hw support needed to run it.

Anyways, this is just an advice to take a look at it too.

Yeh its very interesting. I personaly don't like what Im finding with PIC its all money based. The whole dam webpage is an advertisment for selling their own stuff. But I realy want this to be simple and cheep. I will do more reserch on the arduino because it is more what the electric revalution needs!
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby Arlo1 » Fri Aug 12, 2011 10:42 am

You can find it here for ~$29 and its a bord ready to go.... I might be able to drive the fet drivers right off this bord! http://www.robotshop.com/ca/arduino-uno ... ler-2.html
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby Lebowski » Fri Aug 12, 2011 10:56 am

Arlo1 wrote:
Njay wrote:Take a look at arduino too, it's cheap, and although it doesn't have any special hardware to deal with tri-phase motors but it has a simple C/C++ library and you'll find lots and lots of code and community support.

Whats the chances we could use the arduino programing for the PIC18F2431?


Trust me, you don't want to build your own programmer...

I'm a big fan of programming in assembler because it gives you total and utter control of what the processor
is doing, kind of like that old guy in North Korea.

With C you don't really know how it translates this into actual assembler code. With C you'll definately have
a speed disadvantage although things like calculations will be easier to program (but for me this is part of the fun of
assembler). Assembler is closer to the hardware.

Have a look at the (only 400 pages, http://ww1.microchip.com/downloads/en/D ... 39616C.pdf) datasheet of
the 18F2431, section 23 to see the cool commands available when programming assembler.
I know it seems daunting but it's not a book, more like an encyclopedia where you only read the few tables and
comments of the things you want to use.

What do you want out of your project ? Programming in C on the arduino will be easy and get you results relatively
quick, but you're not going to learn anything. If you spend some time learning about this PIC processer and
assembly language, you'll have learned a real skill. Also, most PIC's are alike so it'll be easy to switch
to different chips while with the arduino you're much more dependent on the service and designs they provide...
Plus, once you get into assembler and PIC's botching together a quick testcircuit and testprogram
gets really easy, I think with my still limited PIC knowledge I can design stuff just as fast as someone with C
and an arduino. But I'll have full control like the dictator that I am :twisted: while the arduino guy is hoping
for the best.

What do you mean expensive ? You need to buy a programmer only once and after that the PIC's are $3 each.
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: Simple BLDC controller

Postby Arlo1 » Fri Aug 12, 2011 11:09 am

As for the money Im just thinking the 50$ for a programer is not for everyone on this forum. I would gladly flash everyones chips for them but I don't want to be resposible for a code problem causeing them to blow up.

As for me I want full control. I will study the compititons chips as well incase I can get any usefull knoladge out of it and make sure I have the best.
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Simple BLDC controller

Postby Lebowski » Fri Aug 12, 2011 11:17 am

if you really want to program PIC's on the cheap, google for parallel port PIC programmer.

Most of this stuff is old though (for one I don't have a parallel port anymore) and probably won't support your 18F2431
User avatar
Lebowski
1 MW
1 MW
 
Posts: 1505
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: Simple BLDC controller

Postby Njay » Fri Aug 12, 2011 11:29 am

If you're going to program in assembly, choose AVR (arduino uses AVR) and save yourself a few headaches. The assembly on AVR is much more developer friendly.

If you're going to program in assembly in a PIC, then pick an AVR and program in C; your C AVR code will easily be faster than your optimized PIC assembly code. AVR's are very fast and have a decent machine-level instruction set, compared to PICs.

I used to be an assembly hardcore guy (and I've programmed assembly on Z80, x86, PICs and AVRs), but I don't find it justifiable anymore, given the speed available on modern microcontrollers; I prefer to have code I can easily read and maintain many months later. The GCC compiler for AVR does a wonderful job at optimization (the arduino environment uses it), and you can look at the assembly code it generates and give it a hand to make it do an even better job, if necessary. Really, just skip assembly and do it in C (through the arduino lib or directly in C; the lib is not very fast, but you can program in C without the lib using the same arduino development environment); later on you can improve your knowledge and skills by starting to dig deeper. The focus of your project is not on learning the machine insideout but to control your bridges.

You can program any AVR with a parallel port too (2 caps and 4 or 5 resistors), and that's what I still do today since my PC still has one (USB -> LPT won't work as a programmer).
Njay
10 kW
10 kW
 
Posts: 559
Joined: Thu Sep 09, 2010 10:43 am
Location: Portugal

Re: Simple BLDC controller

Postby Arlo1 » Fri Aug 12, 2011 11:30 am

Lebowski wrote:if you really want to program PIC's on the cheap, google for parallel port PIC programmer.

Most of this stuff is old though (for one I don't have a parallel port anymore) and probably won't support your 18F2431

Ok its time to move this discustion to a proper location go here for the new controller build, viewtopic.php?f=2&t=30851
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: 5301
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

PreviousNext

Return to Motor Technology

Who is online

Users browsing this forum: No registered users and 4 guests