Media Control Knob

11 (likes)
2986 (views)
This product is available only if you have an account in My Mini Factory service
×
Color:

IntroMedia Control Knob inspired by Mikolas Zuza design:https://blog.prusaprinters.org/3d-print-an-oversized-media-control-volume-knob-arduino-basics/ I've changed the enclosure, code and used digispark instead of arduino so it's hard to call it a remix. Because I've reached 100 subscribers on YouTube and I'm very happy about it you can win one of these, just enter the giveaway here:https://kingsumo.com/g/iwjfoi/3d-printed-media-control-knob-medyk3d-100-subs-on-youtube My video about this item:youtube.com/watch?v=acIH6Y1LRc What it can do?By default pressing the knob is play/pause button, rotating changes the volume, and rotating the knob with button pressed changes the track.You can modify the left() right() and click() functions to suit your needs. BOMStuff I've used (affiliates links, you pay nothing extra, I get some change):Encoder ($ 0.5)http://s.click.aliexpress.com/e/dSqXwoQ Digispark - choose the blue one ($ 1.3)http://s.click.aliexpress.com/e/dYKzAK2 USB cable.3D printed lower and upper cover - about 27 grams of filament (3 hours with 0.2 layer). The codeHow to configure Arduino IDE for Digispark:https://digistump.com/wiki/digispark/tutorials/connectingUploading the code is easy but first you need to follow the instructions from digisaprk on how to add it to arduino IDE if you haven't already.After installing all what's left is to hit upload button and plug the digisaprk using a USB cable. After a while the multimedia knob is ready to use. If you want to change the rotation direction just switch PINENCODERA and PINENCODERB in the code. AssemblyYou will need:wires, wire cutters, digispark, encoder, soldering iron, something to desolder pins from encoder, hot glue, a file, 3D printed parts, usb cable. First prepare the wires cut 5 pieces to about 2,5 cm(1inch) length and cover the end with solder.Desolder the pins from the encoder.Round over the edges of digispark with a file, be careful not to damage the USB socket.Now connect the encoder with the digispark in my case I'm using black wire for GND, red for 5V, these are really important, so be sure to connect them properly.The next three wires are:blue for switch,green and yellow for encoder A and B outputs. These are not super important you can always change them in the software.In any case there is the schematic if you need one.You need to remove the LED. It's a good idea to add something non slippery to the bottom so you can rotate the knob easily.Pure PLA just slides way to easy on the desk surface.   Source code   #include "TrinketHidCombo.h" #define PINSWITCH 0#define PINENCODERA 2#define PINENCODERB 1 bool switchState = HIGH;bool encoderAState = HIGH;bool encoderBState = HIGH;bool previousSwitchState = HIGH;bool previousEncoderAState = HIGH;bool previousEncoderBState = HIGH;bool canClick = true; // the setup routine runs once when you press reset:void setup() { pinMode(PINSWITCH, INPUT); pinMode(PINENCODERA, INPUT); pinMode(PINENCODERB, INPUT); digitalWrite(PINSWITCH, HIGH); digitalWrite(PINENCODERA, HIGH); digitalWrite(PINENCODERB, HIGH); TrinketHidCombo.begin(); // start the USB device engine and enumerate encoderAState = digitalRead(PINENCODERA); encoderBState = digitalRead(PINENCODERB); previousSwitchState = switchState; previousEncoderAState = encoderAState; previousEncoderBState = encoderBState;} // the loop routine runs over and over again forever:void loop() { bool wasChanged = false; previousSwitchState = switchState; previousEncoderBState = encoderBState; previousEncoderAState = encoderAState; bool switchStateReading = digitalRead(PINSWITCH); bool encoderAStateReading = digitalRead(PINENCODERA); bool encoderBStateReading = digitalRead(PINENCODERB); delayMicroseconds(750); if(digitalRead(PINSWITCH) == switchStateReading && switchStateReading != switchState) { switchState = switchStateReading; wasChanged = true; if(switchState == LOW) { canClick = true; } } if(digitalRead(PINENCODERA) == encoderAStateReading && encoderAStateReading != encoderAState) { encoderAState = encoderAStateReading; wasChanged = true; } if(digitalRead(PINENCODERB) == encoderBStateReading && encoderBStateReading != encoderBState) { encoderBState = encoderBStateReading; wasChanged = true; } if(wasChanged == true) { if(encoderAState == LOW && encoderBState == LOW) { if(previousEncoderAState == HIGH && previousEncoderBState == LOW) left(switchState); if(previousEncoderAState == LOW && previousEncoderBState == HIGH) right(switchState); } if(encoderAState == HIGH && encoderBState == HIGH) { if(previousEncoderAState == LOW && previousEncoderBState == HIGH) left(switchState); if(previousEncoderAState == HIGH && previousEncoderBState == LOW) right(switchState); } if(switchState == HIGH && previousSwitchState == LOW) click(); } TrinketHidCombo.poll(); delayMicroseconds(1000);} void left(bool switchState){ canClick = false; if(switchState) TrinketHidCombo.pressMultimediaKey(MMKEYVOLDOWN); else TrinketHidCombo.pressMultimediaKey(MMKEYSCANPREVTRACK);} void right(bool switchState){ canClick = false; if(switchState) TrinketHidCombo.pressMultimediaKey(MMKEYVOLUP); else TrinketHidCombo.pressMultimediaKey(MMKEYSCANNEXTTRACK);} void click(){ if(canClick) TrinketHidCombo.pressMultimediaKey(MMKEYPLAYPAUSE);//MMKEYMUTE}

About the author:
medyk3D
I am a maker and I like to make stuff. I enjoy challenging myself. Visit my youtube channel and leave a comment or a thumb up: https://www.youtube.com/medyk3D If I can repair or make something useful I am up for it. Never afraid to fail, because that is how we learn and improve. Instagram: https://www.instagram.com/medyk3d/ TikTok: https://www.tiktok.com/@medyk3d? Twitter: https://twitter.com/DMedyk3 Odysee: https://odysee.com/@medyk3D:e

Reviews

This model have no reviews. Would you like to be the first to review? You need to print it first.