Servo and LED examples cannot work on NAVIO+

Hi,

I’ve recently bought a NAVIO+ and powered it up.
I also downloaded the example codes from which I compiled and tried to run Servo and LED examples.
However, it always shows that “Failed to open device: Permission denied”.
For servo example, it shows:
Servo: /dev/mem cannot be opened: Permission denied.
Output Enable not set. Are you root?
Failed to open device: Permission denied.

Does anyway know how to solve this problem?
I hope to control the servo as well as LED.

Thanks very much!

Peter

Hi,

You should run examples using sudo:

sudo ./Servo

Oh, thanks!
I ran with sudo, LED works, but servo has no response.
I connected the servo to RC output 1 in NAVIO+.
What’s the problem then?

Thanks!

Peter

Have you provided power to the servo rail? Power module does not power it.
http://docs.emlid.com/Navio-APM/hardware-setup-navio-plus/#rc-output

So I need an ESC which is connected to RC output 3 to power up the servo?

Thanks!

Peter

Peter, you need to connect a source of power (5V) to any spare channel on servo rail. It could be an ESC or a BEC. The reason it works this way is that servos draw large current and we do not want them to cause RPi to reboot.

Oh, I see.
Thank you very much for your advice!

Peter

Servo and LED documentation has been restructured and moved to the new platform.
http://docs.emlid.com/Navio-dev/servo-and-rgb-led/

Hi!

I have also recently bought a NAVIO+ and run first tests with a Raspberry PI A+. I’ve tried C++ examples and all appear to work well except for LED.

When I power up Raspberry PI, led is already on. Running LED example makes no change in LED. Neither does python example. Raspberry PI is powered with 5V 1A current. I run LED example with sudo privileges, as suggested in previous answer.

I would appreciate any help.

Thanks!
Roger

Hello,

Did you test the servo example? If you run “sudo i2cdetect -y 1” do you see address “40” in the table?

Hello,

I cannot test servo example yet: I still haven’t bought them. Table shows 40, 48, 50, 70 and 77.

Navio seems healthy, so it’s probably something wrong with the code that enables PCA9685 output, we’ll recheck and fix it.

@roger567in

Hello, Roger!

I just checked the LED example and it works as expected.

There have been some fixes in the code recently. Could you git pull the repo and then recompile the LED example?

If the issue is still present, you can run a simple script to determine whether PCA’s Output Enable is driven low.

#!/bin/sh -x

sudo echo "27" > /sys/class/gpio/export
sudo echo out > /sys/class/gpio/gpio27/direction
sudo cat  /sys/class/gpio/gpio27/value

If the output is 0 and LED doesn’t work, we’ll need to look into the issue more closely.

Pulling git worked. I had the version comming with one of the SD card downloads in the website. Perhaps it is not updated or I just had an older version.

Thanks a lot for you help!