I Need an Arduino Genius to Solve this Puzzle

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
i-make-robots
 
Posts: 47
Joined: Sun Mar 11, 2012 1:52 pm

I Need an Arduino Genius to Solve this Puzzle

Post by i-make-robots »

http://www.marginallyclever.com/2012/04 ... is-puzzle/
http://arduino.cc/forum/index.php/topic,99886.0.html

Hardware

I have an open source wall-hanging drawbot build on an arduino with an adafruit motor shield connected to two NEMA17 steppers (for XY motion) and a hobby servo (for Z). Arduino board minimum requirement is Due328.

Software

I use FrequencyTimer2 to control a timer interrupt on timer2. I communicate with a Java app over Serial, which I’m told uses timer0. The servo PWM is done on timer1. I tell the steppers to move at a constant speed and they do, emitting a hum. However....

Symptoms

1. FrequencyTimer2 ruins the PWM on pins 9 and 10 on a mega which are the two pins used for servo on the shield. I’m looking for a lib that will make it easy to create timer interrupts (takes care of board-specific issues) and that doesn’t screw with pins 9 & 10. I’m willing to use ServoTimer2 if I can switch the FrequencyTimer to use timer1. Do you know of one?

2. If If the Arduino receives serial data while this is happening I can hear breaks in the hum, which tells me I am losing steps over time.

3. If I try to send too much serial data from the Arduino the program is likely to hang.

So…. what’s my problem?

I really want this to work on Duemilanove 328s, mega 2560s, and UNOs. Unfortunately the timer stuff is getting way past my level of expertise.

Please, geniuses of Arduino! Can you tell me how to make this work?

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: I Need an Arduino Genius to Solve this Puzzle

Post by zener »

You should post on the Arduino forum since there are more Arduino Geniousus there. But I have a little experience. One of the problems with some o fthe Arduino libraries is they don't do things the best way they could, and some don't play well together. There are 2 kinds of serial ports: hardware and software. The hardware ones are basically like a co-processor so they don't disturb your code loop at all, you just write a byte and they do the rest in the background. The software kind are called bit banging. Since they do everything in software they interrupt your loop a lot and slow it down. You want the first kind but it sounds like your library is using the second kind. Good luck!

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

Return to “General Project help”