If you’re like me and are the proud owner of a small room, also known as the Lego Lair, you may find that the lighting conditions in said room sometimes leave a lot to be desired. You may not really notice this until you start using a sensor that uses light to do its thing.
Take the NXTCam for example. It’s a great sensor but it doesn’t work so well under bad light. Everything comes out as shades of grey. You can adjust your colour maps as much as you like, but it won’t make a difference; you either end up not seeing anything at all or the entire world ends up being a single detected blob.
The latest ROBOTC beta (2.16.1) now sports support for the Lego NXT 2.0 colour sensor which can be used as a source of light as well. I added two lights to my new robot, they shine on the ground where the red line runs. I chose to use green light because it turns the red nicely black as far as the NXTCam is concerned.
Bad ambient light, line is detected. | The NXT’s view in Line Tracking mode. | Brighter ambient light, line is still detected. |
The camera can see the line much more clearly. If you are using a different colour line, you may need to experiment with either red, green or blue. Make sure you configure the camera’s colour map with the light sensors shining on your target. I found that configuring the sensor as RBG (white), greatly reduces the amount of light coming from it barely made a difference to what the camera could detect. The primary colours are by far the brightest options.
So how do you configure the sensor as either a red, green or blue light? Easy peasy; just download the latest ROBOTC beta from here: [LINK], and use the Motor and Sensor Wizard to configure the appropriate ports as LEGO Color-RGB (for white), Color-Red, Color-Green or Color-Blue.
Use Color-Ambient to turn the light off but then you may as well not configure the sensor at all.
So there you have it; not much of a hack but a rather simple trick to make your NXTCam work, even under poorer lighting conditions.
You can also try using the standard 9V lights (from Peeron or LEGO Education), or the Power Functions light. I’ve used both, but it doesn’t help the absence of an NXTCam. The readings are still null. Wonder why?
The trouble with the PF lights is that they’re so bright, the reflected light ends up blinding the camera. The additional battery pack is also quite heavy. On the plus side, you do end up freeing two sensor ports.