Skip to main content

No project description provided

Project description

The Dip Coater App

This small App is developed for IvS to drive the motor for the dip coater. The motor is connected to a Raspberry Pi through the GPIO bus.

This App is developed with Textual and the motor driver is controlled using the TMC_2209_Raspberry_Pi library.

Installation

Always install in a dedicated virtual environment!

$ cd </path/to/dip-coater>
$ python3 -m venv venv --prompt=dip-coater
$ source venv/bin/activate
$ python3 -m pip install --upgrade pip setuptools wheel
$ python3 -m pip install -e .

On a Raspberry Pi, install the project together with the RPi package:

$ pip install dip-coater[rpi] 

When you want to develop and test on a macOS or Linux system, install without the RPi package. The App will mock the imports and functions.

$ pip install dip-coater

Usage

Start the App from the command line in a terminal. You can start it also from a remote ssh session in a terminal, e.g. if you have the installation on the Raspberry Pi and you have a remote connection to your RPi.

$ dip-coater

This will show the following App in your terminal:

By default, the Main tab is selected. You can switch to the Advanced tab on top of the screen to access more advanced settings.

To view log messages of the program for debugging, you can switch to the Logs tab.

To run custom, automated routines, you can use the Coder tab. Here you can write your own Python code to control the motor using the Coder API. The code is executed when you press the RUN code button. You can view the available Coder API calls in the collapsible section at the top of the screen, or in the help menu. If you do not want to use the default code, you can enter the file path to a Python file on the bottom of the coder panel. The new file will be loaded when you press the LOAD code from file button

If you prefer light mode, press the t key.

Further help is available in the App by pressing the 'h' key:

Hardware

Mechanical setup

The frame of the dip coater is a 1204 Ball Screw Linear Guide 100mm Long Stage Actuator Slide (link). This linear guide is driven by a NEMA 17 stepper motor (42BYGH48). A mount bracket is added to the back of the linear guide to fixate the linear guide. A sample bracket is added to the guide block to hold the dip sample using a clamp.

Linear Guide Components

For safety reasons and to have an absolute point of reference, two limit switches are installed, one at the top and one at the bottom of the linear guide. When either of the limit switches is triggered, the motor stops. Additionally, you can also perform a homing routine to set the zero position of the motor. Here is an image of the bottom limit switch:

Bottom Limit Switch

The blue wire is connected to the COM pin of the limit switch, the yellow wire to the NC pin.

Electronics

The motor is driven by a BIGTREETECH TMC2209 1.3 stepper motor driver. This driver offers smooth motion control with low noise, low vibrations and advanced capabilities such as StallGuard for sensorless homing. To easily interface the TMC2209 with the Raspberry Pi, the motor, limit switches, and the power, a custom perf board is used. This board contains the following components:

  • TMC2209 stepper motor driver
  • 4-pin female JST connector for the stepper motor
  • barrel connector for the 12-24 V DC power input for the motor
  • 2 2-pin screw terminals for the limit switches
  • 2x20 female pin header to connect to the Raspberry Pi's GPIO pins
  • red LED to indicate power

Perf Board Components

A Raspberry Pi 5 controls the motor driver and provides the user interface. The Raspberry Pi is connected to the TMC2209 using the GPIO pins with the following connections:

Pin TMC2209 connect to Function
TX with 1kOhm UART TX (GPIOXX) of Raspberry Pi send data to TMC via UART
RX UART RX (GPIOXX) of Raspberry Pi receive data from TMC via UART
VDD 3,3V of Raspberry Pi optional, for more stable logic voltage
GND GND of Raspberry Pi GND for VDD and Signals
VM 12V (or 24V) of power supply power for the motor
GND GND of power supply power for the motor
EN GPIO11 of Raspberry Pi enable the motor output
STEP GPIO9 of Raspberry Pi moves the motor one step per pulse
DIR GPIO10 of Raspberry Pi set the direction of the motor
DIAG GPIO5 of Raspberry Pi for StallGuard

Troubleshooting

When installing this package on a Raspberry Pi, it may not be set up correctly for the TMC2209 driver library. (see this page for more information: TMC_2209_Raspberry_Pi). To fix this, you can run the following commands in the terminal:

sudo raspi-config

There go to '3 Interface Options' -> 'P3 Serial Port' Would you like a login shell to be accessible over serial? No Would you like the serial port hardware to be enabled? Yes Finish and then reboot

You may need to add your user (pi) to the dialout group with sudo usermod -a -G dialout pi and then relog. If that does not work, make sure that your user has read/write permissions on the dev file /dev/serial0 by calling sudo chmod 660 /dev/serial0.


I don't know the IP address of my RPi and the screen doesn't work.

If the RPi is on the same network as you, you can scan the IPs on your network.

  1. Install nmap (sudo apt install nmap on Linux, brew install nmap on macOS)
  2. Find your network range; Linux: ip addr show | grep inet, macOS: ifconfig | grep "inet " | grep -v 127.0.0.1 Look for your network interface and not the IP/subnet.
  3. Scan your network: e.g. sudo nmap -sn 192.168.1.0/24
  4. Look for an entry with "Raspberry Pi".

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dip_coater-1.0.0.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

dip_coater-1.0.0-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file dip_coater-1.0.0.tar.gz.

File metadata

  • Download URL: dip_coater-1.0.0.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for dip_coater-1.0.0.tar.gz
Algorithm Hash digest
SHA256 290c7f6d1cac7ca111edabd5b4b4fd06212bf635c8f8431ca1c88976f10f821a
MD5 664c9c08acabacc5548b35db06c4fdc1
BLAKE2b-256 075eb19374553a889b2e59e145f0b06b47b3d3fbb99d8bd5a7666c184e6b0f3a

See more details on using hashes here.

File details

Details for the file dip_coater-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dip_coater-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for dip_coater-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19105420d279ce105594e52ca0ea194721fd3c808e992b44fcacfeeca9feb856
MD5 42f63c83b9e43adca12cfba298cfc128
BLAKE2b-256 2d152c9c7bbd2d7f3e29a1839807dd8af3e65c418413f16cd802b167a9ade87e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page