Can APM 2.8 be used as a regular Ardunio (Uno) board?

Hi,

Sorry for this unusual / silly question, I have a Pixhawk 2.4.8 as FC already, and I’m just wondering if I can use my old APM 2.8 as a regular Ardunio (Uno) board. E.g I try to process some SR04 signal with APM 2.8 and feed to Pixhawk. Is this possible? what will be the pin definition in this case? Anyone have some doc or connection layout chart for this purpose?

Thanks.

This is what ChatGPT told me:

=======================================================

Yes, you can repurpose the APM 2.8 board (ArduPilot Mega) as a regular Arduino board, but there are some limitations and considerations to keep in mind.

The APM 2.8 board is based on the Arduino Mega 2560 platform, which means you can use it for various Arduino projects just like you would with an Arduino Mega. However, there are certain differences and limitations due to the integrated hardware and firmware designed for flight control.

Here’s what you need to consider:

  1. Pin Compatibility: The APM 2.8 board has pins that are compatible with the Arduino Mega 2560. This means you can use the standard Arduino libraries and code to interact with the pins.
  2. Firmware and Bootloader: The APM 2.8 board comes pre-loaded with ArduPilot firmware for flight control. If you want to repurpose it as an Arduino board, you might need to remove the existing firmware and bootloader, then upload a new Arduino bootloader onto the board.
  3. Resources Availability: Some pins on the APM 2.8 board might be used or reserved for specific functions in its original flight control role. Be sure to consult the APM 2.8 pinout diagram and documentation to identify which pins you can safely use for your projects.
  4. Serial Communication: If you intend to communicate between the APM 2.8 and your Pixhawk using serial communication, you should identify the available UART (serial) ports and their pinouts. Be aware that some of these might be used for flight control purposes.
  5. Signal Processing: If you’re planning to process signals from sensors like the SR04 ultrasonic sensor, you will need to identify suitable pins for input/output and power supply. Refer to the APM 2.8 pinout diagram and documentation for guidance.
  6. Voltage Levels: Ensure that the voltage levels used by your sensors are compatible with the APM 2.8 board’s input voltage range.
  7. Power Supply: Make sure to provide appropriate power to the APM 2.8 board if you’re using sensors that require power.
  8. Programming: You’ll need to use the Arduino IDE to write and upload your code onto the APM 2.8 board. Make sure to select the appropriate board type and configuration in the IDE.

For specific pin definitions and connection layouts, it’s recommended to consult the APM 2.8 pinout diagram and any available documentation from the ArduPilot community. Keep in mind that using the APM 2.8 board as a general-purpose Arduino might require some trial and error, as the board wasn’t originally designed for this purpose.

=======================================================

So my question is about (5): which pins should I use to connect to SR04?

Thanks.

which are digital pins on the APM 2.8 board diagram?

Surprisingly, ChatGPT gave you a decent answer. It’s usually terrible with highly technical questions like that (recommend not using it for ArduPilot inquiries, at a minimum).

Recommend looking at an old hwdef from a 3.5 branch or earlier.

You’ll probably have to reflash the bootloader.

It’s an Arduino Mega (not Uno) at heart.

1 Like

I’m now looking for the digital pins on the APM 2.8 board, you know where I can find a diagram?

Thanks.

Not aware of a diagram. Best I can do is this link.

Beyond this, you’ll need to find someone who still remembers (or cares enough) to provide an answer.

Or maybe this?

https://www.sparkfun.com/datasheets/DevTools/Arduino/ArduPilotMega_v12.pdf

1 Like

Thanks.

ChatGPT further told me:

=================================================

Yes, the AUX 1, 2, 3, and 4 pins on the APM 2.8 board are digital input/output pins. These pins are generally used for auxiliary functions and can be configured for various purposes such as additional digital inputs, outputs, or communication interfaces.

=================================================

So any project example to use AUX 1, 2, 3, and 4 as digital pins ?

