MakerBot Print is our newest print-prepration software, which supports native CAD files and STL assemblies,
allows you to interact with all your printers via the Cloud, and many other exciting new features.

Download Now


magic switchboard

by aeropic Feb 11, 2017
Download All Files

Thing Apps Enabled

Please Login to Comment

Hi, the idea is good.

First time I saw it, I was flabbergasted. That's an awesome trick.

same for me ;-)

Thanks !

Great work! A step drill was my best friend for this one. Holes just a little larger than required makes it SOOO much easier to fish things through without them being mashed or inadvertently cut by threaded metal components. Thanks for making this easy - and the great level of detail. I had to scale up the Z axis on the case, to allow for sufficient space for the backside of the switches I used, but that was a simple fix.

Thanks for this feddback! If you made it, please post some pictures ...

Thanks for posting this and sharing your work! One thing I'm a little concerned about before building this is static electricity, since with the hacked switches, any static built up on the body will be transferred from fingers directly to the PIC input pins (as opposed to an un-hacked switch that would be safely isolated, but would need to be concealed so the wiring cannot be seen by the audience). Is there anything you routinely do to reduce the risk of damage due to static discharge when using your box (especially in winter)?

Well, i never experienced any issue with this device... Not sure the PIC Inputs are sensitive to ESD, as far as i remember there are some internal clamp diodes to protect the Inputs of PICs...

Seems pretty resilient so far!

I have not had a chance to do this yet.
My source for the controller is digikey. They have quite a few of the same controller. Would you mind telling me which I should order...hereis the list:

What kind of switch is this? Looks like a single pole double throw....is that correct?
I have never done any programming of controllers. Other that the PICkit3, is there some kind of socket needed to connect the controller to the PICkit3?

Not sure you gave me the correct link as this one points towards a video on youtube...

For the switch, yes it is single pôle double throw (In other words an inverter !) see it open on the pictures...


I have never done any programming of controllers. Other that the PICkit3, is there some kind of socket needed to connect the controller to the PICkit3?

Yes sure... You need to solder a dil socket on one side and a Sil pins connector on a wire to interface the PIC and the pickit...

Were you able to go to the digikey link? https://www.digikey.com/products/en?keywords=16F1825%20microchip%20 Which of these is the prooper controler? So, the sockete is it dil or dip? I am not familiar with these or sil pin connectors...I could not find either when I searched.

I would prefer not using smd....so, which one would work. I don't understand the idfference between them

Thanks. So, I need essentially a socket...is that for programing? What are the sil pins for? I have never worked with microcontrollers before.
btw...I have something for you that will keep you from sleeping I am sure you will like this. I have an idea how some of it might work.

Have you seen this version? https://youtu.be/P_0M_ms16Do
How about this one? https://youtu.be/wq9M38mz3nM
Or, this? https://youtu.be/lw9MGa7iQq4

I don't have a 3 D printer.
Where can I get this printed?

Oh yes, I like the clear box versions, they are amazing.

You can realize my version without 3D printer, just use some thin plywood to make the two faces and some L shaped frame stick to build the frame around...

Can this be done using the slide switches or simple single throw?
Do you know anyone who is willing to sell the already programed chips? :-)
I would like to build the effect using either regular light bulbs 110V, smaller bulbs, like flashlight bulbs, rather than leds.
The idea is to use as few parts as possible...no batteries.
How would one have to change the circuit?
I saw one that at the end of the trick works without batteries...a hidden supercap? I don't know.
Cobra is done with a different ending: http://www.cobramagic.com/Cobra-Light.html

All this would need heavy modifications to both the hardware and the software ...
Sorry I do not sell anything !

Eu gostaria de saber de dá pra usar o PIC16F1825 -I/SL ?
Ele é um smd.


I think it should work with the hex file ... Give it a try ;-)

...All went well up on to the moment to start uploading the Hex file to the board.
I used an Arduino Nano to connect the ESP8266 07 to my laptop. (Connecting via WiFi is for a later deal)
Arduino IDE was updated with the ESP8266 files. I am not sure what ESP8266 board to select but think Generic ESP8266 should work watching a few tutorials on Youtube.
As a test I tried to uploaded the "Blink" Example file selected from the 8266 files. IDE compiles and uploads. Lights blink as they should...
But when finished the ESP8266 07 seems to disconnect and plays death...Even if I disconnect it from the Arduino.
I am doing something wrong but have no clue what...

