PIC24 Camera Stabilizer - Enough Horsepower?

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
eperrin
 
Posts: 6
Joined: Sun Feb 05, 2012 10:51 pm

PIC24 Camera Stabilizer - Enough Horsepower?

Post by eperrin »

Hi all,

I'm in the early design stages of a gyroscopic camera stabilizer. The idea is to mount the camera on a 3-axis motorized gymbal with a gyroscope to measure the camera shake, then actuate the gymbal to smooth out the vibration. I'm certainly not the first person to come up with this concept and don't claim to be.

I've chosen the STMicro L3GD20 3 axis gyro, available as an Adafruit breakout. For the MCU looking at the PIC24F series, 32Mhz 16MIPS full tilt. Would there be enough horsepower to:
  • sample the 16 bit values for each of the three axes continuously at 800hz
  • Perform some basic average/smoothing algorithm on the data
  • Calculate the required motor calculations for each axis
  • Update the motor positions at 50-60hz or so, for each axis
Can this be done in a PIC24, or should I look for a dsPIC or PIC32?

Thanks for any suggestions.

BudgetEngineer

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by adafruit_support_mike »

While I can't say from direct experience that it can be done, I doubt you'd have any problems.

A quick back-of-the-envelope calculation says a 32MHz processor will have about 40,000 clock cycles per 800Hz sampling period, which drops to about 2500 cycles for each of 16 values. Assuming a motor refresh rate of 80Hz to make the math simpler would give you about 400,000 cycles per update period, and about 130,000 cycles per axis.

You can do a lot with that much headroom.

Our stuff is generally designed to work with the Arduino, which uses a 16MHz base clock. Taking the differences between PIC and Atmel architectures into account, a 32MHz PIC should have roughly the same amount of oomph.

Fpex
 
Posts: 4
Joined: Sat May 04, 2013 5:29 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by Fpex »

Just curious, did you manage to build one?

User avatar
eperrin
 
Posts: 6
Joined: Sun Feb 05, 2012 10:51 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by eperrin »

The PCBs were just placed at OSH Park, should have them in two weeks. Here are a few images while I figure out how to post the eagle files to Github and get a blog post going.

Current devices include:
  • Pic32MX150128D
  • 512k EEPROM
  • L3G4200D gyro
  • Roving Networks RN-41 bluetooth radio for RC support
  • 4 PWM servo outputs
  • 4 switch breakouts
  • 5-way tactile joystick header
  • Newhaven Display 160x100 chip-on-glass LCD module
  • Board Dimensions: 1.5 x 2.0"
Image

Image

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by adafruit_support_mike »

Very nice. Post some photos of the hardware once you have it.

Fpex
 
Posts: 4
Joined: Sat May 04, 2013 5:29 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by Fpex »

Very nice, indeed.

User avatar
eperrin
 
Posts: 6
Joined: Sun Feb 05, 2012 10:51 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by eperrin »

Just a quick update - All the components have arrived, just waiting on the PCBs that should be here by Wednesday for a real post. Also have the servos on order from Hobbyking.

User avatar
eperrin
 
Posts: 6
Joined: Sun Feb 05, 2012 10:51 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by eperrin »

Small update, got the PCBs assembled and all the parts are here, just waiting for the servos to arrive. In the mean time, I have a detailed post in the works that will arrive on my blog shortly once I can find time to take some nice photos.

User avatar
eperrin
 
Posts: 6
Joined: Sun Feb 05, 2012 10:51 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by eperrin »

Ok finally got around to writing up a blog post here: http://ebperrin.BANNED.com/2013/06/2 ... tabilizer/
It's a bit dense but goes through the entire design process and there are some photos at the end. The board is talking to the computer, time to start some programming.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: PIC24 Camera Stabilizer - Enough Horsepower?

Post by adafruit_support_mike »

Nice! Thanks for sharing that.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”