Pages: [1]   Go Down
Author Topic: Will two Arduinos work better for the multi-tesks project  (Read 360 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone

My friends and I are currently working one a Tricoptor project. And our original goal is to have an 100Hz update rate( Which we find impossible on AVR later). While tuning PID, we found that our system only maintain an update rate about 30Hz, Which is a little bit not   enough.

I'm wondering that, beside using Arduino DUE to gain faster update rate. Will using two Arduino like MEGA+NANO be an option? If so, how should I divide my code to get better performance. Our project currently have five part: receiving control signal( by Serial through wireless ), getting MPU 6050's signal( by I2C), PID calculating and ESC& servo signal output.

Although I think divide the whole process into two Arduino is a workable plan, but I have no clue on which part should I divide, It will be great idea if anyone can give me an suggestion.     
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26474
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If so, how should I divide my code to get better performance.
Put lines 100 to 237 on processor 1, and all the rest on processor 2.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Sitting in the garage.
Offline Offline
Sr. Member
****
Karma: 4
Posts: 461
I made the pretty light blink.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you make it 100 to 238, then you can take advantage of the Parson's coefficient.  Might help with speed.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26474
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

{ nods sagely }
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Put lines 100 to 237 on processor 1, and all the rest on processor 2.
Is this even possible? All I know is I can put different calculation to different processor. Can I ignore the structure and divide it by lines?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is an Ardu-IMU project which gives you a self-contained solution to manage the IMU and take care of all the complex number crunching required to deal with that. That would give you a known efficient working solution for the most complex part of your project, leaving your main Arduino and whatever sketch you're running on it to just deal with the closed loop control algorithm. You'll need to read up on the Ardu-IMU and see what sort of update frequency it can achieve - your 100 Hz target seems pretty hard to me, but perhaps it's possible; if not, re-check the analysis that told you 100Hz was necessary, because you may have set the requirements harder than they need to be.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 34510
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Put lines 100 to 237 on processor 1, and all the rest on processor 2.
Is this even possible? All I know is I can put different calculation to different processor. Can I ignore the structure and divide it by lines?
They are taking the piss because of your piss poor question. No detailes no sensible answer.

Quote
getting MPU 6050's signal( by I2C),
That is your bottle neck use the I2C master libary, this allows you to up the speed of the bus to 400KHz and beyond if your device can take it. You have got pull up resistors on the bus lines haven't you?
Forget two processors.
Logged

0
Offline Offline
Sr. Member
****
Karma: 8
Posts: 394
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
While tuning PID, we found that our system only maintain an update rate about 30Hz, Which is a little bit not   enough.

The first rule of performance tuning: find out where the time is spent.  Actually this rule  is also rules 2,3,4,5,6,7,8,9, etc.
Do not guess!  Human intuition on computer performance is very unreliable.  Measure, measure, measure!

For the Arduino simply have a few long variables, e.g.  loopStart, loopMid, LoopWhatever, .,,.
Assign loopStart = micros();  and so forth.  At the end of the loop print the values (not in the loop!).
By this method you will find the actual bottleneck - not somebody's guess.

I did performance tuning for a living, I ALWAYS start with rule #1.

Joe




Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 34510
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I did performance tuning for a living, I ALWAYS start with rule #1.
I would rather start with rule #4.  smiley-wink
Logged

Pages: [1]   Go Up
Jump to: