While most of the new Mindstorms EV3 software is backwards compatible with the NXT hardware, i.e. NXT can be programmed using EV3 software, there are some notable and somewhat annoying exceptions. Over the last few weeks I have been wrestling with one particularly pesky such incompatibility, namely using NXT light sensors with EV3 software. I suspect this problem might be rather common as the NXT is phased out by the EV3, particularly among FLL teams and in schools that have a mixed set up of Mindstorms bricks.
The root of the problem is that the NXT's light sensor has been replaced by a colour sensor in EV3 which has quite different capabilities. As a result the EV3 color sensor block, which intuitively may appear as the right program structure for controlling the NXT light sensor, cannot properly control the NXT light sensor hardware. While there has been various attempts to provide a solutions to this limitation (e.g. here) the only workaround that has worked reliably for me is using the EV3 sound sensor block as an interface to the NXT light sensor hardware.
It sounds crazy to use the sound sensor block for the light sensor, but the the sound sensor block will turn on and off the NXT light sensor LED so you can measure both reflected light (dB mode with lamp on) and ambient light (dBa mode with lamp off). However, the measured range is scaled to about 17 (dark) to 70 (bright) instead of 0 - 100, so adjust your calibration and light thresholds accordingly!
The gist of the procedure consist of a calibration step where the light sensor is calibrated pointing at white and black surfaces. These calibration values are saved to a file and are then used by the bespoke light sensor code to evaluate the colour it is pointing at. While this workaround has shown to be reliable its main drawback is that there is a delay in the processing of the sound sensor data, so for example to use in in line following and edge detection algorithm requires the robot to move slowly or the sensor will not pick up the colour change.
The code is available below. To add it to the EV3 software just follow the following steps:
To use the code for your NXT brick follow the following procedures:
Science classrooms are unique learning environments unlike any other classrooms. As a matter of fact, some things only happen in science classrooms. Here is a collection of event that happened in my own science classroom over the last school year. It's a growing list, so check back for updates.
Report from yours truly live-tweeting and navigating the melee at GETCA 2015 (Annual Greater Edmonton Teachers' Conference).
Can a pencil be more than just your average run of the mill pencil? The legendary Palomino Blackwing Pearl can take a student or teacher's writing to new heights. We have taken a batch of the Pearls for a spin and are blown away by how much writing and sketching can be transformed by this unassuming pencil.
Dr. Pineda's Classroom is going YouTube with the release of its first screencast on the exciting topic of calculating percents. Only time will tell if this is the start of something big and shiny or just a passing fad.
After several weeks working on setting up habitats for new classroom animals the big day finally arrived. The newest addition to our classroom include aquatic denizens in our new aquarium and a teenage bearded dragon with lots of attitude and no table manners.