Skip to content

On/Off Button mount for Makerselect v2/wanhao duplicator.

Advertising
Advertising
?
Creation quality: 5.0/5 (1 vote)
Evaluation of members on the printability, utility, level of detail, etc.

  • 1.2k views
  • 1 like
  • 11 downloads

License
3D design format
STL Folder details Close
  • Button_mountv2.stl

Learn more about the formats

3D model size X 36.2 Γ— Y 37.7 Γ— Z 33 mm
Publication date 2021-05-16 at 23:11
?
Published to Thingiverse on: 2018-01-29 at 02:04
Design number 428798

3D printer file info

3D model description

I have my monoprice Maker select v2 printer connected via a relay as described in thing 1428478 (https://www.thingiverse.com/thing:1428478) so I can turn it on and off remotely from octoprint. This is great, but I wanted a local way to turn it on or off without having to use a browser or the power switch. Turning it off via the power switch means that it can't be turned back on via octoprint, and turning it off via octoprint means it can't be turned back on with the power switch.

So I designed the button mount to attach a push button switch to the side of the printer. The button is wired to the raspberry pi to provide another input that can be used to trigger a script to toggle the printer state.

It screws into the two screws near the top on the right side. You will need two (2) M3 screws at least 8mm long to replace the short screws. I used 10mm screws left over from the z-brace mod. You will also need a push button with a shaft no wider than 16mm and a collar/nut between 16mm and 25mm. I pulled my button from my collection, but it was like this one from adafruit.

Those two screws hold the top brace in place, so I would take care to never remove them both at once.

Installation instructions

  1. Solder two wires to the switch.
  2. Measure and cut wires to desired length, adding an inch or two for routing via the channel in the bottom of the button holder.
  3. Thread button switch into large hole on button holder, and secure with the nut that comes with the switch.
  4. Unscrew the top screw from the printer.
  5. Secure the top of the holder to the printer using a longer M3 screw to replace the one you took out. Tighten it enough to secure the printer, but still let the button holder swivel.
  6. Remove the second short screw.
  7. Route the wires in the channel on the button holder and swivel the holder until the bottom hole lines up.
  8. Screw the second longer screw to the bottom hole.
  9. Making sure that the wires are coming out of the channel and are not pinched, tighten down both screws.
  10. Connect other end of the wires to your Raspberry pi or whatever the switch is going to control. I used Pin 26 and Ground

software setup

I already had scripts to start or stop the printer by toggling pin 19 of the raspberry pi which was connected to the relay, as described in jeffeb3's thing 1428478 (https://www.thingiverse.com/thing:1428478). Now I needed to read the pin I wired up (pin 26, paradoxically right by pin 19) and toggle the printer state. Here is how I did it, adjust these steps to match your setup:

I made the following script to read pin 19 and toogle the power state. It runs the same scripts that octoprint does to power the printer on or off. That way if I choose to change the behavior of one of them, the toggle script will pick up the change.

#!/bin/bash
state=`gpio -g read 19`
echo "state is $state"
if [ "$state" -eq "0" ]
then
   /home/pi/scripts/printer_on.sh
   echo "turning printer on"
else
   /home/pi/scripts/printer_off.sh
   echo "turning printer off"
fi

Once I had verified that this worked, I had to trigger it whenever the button shorts the button pin (26 in my case) to ground.
1. Configure the pin to be input -- gpio export 26 in
2. Configure the internal pullup resistor, so it reads 1 when the button is NOT pressed -- gpio mode 26 up
3. Test to see if the button works by reading the pin with the button pressed and not pressed -- gpio read 26

To watch the pin I downloaded and compiled gpio-watch program. gpio-watch has a mode where it will watch for a rising edge (transition from 0 to 1) and "debounce" the signal by waiting to see if the signal stays the same before showing the change. This is to keep the button from triggering multiple times during the transition between the switch being fully engaged and disengaged. The debounce time the software is compiled with was inadequate on my raspberry pi 3, I had to increase it several times before it reliably triggered only once per button press.

  1. dowload the zip file and expand it
  2. Edit "main.c" and change the line that says #define DEBOUNCE_INTERVAL 100000L to #define DEBOUNCE_INTERVAL 100000000L (or whatever value works for you).
  3. Compile the software -- make
  4. install it -- sudo make install

After gpio-watch is configured to watch a pin, it will run a script with the same name as a pin in /etc/gpio-watch. So in my case, it runs /etc/gpio-watch/26.

#!/bin/sh
  #echo
 "Something happened! Pin=$1, value=$2"
/home/pi/scripts/printer_toggle.sh

After that script is in place, you can test it with gpio-watch 26:switch. Note that this will only work if you have configured the pin as detailed above.

Finally, you have to set the pi to set up the pins at startup and to run the gpio-watch process in the background. Add this to rc.local:

/usr/bin/gpio export 26 in
/usr/bin/gpio mode 26 up
/usr/bin/gpio-watch 26:switch &

Now enjoy turning your printer on and off with the press of a button, while still being able to control it from octoprint.

3D printing settings

-

Advertising


Issue with this design? Report a problem.

Would you like to support Cults?

You like Cults and you want to help us continue the adventure independently? Please note that we are a small team of 3 people, therefore it is very simple to support us to maintain the activity and create future developments. Here are 4 solutions accessible to all:

  • ADVERTISING: Disable your banner blocker (AdBlock, …) and click on our banner ads.

  • AFFILIATION: Make your purchases online by clicking on our affiliate links here Amazon.

  • DONATE: If you want, you can make a donation via Ko-Fi πŸ’œ.

  • WORD OF MOUTH: Invite your friends to come, discover the platform and the magnificent 3D files shared by the community!


Sharing and downloading on Cults3D guarantees that designs remain in makers community hands! And not in the hands of the 3D printing or software giants who own the competing platforms and exploit the designs for their own commercial interests.

Cults3D is an independent, self-financed site that is not accountable to any investor or brand. Almost all of the site's revenues are paid back to the platform's makers. The content published on the site serves only the interests of its authors and not those of 3D printer brands who also wish to control the 3D modeling market.

100% secure payment by credit card, PayPal, Apple Pay, Google Pay, etc.
View all payment options.