Working out arduino capability in relation to processing speed for a UAV

Hi

For one of my university modules we need to design a fixed wing UAV with a flight computer using arduino uno. We have been given a few ideas as to what we can do as follows:

  • Record multiple parameters and use one or two to control the aircraft in a simple manner (constant pressure altitude, constant heading, level flight etc.)
  • Record and use multiple parameters during the flight (loiter at a constant pressure altitude, follow GPS waypoints etc.)

But we have been told that we cannot do everything with the components we have and we need to work out a trade-off between Arduino capability, what can be achieved and processing speed. I began by looking at the data sheets and manuals for the sensors we were given to work out which pins were needed on the arduino and found out that some needed the same pins which led to the first limitation. But now I can't work out how the design is limited by processing speed, I know the processing speed of the arduino uno is 16MHz but how does this relate to what I am able to do? Is there some sort of max processes each sensor can perform per second and if so how do I work this out?

Sorry if this seems like a stupid question, I'm fairly new to all this. Thanks for any help

skelleyboner: I know the processing speed of the arduino uno is 16MHz but how does this relate to what I am able to do?

That means you can execute 16 million instructions (not lines of code but machine instructions) per second. So if you have to do for instance some complicated calculations and those take a lot of cycles but it has to be done at least once a second it might not work out.

When you say things used the same pins and that led to a limitation, what pins and for what purpose? There are some thing, like the SPI bus or the I2C bus where many many things are supposed to share the same pins.

When I was talking about sharing the same pins I meant for example I have an Adafruit Triple Axis Gyro Breakout and an LSM303 Accelerometer which both need to be plugged into analog 4 and 5. I also have an Adafruit Ultimate GPS Logger Shield which just plugs into the whole top of the arduino using I think all of the pins.

skelleyboner: When I was talking about sharing the same pins I meant for example I have an Adafruit Triple Axis Gyro Breakout and an LSM303 Accelerometer which both need to be plugged into analog 4 and 5.

Why do they need A4 and A5? What are they using those pins for? Isn't there something special about A4 and A5 on the UNO board? (Hint: Once you find the answer you can go back to my previous post and see that yes, they should share those pins.)

skelleyboner: I also have an Adafruit Ultimate GPS Logger Shield which just plugs into the whole top of the arduino using I think all of the pins.

Why do you think it uses all the pins? Did you read that in the documentation for it? Or did you assume that just because it plugs in all the way across that it must. Instead of just "thinking" something must be true, why don't you go read the documentation and find out?

those analog pins are for the I2C I wasn't sure whether you could use multiple components with the same I2C. The manuals I have for the GPS don't tell you which pins it uses to plug into but has photos showing how to wire it, in the photos it shows all pins being used. Unfortunately I do not have the GPS in front of me to look at it as this is a group project and another member has it.

I know that you can plug things into the top of the GPS but I did not know that you could plug multiple components into the same I2C. Is it possible to use multiple components in the SDA and SCL pins as well?

skelleyboner: those analog pins are for the I2C I wasn't sure whether you could use multiple components with the same I2C.

Have you looked up how I2C works? Have you searched the term "I2C". Why wonder when you can know. That answer will be VERY evident if you'll look up even the definition of I2C.

The key here, especially since this is a school project, is for you to actually go do some learning. Not just ask around on internet forums. Go look. Don't be scared. Don't be lazy. You can do it.

skelleyboner: The manuals I have for the GPS don't tell you which pins it uses to plug into but has photos showing how to wire it, in the photos it shows all pins being used. Unfortunately I do not have the GPS in front of me to look at it as this is a group project and another member has it.

Well I've got even less than you do. I don't even know exactly which shield you have.

You don't need the actual shield in front of you. You just need the internet to look up the datasheet or other documentation for it. You have that I know because you're talking to us here.

skelleyboner: I know that you can plug things into the top of the GPS but I did not know that you could plug multiple components into the same I2C. Is it possible to use multiple components in the SDA and SCL pins as well?

What are SCL and SDA? Go look up I2C. I think you need to do at least a little bit of reading for a school project. I mean if you had some question about some esoteric topic I'd be more likely to give it to you. But you're asking for the bare bones basics that if you even tried a tiny little bit you'd know.

Google I2C and read up.

I am a mechanical engineering student at university, I am more familiar with python coding and not with arduino. My last arduino project was a 2 wheeled robot where I only had to write the code and design the robot, the wiring diagram was given to us so understanding I2C was something I didnt spend time on as we were given a very limited time to complete the project. My question was more aimed towards the processing speed aspect not the I2C but thankyou for your input.

I'm just trying to help you see that the "limitation" you saw was not a limitation at all.

skelleyboner: I am a mechanical engineering student at university, I am more familiar with python coding and not with arduino. My last arduino project was a 2 wheeled robot where I only had to write the code and design the robot, the wiring diagram was given to us so understanding I2C was something I didnt spend time on as we were given a very limited time to complete the project.

So that experience with the last project somehow prevents you from spending five minutes reading up on I2C on the internet now? I mean if time is limited wouldn't it have made more sense to do that instead of spending the nearly hour and a half that you've spent on this post hoping someone would just tell you the answer?

Time was limited on the last project, I was just explaining why I did not understand I2C until now. Again, thank you for helping explain that this was not a limitation but my main enquiry was about the processing speeds and those limitations, not the pins. This is something I have spent a lot of time trying to research and find out about. I have looked through lots of things on the internet and have the arduino cookbook, neither of which helped me work out how I might be limited by processing speed. So when I asked for help here, I was not just trying to find someone to give me the answer.

How you might be limited by processor speed?

You get 16 million instructions per second.

You need to do something once per second but that thing takes 20 million cycles.

You are then limited by processor speed.

This is not the kind of thing you think about before you have an idea for a design. The process goes like this. You think of a design and from that determine how much processor power you need and then look at the processor to see if it is fast enough for that idea.

Processing speed is one thing but the speed of the I2C bus is another altogether. If devices are connected on the I2C bus that is going to be the bottleneck not the processor. Look up the standard speed for an I2C bus and work out how long it takes to transfer a byte and what the overhead in bytes is for your devices along with the number of data bytes.

This is the first week of the project, by the end of next week we have to submit a conceptual design report. This is before we have even written any code. The exact text given to us says the following:

'Not everything can be done with the components you have. There is an important trade-off between Arduino capability, what can be achieved and processing speed, I want to see how you tackle this problem'

So once I have come up with a design say for example I want to record several parameters, maintain constant pressure altitude and constant heading, how do I then work out how much processing power is needed when no code has been written so I don't know how many cycles each thing will take per second?

I then work out how much processing power is needed when no code has been written so I don’t know how many cycles each thing will take per second?

Simple - you can’t.

Grumpy_Mike: Processing speed is one thing but the speed of the I2C bus is another altogether. If devices are connected on the I2C bus that is going to be the bottleneck not the processor. Look up the standard speed for an I2C bus and work out how long it takes to transfer a byte and what the overhead in bytes is for your devices along with the number of data bytes.

Thanks this is very helpful, so I will focus on the I2C speeds.

Grumpy_Mike: Simple - you can't.

This was my initial thoughts and what was confusing me so much, thanks for clearing this up for me