In a previous post I described some safety electronics for Squirty the RepRap that will switch off power to the printer if the hotend got too hot or if the bed was powered for too long. In this post I’ll describe an upgrade to that system and a setup to allow logging of safety information to a Raspberry Pi.
Some of the feedback I got on the safety system pointed out that it wouldn’t protect against a bad power connection to the heated bed. A bad connection at this point is a common problem and can cause sparking, melting of the terminal or even fire. To protect against this possibility I soldered two sensing wires to the bed terminals. These are connected to a potential divider made up of a 470k and 100k resistor, which will reduce a 19V level on the sensing wire to 3.3V. The output from these potential dividers then can be read by analog pins on the Freaduino I am using to control the safety cutoff.
I have edited the firmware so that the printer will now be switched off if the voltage on the positive bed power supply falls below 18V, and if the voltage on the negative bed power supply rises above 1V. I tested the cutoff by pulling out the power supply wires.
There are now several ways that the safety cutoff can be activated. That means if you leave a print going and come back to find that the cutoff has been activated you have no way of knowing what went wrong. To get around this problem I connected the Freaduino to my OctoPi host using a USB cable, and wrote a shell script that will log output from the Feaduino to a text file automatically. That way you can inspect the end of the log to see what went wrong.
The updated firmware is available on github and there are instructions below on creating the shell script to log the safety system output to a raspberry pi.
Create a new shell script using
sudo nano printer_safety_logging.sh
echo "Safety logging active"
echo "Safety logger Pi switched on at: " >> /home/pi/safety_log.txt
date '+%A %D %X' >> /home/pi/safety_log.txt
echo "" >> /home/pi/safety_log.txt
cat /dev/ttyACM0 >> /home/pi/safety_log.txt
Make it executable with
sudo chmod +x printer_safety_logging
Add the script to startup by opening rc.local (
sudo nano /etc/rc.local) and adding the following line just before
sh /home/pi/printer_safety_logging.sh &