Topic outline

  • General

  • ACTIVITY DESCRIPTION

    This activity is a playground to explore both colour recognition techniques and servo motors controls. Both the direct use of a newly released colour sensor and light reflection measurements are discussed. In the former case the traffic light is realized with a led shield, while in the latter one mBot, equipped with servo control, stands still and acts as the traffic lights by rotating a coloured disk. The main robot, instead, reads the traffic light colour and move forward or stop accordingly.


    Some students do not know the composition of the colors, which with the primary and secondary colors.


    A robot runs along any given path, reads the traffic light colour and move forward or stop accordingly. In one setup (configuration a) the traffic light is a Arduino led shield and the colours are detected through a colour sensor. In configuration b, instead, one mBot, equipped with servo control, stands still and acts as the traffic light (by rotating a coloured disk) and the colour detection is performed through optical measurements in reflective geometry.

  • FIRST VERSION

    The activity consists of drawing a circuit with black tape, create a traffic light with a mCore shield and thanks to the colour sensor, when the robot detects the red light it will stop, with the yellow light it will considerably decrease its speed and when it detects the green light will continue the speed or will be launched.





    When Ranger detects the red colour it stops:





    And if the colour is yellow its speed is lower and if the colour is green the mBot Ranger will be continue:



  • SECOND VERSION

    We list the simple steps needed to play the activity, discuss the colour detection technique and illustrate the algorithm and code.


    1. Set up the "road”: a track of black tape the mBot can follow.


    2. Set up the Traffic Lights:

      1. Install the Arduino Led shield on a proper support.

      2. Choose one mBot to act as the traffic light. Mount on it the RJ25 adapter and the micro servo control. In our case, we installed the servo facing downward. Prepare a paper disk approximately 15 cm in diameter, divide it into three coloured sectors: yellow, green, red (or just two, discarding yellow). Make a hole in the disk center and mount it securely on the servo control.


    3. Upload the code to the mBot(s)/mBot Ranger acting as the car(s) and to the traffic lights (mbot or shield).


    4. Play the game! When the mBot reach the traffic light and if it is

      • GREEN it will continue to run forward.

      • YELLOW it will slow down its speed, but continue to run forward.

      • RED it will stops at the traffic lights and it will continue to detect colours, in order to start again when the traffic lights turn green.



    Light and Colour detection in reflective geometry


    In physics, we speak of a scattering experiment when a given radiation (eg. light, as in our case) is sent to the investigated sample/surface and the scattered radiation intensity is measured. This can be done either in: Transmission geometry, where one measures the radiation that has gone through the sample and has emerged on the other side1; or Reflective geometry, where one detects the radiation that is reflected by the sample and comes back almost in the same direction of the incident beam. This configuration is also known as backscattering.


    If we recall the mechanism of our colour vision, it is easy to understand that Colours can be detected by light backscattering: an object appears for example green, because it reflects green light and absorb blue and red light.


    Therefore if we hit the object with red light, we will have a low reflected intensity, while if we use green incident radiation we will get an high scattered intensity. More in general each colour will reflect mostly light of the same colour; in case of a white object all colours will be reflected with high intensity, while a black object would absorb most radiation.


    To perform the colour measurement, we turn on alternatively red, blue and green light on the led module and with the light sensor module we detect the reflected intensity for each colour. The software then elaborate the results.


    For the measurement to work properly, it is necessary to embrace the light sensor into a small black tube (we used standard heat shrink tubing for electrical wires) in order to reduce the noise coming from the environment (eg. sunlight).

  • ACTIVITY RESOURCES

    Folder: 1File: 1