Next...How do I import your Hex file into Arduino IDE? I have no idea, even trying to find a tutorial did not help...
Questions all over...But hey, what do you expect from a newbie...Can you help me please? :)

Some complements to my previous answer.
From what you've written it seems that you've correctely configured the arduino IDE including the "generic ESP8266 board" which is indeed the correct one.
As you've succeeded to compile and run the blink code, your hardware seems to be OK, but I'm not sure.
You say it plays death ... Do so succeed to re-compile and uplink the same firmware ? After compiling when uploading the firmware to the ESP , the IDE displays a serie of increasing dots : "..................................... "
Did you try to disconnect the GPIO0 pin from ground (when programming) and leave it floating when running the program after a hard reset (power up) ?

Ok, I am lost...I have no clue what is wrong with my set up and getting a bit frustrated at this moment.
All connections are checked and measured over and over...I re-programmed the esp8266 several times...
But still when I power-up the board, it does weird things...
---for example: starting (just connecting power) with all switches off (like it should performing the trick) lights react to the corresponding switches...SW1=L1, SW=L2 etc....but no sequence as it should. Staring up with all switched on results in weird patterns like switch 3 is turning off L1 and turning on L3 at the same moment....
Any clue?

Hi Willem70, Don't discourage yourself it will work ...
First of all, reprogram it in order to get a correct and known initial state.
Remove the batt, all switches OFF, set the batt.
Then perform this sequence:

  • SW1 ON, SW2 ON, SW3, ON, SW4 ON it shall light all leds in the same order
  • turn OFF in this order SW4, 3, 2, 1 it shall turn OF the associated leds.
  • wait 5 sec
  • now turn ON SW2 and tell me if it turns ON LED1 ?

Thanks for your quick reply and encouraging!

I ran your sequence but SW2 still lights LED2, SW1 does LED1, SW3 is LED3..etc...

OK, it could be that you locked the device during some manipulations... The locking status is stored in EEPROM and I'm not sure the EEPROM is overwritten during programmation.
Try to unlock it using this procedure :
To unlock the device, remove the battery, turn ON switch 1 only and insert the battery back.

Then turn OFF SW1, wait 5 sec and you should be back in sequence 1. Try then from this stage to turn ON SW2 or 3, it should light on LED 1...

...Just got home from work and had to check your latest suggestion...but again noting more then SW1 to L1 2to2 3to3 etc.
Also it seems that my switches work in the opposite way :O...I have no clue why...The are "tricked" and work perfect.
If I connect power (using a 3v dc adapter for the moment) when all switches are on, LED 1,2 and 4 come on. 3 stays off....?!!
If I then start switching 1,2,3,4 or in any other order, LEDs go on and off or even switch places, (switching on/off will flip between LED 1 and 3 for example)
I dont see the logic here! hahaha!
But that could also be me being that rookie....

