Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: LRPalmer3 on March 20, 2013, 06:28:29 PM

Title: Looking for smaller Axon
Post by: LRPalmer3 on March 20, 2013, 06:28:29 PM
I'm looking for a microcontroller with a 1.5 inch (squared) footprint that can interface 4-8 servo motors, and has at least 2 ADC channels.  The Axon is just about as small as I can find, but it is still too big.

I can buy a ATTiny chip and make my own board, but I'd rather start with something off the shelf.

Suggestions?
Title: Re: Looking for smaller Axon
Post by: Azraels on March 21, 2013, 12:17:19 AM
Well you could wait for this to come out:
http://www.kickstarter.com/projects/1608192864/rfduino-iphone-bluetooth-40-arduino-compatible-boa?ref=category (http://www.kickstarter.com/projects/1608192864/rfduino-iphone-bluetooth-40-arduino-compatible-boa?ref=category)
Title: Re: Looking for smaller Axon
Post by: jwatte on March 21, 2013, 11:05:50 AM
What kind of servo motors?

A ATTiny84 sounds like it fits the bill, if the "servo motors" are really analog hobby servos driven by PWM. It can run (at 8 MHz) with no external components except possibly a pull-up resistor for reset and a decoupling capacitor across VCC/GND. You can get an appropriate socket, and solder the components to that, and then put the chip in it -- board not needed!
Title: Re: Looking for smaller Axon
Post by: LRPalmer3 on March 22, 2013, 07:15:31 AM
We'll see if the developer can actually produce those rfduino's.  I'm tempted to make that my first kickstarter donation.

I will look into the ATTiny84.  Yes, the servos are standard futaba-type stuff.  Will probably look into arduino's as well.  I might need to send data between boards, so some serial interface would be useful.
Title: Re: Looking for smaller Axon
Post by: Jon_Thompson on March 22, 2013, 08:08:15 AM
The ATTiny861 might also be worth considering before you make a final decision: http://www.atmel.com/devices/attiny861.aspx (http://www.atmel.com/devices/attiny861.aspx)
Title: Re: Looking for smaller Axon
Post by: jwatte on March 22, 2013, 12:34:17 PM
The 861 does not have enough I/O pins to drive 4-8 servos and read 2 ADCs. That's also why I suggested the Tiny84 instead of the Tiny85. (Also, needing an ADC disqualifies the really cheap ones.)
Title: Re: Looking for smaller Axon
Post by: Jon_Thompson on March 22, 2013, 03:54:49 PM
The 861 does not have enough I/O pins to drive 4-8 servos and read 2 ADCs. That's also why I suggested the Tiny84 instead of the Tiny85. (Also, needing an ADC disqualifies the really cheap ones.)
Not the ATTINY86, but the 861: 16 I/O pins, of which 11 take ADC. Just drive the servos on a timer interrupt.  ;D
Title: Re: Looking for smaller Axon
Post by: jwatte on March 23, 2013, 12:58:10 AM
Gotcha. That looks like a slightly bigger chip, and otherwise almost identical in capabilities to the Tiny84, and should also work fine as you say.

Having extra pins is always nice; especially if you can leave those for the ICSP header so those don't have to do double duty -- making sure that re-programming the chip is possible, and doesn't drive your other circuit in some weird way, is important, too :-)

I've found that the best way to drive PWM for servos is to set the 16-bit timer to tick quickly (I use 2 ticks per microsecond,) and then calculate a "breakpoint" (in time) and "output value" (for the output register) based on the state of each of the pins. Do this by sorting the PWM duration of each pin from shortest to highest, and set the output register to 0xff minus the pins that should be low at that time.
Then:
- disable interrupts
- set the output register 0xff
- read the timer as a start value
- while the current timer minus start value < next-change-time, do nothing
- set the output register to the next-change-value, and increment the pointer to the next breakpoint
- if not yet at register value 0, go back to line 4
- enable interrupts

This will generate rock solid PWM with 0.5 microsecond resolution (much better than, say, the Arduino "Servo" library) for any number of output registers (you could drive more than one register in the loop.) The cost is disabling interrupts for up to 2 milliseconds every 30 milliseconds; if you need to poll some serial input port or something that can generate more data than can be buffered in that 2 millisecond time period, you're in trouble. That's why I like the USB hardware of the Atmegas; they buffer an entire packet :-)
Title: Re: Looking for smaller Axon
Post by: Jon_Thompson on March 23, 2013, 06:39:40 AM
The 861 is also great for times when you need to set lots of options on DIP switches. I use it a lot in custom props where the customer can decide how to set things up.
Title: Re: Looking for smaller Axon
Post by: Admin on March 24, 2013, 03:09:57 PM
I'm looking for a microcontroller with a 1.5 inch (squared) footprint that can interface 4-8 servo motors, and has at least 2 ADC channels.  The Axon is just about as small as I can find, but it is still too big.
This is the smallest I got:
http://www.societyofrobots.com/axon_mote/ (http://www.societyofrobots.com/axon_mote/)

It's 1.7 inch squared, but otherwise does all that you specified.

(http://www.societyofrobots.com/axon_mote/images/axon_mote_dimensions.png)