Arduino reading multiple sensors and controlling esc's not enough pins

Hi there,

I am currently working on a school project, and I want to build a drone together with a classmate. I have experience with Arduinos, programming soldering etc for smaller projects, but this time we want to build a drone.

I have ordered all the parts I need, but I run into a bit of a problem. We want to build a drone, with a safety system depending on multiple ultrasonic sensors. But I will run out of pins when I want to use the following items:

4 * 30 A ESC
6 * UltraSonic Sensor
1 * NRF24L01
1 * GY-521

Because of space concerns, I don't want to use an Arduino Mega. But I need the pins from it, do you have any suggestions on how I can make this project happen with preferably an Arduino uno?

I have read articles and forum posts about extending Arduino pins, but I am not sure if it will work for my project because I need to read a lot of inputs, and from what I read shift registers are not up for that task (correct me if I am wrong).

Is there someone who give me advise on how I can make it happen?

Did you also count the analogue pins?

They are just digital pins, with the added functionality of analogue-in.

digitalWrite (A1, HIGH); // works

Note that this does not apply for A6 and A7 of a Nano.
Leo..

Don’t forget the MCP23017 port expander.

As its for a drone weight will be important. Have you consiidered using a nano or pro micro whaich all seem to have enough connectivity?

Thank you all for reacting.

When I do a little calculation, I need 23 signal pins if I am correct.

(6 UltraSonic Senors) 6 * 2 pins (for echo and trigger)
(4 ESCs) 4 * 1 pin (only the signal wire)
(1 GY-521) 1 * 2 pins
(1 nRF24L01) 1 * 5 pins

That makes a total of 23 pins needed, and the Arduino Uno (including the analogue pins) does not have enough pins.

johnerrington:
As its for a drone weight will be important. Have you consiidered using a nano or pro micro whaich all seem to have enough connectivity?

As johnerrington said, weight is important, I am sure that we will succeed with the weight (we have a lot of headroom) but as light as possible would be nice, But due to the lack of pins of a nano I don't think it will be the best chose (although I would like it if it works with a nano).

Does anyone have experience with the MCP23017 as suggested?

SteveMann:
Don't forget the MCP23017 port expander.

It would be ideal if the MCP23017 in combination with an Arduino Nano will have enough pins. But I am not sure if it will work well with all the sensors?