This blog is translated from German with DeepL.
In a recently completed mechatronics project, we used, among other things, the electronic components mentioned in the heading to control a continuous test device and monitor the state of the test object.
A microcontroller is a programmable single-chip computer system. Peripheral functions may include USB, I²C (Inter-Integrated Circuit), SPI (Serial Peripheral Interface), serial or Ethernet interfaces, PWM (Pulse Width Modulated) outputs, LCD controllers and drivers, and analog-to-digital converters. Some microcontrollers also have programmable digital and/or analog or hybrid function blocks. Product examples of microcontroller boards are Arduino (Uno, Mega, etc.) and Raspberry Pi, which are relatively inexpensive to buy. By the way, a simple Arduino microcontroller is built into many a household 3D printer.
We connected infrared and photo sensors and limit switches to the microcontroller to check the state of the continuous test device and its test object. A stepper motor (200 steps per revolution) with stepper module (controls the coils of the stepper motor) formed the mechanical drive for the test device. In order for the user to know what the test status is at present, the most important information is displayed on an LCD screen. Further switches and control buttons are available for starting/stopping or setting the cycle time.
Figure: Microcontroller board example
The entire electronic wiring was drawn and planned on the freely accessible software Fritzing (http://fritzing.org/download/). There, several components such as microcontrollers, diodes, etc. are already available in the component library and can be dragged and dropped onto the sketch area. Professionals can create their own components, modify existing ones and design their own circuit board. With suppliers on the Internet, the circuit boards can be etched from quantity 1 to small series.
Image above: Fritzing sketch (click on image to enlarge).
Now what was missing was the programming that would map the planned test procedure and breathe life into the test device. The programming language for our Italian microcontroller Arduino Uno is based on the C language, but simplified for users who are not programming experts. Extensive documentation on the available functions can be found on the Internet ((http://www.arduino.org), as well as countless open-source examples that can be studied, copied and adapted, or that form a good inspiration.
With the few sensors, controls, a 600-line program and with countless variables, the microcontroller’s memory space became fuller and fuller. But we were spared to use the next bigger Arduino Mega (54 digital/16 analog interfaces, bigger memory).
It turned out that the Arduino experimental platform was just sufficient for our project. For larger and more complex systems, another microcontroller platform may have to be used because of the relatively small memory and the limited number of inputs/outputs.