
Classd
yope/kamaq
Python/Cython implementation of 3D printer firmware running on Linux

Python/Cython implementation of 3D printer firmware running on Linux
Pihat all is an open-source printed circuit board by yope, from the yope/kamaq repository on GitHub, published under the GPL-2.0 licence. It is a 2-layer board of 143 × 97 mm with 305 parts on 192 nets, routed with 2,492 tracks and 382 vias.
It is built around the PAM8320RDR, TLV2464CD and 74HCT08D, with the CM6206-LX, S1M and BSS138W among its other parts. Its parts include 127 capacitors, 121 resistors, 22 connectors, 14 ICs and 10 diodes. It belongs with the robots and motor control and computers and single-board computers boards of this library.
Kamaq is a 3D-printer (FDM) controller software running on an embedded Linux system. It is capable of controlling a RepRap-style 3D printer, but with different electronics. Stepper motor control is done using a 8-channel (7.1) USB audio device and some class-D audio amplifiers. Endstop switches are monitored via GPIO inputs (interrupt-capable) and temperature control for extruder and heated bed via standard hwmon-compatible ADC's and GPIO-outputs for heater control. The software has a web-iterface for machine control and monitoring. Why do it like this when there are already so many different hard- and software projects dedicated to 3D printers (RepRap and all its derivatives)? Well, because as is the case with all engineers, I always know better ;-)
This project is currently in heavy development. There are some bugs and missing features, but overall the software can be (and has been) used for many successful prints. The software can control 4 motors (X, Y, Z and Extruder), read 3 endswitches and control extruder- and heated-bed temperatures. The G-Code interpreter is still very simple, but the software is already able to succesfully print objects from a G-Code-file generated with cura or repsnapper.
Kamaq should be able to run on any embedded linux platform such as the beagle- board, beagle-bone or the raspberry-pi with a suitable audio device, GPIO and HWmon compatible A/D converters for temperature measurement. The sound device should have twice the number of channels as the number of motors that need to be controlled. For example a cheap 7.1 USB audio device will be enough for controlling 4 stepper-motors.
Of course the main goal for this project is controlling 3D-printer hardware, such as the RepRap Prusa i3 for example, but it may also be adapted for other applications requiring control of motors from G-Codes.
The sound-card will work better if modified slightly, by shorting the DC- blocking capacitors at the output. On many USB audio devices this is a trivial task to do. For example the Sweex SC016 contains a C-Media CM6206 7.1 channel USB audio codec. Datasheets can easily be found via Google, and they contain reference schematics that will be very similar to most implementations of popular 7.1 USB audio devices that use this chip. Most of the time they will use cheap through-hole electrolytic capacitors, that are very easy to short out.
Bipolar 2-phase stepper-motors are best driven by a controlled current. Although in theory, having a good model of the motor that takes into account inductance and back-EMF at different speeds, one could calculate the correct voltage-waveform to be applied to the motor windings and just use a voltage- amplifier wich might be a little easier to build (specially when using class-D amplifier IC's). For my first hardware implementation, I built very simple class-B amplifiers with current-feedback based on a bunch of TDA2030A I had laying around. This version didn't require any motor modeling. The second version which I am currently using is based on class-D audio amplifier IC's, which save a lot of space and simplify the power supply enormously. The class-D amplifiers lack current-feedback though, so I have added rudimentary software support for voltage control also.
To control heater elements (such as for the extruder or the heated-bed of a 3D-printer), simple low-side switches with power-MOSFETS with very low-Rdson will be perfect. Temperature feedback is best implemented via simple A/D converters that support HW-mon drivers, such as the ADS1015 from TI, which has mainline-linux support.
I have implemented all the needed hardware to control a 3D printer using this software in very little time and effort. If there is enough interest I might open-source the hardware (Kicad schematics and layout) too, but it is really simple and straight-forward stuff right now hacked together in very little time.
kamaq.py: Main application, starts the web-server.
grunner.py: This command-line tool can execude whole G-Code files or single movements by specifying relative distance on each axis (including extruder) on the command-line. It supports homing on endswitches and extruder temperature control. Currently not functional. Use the web-server instead.
set_current.py: Very simple tool that sets constant motor currents for all motors specified on the command-line. Can be used for adjusting motor current via the audio mixer. For each motor, two values are specified from -30000 to 30000, corresponding to the currents through each of the two coils. If less than 8 values (for 4 motors) are specified, the rest is assumed to be 0.
adjust_bed.sh: A script that aids in adjusting the for corners of the print- bed.
clean_extruder.sh: Move to a suitable position (high enough Z), heat extruder and start extruding a few cm. Deprecated. Will be removed soon probably.
Features that may or may not be implemented in the near or far future:
Install build dependencies (debian jessie or ubuntu):
$ sudo apt-get install python3 cython3 libasound2-dev
Building (in-place, installation not supported yet):
$ make
| Qty | Value | Footprint | References |
|---|---|---|---|
| 56 | 1U | SM0805 | C1002, C1003, C1005, C1006, C1007, C1008, C1009, C1102, C1103, C1105, C1106, C1107, C1108, C1109, C1202, C1203 +40 |
| 21 | 10K | SM0603 | R206, R207, R208, R209, R210, R307, R308, R309, R310, R317, R318, R319, R320, R407, R408, R409 +5 |
| 21 | 1K | SM0603 | R101, R102, R1301, R1302, R1303, R1305, R1306, R1307, R1309, R1310, R1311, R1313, R1402, R1406, R1501, R1502 +5 |
| 20 | 10N | SM0603 | C301, C302, C304, C305, C401, C402, C404, C405, C501, C1001, C1101, C1201, C1404, C1405, C1406, C1407 +4 |
| 19 | 22K | SM0603 | R204, R303, R304, R305, R306, R313, R314, R315, R316, R403, R404, R405, R406, R413, R1401, R1407 +3 |
| 16 | 0.5/3W | R6 | R504, R505, R604, R605, R704, R705, R804, R805, R904, R905, R1004, R1005, R1104, R1105, R1204, R1205 |
| 16 | 2.2K | SM0603 | R301, R302, R311, R312, R401, R402, R411, R412, R501, R601, R701, R801, R901, R1001, R1101, R1201 |
| 16 | 220P | SM0603 | C510, C511, C610, C611, C710, C711, C810, C811, C910, C911, C1010, C1011, C1110, C1111, C1210, C1211 |
| 16 | 47K | SM0603 | R502, R503, R602, R603, R702, R703, R802, R803, R902, R903, R1002, R1003, R1102, R1103, R1202, R1203 |
| 14 | 100N | SM0603 | C201, C202, C204, C206, C208, C303, C403, C1302, C1403, C1502, C1503, C1504, C1506, C1507 |
| 10 | KC1U | SM0805 | C103, C203, C205, C207, C1301, C1401, C1402, C1408, C1501, C1505 |
| 8 | 10U | SM1206 | C504, C604, C704, C804, C904, C1004, C1104, C1204 |
| 8 | PAM8320 | SO16E | U501, U601, U701, U801, U901, U1001, U1101, U1201 |
| 5 | LED | SM0603 | D101, D201, D1504, D1505, D1506 |
| 5 | S1M | DO-214AC(SMA) | D1401, D1402, D1501, D1502, D1503 |
| 3 | 1.2K | SM0603 | R1304, R1308, R1312 |
| 3 | 47 | SM0603 | R1403, R1404, R1405 |
| 3 | JUMPER | SIL-2 | JP101, JP102, JP1501 |
| 3 | SQM100N04 | TO263 | Q1501, Q1502, Q1503 |
| 3 | TLV2464 | SO14E | U301, U401, U1301 |
| 2 | 22 | SM0603 | R211, R212 |
| 2 | ALU470U-25V | C2V8 | C101, C102 |
| 2 | ATX_PER | bornier4 | P101, P102 |
| 1 | 0 | SM0603 | R202 |
| 1 | 12MHZ-12PF | HC-49V | X201 |
| 1 | 1M | SM0603 | R203 |
| 1 | 25A | ATO257 | F1501 |
| 1 | 330 | SM0603 | R205 |
| 1 | 74HCT08 | SO14E | U1501 |
| 1 | ADC128S022 | SO16E | U1401 |
| 1 | AUX | bornier2 | P1507 |
| 1 | BED | MC4 | P1506 |
| 1 | BSS-138 | SOT23GDS | Q101 |
| 1 | CM6206 | AB2_LQFP48 | U201 |
| 1 | CODEC_ANALOG | SIL-10 | P201 |
| 1 | CONN_13X2 | pin_array_13x2 | P1501 |
| 1 | END_L | SIL-2 | P1508 |
| 1 | END_X | SIL-2 | P1502 |
| 1 | END_Y | SIL-2 | P1503 |
| 1 | END_Z | SIL-2 | P1504 |
| 1 | EXT | bornier2 | P1505 |
| 1 | FAN | SIL-3 | K1401 |
| 1 | KC10U | SM0603 | C104 |
| 1 | MOLEX-39-28-1043 | MINIFIT-4 | P104 |
| 1 | MOTOR_E | MC4 | P108 |
| 1 | MOTOR_X | MC4 | P105 |
| 1 | MOTOR_Y | MC4 | P106 |
| 1 | MOTOR_Z | MC4 | P107 |
| 1 | N.P. | SM0603 | R201 |
| 1 | SERIAL | SIL-4 | P103 |
| 1 | SI2302DS | SOT23GDS | Q1401 |
| 1 | TEMP_ADC | SIL-4 | P1401 |
| 1 | TEMP_AUX | SIL-2 | P1303 |
| 1 | TEMP_BED | SIL-2 | P1302 |
| 1 | TEMP_EXT | SIL-2 | P1301 |
| 1 | USB-MINI-B | USB_MINI_B | CON101 |

yope/kamaq
Python/Cython implementation of 3D printer firmware running on Linux


cernohorsky/DeltaSDR
HF Software Defined Radio Transceiver that includes ADC and DAC circuits. No soundcard is needed. Board communicates only trough one USB cable.


leafai-io/leaf-node-v3.x
Modular node for sensor monitoring and device control in grow environments.

TheNoobInventor/pi-pico-drone
A micro drone is made using the Raspberry Pi Pico W. It is fitted with the MPU6050 IMU module and BMP280 barometric sensor. The drone will be controlled using TinyMPC and employ a Micro-ROS client on FreeRTOS.

vorlaxen-labs/AratMicro
High-performance, open-source micromouse robot platform built for Robosam and MEB Robot (Ministry of National Education Robotics Competition, Turkey).


It measures 143 × 97 mm and has 2 copper layers, 1.6 mm thick.
305 parts, built around the PAM8320RDR, TLV2464CD, 74HCT08D and CM6206-LX. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the yope/kamaq repository on GitHub, at the commit this page was made from: the board is schematics/pihat/pihat_all.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the GPL-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).