Zauberling v0.2

After designing and printing the 3D case and developing a universal interface and power supply, it was time to process all the new insights, wishes and ideas since the prototype of this module.

On this page more about the development of the Zauberling version 0.2. It now has some extra push buttons, four inputs and outputs with different power levels. It is switchable between positive or negative logic and equipped with a small screen for optimal feedback to the user.

Video : permission for cookies required
Settings
Zauberling without lid

Due to its versatility and configurability, the Zauberling is a so-called 'drop-in replacement' for any traditional Silberling. With its programmability, setting options and power outputs, it goes even further.

Because the module is freely programmable, it also allows the functionality of the small configurable electronics modules such as the E-Tec Module (fischertechnik no. 108227), Electronics Module (fischertechnik no. 152063), the Robotics MiniBots Module (fischertechnik no. 156499) available and combinable with the Silberlingen.

The idea developed further

Naturally, this quickly led to the wish to make several copies of this flexible module. However, building the prototype of the Zauberling was quite labour-intensive and new insights and ideas were already emerging. In order to make optimum use of the limited interior space in the case (only 40x70x25 mm), I decided to make a universal power supply board that can also make the programming interface and I2C bus available. The main PCB of the Zauberling (or anything else I could think of after that) could then be slided on top as a 'sandwich'.

It was high time for a list of wishes and ideas for the next generation of Zauberlingen:

  • The 'series production' would preferably be a lot less laborious by having ready-made printed circuit boards produced.
  • Where possible, SMD (Surface Mounted Device) components on the future printed circuit boards could save space. After all, to realize everything in the limited space of a Silberling case would already be enough of a challenge.
  • Four inputs (instead of three) is more consistent with the number of outputs. It also enables duplication of logic functions (e.g. such as two AND gates).
  • Sockets for traditional fischertechnik plugs take up a disproportionate amount of space on the front and on the underlying printed circuit board. An big advantage of a space-saving solution for this would be that the various supply voltages, but also signal variants of the outputs could be made available on the front.
  • The idea that positive or negative logic can be used automatically on the inputs (see software prototype) was a stimulating idea, but appears to be limiting for sensors whose input status is not always fixed when the controller is started. Therefore, a global setting for positive or negative logic of the module would be practical. The correct output levels for using the Zauberling in combination with the traditional Silberlingen (with negative logic) could then also be immediately tuned to this logic choice.
  • The above point entails the desire, in addition to the analog motor outputs that can supply up to the voltage level of the external power source, for compatibility reasons also to have purely digital outputs on the module that are limited to 'Silberlingen level' (9 volts).
  • Ideally, the I2C bus should be routed outside to allow communication between Zauberlingen or other modules. This makes it easier to connect various external sensors or controllers (for example, servos or stepper motors).
  • Due to the above point, making servo connections available, as on the prototype of the Zauberling, has less priority.
  • A RESET push button on the front of the Zauberling would make it possible, for example after making the one-time functionality or logic settings, to restart the processor without necessary interruptions of the supply voltage(s).
  • If it were possible in terms of inputs, a universal 'Trigger' push button on the front would be nice. Depending on the function, this makes it possible to test the behavior of the module without the necessary connections to the inputs. For example, with counter functionality this button could be a manual reset, with a motor control function a on/off switch, etc.
  • Because the Zauberling can take on so many functional forms due to the DIP switch settings, a small display on the front would be the icing on the cake. The current function of the Zauberling could then be shown on the display. It could also display counter or analog values. Because a display could also immediately show the feedback about the inputs and outputs, this saves numerous (control) LEDs on the front (and the underlying printed circuit board).

A display on the Zauberling