We will try something else: Be sure you've the last version from the thingiverse page and find this line in the sketch
if ((digitalRead(SW1)==0)&&(digitalRead(SW2)==0)&&(digitalRead(SW3)==1)&&(digitalRead(SW4)==1)) { // WIFI is used only when boot with GPIO12 & 13 to ground <<<<<<<<<<<<<<<<<<<<<<<<<<< !=1

replace it by
if (withWifi == 0) { // WIFI is used only when boot with GPIO12 & 13 to ground <<<<<<<<<<<<<<<<<<<<<<<<<<< !=1

This will force the activation of the wifi and the associated web server

From a PC on the local network, connect to :
You may need to install apple "bonjour" software that activates the DNS on the local network
another option is to connect to
http://192.168.0.xx/ which is the IP adresse given by your router to the ESP replace XX by the correct value

you should then see a page saying something like:
Hello magicswitchboard debug server !
useless but fun :p
SW1234 = 0000 LED = 0000

this last line gives every 5 sec the status of the switches and the leds...
Just tell me if you succeed up to this step...

Hi again, Got your first info also...I will email some pics of my version... :)
And, tomorrow I will play around the with the new WIFI lines you posted.
I will let you know when I succeeded...Thanks!

I ment to say that the "Blink" test did NOT work...Lights blink at upload...RX/TX seem to work. When finished the ESP8266 shuts down.
No Blinking as intended by the Sketch...After reset and just connected to power still no Blinking, just a steady red light...but that was yesterday afternoon and spend the rest of the day re-building the plywood board...happy with result.
So tonight I try to connect lights and switches and maybe even try if it all works...I keep you posted and thanks again for helping me!
I used the INO file as you mentioned (Looked trough it before but did nor realized it was the Sketch just the explanation to the magic :O)
It compiles and does upload to the board via the Arduino Nano....
Soon more.

don't worry for the blink program, the blue led works weirdly sometimes and is not accessible by program on all ESP8266. I do not remember with the ESP-07 ...

Before setting everything inside the plywood board, I would advice you connect a LED + a resistor in serial on a GPIO and try it ...

And before inserting everything do not forget to remove the both LEDs (red and blue) as you might see them through the plywood and ruin any magic... (you can paint them in thick black if you don't want to remove them)

Do not try to upload the. Hex file as it is for the microchip microcontroler.
Instead, download the. Ino file double click on it and arduino should propose to create a folder, just do it.
Then the source code should open in the ide.
Then you have to modify the lines for the WiFi account and pswd.
Compile it and unlink it to the board (same process that for the blink program...)
And you are done!

Thanks for offering your help! (Won't be surprised if I need it :) )
I hope to find some time this weekend for a first attempt to program the controller. Most plywood parts are done. Only need to re-cut the "secret" layer now that I am using different switches and controller. I tricked the switches yesterday night and they work like a charm.
When possible I will post some pics of my version and build.

Hi! I love your setup and little twists in the program of the board.
I am building one and love the idea to have the possibility of re-program with WiFi! My first setup was Arduino based but like this approach better.
It will be a challenge because I am new to most of the micro controller stuff...I hope your detailed explanation will get me trough... :)
My version is based on a few layers of Lasercut plywood and looks like a vintage kids toy.
I love to build magic tricks and searched for a long time for a good Magic Switch Board plan and was very happy to find your post here ...Thanks for sharing!

I think the laser cut plywood will be really nice. It may help to give more mystery to the board as it will look less high tech that the 3d printed version.
In case you would face some difficulties with the esp8266 programming please contact me!

Can i use this with an arduino micro?

I don't really know... The code is written under the arduino IDE and should compile for Arduino micro assuming you do some cleaning to suppress all the wiffi part. As the code is pretty well commented, it should be easy to do it.
My concern is rather on the thickness of the board especially at the level of the reset button and the usb connector...


I have translated your manual into Spanish

Manual in Spanish:
Obviamente, hay algo de electrónica dentro. Se basa en el microcontrolador microchip 16F1825.
El microcontrolador se encarga de percibir la posición de los interruptores y aprende que se enciende para el interruptor de cada interruptor para encenderlo y apagarlo.
Primero apaga todos los interruptores e inserta la batería. El dispositivo se resetea y se inicia en la secuencia "predeterminada", lo que significa que aprender la relación "LED-interruptor" de izquierda a derecha; Los LEDs están numerados, LED1 el de la izquierda, después LED2, LED3 y LED4 el más a la derecha. Los interruptores se numeran de la misma manera, SW1 el de la izquierda (el más cercano a la batería), después SW2, SW3 y SW4.
En este momento, simplemente con el interruptor SW1, después SW2, SW3 y SW4 asociado a estos conmutadores a LED1, LED2, LED3 y LED4.
Una vez aprendido, los interruptores se pueden encender / apagar en cualquier orden, ya que están asociados con los LED.
Si apaga todos los LEDs y permanece apagado durante 5 segundos, el sistema se resetea y entra en un nuevo estado de aprendizaje. Por favor, en esta etapa apaga el SW1 en el último lugar ... para que la secuencia para el aprendizaje siga siendo la predeterminada (1,2,3,4).
A continuación, puedes pedir a la víctima 2 colores para intercambiar dos LED. Cambia los 2 LEDs y tendrás que aprender de nuevo los interruptores:
Mira cuál es el LED izquierdo y enciende el interruptor con el color de ese LED.
Repita con LED2, LED3 y LED4.
Simple hasta ahora, ¿no? Vamos a complicarlo un poco!
Esta versión permite al usuario seleccionar en secreto 4 secuencias de LEDs diferentes, de lo contrario las "víctimas" más las listas entender el truco al repetirse la misma secuencia de aprendizaje.
El orden de los LEDs es 1-2-3-4 por defecto y después depende del último interruptor que se apagó y el tiempo de espera.
Si el último interruptor apagado es:

  • 1, esto da la secuencia 1 = 1-2-3-4
    Explicado arriba como seleccionar los interruptores.
  • 2, esto de la secuencia 2 = 2-3-4-1 + truco especial # 2 (ver abajo).
    Mira que colorea el LED2 y enciende el interruptor con el mismo color, después haz lo mismo con el LED3, el LED4 y último LED1.
  • 3, esto de la secuencia 3 = 3-4-1-2 + truco especial # 3 (ver abajo).
    Igual que el anterior, pero empezando por el LED3.
  • 4, esto de la secuencia 4 = 4-3-2-1.
    Igual que el anterior empezando por el LED4.
    Truco N º 2 en la secuencia 2: se inicia cuando en la secuencia 2 todas las lámparas están encendidas:
    A) Retire 2 LED mientras están encendidos.
    Permita al usuario intercambiar o no las lámparas y que las inserciones dentro de los zocalos vacios.
    Se encenderán al insertarlos. Ahora arreglar los interruptores dependiendo de:
    B) si las lámparas han sido intercambiadas:
    Primero apaga los otros 2 LED, comenzando con el interruptor más la derecha de los 2 LED que no se han cambiado y después el otro.
    Una continuación puede los LED intercambiados, primero el LED más a la izquierda y luego el de la derecha.
    Si las lámparas no han sido cambiadas, la primera vez un interruptor izquierdo y luego otro situado en la derecha del primero (no es necesario que el mar más cercano a la derecha), simplemente para demostrar que nada ha modificado.
    Repetir la subsecuencia A a B tantas veces como quieras.
    Luego termine la secuencia con todos los LEDs apagados
    La nueva secuencia se determina como se determina en el último apagado, 1-2-3 o 4.
    Truco N ° 3 en la secuencia 3: se inicia en la secuencia 3 menos 2 LEDs están encendidos:

