Atmega8A-PU filament monitor with optical encoder for Marlin firmware v2

Atmega8A-PU filament monitor with optical encoder for Marlin firmware v2

myminifactory

WarningThis modification could break your 3d printer if you don't follow proper static discharge procedures and personal safety precautions when working with your printer.I accept No responsibility whatsoever for any damage to your person or property due to use of the Filament Monitor or related systems.No guarantees of functionality or fitness for any particular use of the Filament Monitor.User Accepts All risk Atmega8A-PU filament monitor with optical encoder for Marlin 1.1.x firmware second version. 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 from a old optical mouse 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 5 months already.The desing is simple and cheap to implement, i used parts from an old ball mouse: one encoder wheel and infrared emitter & receiver, an atmega8 microcontroller and some 0.25w resistors & capacitors.To facilitate filament movement i used 2 small pieces of ptfe tubing.   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 phototransistorPC3 is used for the second phototransistorPC2 is used to display operation modePC1 is used to signal filament stoppagePC0 is used to start the operationsThe 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 stoppage2) 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 support.zip archive, also you can recompile the project from filament_monitor subfolder and use the recompiled hex file.Fuses: LOW: 0xFF, HIGH: 0xC9Any 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.x firmware are available in marlin.patch from support.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.70389Enqueued 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 setting The monitor is splitted in 2 parts, one which can be attached to extruder and one which contain the monitor and can be mounted to the frame, for multiple use cases.In my case sensor_support file was used to attach the monitor to "Infill 3D 75 Geared Extruder"The sensor_case_filament_guide & sensor_case_support are not required, their are just examples of how the filament case can be used.Also sensor_wheel should be adjusted to your particular case.  

Download Model from myminifactory

With this file you will be able to print Atmega8A-PU filament monitor with optical encoder for Marlin firmware v2 with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Atmega8A-PU filament monitor with optical encoder for Marlin firmware v2.