A Zauberling can bend to his present task like a functional chameleon. But when using several such modules in a project, one could quickly lose the overview. In principle, the same problem occurs with all modules that are configurable with DIP switches (such as fischertechnik's own E-tec or Electronics Module) and do not give any further feedback about their inputs, outputs, behavior or functionality.

A bunch of LEDs on the front of the Zauberling takes up a lot of space, and will of course only partially solve the problem; when troubleshooting, they do not yet provide a definitive answer about the set functionality of the relevant module. A small display would therefore be a nice extension. In addition to clear feedback about the inputs and outputs, all kinds of useful other (textual!) information could also be displayed on this.

Once I had removed the sockets for connecting the traditional fischertechnik plugs from the front, with the necessary sliding and puzzling, there was room for a small display. Since ports A4 (SDA) and A5 (SCL) were already reserved for making the I2C bus available, the choice for an I2C display was an obvious choice. The display SSD1306 with 128X64 OLED pixels on ~2.5 cm (0.96 inch) screen diagonal already offers sufficient opportunities for feedback.

Display on Zauberling

Pros and cons of a display

When experimenting and testing the new Zauberling on an experiment board, a few limitations came to light:

  • Writing to a display is relatively slow and affects the speed of the main loop of the Arduino, in which the inputs are scanned. In practice, the 16 MHz of the Arduino Pro Mini is sufficient to hardly notice this, but one should realize that fast impulses on the inputs could be missed as a result.
  • The address on the I2C bus of the display is not (or, depending on the type, only limited) adjustable. This limits the simultaneous (and unique) use of the display on each module when linking multiple Zauberlingen via I2C.
  • Most software libraries for the SSD1306, such as the Adafruit library, require half of the available 2 Kb SRAM memory of the Arduino Pro Mini to drive the display! Although I had no problems programming all the basic functionalities in the Zauberling with 1KB of remaining programming space, this does not leave much room for the use of extra libraries. This may limit the use of specific I2C sensors that require a relatively large software library (such as the VL53LXX Time-of-Flight sensor I tried).

Until now, the enormous advantage of a readout on the Zauberling easily outweighed these obstacles in practice. In addition, it is always possible to omit the use of the display on the respective Zauberling for specific applications. And perhaps it will be useful in the future to explore how the display, perhaps more limited and less graphical, can be used without the relatively large claim on the processor's SRAM.

'Trigger' push button via a trick

The design involved weighing the use of the Arduino Pro Mini's analog inputs on a gold scale. However, I dropped the idea of ​​saving inputs/outputs by reading out the DIP switch for the configuration with one analog input (see concept here or here). Because I wanted to take the I2C bus (A4/A5) outside, there were only six analog inputs left for the two potentiometer settings and the four (analog) inputs.

With this, all entrances and exits had been used, while the coveted 'universal trigger' push button on the front of the Zauberling had not even been realized yet. Fortunately, with a bit of puzzling, I managed to make it functional. The DIP switch for setting the functionality is only read out once during the initialization phase of the Zauberling. With the 'Trigger' push button, all switches of the DIP switch are pressed 'active' simultaneously (DIP setting 15) via a 'logic OR' (with four diodes). This allows this 'Trigger' push button to be detected neatly. The only limitation, of course, is that the 'Trigger' push button cannot be used with initial function selection 15 of the DIP switch. Because such an extra push button is not necessary for every function, this seems no problem at all.

The modified schematics

The servo connections have been removed. The four analog inputs can individually be switched between resistance or voltage measurement with a DIP switch. The function selection DIP switch is read during the initialization of the Zauberling for the function setting, and can then be bridged during the program with a push button with the 'Trigger' button on the front. The choice for positive or negative logic can be made with a slide switch.

Zauberling V0.2 Schematics
2x NAND Zauberling

There is also a RESET push button on the front now. Two potentiometers are now available on the new Zauberling for setting thresholds or other analog configurations. The digital outputs controlling the motor outputs are available buffered at 9 volt Silberlingen level. These signals are linked and cannot be controlled separately, but this can even be an advantage in some experiments.

The current function of the Zauberling and other configuration (such as the choice of positive or negative logic) as well as the status of the inputs and outputs are visible on the display. Specific information per function (such as a counter or the descending time of a mono-flop) can also be displayed here.

For connectors on the front so-called 'female header connectors' are used now. These make it easy to make the different supply voltages available on the front as well. Handy, for example, for simply supplying active sensors with a power supply (with one plug, such as with a servo).

The printed circuit board and assembly

The starting point when designing the main board of the Zauberling was that the connectors that connect to the signal and power rails of the power and interface board are in the right place on the PCB. But after making a usable arrangement of the components that determine the layout of the front, there was little space left to place the other necessary components on the (small) double-sided PCB. It soon became clear that SMD components should be used wherever possible, so that the two sides of the print could be used optimally.

Both the ATmega328 microprocessor and the TB6612FNG motor driver are of course available in SMT (Surface Mount Technology) technology, but for both components I eventually opted for a complete board/module. These were more readily available and, oddly enough, even cheaper. And because in this case it was a small series of semi-prototypes, it seemed to me that the advantage of even more PCB layers for the copper traces outweighs the 'piggy-back' mounting of these small boards on a series of undrilled SMT copper islands.

By soldering header strips to the SMT islands and then cutting them off, mounting is very easy in practice. The photos show how the components are mounted on both sides of the PCB. The multi-layered main PCB is in turn merged with the power supply and interface PCB, which is mounted at the bottom of the case. As a result, the resulting 'sandwich' makes optimum use of the limited space in the case, also in terms of height.

 Zauberling V0.2 copper topZauberling V0.2 pcbZauberling V0.2 sandwichZauberling V0.2 build-in

Zauberling output indicators

At the bottom of the Zauberling's screen, depending on the selected function, either the four digital or the two motor outputs can be monitored. Strips are shown for a motor function, in which the position and length of the bars reflect the output voltage and direction of rotation.

For some applications it may be useful to use both output types. For example, to have a digital signal available that indicates the direction of rotation of a motor. For a quick overview of the output signals, a few 'output indicators' with LEDs (with series resistor), which can be plugged directly onto the outputs, offer a solution. One gives a good look at the digital output signals, the other contains two bi-color LEDs that make it easy to read the rotational speed and direction of a motor output.

Zauberling piggy backZauberling V0.2 sandwich side-viewZauberling Look Inside

First experiments

The basic Sketch for the Zauberling can be downloaded from GitHub. The various functions of the Zauberling can be set with the 'Function' DIP switch. After making changes to the configuration, a short press on the RESET button on the front is enough to use the next function. Twelve useful functions and one engine demo sequence are available as standard.

With Flip-Flops that act as a 3-bit binary counter and two Zauberlingen that decode this binary number again, the next LED in the series lights up with each press of the button. A nice proof-of-concept for some basic functions, but not really something that adds much to the digital functions of the traditional Silberlingen. In fact, these will easily rival the Zauberling in terms of speed with their lightning-fast parallel operating discrete electronics.

But the Zauberling obviously comes into its own as a PLC (Programmable Logic Controller) for process automation or for adding specific functions that can simply never be made with the Silberlingen. Its strength lies in its programmability and collaboration possibilities with the traditional Silberlingen.

3x FF - 2x decoder - Zauberling
I2C Nunchuk Zauberling

I2C bus

The addition of the I2C bus makes it possible to use the Zauberling with all kinds of external sensors. As a preliminary exploration in this area, I already tried out a few applications. It turned out to be quite easy to control two motors with a so-called Nunchuk (hand controller). Both the Nunchuk and the motors can be connected directly to the Zauberling. The status of the push buttons, or the acceleration/position information of the Nunchuk could be communicated via the I2C bus for processing by other Zauberlingen or specific I2C modules. For example, I experimented for a while with an I/O expander (PCF8575 or MCP23017) that could be build in a separate Silberling case in the future.

I did a second I2C sensor experiment with the color sensor TCS34725. Outputs 1 to 4 are activated respectively when a red, green, blue or yellow domino is detected. This makes it possible to create an automatic color sorter.

The I2C bus enables additional inputs and outputs, communication, the connection of sensors or the control of servos or stepper motors. Versatility that encourages one to check out some old construction examples from the Hobby4 book series and control them with modern technology. Plenty of material for experiments with the Zauberling for the future, so... to be continued! 😉

I2C Color detect Zauberling