The possibilities of the new Zauberling have increased greatly because the serial I2C bus has been made available on the back of the module. This bus offers, among other things, the possibility to connect various external sensors.
For my first experiment I chose the TCS3472 color sensor. The original color sorting line from fischertechnik turned out to be a good starting point for this.
The fischertechnik product range has been offering pre-built training and simulation models for many years. These 'Training Models' can be used in technical education and education in the field of STEM (Science, Technology, Engineering and Mathematics). With these models, usually equipped with a conveyor belt or gripper arm, various industrial automation processes can be simulated.
These models are often available in different versions. As 9 volt models for control with fischertechnik's own TXT controller, or as 24 volt models where an adapter circuit board makes it possible to experiment with an external PLC (Programmable Logic Controller). The adapter PCB then offers, among other things, screw terminals for connecting the pneumatic valves and relays with which the direction of rotation of motors can be checked.
The 'Training Models' are only available to order and are delivered ready-built. Technical developments can sometimes go very quickly, and the models are available in different versions. The various promotional photos of various incarnations of the Color Recognition Sorting Line (536633) even appear to have been simply photo-edited to clarify that the model is both fitted with the 24 volt PLC printed circuit board (to which, curiously, the relays for the motor appear to be missing) if can be controlled with the 9 volt TXT controller.
Although the basic functionalities of these models have remained largely the same over the years (factory simulation, color or "product" sorting), these simulation models are continuously updated to the state of the art and with the new possibilities in the fischertechnik product range. Where in earlier models for color recognition, for example, a combination of a ball lamp (37869) and phototransistor (36134) was used as a reflection light sensor, today the color sensor (128599) is used for this. Just as the TX and later TXT controllers often took over the role of the earlier interface modules.
The original 536633 sorting line simulates the automated detection and separation of small white, red and blue discs by means of the fischertechnik color sensor (128599). As soon as a disc on the conveyor belt has passed the first light barrier, a series of reflection light measurements begins. As the object moves under the sensor, the fischertechnik color sensor illuminates the object with LED light and measures the amount of reflected light. As soon as the disc reaches the second detection gate, these measurements stop and the lowest reflection light value of the passed disc has been determined. Each of the three colors yields a different minimum value. The output value of the sensor is an analog voltage between 0 and 2 volts and depends on ambient light and the measuring distance and color of the object. This value determines, by comparison with fixed threshold values, the (probable) color of the object that passed.
After this, the belt only needs to rotate the relevant distance, after which the pneumatic ejector can slide the disc of the belt into the correct magazine. The number of pulses from a pulse generator on the motor is a measure of the required distance that the conveyor belt must run. Three additional light gates detect that a color bin is full, so the original model uses five light gates.
The color detection process of the fischertechnik color sensor is not ideal. Only one reflective light value is read. Nowadays there are (for surprisingly little money, think of amounts around € 1.50 instead of > € 25,- for a fischertechnik 128599) color sensors that read four reflection components and can also be read via the I2C bus. A useful example is the TCS3472. This sensor also has an infrared filter to further limit the disturbing influence of ambient light. This cheap, but very accurate sensor has already been extensively described in the ft:pedia in the past.
Because the sorted plastic dominoes are collected in spacious red fischertechnik cassettes (130961), I have omitted the detection sensors in the storage locations. The light barrier at the beginning can also be eliminated due to the continuous color detection. To make the detection beam as narrow as possible, I chose semiconductor lasers as the light source for the four light barriers along the route. Photo-resistors (LDRs) are sufficient as a sensor. Because the detection threshold can be very small when lasers are used, the ambient light has relatively little influence and no (more sensitive) photo-transistors need to be used.
Semiconductor lasers are not expensive anymore. For a few euros you can already buy a 50 mW copy with which you can easily shine hundreds of meters. For a project like this, where the distance is only 10 cm. a smaller 5 mW laser will suffice. I used the KY-008 module with red (650nm) laser diode which is often sold together with a receiving sensor module. These modules work on 5 volts and in my case could be powered directly from the Zauberling. As a sensor I did not use the supplied ISO203 Laser Receiver Module, but soldered a few simple LDRs in fischertechnik light bricks (38216). In the photos, the interfering light covers have been removed. In practice, these were not really necessary because the input sensitivity of the Zauberling could be set very low when illuminated by such a strong laser light beam.
The color sensor is connected via the I2C bus to a Zauberling module whose sole task is to decode the color. Each of the four outputs represents a recognized color and becomes active when that color is detected. These output signals are also used to light up the color indicator LEDs near the trays so that immediately after leaving the sensor lock it is visible in which tray the stone will be slid. Each output signal also serves as an input to one of the two inputs of an AND gate. The signal from a light barrier along the route always forms the other input of this AND gate. In this way only the pneumatic valve of the relevant slide will be activated to slide the object into the correct container. The timing of detection just before a slide, and the actual slide movement is slightly dependent on the speed of the conveyor belt. An adjustable delay is provided for this purpose. In the NAND program of the Zauberling (program selection 2), the right-hand potentiometer (SET 2) is reserved for this. The time that the output of the AND gate 'lags' on the inputs can easily be set between 0 and 500 milliseconds.
Due to the pliability and programmability of the Zauberling, control was relatively simple. One Zauberling handles the color detection via the color sensor connected to the I2C bus. This functionality can be programmed by commenting out #define FUNC13_COLORSENSOR in the standard Zauberling software under DIP switch setting 13. Input 1 of the Zauberling can be set as HIGH without any additional external connections required by setting the input characteristic to W (ohmic, DIP switch up). The module will then retain the last detected color. Otherwise, the currently detected color will only appear at the output momentarily. Each output represents a different color: Q1 becomes active for red, Q2 for green, Q3 for blue and Q4 for yellow.
Furthermore, four 2-input AND gates are required. For this, two additional Zauberlingen are used, which are set to program 2. The normal Silberlingen could also be used for this. As mentioned, however, with the Zauberling this gate function is already equipped with an adjustable 'delay' of the output. This eliminates the need for an additional monoflop to slow down the slider action if the belt isn't moving fast enough. Possibly, the timing can probably also be solved by placing the lasers even closer to the sliders or by shining them diagonally across the belt.
With an infrared filter and true RGB metering, the TCS3472's color measurements are a lot more reliable than those of fischertechnik's original color sensor. The measurement is much less sensitive to ambient light and is not limited to the traditional white, red and blue color discs. With the original reflective light sensor, it would probably have been difficult to reliably detect the color green, while the TCS3472 even made a good distinction between yellow and white. Each measurement produces four values, which can be thought of as an RGB vector of a certain length (the “Clear Light” measurement). It is easy to see that this allows a more reliable color determination than based on threshold values of a single reflective light measurement value.
With the TCS3472 it is possible to distinguish more than the traditional three, or as in the improved model four colors. For example, we could simply roll a fifth color (eg white or silver) into a container at the end of the belt. In my case this would have required refinishing the dominoes; these simply had only four different colors. Four colors therefore seemed more than sufficient to demonstrate the principle.
Another great advantage of color measurement with the TCS3472 is that there is no need to separate a concrete end of the measurement cycle. However, this advantage is not yet optimally used in the current model. Like the original fischertechik model, the model gets lost when several objects are placed close behind each other on the conveyor belt. As a result, the conveyor belt can only sort one color object at a time.
However, the speed of the system could be greatly improved if the next color could be determined before the last object has reached its desired color sorting tray along the track. In the current set-up, this is of course not yet possible because the ejection slides are based on the last recognized color and this must remain unchanged until the relevant laser detector along the track signals that the object can be pushed off the track.
This could be solved with a 'memory buffer' for the order and spacing between the color objects on the track. A condition is then a more accurate distance measurement of the path traveled by the conveyor belt. The original fischertechik model already uses a pulse generator to determine the distance to the correct ejector slide, but this alone does not allow simultaneity on the belt. It is certainly a stimulating challenge to further optimize this process, for example by using an encoder or stepper motor. Who knows, this project will be continued in the future...
The current model can be seen in action in a video on YouTube, here is also a video of the original fischertechnik sorting line 536633.