<< return to Pixycam.com

Setting White Balance Through Arduino

Hi all -
Does anyone know if there’s a command to set white balance through arduino, or how I’d accomplish that? I want Pixy to be able to start up and set up automatically when the Arduino powers up, and right now I have to connect it to my computer to set White Balance, Brightness, and run the default program, all of which I’d like to do from the arduino. The reason White Balance is so crucial, is because I have a visible light filter on the camera, and I want the infrared blobs to show up as non-white so the camera picks it up. Thanks!

Hi Daniel,

Unfortunately this is not possible with the current Pixy Arduino library. However, this is a commonly requested feature, so it is likely we’ll be adding it in the near future.

Thanks!

Scott

Is there any way to change any of the defaults via Arduino commands? All I need is some way for the infrared beacon to not appear white, and therefore be recognizable by the detection algorithm.

If not, I’m going to try to edit the Arduino libraries to set the WBV, as I need to finish this project quite soon. I was wondering whether you could point me in the direction of the files / code that are used to alter the white balance, as well as any suggestions you would have for these changes. It seems like the console commands allowed in pixymon are created in the “camera.cpp” file when it creates the ProcModule g_module (https://github.com/charmedlabs/pixy/blob/master/device/libpixy/camera.cpp , line 53) but I’m not really sure what ProcPtr is, as well as where a ProcModule is defined, as well as how the change is actually put in place via the creation of the ProcModules.

Thanks for the help!

Hi Daniel,

The specific function you’re looking for is @int32_t cam_setWBV(const uint32_t &wbv)@, (“line 337”:https://github.com/charmedlabs/pixy/blob/master/device/libpixy/camera.cpp) which is pointed to by the ProcPtr.

It may be helpful for you to look at how the @setServos@ command works in the Arduino library. See the @setServos(uint16_t s0, uint16_t s1)@ function “here”:https://github.com/charmedlabs/pixy/blob/master/arduino/libraries/Pixy/TPixy.h and the @void handleRecv()@ function “here”:https://github.com/charmedlabs/pixy/blob/8336fb77994d5562bc9f8f6850a6c7852db25638/device/video/progblobs.cpp. You could try to model this approach and implement your command in a similar way.

Scott