NXT high power motor controller

There is no ready-made solution for the NXT to run high power motors, like buggy motors, or multiple NXT motors on one channel.

I needed speed and direction control, and more current than the 1A H-Bridges in the NXT can handle.

I briefly considered using an RC style ESC.
– Could supply super high current

– It would require a servo controller to operate.
– It would only have preprogrammed functions.
– I would need one that supports reverse.

I had a couple SN754410 1A Motor driver IC’s, so I decided to make my own controller.

I considered using a motor port for the signals.
– It would take care of the PWM generation as well as the direction.
– It would simplify the design.

– It would use a motor port, which can be in very high demand.
– It would only allow braking PWM speed control, and no floating.

I ended up using a PICAXE 20X2 as an I2C slave. I have it generate the PWM and direction signals.
– It uses a sensor port.
– It is I2C, so almost any U-Controller could control it (not just NXT).
– It uses floating PWM speed control (uses less power).
– It has full PWM braking (you can choose how hard it applies the brake).
– It is extremely customizable.
– I could use the 20X2 for other tasks (ADC etc.) at the same time.
– I had to have room for a DIP 20 package on the controller.
– Took a little time to program (although I loved doing it).

The design is very basic and was fairly straight-forward to build. The only components needed, are the PICAXE (and two resistors to keep the serial input from floating), the SN754410 H-Bridge, and mindsensors breakouts. The PICAXE has internal I2C pullups, so I don’t need external ones. The NXT sensor port supplies the power for the logic. The SN754410 is a 1A dual H-Bridge, so I put both sides in parallel to get 2A.

The part of design that took the longest, was making the PICAXE program. I made many versions that used different logic, and finally settled on the one that suited me best.

Here is the PICAXE BASIC program:

setfreq m8                       'Make sure it is running at 8mHz clock speed
hi2csetup i2cslave, %00110000    'Set the I2C address


	symbol PWM_PIN = C.5
	symbol CON_PIN_0 = C.0
	symbol CON_PIN_1 = C.1
	symbol PWM_VALUE = b0
	symbol MOTOR_CON = b1
	symbol PWM_ON = b2
	pullup %10100000                'No external pullups needed.
	pwmout pwmdiv4, PWM_PIN, 63, 0  'Initialize the PWM


	get 66,MOTOR_CON                'Read the direction from the I2C register
	get 67,PWM_VALUE                'Read the PWM power from the I2C register

	if MOTOR_CON = 0 then
		if PWM_VALUE >= 252 then
			high PWM_PIN
			if PWM_ON = 0 then
				pwmout pwmdiv4, PWM_PIN, 63, PWM_VALUE
				PWM_ON = 1
			pwmduty PWM_PIN, PWM_VALUE
		if MOTOR_CON = 3 then
			low CON_PIN_0,CON_PIN_1
			if MOTOR_CON = 1 then
				low CON_PIN_0
				high CON_PIN_1
				if MOTOR_CON = 2 then
					low CON_PIN_1
					high CON_PIN_0
Goto main

Here are a few pictures of the controller on twister 2.0:

Here is the schematic (updated 5/13/11):

This entry was posted in Electronics, Mindsensors, Mindstorms, NXT, PICAXE and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s