Atmega8A-PU filament monitor with optical encoder for Marlin firmware by stinguc 3d model
Warning. This content is not moderated and could be offensive.
ammo
3dmdb logo
Thingiverse
Atmega8A-PU filament monitor with optical encoder for Marlin firmware by stinguc

Atmega8A-PU filament monitor with optical encoder for Marlin firmware by stinguc

by Thingiverse
Last crawled date: 3 years ago
Atmega8A-PU filament monitor with optical encoder for Marlin 1.1.0-RC8 firmware
The second version can be found at https://www.thingiverse.com/thing:2838776
Having a cheap chinese hotend, from time to time i had filament filament grinding & clogging so naturally i searched for a filament monitor. None of them fulfilled my needs so i created one. Having some spare Atmega8A-PU microcontrollers and some phototransistors (http://www.tme.eu/en/details/ll-304ptc4b-1ad/phototransistors/lucky-light/) and using as inspiration 2 projects available on the internet:https://github.com/leuconoeSH/avr-exampleshttps://sites.google.com/site/tunelldev/home/filamentmonitor
i created a simple filament monitor which fullfilled my needs and is working without any issue for 1.5 months already.
The desing is simple and cheap to implement: 2 phototransistors, 2 leds, an atmega8 microcontroller and some 0.25w resistors & capacitors is all you need for electronics. Also 2 small pieces of ptfe tubes are nice to have, but not strictly required, in order to facilitate filament movement.
I used the PORTC of Atmega8A-PU microcontroller to sense and control the program logic.
PC5 is used for emitter led (the led which is used to detect the filament movement)
PC4 is used for the first phototransistor
PC3 is used for the second phototransistor
PC2 is used to display operation mode
PC1 is used to signal filament stoppage
PC0 is used to start the operations
The filament monitor uses, to monitor the filament movement, an optical encoder created by EMITTER_LED, A_RECEIVER, B_RECEIVER & wheell_alt.
After power on the default timeout to signal filament stoppage is set to 8 seconds.
There are 2 modes of operation:
1) If you short press the start button the default timeout (or the last timeout set) is used to detect filament stoppage
2) If you long press (at least 2 seconds) the start button, the filament monitor enters an mode where you can change the default timeout for filament stoppage detection. To set a new timeout you should keep the start button pressed until the desired timeout is set. The new timeout is indicated by OP_MODE_LED which blinks once at every second if the start button is pushed. So to set a timeout of 10 seconds proceed like that: press and hold the start button, wait 2 seconds (still holding the start button) and the OP_MODE_LED starts to blink, now count each blink and when 10 is reached release the start button. After each new timeout set the OP_MODE_LED displays the new timeout blinking for each second in the new timeout. So if you set 10 seconds as a new timeout, after start button release the OP_MODE_LED will blink for 10 times before start.
At any time, after start, you can stop the filament monitor by pressing the start button.
The OUT_PIN (pin 1 of PORTC) has a value of 0V on start and normal operation mode and will raise to 5V (for 2.5 seconds) on filament stoppage. Also on filament stoppage the OP_MODE_LED will blink.
After signalling a filament stoppage the monitor will stop so in order to restart it you will need to press the start button again. Also after a (re)start, without power off, the filament monitor will use the last timeout set.
To flash the microcontroller you can use the FilamentMonitor.hex file from filament_monitor.zip archive, also you can recompile the project from filament_monitor subfolder and use the recompiled hex file.
Fuses: LOW: 0xFF, HIGH: 0xC9
Any AVR programmer can be use to program the microcontroller. I used the one from Open Programmer (https://sourceforge.net/projects/openprogrammer/)
The monitor was designed for Marlin firmware & RAMPS 1.4 board but should be easilly adaptable to other configurations.
To connect the monitor to RAMPS 1.4 , please check the corresponding image. The signal provided by filament monitor will be connected to D44 on AUX-2.
The needed modifications of Marlin 1.1.0-RC8 firmware are available in marlin.patch from filament_monitor.zip archive.
When the filament monitor signals the error condition an M600 command is added to the current queue and previous and current enqueued commands are sent to the connected PC (if any), so if you use a program like Printrun (http://www.pronterface.com/) you will see in console something like:
M600 triggered.
Previous command: G1 X164.957 Y136.368 E4.70389
Enqueued commands: M600
Also you should activate M600 command in Configuration_adv.h (marlin firmware), uncomment the line:
// #define FILAMENT_CHANGE_FEATURE // Enable filament exchange menu and M600 g-code (used for runout sensor too)
and change FILAMENT_CHANGE_X_POS, FILAMENT_CHANGE_Y_POS, FILAMENT_CHANGE_UNLOAD_LENGTH & FILAMENT_CHANGE_EXTRUDE_LENGTH accordingly to your printer settings.
wheell_alt.stl should be made from a non-transparent filament. I made all pieces from green non-transparent PLA. For EMITTER_LED i used a bright green one and for OP_MODE_LED i used a red one.
Optional components are presor_wheel.stl & arm.stl

Tags