Home Creators Posts Import Register Favorites Logout

Content

This post contains links to the additional resources used in the "Knock, Knock" puzzle described at https://www.patreon.com/posts/24133922

Components Used: 

- Arduino UNO, ~$4 from, e.g. AliExpress 

- Prototype Shield, ~$1, AliExpress

- 5V passive buzzer, ~$0.07, AliExpress 

- 15mm Piezo, ~$0.06, AliExpress

- Keyes KY-030 microphones module, ~$1, AliExpress 

- 5V relay module. In the video I used a 2-channel module, because that's what I had to hand, although you only actually need a single channel module if the only load you want to activate is the maglock. $1, AliExpress

- 180kg 12V maglock, $20, Amazon 

- 220Ω resistor

- 165Ω resistor

- LED  

 Total Cost = under $30 (vast majority of cost is the maglock!) 

 Download:  

The Arduino code, wiring diagram, and Fritzing project can be downloaded in a .zip archive from https://drive.google.com/open?id=1CVMpqn3As1iAQKPISKz-6OzvqD2TSuFr 

Comments

David Cottam

Hi Alastair! Every year we have done an escape room for our kids on Christmas Day, they have gotten to the point where I need fun puzzles, hence why I became a Patreon! A lot of the links above no longer work, do you have alternatives? Thank you! ** Update ** I was able to find everything but the following: -- Keyes KY-030 microphones module -- 165Ω resistor

Annalise Shippee

Not sure if you will still respond. I have really enjoyed your puzzles thus far and have taken on the adventure of trying this one. I have only done very basic coding. What do I need to remove to make the code I downloaded work for the Happy Birthday knock and a failsafe maglock? When I try to run a test on the arduino sketch it gives me the error that the playbackKnockpattern was not declared. Help please!

Rebecca

Is there a RESET code to be able to use it with MQTT - to reset the device remotely?

David J Sebek

I have had no problems with this code until today. I was testing thresholds for a puzzle sequence I was trying out, had uploaded the code a number of times and then started getting a number of errors. Went back and copied original code from Patreon and still getting same error messages: /usr/local/bin/arduino-cli compile --fqbn arduino:sam:arduino_due_x_dbg --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/892287084/build --build-path /tmp/arduino-build-AD2D42274FF088F64D9059DDF4E09887 /tmp/892287084/Knock_Knock_May_30_2021 Compiling sketch... /home/builder/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -mcpu=cortex-m3 -mthumb -DF_CPU=84000000L -DARDUINO=10607 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino Due\"" -I/home/builder/.arduino15/packages/arduino/hardware/sam/1.6.12/system/libsam -I/home/builder/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/CMSIS/Include/ -I/home/builder/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/Device/ATMEL/ -I/home/builder/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/sam/1.6.12/variants/arduino_due_x /tmp/arduino-build-AD2D42274FF088F64D9059DDF4E09887/sketch/Knock_Knock_May_30_2021.ino.cpp -o /tmp/arduino-build-AD2D42274FF088F64D9059DDF4E09887/sketch/Knock_Knock_May_30_2021.ino.cpp.o /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino: In function 'void setup()': /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:96:47: error: invalid conversion from 'const int*' to 'int*' [-fpermissive] playbackKnockPattern(secretKnockPattern, 500); ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:375:6: error: initializing argument 1 of 'void playbackKnockPattern(int*, int)' [-fpermissive] void playbackKnockPattern(int knockPattern[], int maxKnockInterval){ ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino: In function 'void loop()': /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:153:38: error: invalid conversion from 'const int*' to 'int*' [-fpermissive] printPattern(secretKnockPattern); ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:402:6: error: initializing argument 1 of 'void printPattern(int*)' [-fpermissive] void printPattern(int pattern[]){ ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:157:55: error: invalid conversion from 'const int*' to 'int*' [-fpermissive] if(comparePattern(inputPattern, secretKnockPattern)){ ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:295:6: error: initializing argument 2 of 'bool comparePattern(int*, int*)' [-fpermissive] bool comparePattern(int inputPattern[], int secretKnockPattern[]) { ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino: In function 'void onIncorrectInput()': /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:177:27: error: 'tone' was not declared in this scope tone(buzzerPin, 500, 200); ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino: In function 'void onPuzzleSolved()': /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:199:27: error: 'tone' was not declared in this scope tone(buzzerPin, 784, 200); ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino: In function 'void playbackKnockPattern(int*, int)': /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:379:33: error: 'tone' was not declared in this scope tone(buzzerPin, 784, blinkTime); ^ /tmp/892287084/Knock_Knock_May_30_2021/Knock_Knock_May_30_2021.ino:382:19: error: 'noTone' was not declared in this scope noTone(buzzerPin); ^ Error during build: exit status 1

David J Sebek

Any thoughts on why it would work well and then suddenly all these error messages when trying to upload again?

David J Sebek

It’s a Uno…I must have switched it in the uploaded without noticing…thank you for the quick reply and keep posting…always look forward to the next puzzle!!

세진 박

what kind of resistance should i use in esp32 wroom 32d