No idea. ChatGPT sucks at tech data. Look at the schematic I found in 30 seconds of Google image searching.

1 Like

OK, I found some diagram on the web about the Aux pins:

Step 3 - Connecting and Calibrating Radio Control

and some code from ChatGPT:

=========================================

Certainly, you can repurpose the AUX 1, 2, 3, and 4 pins on the APM 2.8 board as digital pins for various projects. Here’s an example project idea that uses these pins as digital inputs to control LEDs:

Project: LED Control with APM 2.8 AUX Pins

In this project, you’ll use the AUX 1, 2, 3, and 4 pins on the APM 2.8 board as digital inputs to control individual LEDs. Each AUX pin will be connected to a push button switch, and when the button is pressed, it will turn on or off the corresponding LED.

Components Needed:

APM 2.8 board
Breadboard
LEDs (4)
220-470 ohm resistors (4)
Push button switches (4)
Jumper wires

Instructions:

Connect LEDs and Resistors:
    Connect each LED's anode (longer lead) to a digital pin (AUX 1 to AUX 4) on the APM 2.8 board through a resistor (220-470 ohms). Connect the cathode (shorter lead) of each LED to the ground (GND) pin on the APM 2.8 board.

Connect Push Button Switches:
    Connect each push button switch between the corresponding AUX pin and the ground (GND) pin on the APM 2.8 board.
    Connect a pull-up resistor (10k ohms) between each AUX pin and the supply voltage (VCC) pin (typically 5V) on the APM 2.8 board.

Upload Arduino Sketch:
    Use the Arduino IDE to write and upload a sketch that reads the status of each push button switch and controls the corresponding LED based on the button's state (pressed or released).

Here’s a simplified example code snippet to get you started:

arduino

#define AUX_PIN_1 54
#define AUX_PIN_2 55
#define AUX_PIN_3 56
#define AUX_PIN_4 57

void setup() {
  pinMode(AUX_PIN_1, INPUT_PULLUP);
  pinMode(AUX_PIN_2, INPUT_PULLUP);
  pinMode(AUX_PIN_3, INPUT_PULLUP);
  pinMode(AUX_PIN_4, INPUT_PULLUP);

  pinMode(LED_BUILTIN, OUTPUT); // Use built-in LED as a status indicator
}

void loop() {
  if (digitalRead(AUX_PIN_1) == LOW) {
    digitalWrite(LED_BUILTIN, HIGH); // Turn on built-in LED
  } else {
    digitalWrite(LED_BUILTIN, LOW);  // Turn off built-in LED
  }

  // Repeat the above logic for AUX_PIN_2, AUX_PIN_3, and AUX_PIN_4
}

Remember that this is a basic example to demonstrate using the AUX pins as digital inputs. You can expand upon this idea by adding more functionality, such as using the AUX pins to trigger different actions or controlling more complex devices.

Before implementing the project, make sure to review the APM 2.8 documentation and pinout diagrams to ensure you’re using the correct pins and connections for your specific board.

=========================================

I think I can do some experiment from here.

Please stop posting ChatGPT transcripts.

1 Like

Sorry about that, there need to be a convention for a special marker for the ChatGPT contents.

(I posted those only because they actually make sense, and I clearly marked them).

There need not be a marker for that here. The results are rarely useful. This one’s an outlier, and I’d be shocked if those code snippets work. If you choose to use them, and they do work, I suppose it’d be an interesting follow up post.

Appreciate that you referenced the source. So many just copy/paste as if it’s fact when it’s obviously BS.

ChatGPT has its place. That place is mostly not for tech writing and answers.

1 Like

Sure, I will report back (success or failure).

1 Like

Switch to phind.com for any programming questions, and you will be positively supprised

whats the point when you can get arduino compatible chips for less than £1.
https://www.aliexpress.com/item/1005004989412626.html

I looked at using a APM as a sensor board once but there ended up being issues with i2c conflicts due to the hardware on the apm having the same addresses as hardware on the pixhawk.