Baby-O 18V25CS motor driver for sensored motor

I wondered whether a stepper motor could spin really fast. For this purpose I have built my own 12 teeth stator with North and South poles alternating. The cage has 12 magnets too, also North and South alternating. The motor has to be flipped over to start.
For safety reasons I use the Overflow interrupt of Timer0 to cut the power, in this manner there is no power to the outputs when the motor is “stalled” The motor interrupt counts the number of turns and resets the overflow timer, it never fires until the motor is stalled.
For controlling the pwm I use Timer2 at a rate of 10 kHz, the M2A output is used towards the PWMH input, a hardware jumper allows a duplicate signal to PWML.
The Rx input (counts) was captured through Timer1 input capture as explained in an earlier post.
The HALL sensor gets the power directly from the processor on port PD7 and PD4, PD2 (INT0) is used for the external interrupt. I made a counter that gives the DIR change a little slack to reduce the induction from the coils.
The motor spins really fast, with a 11000 NO LOAD rpm the DIR changes at 2200Hz, at 50 Watts it spins a prop at 6000 rpm which is comparable to a classic motor. A short demo is available at Youtube, search for Pololu POC

	if ( turns <= 3) // Motor is NOT running, keeps motor OFF before started by hand
	{ OCR2A = 0; } // set duty cycles for brake
	turns = 0;

	turns = ( turns + 1 ); // count number of turns running
	if ( turns >= 3)
	OCR2A = 0; TCNT0 = 0; // give DIR change some slack, reset overflow timer
		if ( (PIND & (1 << DDD2)) == 0 ) // if HALL is LOW
		{ PORTB &= ~(1 << DDB4); } // drive DIR pin PB4 LOW
		{ PORTB |=  (1 << DDB4); } // drive DIR pin PB4 HIGH
	OCR2A = (counts); // put the power back on
	if ( turns >= 100 ) { turns = 10; } // prevents overflow

Baby-O muscle power pictures.pdf (514 KB)

Hi, Erik,

Do you have any close-up pictures of the motor?

- Jan

The HALL sensor is visible on the edge, it is glued to a PCB which on its turn is glued to a piece of wood. This can rotate along the shaft so I can give the sensor a little advance. The m3 bolt has two black markings, the rpm is the highest within this bandwith, a litte earlier and the motor drops rpm, a little further away too. It seems that the position of the HALL sensor is good within 1mm which is easy to build.

The cage has 12 magnets and is originally a kit purchased from

The komodo I used is a 2805. There is a detailed user manual on this site available.