I’ve opened up two sacrificial motors, and they definitely seem to have some sort of on-board Hall effect sensors. I haven’t looked for the pinout yet, but chips were all labelled 1036 for one of the motors, and J588m for the other one. Google turns up nothing about these (that I can find).
The motor connector has eight pins, three of which are used up by the motor windings A, B, and C. That means two of the remaining pins are probably VCC and GND. The last three pins must be the Hall sensor outputs.
Currently, I’ve only got the motor running in open loop. That results in a working, but pretty crappy rotation. When I have some time, I’ll grab the feedback, and close the motor loop. Here’s the PIC code I have right now:
#include <htc.h> //Int osc, wdt, mclr disabled, bor, fscm __CONFIG(0x3BD4); #ifndef _XTAL_FREQ #define _XTAL_FREQ 4000000 #endif //Pres butan #define PITCHFW RA4 #define PITCHRV RA3 #define YAWFW RA2 #define YAWRV RA5 //Outputs //Motor variables (RC0, RC1, ETC) #define PITCHA 0 #define PITCHB 1 #define PITCHC 2 #define FLOATA 3 #define FLOATB 4 #define FLOATC 5 //String constants #define PITCHMOTOR 1 #define YAWMOTOR 0 //AC', AB', B'C, A'C, A'B, BC' #define FORWARD 0 //BC', A'B, A'C, B'C, AB', AC' #define REVERSE 1 unsigned char iPortCValue, iPitchStep, iYawStep; void set_bit(unsigned char iAddress, unsigned char bBit) { iPortCValue |= (1<<bBit); PORTC = iPortCValue; } void clear_bit(unsigned char iAddress, unsigned char bBit) { iPortCValue &= ~(1<<bBit); PORTC = iPortCValue; } void delay_motor(void) { unsigned char i, e; for (e = 0; e < 6; e++) { for(i = 0; i < 170; i++) { asm (" nop "); //__delay_ms(1); } CLRWDT(); } } void move(unsigned char iDirection) { delay_motor(); //AC', AB', B'C, A'C, A'B, BC' switch (iPitchStep % 6) { case 0: //AC' AB'C' PORTC = 0x29; break; case 1: //AB' AB'C PORTC = 0x19; break; case 2: //B'C A'B'C PORTC = 0x34; break; case 3: //A'C A'BC PORTC = 0x2C; break; case 4: //A'B A'BC' PORTC = 0x1A; break; case 5: //BC' ABC' PORTC = 0x02; break; } if(iDirection == 1) { iPitchStep++; } else { iPitchStep--; } } void main(void){ OSCCON = 0xF1; //Internal osc TRISC = 0x00; //Port C Tris output TRISA = 0xFF; //Port A Tris input iPortCValue = 0; iPitchStep = 0; iYawStep = 0; int i = 0; while(1){ //if(RA2 == 1) { for (i = 0; i < 36; i++) { if(RA5 == 1) { move(1); } else if (RA4 == 1) { move(0); } } for (i = 0; i < 200; i++) { delay_motor(); } //} } }