selfmade I2C Servo Controller Chip

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc

Moderators: roger, 99jonathan, imaqine

selfmade I2C Servo Controller Chip

Postby s.frings » Sun Oct 23, 2011 11:53 pm

Hello all,
I like to attach more than 3 motors to my Lego computer. I think that regular R/C car servos are the most attractive ones because of their compact construction and low price. These motors are controlled by PWM signals.

For that purpose, I developed an adapter based on a cheap ATtiny2313 microcontroller. It provides an I2C input and 10 PWM outputs for regular modelcraft servo motors. There is also an activity indicator LED which can be very helpful for troubleshooting. The led blinks once during power-on and then flashes whenever the device gets addressed by the I2C bus. If you have already used the Philips PFC8574 (8 digital I/O) or PCF8591 (4 analog inputs), you will love my servo controller because it works in the same way.

Image

Schematic: http://stefanfrings.de/servocontroller/servocontroller.png
Firmware: http://stefanfrings.de/servocontroller/ServoController.hex
Source: http://stefanfrings.de/servocontroller/ServoController.c
Lejos example program: http://stefanfrings.de/servocontroller/ServoControllerTest.java

How to program the I2C interface:
Send a message of 1-10 bytes to the address 0x1E (if all address inputs are not connected). Each byte defines the PWM pulse width for one servo output.

0= switch off
30 = most left position
95 = center position
160 = most right position

Do not drive servos against their hard limits for longer time because that might damage them. Depending on the servo manufacturer, the PIN assignment may differ. The usual wire colours are:

GND = black or brown
Battery (+) = red, Voltage is usually 6V
PWM signal = orange, yellow or white

Cable connection to the NXT computer:

red = GND (no error!)
green = VCC
yellow = SCL
blue = SDA

The white and black wires are not needed. This is the analog input which is still available for whatever you want to use it.

By the way, a very similar product is available for 50 dollars on http://www.mindsensors.com. My selfmade controller costs only 5 dollars.

Please tell me if you like this.
Last edited by s.frings on Mon Oct 31, 2011 7:46 pm, edited 1 time in total.
s.frings
Active User
 
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm

Re: selfmade I2C Servo Controller Chip

Postby Rickz2020 » Fri Oct 28, 2011 12:08 am

This is amazing.

You should get a nice casing for it, some neat plugs so that you can easily connect/disconnect the cables and then sell it :)
Rickz2020
Active User
 
Posts: 121
Joined: Thu Feb 10, 2011 5:47 pm
Location: London, Earth.

Re: selfmade I2C Servo Controller Chip

Postby TechnoX » Fri Oct 28, 2011 3:57 pm

Nice project!
I'm in the thoughts of making something similar.

You have to connect the ground from the external battery to the one in the NXT, right?
To have common ground for the PWM in the servos ;)
TechnoX
Novice
 
Posts: 51
Joined: Tue May 03, 2011 5:57 pm
Location: Sweden

Re: selfmade I2C Servo Controller Chip

Postby s.frings » Fri Oct 28, 2011 6:59 pm

Yes, a common ground line is required, but separate power supplies.
s.frings
Active User
 
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm

Re: selfmade I2C Servo Controller Chip

Postby mattallen37 » Sat Oct 29, 2011 10:21 pm

Am I seeing this right? 7.2v battery directly to the servos?
Matt
mattallen37
Novice
 
Posts: 28
Joined: Thu Mar 03, 2011 7:45 am

Re: selfmade I2C Servo Controller Chip

Postby s.frings » Sun Oct 30, 2011 11:43 am

The default power supply for servos is 6V, however many servos can alos be used with 7,2 Volt. I did not try that for a longer time, I normally use a 6V AC adapter.
s.frings
Active User
 
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm

Re: selfmade I2C Servo Controller Chip

Postby mattallen37 » Sun Oct 30, 2011 5:19 pm

Okay, I didn't know that. Just be careful.
Matt
mattallen37
Novice
 
Posts: 28
Joined: Thu Mar 03, 2011 7:45 am

Re: selfmade I2C Servo Controller Chip

Postby s.frings » Fri Apr 06, 2012 11:52 am

The link to the firmware and source has changed:
http://stefanfrings.de/servocontroller/ ... roller.zip
s.frings
Active User
 
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm


Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff