Abstract: This files contain the design of an modular linear stage for optoelectronic measurements as well as example software for measurements. It is build from open hardware parts (uStepperS and C-Beam Linear Actuator), commercial available parts, a designed shield for the hardware control as well as custom made laser-cut parts. The composition, the designed hardware and software is licenced under a free GPLv3 licence (see bottom of this page).
TechnicalRemarks: # Modular linear experiment stage
This files contain the design of an modular linear stage for optoelectronic measurements as well as example software for measurements. It is build from open hardware parts (uStepperS and C-Beam Linear Actuator), commercial available parts, a designed shield for the hardware control as well as custom made laser-cut parts. The composition, the designed hardware and software is licenced under a free GPLv3 licence (see bottom of this page).
Licences of the used components:
C-Beam Linear Actuator OpenBuilds®, LLC design work(s) shared Open Source under the CC BY-SA 4.0 License Terms and Conditions
uStepperS by ON Development is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Controle software for the 'uStepper S'
This module is used with the 'uStepper S' and the custom made shield for distance measuring with angle dependancy.
Usage
You can use the setup via the manual rotary encoder switch or via the serial commant (use arduino-GUI and serial window or see python example)
```
--- Proximity reference setup ------------------------------------
Manual mode:
Turn the knob to change the distance / angle");
Click once to change the step size");
Double-click to change between distance and rotation");
Press > 1 second to set the distance / angle to 0");
PC mode (via serial):
Type the distance (mm), speed (mm/s) and angle (°), seperated by a commata");
E.g. '20.0,40, 15' means 20.00 mm (v=40mm/s for distance) and 15.00°"
```
Somehow there is a bug with my board/software and setting the speed via stepper.setRPM(rpm) inside the code does not work properly. So do not expect the speed to be exact.
Installation
uStepper S
The uStepper is programmed like an arduino bord with the Arduino IDE: https://www.arduino.cc/en/Main.Software
To install the uStepper into the arduino IDE follow: https://github.com/uStepper/uStepperS
Rotary encoder for angle motor
To make the rotary encoder working, you may need to fix the Encoder.h (\Arduino\libraries\Encoder\utility\interrupt_pins) library by adding the PB version of the microcontroller __AVR_ATmega328PB__
to the list:
```
// Arduino Uno, Duemilanove, Diecimila, LilyPad, Mini, Fio, uStepperS, etc...
elif defined(AVR_ATmega328P) || defined(AVR_ATmega328PB) || defined(AVR_ATmega168) || defined(AVR_ATmega8)
#define CORE_NUM_INTERRUPT 2
#define CORE_INT0_PIN 2
#define CORE_INT1_PIN 3
```
Interrupts
Also on the uStepperS board the interrupts do not work. A workaround is to use Pin Change Interrupts. They are different than normal Interrupts ("might be a tiny bit slower and not that reliable because of that detection overhead (talking about micro seconds)") but there is an arduino library.
→ seems to work with both motors and rotary encoder at the same time !
Distplay
To get the display running with the uStepperS, we need to change its lib rgb_lcd.h:
There is some wired behavior when using the serial of the uStepperS (ATmega328PB). Plugging the Grove-LCD RGB Backlight display in pins A1 (SDA0) and A2 (!!! this pin is changed [from A0 → A2 on my bord] but SCL0 is still there) the example code works. But pin D7 (SCL1) and D8 (SDA1) are somehow always HIGH which causes problems (not enough pins, strange behavior when uploading code with INX from ULN2003 driver on D7 &D8 ).
To circumvent this behavior the display should be attached to SCL1 /SDA1. This is not possible by default due to missing firmware. Therefore we need to add support for the microcontroller:
Sources:
https://github.com/MCUdude/MiniCore This lib adds support for the ATmega328PB, in detail for serial communication with the lib Wire1.h
https://www.instructables.com/How-to-share-i2C-connection-on-Due/ To get the display running, we need to change its lib rgb_lcd.h
- Go to the folder \Arduino\libraries and copy the folder \Grove_-LCD_RGB_Backlight and rename it to \Grove-_LCD_RGB_Backlight_Serial1
- In the Folder \Grove_-_LCD_RGB_Backlight_Serial1 rename the files rgb_lcd.cpp and rgb_lcd.h to rgb_lcd1.cpp and rgb_lcd1.h
- Open the file rgb_lcd1.cpp with an text editor and change the lines
#include
to #include
#include "rgb_lcd.h"
to #include "rgb_lcd1.h"
- Also add the line
extern TwoWire1 Wire1; // insert this line is the modification to include Wire1 (SDA1 / SCL1) .…
- Then press ‘Ctrl+h’ to replace all function calls starting with
Wire.xxx()
with Wire1.xxx()
! Make sure to not replace the lines added above a second time
- From now on in the arduino code always include
#include
and #include "rgb_lcd1.h"
Design shield for µStepperS
In order to also control a 28BYJ-48 stepper motor (e.g. for angle dependent reflectance measurements) or custom components that need high currents (e.g. high-power LEDs) a large part of the project was to design a shield.
Software: https://www.kicad.org/
* https://docs.kicad.org/5.0/en/getting_started_in_kicad/getting_started_in_kicad.html
Further reading:
Digital pins (pullup & down resistors):
- https://www.mymakerstuff.de/2016/03/22/arduino-tutorium-kapitel-5-pull-up-und-pull-down-widerst%C3%A4nde/
- https://www.arduino.cc/en/Tutorial/Foundations/DigitalPins
Stepper Motor driver
- https://www.hwlibre.com/en/28byj-48/
- https://www.electronicoscaldas.com/datasheet/ULN2003A-PCB.pdf
Rotary encoder
- https://lastminuteengineers.com/rotary-encoder-arduino-tutorial/amp/
- The switch needs a pullup resistor (similar to stop-switch)
Grove-LCD Display
- https://wiki.seeedstudio.com/Grove-LCD_RGB_Backlight/
💌️ License
Copyright (C) 2022-2023 Mervin Seiberlich and Konstantinos Falis
Authors - Mervin Seiberlich, Konstantinos Falis
The Modular linear experiment stage is free hardware and software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
experiment_evaluation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with experiment_evaluation. If not, see https://www.gnu.org/licenses/.