There are a number of types, but the most common is the X27.168. There are a number of conflicting descriptions online and the full datasheet is hard to find (so I will attach it).
Basically what you have is very similar to what you would find in an analogue quartz clock. The differences being that the rotor has 3 sectors and the stator has two coils. This allows both forward and backward rotation using a 6 pulse sequence. A full rotation is 1080 steps (1/3° per step) so it almost looks continuous - the full rotation takes about 2 seconds(if you want to go that fast). The unit as supplied will only go through 315°, but removal of a tag makes it full rotation.
Just as a demonstration I have made a temperature gauge. To increase the degree of difficulty I am reading the outside temperature via a rf link (using a RFM69).
The gauge can be driven straight from the microprocessor pins (16F18326) no back emf protection is required because of the high resistance of the inductors. It runs quite nicely on 3V (2xAA batteries).
They are also quite cheap (especially from China).
#chip 16F18326,8#config RSTOSC=hfint1, MCLRE=Off, WDTE=off, boren=off, FEXTOSC_OFF, CLKOUTEN_OFF, CP_OFFunlockpps'Module: MSSP1RA0PPS=0x0018'SCK1 > RA0SSP1CLKPPS=0x0000'RA0 > SCK1 (bi-directional)RA2PPS=0x0019'SDO1 > RA2SSP1DATPPS=0x0003'RA3 > SDI1'Module: MSSP2 ***********************only for testing rx*******'RC2PPS = 0x001A 'SCK2>RC2'SSP2CLKPPS = 0x0012 'RC2>SCK2(bi-directional)'RC1PPS = 0x001B 'SDA2>RC1'SSP2DATPPS = 0x0011 'RC1>SDA2(bi-directional)lockppstrisc=b'00000000''pointer pins c.0,c.1,c.2,c.3latc=b'00000000'k1=3inipoint'get pointer in phase!dimid8,id9asworddimtt,tt40out,tempword,humword,qt,tttasworddima1,a2,a3,a4,a4old,ttoldasWORDdima5,a6,a7aswordwait1seca4old=0'20 deg Ca4=0mov=0a7=0a1=0ttt=2338ttold=2338'20 deg set pointer#define HWSPIMode MasterSSPADDMode 'is this necessary?SPIModeMastersspaddmode,0'initialize spicpha=0:cpol=0'dont think this is needed - belt and braces!'set SPI pinsdirporta.1out'chip selectsetporta.1on'unselectdirporta.3in'sdidirporta.2out'sdodirporta.0out'clkdirporta.4in'clock xtaldirporta.5in'pinsintcon.6=1'enable interruptst0con0=b'10011110''15:1 post scaler(bits3-0=1110) bit4(=1-->16) 16/8 bit'bit7 enabled't0con1=b'11011011' '1:2048't0con1=b'11010011' '1:84minutes't0con1=b'11010000' '1:130sect0con1=b'11010001''1 min'bits 7-5 110= SOCS,bit4=0 not sync with clk'bits 3-0 =0001 2:1 pre-scaler --> 1 min (with 15:1 post-scale)'t0con1=b'11010010' '1:42minstmr0h=b'00000000'tmr0l=b'00000000'pie0.5=1'enable t0 overflow intpir0.5=0'int resetini_rfm69dospiwrite(0x01,0x04)'stndbywait1msspiwrite(0x28,0x10)'clear fifo for data'wait 200 ms 'newdelayrx_rfm69'start receivingwait1ms'new delaydospiread(0x24,rssidat)ifrssidat<205thenexitdo'check Tx really readywait10uslooppir0.5=0dospiread(0x28,fifordy)if(fifordyand0x04)=0x04thenexitdo'fifo data ready?wait50usloopwait100us'wait 1 ms'spiread(0x24,rssidat)rxpacket_rfm69spiwrite(0x01,0x00)'sleep rfm69tmr0h=b'00000000''delay so we dont miss the transmission was 00000011tmr0l=b'10000000''is it long enough??'tz1 tz2sht40outpointervregpm=1'not for LF modelsleep'pic16f18326vregpm=0noppir0.5=0'reset interrupt flagloopsubpointerifttold=tttthenreturnifttold<tttthena4=ttt-ttold:mov=1ifttold>tttthena4=ttold-ttt:mov=0ttold=tttifa4=0thenreturnifmov=0thenpoint_acwifmov=1thenpoint_cwendsubsubpoint_cwdok1=k1+1a4=a4-1ifk1=7thenk1=1readtablepulses,k1,coutlatc=coutwait2msifa4=0thenexitdoloopwait5ms'make sure pointer stopslatc=0endsubsubpoint_acwdok1=k1-1a4=a4-1ifk1=0thenk1=6readtablepulses,k1,coutlatc=coutwait2msifa4=0thenexitdoloopwait5mslatc=0endsubsubinipointrepeat36k1=k1+1'cw rotation 19-20 degifk1=7thenk1=1readtablepulses,k1,coutlatc=coutwait5mslatc=0wait10msendrepeatlatc=coutwait10sec'hold to mount pointerlatc=0endsubtablepulses'6 pulse sequence for 2 deg rotb'00000101''each step 1/3 deg (angle - not temperature)b'00000001'b'00001000'b'00001010'b'00000010'b'00000100'endtablesubsht40out'sht40 highbyte 1sttempword=tz2tempword_h=tz1tempword=tempword+6'round uptt=tempword/4+tempword/59+tempword/10000'temp*100ttt=tempword/11+tempword/192'temp*36 for gaugeqt=tt/10iftt<4501thentt40out=4500-tt:st40out=1iftt>4500thentt40out=tt-4500:st40out=0humword=hz2humword_h=hz1hh40out=(humword/5+humword/107)-600'ttt is the value!endsubsubini_rfm69spiwrite(0x07,0x6c)'frequencyspiwrite(0x08,0x80)'setspiwrite(0x09,0x00)'//434MHz'reg value/16384 = f in MHzspiwrite(0x02,0x00)'//RegDataModul FSK Packetspiwrite(0x05,0x02)'//RegFdevMsb 241*61Hz = 35.2KHzspiwrite(0x06,0x41)'//RegFdevLsbspiwrite(0x03,0x03)'//RegBitrateMsb 32MHz/0x06 10 = 38.4kpbsspiwrite(0x04,0x41)'//RegBitrateLsb'spiwrite(0x03,0x01) '//RegBitrateMsb32MHz/0x0610=76.8kpbs'spiwrite(0x04,0xA1) '//RegBitrateLsbspiwrite(0x13,0x0F)'//RegOcp Disable OCP'spiwrite(0x18,0x81) '//RegLNA-maxgain200Rspiwrite(0x18,0x01)'50 ohms max gain'spiwrite(0x19,0x52) '//RegRxBwRxBW83KHzspiwrite(0x19,0x4A)'//RegRxBw adj this RxBW 100KHz'If these are wide enough it does not seem to matter'maybe with near channel interference it should be set as low as possible?spiwrite(0x2C,0x00)'//RegPreambleMsbspiwrite(0x2D,0x02)'//RegPreambleLsb 2Byte Preamblespiwrite(0x2E,0x90)'//enable Sync.Word 2+1=3bytesspiwrite(0x25,0x03)'// DIO mapping1 DIO3-->PLL lockSPIWrite(0x29,0xC8)'// RegRssiThresh 200spiwrite(0x2F,0xDA)'//1st byte SyncWord = DA 71 D8spiwrite(0x30,0x71)'//sync word 2nd bytespiwrite(0x31,0xD8)'//sync word 3rd bytespiwrite(0x37,0x08)'//RegPacketConfig1 Disable CRC ,NRZ encodespiwrite(0x38,0x04)'//RegPayloadLength 4 bytes for length & Fixed lengthspiwrite(0x58,0x1B)'//RegTestLna Normal sensitivityspiwrite(0x58,0x2D)'// high sensspiwrite(0x6F,0x30)'//RegTestDAGC Improved DAGCspiwrite(0x01,0x04)'//??Standbyendsubsubspiwrite(addr1,dat1)setporta.1offaddrw=addr1or0x80FastHWSPITransferaddrw'writeFastHWSPITransferdat1setporta.1onendsubsubspiread(addr2,dat2)setporta.1offfasthwspitransferaddr2'read regspitransfer0x00,dat2setporta.1on'deselectendsubsubrx_rfm69'spiwrite(0x11,0x9F) '//RegPaLevelFifoInforRx'spiwrite(0x25,0x44) '//DIOMappingforRxspiwrite(0x5A,0x55)'//Normal and TRxspiwrite(0x5C,0x70)'//Normal and TRxspiwrite(0x01,0x10)'//Entry to Rxdospiread(0x27,rxdat)if(rxdatand0xC0)=0xC0thenexitdo'check for rx readywait1msloopendsubsubclrfifo_rfm69'not neededSPIWrite(0x01,0x04)'//Entry Standby ModeSPIWrite(0x01,0x10)'//Change to Rx ModeendsubsubRxPacket_rfm69'spiread(0x24,rssidat)SPIRead(0x00,tz1)'temperaturespiread(0x00,tz2)spiread(0x00,hz1)'humidityspiread(0x00,hz2)'spiread(0x24,rssidat)endsub
I've been doing further experiments. I got some VID29-07 steppers. They seem better constructed than the x21768, but they work in exactly the same way - a 6 pulse sequence for 2 degrees.
I tried shaped pulses (using PWM) but it did not seem to make any difference to the performance.
The thing that does make a difference is that the pulses that energize two coils should be half the length of the other pulses (I'm using 1.5 ms and 3 ms for the short and long) seems to be much smoother.
So I've made a barometer. The detector is a LPS22HB. I have attached a photo the main dial is showing the atmospheric pressure in millibars; the smaller dial is showing the change in pressure (over the last 3 hours) - this is apparently important for weather determinations.
So the reading is about 1010 mb and the pressure is falling slowly (0.5 mb/3hr).
There are also steppers of this type with two concentric shafts VID28-05 (aka BKA30D-R5).
I have made a temperature gauge that shows both inside and outside temperatures.
Attached is a picture of the gauge and that of the double stepper motor (note the large number of cogs - this give rise to lash and some inaccuracy). It would seem I can only load one picture per post so the cogs will have to wait.
There are a number of types, but the most common is the X27.168. There are a number of conflicting descriptions online and the full datasheet is hard to find (so I will attach it).
Basically what you have is very similar to what you would find in an analogue quartz clock. The differences being that the rotor has 3 sectors and the stator has two coils. This allows both forward and backward rotation using a 6 pulse sequence. A full rotation is 1080 steps (1/3° per step) so it almost looks continuous - the full rotation takes about 2 seconds(if you want to go that fast). The unit as supplied will only go through 315°, but removal of a tag makes it full rotation.
Just as a demonstration I have made a temperature gauge. To increase the degree of difficulty I am reading the outside temperature via a rf link (using a RFM69).
The gauge can be driven straight from the microprocessor pins (16F18326) no back emf protection is required because of the high resistance of the inductors. It runs quite nicely on 3V (2xAA batteries).
They are also quite cheap (especially from China).
Here's the code and attached is the datasheet.
I've been doing further experiments. I got some VID29-07 steppers. They seem better constructed than the x21768, but they work in exactly the same way - a 6 pulse sequence for 2 degrees.
I tried shaped pulses (using PWM) but it did not seem to make any difference to the performance.
The thing that does make a difference is that the pulses that energize two coils should be half the length of the other pulses (I'm using 1.5 ms and 3 ms for the short and long) seems to be much smoother.
So I've made a barometer. The detector is a LPS22HB. I have attached a photo the main dial is showing the atmospheric pressure in millibars; the smaller dial is showing the change in pressure (over the last 3 hours) - this is apparently important for weather determinations.
So the reading is about 1010 mb and the pressure is falling slowly (0.5 mb/3hr).
There are also steppers of this type with two concentric shafts VID28-05 (aka BKA30D-R5).
I have made a temperature gauge that shows both inside and outside temperatures.
Attached is a picture of the gauge and that of the double stepper motor (note the large number of cogs - this give rise to lash and some inaccuracy). It would seem I can only load one picture per post so the cogs will have to wait.
Here's a picture with the top removed to reveal the two steppers and a mass of cogs.