I have been using RaspberryPi with Navio+ for a quadCopter.
I would like to use an Arduino to receive the PWM output for the motor over i2c.
(Reason: to make it modular)
Please can someone help me how I can use the onboard i2c port to communicate with the an Arduino.
Any help will be greatly appreciated.
I2C is supposed to be multi-master so the same I2C library can be used on the Navio side, and whatever Arduino/chip I2C library on that side. But if the APM HAL is not explicitly coded to follow the multi-master behaviour it will not work (see
If you want to communicate with APM there is no I2C back-door I am aware of as It uses MAVLink as it’s external API over serial, network or loopback.
It’s interesting but if course even if you got it workimg carries the risk that interrupting the APM HAL with your own parallel I2C requests could crash your quadcopter.
Using an extension point in the APM source and doing everything on the Navio (RasPi) would be a safer option.
Even if you are not using APM I wonder why you need an Arduino when you have a full RasPi with all the Navio connections (I2C, SPI, even a few spare GPIO and ADCs)?
I think the idea if editing Emlid’s part of the APM HAL to support multi-master (assuming it’s not there already) would be a positive achievement.
Thanks for the reply.
I have changed the design a bit.
The Navio will be controlling the servos directly but I still need a feedback to the Navio regarding the angle of the servo.
Assuming that I don’t use I2C, is there any other way I can communicate back this angle (4 devices) to the Navio?
This is perfect.
There are 4 ADC pins available which I can use to get the angle of the 4 servos.
There is an example code for ADC.
Question1: How do I integrate the ADC code into APM?
Question2: I can’t seem to find the circuit diagram for Navio+. All searches give me Navio. I just need to find out the ADC pins on Navio+?
Thanks for the help.
Under the Navio+ you can find pads ADC2 and ADC3, they can be used as either pin 4 or 5 in APM. ADC range is 0-3.3V .
I wonder if this may help:
Searching around a bit, it seems like there are various servo hacks for getting absolute position control.