Home        Store        Learn        Blog

Lumen R2 brightness control with pixhawk

I am trying to control the brightness for the the lumen light via PX4 but I am not able to do so. I was trying to generate PWM signals from the PX4 on the main channel (any one will do from 1-6) but still i am not even able to get the light ON.

I have tried the default pwm command via the mavlink shell of PX4 for generating the pwm signals but with no luck in generating the signal required for controlling the brightness.

I have flashed the PX4 with px4_fmu-v3_default firmware.

Can you help me with the steps to control the brightnesss of the Lumen lights using PX4?

Hi @AkshatAgarwal, welcome to the forum :slight_smile:

PX4 is an autopilot flight stack (software), that can run on an autopilot board. We (Blue Robotics) develop and support ArduSub, which is a separate and unrelated autopilot software tailored to underwater vehicles, that can run on some of the same autopilot boards (like the Pixhawk 1 and the Pixhawk 4). If you’re wanting to use the PX4 firmware then we won’t be able to help you - you’ll need to ask your question on the PX4 forum.

If you’re wanting to use ArduSub then you’ll need to install it. Generally the first set of MAIN outputs are used for thrusters, and if they’re configured as thruster outputs they won’t be usable as general PWM outputs (make sure you have the correct frame selected for your vehicle). You can use QGroundControl to set the Lights output channel (1-8 for MAIN, 9+ for AUX) that you have your Lumen signal wire connected to, and from there you should be able to control it using a calibrated joystick :slight_smile:


Thankyou for your reply. I will try to use Ardusub instead of PX4 firmware to check if it works for me.

I was looking to control the brightness without any use of external joysticks. Can you suggest some alternative way to control the brightness via pwm only.

Also can you please suggest the frame to be selected for this configuration.

One more thing to confirm that I am connecting a separate 12V power supply for powering the Lumen light and just connecting the yellow pwm wire to S pin of channel 5 of main output. The pixhawk 4 board is powered using a usb. Do I need to make any changes to this setup.

What are you actually trying to achieve here? Are you starting out small with a single Lumen and planning to increase your project complexity as you progress, or are you just wanting to have a dimmable waterproof light?

If the only reason you have the Pixhawk board is to control a Lumen then perhaps you’re better off using a more general purpose microcontroller board like an Arduino (we have example code for using one with the lumen here), or if you don’t want to do any programming you can use our thruster commander or a servo tester (check the voltage rating first).

If you’re making an underwater vehicle then the frame is whichever frame you’re using (based on the configuration of your thrusters). If you’re not making an underwater vehicle then please explain more of what your project is about and what you’re trying to achieve, so I can help you more effectively :slight_smile:

It’s fine for the power supply to be separate, but you need to make sure the ground connection is shared, so the ground wire of your power supply needs to connect to both the Lumen ground and the pixhawk channel ground.

I am starting out small with a single lumen light only that is connected with pixhawk. For now I have not decided to build a underwater vehicle and might not be using any frame as of now. So it is just pixhawk board with Lumen light.

I do not want to use generic boards like ardiuno as I might want to interface some other components with pixhawk board in future.

For now can I go with any frame to control the lights?

Ok, but understand that a Pixhawk is made to be a flight controller board, so the hardware and firmware are set up around that idea. To control something with a Pixhawk you either need an input device like a radio controller or joystick, or you can send commands to the board with a program (e.g. you can control it with Python scripts using the pymavlink library), or you can write custom firmware that performs a control sequence without user input. Custom firmware or custom input device types (e.g. a potentiometer that you can use as a control knob) are generally simpler to do on a general purpose board, but if you’re happy working within the constraints of a flight controller board then the Pixhawk should be fine.

Yes, although you’ll need to make sure the PWM output port you want to use for the lights is past the initial ones that are used for the thrusters (e.g. if you set the SimpleROV-3 frame, which has 3 thrusters, then you could use ports at or past MAIN 4).

Thanks for the reply.

I flashed the Ardu sub firmware pixhawk1. 4.0.1 for pixhawk 4 controller board. But I am getting repeated warnings that some parameters are missing or the firmware is not supported completely or the firmware is corrupted.

I am using the default frame i.e. BlueROV2Vectored. and LED is connected to main Channel 5.

Also, I tried changing values on the lights setup for brightness steps but it did not change the brightness level of the LED. Please suggest how the change will be reflected as if i just want to set a hardcoded value of brightness.

Usually that warning occurs if you have a mismatch between your ArduSub and QGroundControl version. Did you get your QGroundControl from our documentation or our Software Setup Guide? In this case you’ve said you flashed a Pixhawk 1 firmware onto a Pixhawk 4, so it’s possible that’s the issue. If you have a Pixhawk 4 board then assuming you’re flashing the firmware through QGC there should be an option for either Pixhawk 4 or fmuv5. Don’t use the Pixhawk 1 or fmuv3 options unless you actually have a Pixhawk 1 board.

As I mentioned in my previous comment, you’ll need to use a higher port number than the number of thrusters used by the selected frame. The BlueROV2 Vectored frame uses 6 thrusters, so your lights can only be controlled on ports MAIN 7 or above.

QGC allows configuring settings in the firmware, and can take user input from a suitable input device (e.g. joystick) to control the board. The ‘brightness steps’ option determines how many gradations/levels there are between minimum and maximum brightness when controlling the lights. You can’t control the lights in a normal way through QGC without using an input device.

If you really don’t want to use a joystick and you have the lights plugged in to one of the motor positions (which you currently do), you could very awkwardly control the brightness using the motor testing functionality from the motors setup page, but it would only allow control for a brief period while the board is ‘armed’. It’s very much not intended to function like that, and proper control requires either using a Joystick or doing one of my other suggestions from my previous comment.

Yes I did get my QGroundControl from your documentation

Also, I do not see any options for pixhawk 4 or fmu5. I only get cubepurple / pixhawk1-1m-4.0.1 / pixhawk1-4.0.1 and fmuv3. So I chose pixhawk1-4.0.1.

As per this reply can you suggest how can i use pymavlink to send the command to control brightness or can you direct me to a way to set a specific value based on some inputs from user that changes the brightess via a custom firmware

Are you sure you have a Pixhawk 4 board? If you post a picture of the board you’re using I can confirm.

Some more context as to your existing programming experience would be useful here. I can’t do development work for you (e.g. write a custom firmware), and don’t know of any existing ones that would be set up to accept user input other than mavlink messages.

Pymavlink is likely easier, both to explain and to do. Have you used Python before? The pymavlink link I gave you should explain the basics of installing it, and if you plug your lumen into AUX 1 you can use the Set Servo PWM example to set the lights brightness level :slight_smile:

Thanks for your reply. It was really heplful.

Yes, I have used python before and will try to use the example suggested by you.

Added pics for your reference.

1 Like

Glad your problem seems to have been solved :slight_smile:

That’s a Pixhawk 1, which as mentioned can run the PX4 firmware, but can also run our ArduSub firmware. Pixhawk 4s look different and say Pixhawk 4 on the front instead of Pixhawk :slight_smile: