I am making a new drone once again and one of my conclusions of my previous drone was that it was a little bit to slow to handle PID, radio and everything else, so my plan this time is to have two arduinos, one that recives the data from my remote, and one that does all the logic and gets the data from the IMU.
I have tried this method of data transfer from my reciver to the main arduino:
float toSendDataArray[5]; // Change the size and data types as needed
void setup() {
toSendDataArray[0] = 1000.0; // Use floating-point values instead of strings
toSendDataArray[1] = 0.0;
toSendDataArray[2] = 0.0;
toSendDataArray[3] = 0.0;
toSendDataArray[4] = 1.0;
Serial.begin(115200);
}
void loop() {
Serial.write((uint8_t*)toSendDataArray, sizeof(toSendDataArray));
delay(10);
}
And this on the main arduino:
if (Serial.available() >= sizeof(recivedDataArray)) {
Serial.readBytes((char*)recivedDataArray, sizeof(recivedDataArray));
previousMessageMillis = millis();
// Print the received data
for (byte i = 0; i < sizeof(recivedDataArray) / sizeof(float); i++) {
Serial.print(recivedDataArray[i], 2); // Print each float value with 2 decimal places
Serial.print(" ");
}
Serial.println(); // Print a newline for formatting
}
What do you recommend as a faster arduino? Now I am using two pro mini 5v? What alternativs are there that arent massivly big. I have a Mega and some Unos, are those the only options?
A question to the proffesionals, so I have always had a hard time with the NRF24 communication, it doesnt seem super reliable, on the other hand, is HTTP an option? To have some kind of SIM card and use a webserver on the arduino to have event based controlling of the drone? What are your thoughts?
You said you were going for speed. This would be slower would it not? There would be more bytes to transmit.
What happened to wanting it to be fast? None of this sounds fast at all.
This is true. Making the system more complicated will make it slower, not faster. Perhaps you should let someone help you to improve that other code before you go and split it to two MCUs and make it worse.
The drone worked "okay", but the radio lost connection every now and then. The stabilization often worked but my hypotheses is that when things started to take a lot of time it started wobbling every now and then. But can ofcourse also be my PID that is not calibrated perfecly.
You know what they call it when you start developing off of an untested hypothesis don't you? It's called a waste of time. You could be making the problem worse or not affecting it at all because you don't know what the problem is. Save yourself some time and frustration and make sure that this is even your problem before you go and do a bunch of work that may be a waste.