Firmware for embroidery machines and custom stepper motors control.
 
 
 
Go to file
Martin 991512440b Add LICENSE 2018-11-30 20:04:39 +00:00
.gitignore Some cleanup and fixes. 2018-07-12 02:05:39 +02:00
LICENSE Add LICENSE 2018-11-30 20:04:39 +00:00
Makefile Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
README.md Config file cleanup, support for M301 code. 2018-11-30 20:03:21 +01:00
arduino.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
arduino_32U4.h Refactor of homing code by merging teacup snippets and added option of movement triggered by sensor interrupt. 2018-09-25 04:41:58 +02:00
arduino_168_328p.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
arduino_644.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
arduino_1280.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
arduino_lpc1114.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
arduino_stm32f411.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
arduino_usb1286.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
arduino_usb1287.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
boards.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
config.h Config file cleanup, support for M301 code. 2018-11-30 20:03:21 +01:00
debug.c Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
gcode_parser.c Config file cleanup, support for M301 code. 2018-11-30 20:03:21 +01:00
gcode_parser.h Refactor of homing code by merging teacup snippets and added option of movement triggered by sensor interrupt. 2018-09-25 04:41:58 +02:00
homing.c Refactor of homing code by merging teacup snippets and added option of movement triggered by sensor interrupt. 2018-09-25 04:41:58 +02:00
homing.h Refactor of homing code by merging teacup snippets and added option of movement triggered by sensor interrupt. 2018-09-25 04:41:58 +02:00
kinematics.c Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
kinematics.h Some refactoring 2017-02-19 19:15:53 +01:00
maths.c Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
maths.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
motion_planner.c Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
motor.c Improved dc motor slow down and stop. 2018-10-30 18:36:17 +01:00
motor.h Added working code for dc motor speed controller and planner. 2018-10-13 22:19:06 +02:00
msg.c Refactor of homing code by merging teacup snippets and added option of movement triggered by sensor interrupt. 2018-09-25 04:41:58 +02:00
msg.h initial commit 2017-02-19 17:50:07 +01:00
pinio.c Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
pinio.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
queue.c Improved dc motor slow down and stop. 2018-10-30 18:36:17 +01:00
queue.h Fixed speed planner slow down procedure. 2018-10-23 18:17:20 +02:00
ringbuffer.h initial commit 2017-02-19 17:50:07 +01:00
runsim.sh Some cleanup and fixes. 2018-07-12 02:05:39 +02:00
sensors_control.c Improved dc motor slow down and stop. 2018-10-30 18:36:17 +01:00
sensors_control.h Config file cleanup, support for M301 code. 2018-11-30 20:03:21 +01:00
serial.c Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
serial.h Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
simulavr_info.h initial commit 2017-02-19 17:50:07 +01:00
teathimble.ino Added working code for dc motor speed controller and planner. 2018-10-13 22:19:06 +02:00
teathimble.ino.c Added working code for dc motor speed controller and planner. 2018-10-13 22:19:06 +02:00
timer-avr.c Added board configuration scheme. Code refactoring and some updates with teacup. 2018-09-08 01:41:22 +02:00
timer.h Refactor of homing code by merging teacup snippets and added option of movement triggered by sensor interrupt. 2018-09-25 04:41:58 +02:00

README.md

Teathimble

Teathimble is a minimalistic firmware intended to control embroidery machines. It runs on most AVR (so arduino as well) microcontrollers and fits into ATmega32 MCU, providing great base for many projects. Teathimble is a trimmed fork of Teacup - lean and efficient firmware for RepRap printers by Triffid Hunter, Traumflug, jakepoz, many others.

Features

  • Minimalistic code.
  • Communication via buffered serial and text commands (G-code).
  • True acceleration, interrupt based, with look-ahead and jerk calculation planning.
  • Integer only math to save cpu cycles for performance boost.
  • Up to 4 axis in straight or coreXY kinematics scheme.
  • DC motor speed controller.
  • Decent performance: can run up to 48'000 evenly spaced steps/second on 20 MHz as mentioned by core developers.

Work progress

For coil winder machine check this branch. Current code is checked on custom made arduino-like board top on ATmega32 to control simple embroidery machine and coils winder. It is just a matter of formality to port configurations on other available boards. You might also need this arduino core to turn custom board into arduino compatible. To run inside simple simulator build project with enclosed makefile, this might be come in handy for development.

Building

Most of the configuration is described and is in config.h file. To disable simulavr info sections, launch make with variable set SIMULFLAGS= Example command for flashing Arduino UNO: make flash MCU=atmega328p SIMULFLAGS= UPLOAD_PORT=/dev/ttyACM0, assuming that configuration is complete. Makefile contains paths configuration to arduino core or mighty core, they need to be set up correctly. Project does not use arduino libraries at all, it is just compatible with Arduio IDE which should be capable of whole compilation and memory programming task, just open the .ino file.

List of supported G-codes

For now parser is kept simple and not so proof for sophisticated errors in code syntax.

  • G0 X? Y? F? - liner move - jump, F is an feedrate
  • G1 X? Y? F? - linear move - stitch
  • G28 - home axes
  • G90 - set to absolute positioning
  • G91 - set to relative positioning
  • M0 - unconditional stop of all movement in progress
  • M112 - kill, stops everything and requires reset
  • M114 - get current position info
  • M119 - get endstop triggers status
  • M222 S? - sets the motor max speed limit in SPM
  • M301 S? P? I? - set the kP and kI values, S sets the current motor speed for tuning purposes

Source files description

Code is written in pure C.

Name Description
config.h Configuration constants definitions.
debug.c Debugging aids.
gcode_parser.c G-code interpreter, instructions and their actions definitions.
kinematics.c Separated code for different movement schemes.
maths.c Calculation stuff, functions, constants, tables.
motion_planner.c Ramping acceleration and lookahead related stuff.
motor.c A rather complex block of math that figures out when to step each axis according to speed and acceleration profiles and received moves.
msg.c For numbers parsing.
pinio.c Initialize all I/O.
queue.c The queue of moves received from the host.
sensors_control.c DC motor speed controller implementation and needle position detection and processing.
serial.c Serial buffers and communication management.
teathimble.ino.c Code starts here.
teathimble.ino Same as above, allows firmware to be built in Arduino IDE.
timer-avr.c Timer management, used primarily by motor.c for timing steps.