A) uno de los LED encendidos, espere 5 segundos durante los cuales quita el capuchón de color del interruptor correspondiente.
Conecte el interruptor sin el capuchón, pero el LED no se enciende.
Puedes apagarlo / encenderlo cuántas veces desees, pero no esperes más de 4 segundos cuando el interruptor está en la posición apagado.
Puedes encender y luego apagar otro LED y realizar el truco sin capuchón. Si se quita más de un capuchón, recuerda la posición inicial de estos.
Ahora, cada vez que apague un interruptor sin capuchón y apague (durante más de 4 segundos, vuelva a activar. ¡Antes de encenderlo, coloque la tapa en el interruptor!
Usted puede incluso terminar con todos los capuchones quitados si tiene la precaución para mantener por menos un interruptor en la posición de encendido (los 4 interruptores se quedan en la posición de apagado se bloquea, como se explica más abajo).

Puedes repetir la subsecuencia tantas veces como quieras.
A continuación, puede terminar la secuencia con todos los interruptores apagados, si desea bloquear el dispositivo para el audífono y la revisión, por mucho que cambiar los LED, los capuchones o dejar y poner la batería del dispositivo solo funcionará como dice la Lógica (el primer interruptor siempre encenderá / apagará el primer LED, el segundo el segundo, etc).
Para el bloqueo del dispositivo, la vaya a la secuencia 3, luego ingrese el truco especial y el hilo para los 4 interruptores. Todos los interruptores están en posición cerrada con todos los LEDs apagados ==> apague todos los interruptores, espere 3 segundos y ha bloqueado la centralita. Lo que significa que ahora y hasta desbloquear, hay una conexión virtual directa de los interruptores y leds (1-1, 2-2, 3-3, 4-4). Puesto que estas en la secuencia especial 3, todas las tapas de color son quitadas, los deberes insertan en frente del mismo LED ... ¡Ahora ya puede dar el tablero a la audiencia!
Para desbloquear el dispositivo, retire la batería, encienda el interruptor 1 y inserte la batería.
Recuerde iniciar siempre la unidad con todos los interruptores en el estado OFF (apagado).
Practica mucho, entiende lo que haces y siempre recuerda donde estás (sobretodo cual es el último interruptor apagado, y cuando está en la secuencia 2 o 3 tener mucho cuidado !!!!)

Thank you, I appreciate this cooperation spirit of the internet.
Now you put on me some pressure to write the french translation ,-)

By the way, did you upload the new firmware with the switch4 locking procedure?

Hi aeropic:
Yes, I have loaded the new firmware and it works perfectly.
Thanks for your attention.

I love the face of the victims when I do the show ;-)

Comments deleted.