View Full Version : Discussion A sensored motor with a 16F88 ??
duhh
Aug 18, 2008, 08:01 AM
I want to make a controller for a sensored motor with the 16F88.
I Have one pwm pin and 6 I/O pins left.
Does annybody know if this kind of thing is possible ??
AndyKunz
Aug 18, 2008, 08:48 AM
Extremely possible - it was done this way before sensorless came along, using even less-capable PICs (PIC16C54 could do it...)
The PIC should monitor the hall switches which will generate a Gray Code sequence as the motor rotates. All you need to do is look up the 3 bits in a table (only 6 entries are used) which provides you with the necessary on/off for each of the FETs.
You will want to build a little smartness into your control to prevent shoot-thru. Basically, when you know the next I/O setting you don't go there immediately. First you will need to turn off ALL the FETs, then delay a few microseconds, then turn on the new pattern.
The PWM output should be routed through a logic gate on the low side. A 74XX138 will do what you want (use the 3 FET positions on the address lines A0-A2, and the PWM on the G or /G input). The high side FETs don't need to be PWM'd - just the low side.
If you want to play around with advance timing, you can do that too, but it will be a lot easier if you just use the hall sensors with neutral timing (usually OK but not especially powerful).
It's a GREAT way to learn how the motors work and how brushless commutation works.
Have a great time playing!
Andy
mjsas
Aug 18, 2008, 11:32 PM
The PIC should monitor the hall switches which will generate a Gray Code sequence as the motor rotates. All you need to do is look up the 3 bits in a table (only 6 entries are used) which provides you with the necessary on/off for each of the FETs.Andy
If I read your description correct, all the PIC is doing is the function of six AND gates plus the PWM. The PWM could be done with a simple 555 timer circuit. I guess the shoot through prevention would be another function but that could be done in a crude manner with a six input OR gate.
AndyKunz
Aug 19, 2008, 08:02 AM
Basically, yes. If it weren't for shoot-thru, you could hook up the hall outputs to the address pins on an EPROM, the data pins to the FET gates, and have a functional commutator.
Andy
Bruce Abbott
Aug 19, 2008, 10:55 AM
If the PIC is also being used for other tasks then it may be safer to have the commutation controlled externally. A PROM should work if its data outputs are latched to prevent glitches, and the PIC can provide PWM and other functions (eg. direction control, current limiting).
However, the implementation could be quite tricky and you will need at least 2 extra chips, so it might be easier to use a dedicated driver chip such as the NJM2624 (http://mediasolution.jp/njr/hp/productDetail.do?_isTopPage=false&_productId=378&_moveKbn=PRODUCT_DETAIL_MOVE_SPEC) ($1.77 at Digikey (http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=NJM2624AD-ND)). I made a sensored controller (http://homepages.paradise.net.nz/bhabbott/sensored.html) using an NJM2624 and PIC10F206. It runs a stock CDROM motor which has built-in analog hall sensors. The only tricky part was determining the correct wiring sequence for the Hall sensors (there are several possibilities for both order and polarity, and no standard!). If your Hall sensors have logic level outputs then it should be easier to figure out the correct sequence, but you will need a few resistors on each Hall Amp input to convert the signal from digital to analog.
mjsas
Aug 22, 2008, 10:47 PM
Basically, yes. If it weren't for shoot-thru, you could hook up the hall outputs to the address pins on an EPROM, the data pins to the FET gates, and have a functional commutator.
Andy
If something like the IR2130 FET driver is used it has shoot-thru protection.
duhh
Aug 28, 2008, 01:59 AM
Hey Thnxx for al answers. I have looked into the device 74xx138
well I think I want a quad 2 input logic and gate and use three of them but the output is far to low to drive anny mosfets so after looking into it a bit more I think now I will use the TC4468 witch is both (i think) a logic and gate and a mosfet driver ..
Can annyone confirm this for me ??
I want to do the deadtime control etc. within the code of the pic.
so on one "2 input logic and gate" I have one pic output and the pwm channel .. when both are high the mosfet will be set open ..
want to use a TC4469 for the P channel just like is done in the famos appnote an857 from microchip.
duhh
Sep 21, 2008, 12:39 PM
well a lot has been doe :) my motor is actually rotoating but is doensn`t really commutate`s yet as my hall sensores seems to be giving me -0.9 Volt, 0 Volt or +0.9 Volt. And I ony have three digital input pins for them ...
Does anny one of a way I could use these signals for input to my pic16F88 ?
youtube (http://www.youtube.com/v/jKywgDrO1Dc)
Bruce Abbott
Sep 27, 2008, 10:30 AM
well a lot has been doe :) my motor is actually rotating but is doesn't really commutate`s yet as my hall sensors seems to be giving me -0.9 Volt, 0 Volt or +0.9 Volt. And I only have three digital input pins for them ...
Does any one know of a way I could use these signals for input to my pic16F88 ?
You sensors are analog (they produce a differential output signal proportional to a magnetic field). You need to convert the analog signals to digital. This can be done using 3 opamps, with a small amount of positive feedback to make sure that the outputs 'snap' fully on or off as the magnets pass over the Hall sensors (see circuit below). The 220 Ohm resistor (marked R2 on your PCB) supplies current to activate the Hall sensors. Note that the sensors are connected in series, so they all receive the same current but their output voltages are different (there also appears to be another resistor connected from the bottom Hall sensor to Ground, but it's partially obscured so I can't see its value).
The opamp's input common-mode range must be sufficient to handle the different output voltages from the sensors. An LMC6682 is OK since it has rail-to-rail inputs. An LM324's inputs can only go up to Vcc - 1.5V, so the upper opamp may not work properly.
vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.