magic switchboard

magic switchboard

thingiverse

What is a "MAGIC SWITCH BOX" ? This is a fascinating magic trick with a board, a battery, 4 switches and 4 LEDs .... check on youtube! https://youtu.be/eHHGQq2YyRk There are 4 switches and 4 LEDs, one green, one red, one yellow and one blue. The switches are connected with visible wires one to each LED. When one switch is closed, it lights up the LED that is connected to it with the same color. A basic electrical circuit,.. It can even be shown to the "victim" who, even with good electronics skills will only see a basic circuit. But then the magic happens. When you rearrange the LEDs by swapping them in their sockets, the same color switch still turns the same color LED on even though they are no more connected... I would advice you to see directly the video then go to the "how I designed this" to get all explanations Enjoy the magic first on yourself before reading further ;-) How I Designed This user manual... (spannish translation available in the comments section) Obviouly, there is some electronics inside. Here it is based either upon a 16F1825 microchip microcontroler or upon an ESP8266-ESP07 (you get the choice) Whatever the choice, the microcontroler has the job to sense the position of the switches, learn witch LED is associated to witch switch and turn it ON or OFF accordingly... First switch-off all switches, insert the battery. The device is reset and will start in "default" sequence which means it will learn switches-LEDs from left to right (the left switch, the one closer to the battery, is numbered SW1, then going to right SW2, SW3, SW4). The LEDs are also numbered LED1 to LED4 from left to right. At that stage just turning ON SW1, then SW2, then SW3, and SW4 will associate those switches to LED1 then LED2 , LED3 and LED4. Once learned, the switches can be turned ON/OFF in every order as they are associated to LEDs... Got it ? If you turn OFF all LEDs and stay OFF during 3 seconds or more, the system is reset and will enter a new learning state. Please, at this stage turn OFF SW1 last... so that the learning sequence will remain the default one (1,2,3,4) . You can then ask the victim to swap two LEDs. You will have to learn the switches again : look which is the left LED and turn ON the switch with the correct color repeat with LED2, LED3, LED4 ... Simple up to now, is'nt it ? Let's complicate a bit ! My version allows the user to secretly select 4 different LEDs sequences otherwise most clever "victims" might understand the trick... The order of LEDs is default 1-2-3-4 and after that set by last switch turned off and time out. If last switch off = 1 this gives sequence 1 = 1-2-3-4 2 this gives sequence 2 = 2-3-4-1 + special trick #2 (see below). 3 this gives sequence 3 = 3-4-1-2 + special trick #3 (see below). 4 this gives sequence 4 = 4-3-2-1. Condition for reset is: All switches off AND at least one switch learned AND 3 seconds of timeout elapsed ==> this resets to new sequence determined by last switch off, 1-2-3 or 4. n° 2 special trick on sequence 2 is started when in sequence 2 all lamps are ON: a) remove 2 LEDs while they are ON allow the user to swap or not the lamps and insert them inside the socket they remain ON but the switches will follow later on b) if the lamps have been swapped, turn OFF the 2 other LEDs start with rightest switch first then the left one (associated to the both other lamps) then you can switch OFF the swapped lamps in the order you wish they have been associated by the previous sequence to the correct LEDs and the magic occurs... if the lamps have not been swapped turn OFF one left switch first then another switch located at the right of the first one (not obliged to be the closest right one...) repeat subsequence a to b how often you want then finish the sequence with all LEDs OFF new sequence is as usual determined by last switch off, 1-2-3 or 4. n° 3 special trick on sequence 3 is started when in seq 3 at least 2 lamps are ON: a) switch OFF one of the 2 lamps - wait 3 seconds during which remove the color cap of the corresponding switch switch the capless switch ON but the LED does not turn ON, you can turn it OFF/ON how often you wish but do not wait more than 4 seconds when OFF you can turn ON then OFF another LED and perform the capless trick. If more than one cap is removed remember the initial position of the caps... now everytime you turn OFF a capless switch and keep it OFF more than 3 sec, it will become active again. Before switching it ON, set the cap on top the switch ! you can even finish with all caps removed if you take care to keep at least one switch in ON position. repeat subsequence a how often you want then finish the sequence with all switches OFF (if you want to lock the device) new seq is as usual determined by last switch off, 1-2-3 or 4. The device can be locked to be given to the audience. There are 2 ways to lock the device, 1) go to sequence 3, then enter the special sequence and do it for all 4 switches. All switches are ON with all LEDs OFF ==> turn OFF all switches, wait 3 seconds and you've locked the switchboard. which means that now and until unlock, there is a virtual direct connection of Switchs and leds (1-1, 2-2, 3-3, 4-4). Since you are in special sequence 3, all the color caps should be removed at that stage, just insert them in front of the same LED... You can give the board to the audience ! 2)firmware 1.1 for the PIC microcontroler allows to lock the device with another process: simply turn ON switch 4 then insert the battery! While for ESP8266 simply turn ON switch 2 then insert the battery! (NEW for ESP) To unlock the device, remove the battery, turn ON switch 1 only and insert the battery back.(this works for both PIC and ESP and this is NEW for ESP) and you're back in sequence 1 Remember to start unit with all switches in OFF (open) state. Practice a lot, understand what you do and always remember where you are (which is the last switch turned off and when in sequence 2 or 3 take care !!!!) Bill of materials you will need: a PIC 16F1825 or an ESP8266-ESP07 4 switches 4 socket DC power plugs (for jacks 5.5mm , 2.1mm) choose a all metal item 4 DC power plugs jacks 5.5mm 2.1.mm 4 5mm LEDs one blue, one red one yellow, one green 4 SMD resistors of 75 Ohms 20cm of 3mm copper adhesive tape some small diameter wires one LiFePO4 3V 400mAh rechargeable battery (it is important to use a LiFePO4 which is compatible with the maximum tension allowed for the ESP8266). If you prefer you can use 2 AA cells in serial. 4x 2 cm of heat shrink tube (red, green, blue, yellow) option 1 : programming the PIC 16F1825 microcontroler the core of the magic board is based upon a cheap PIC 16F1825 microcontroler which must be programmed with the provided .hex file. (magic.production.hex) You need for this a USB programmer such as a pickit3 or pickit2 (they can be found for cheap on ebay) Even if the pins needed to program the firmware are still accessible once the magic switchboard is built, I would advice you program the PIC before soldering it ... Thickness of the PIC is 3,3mm in DIL package, you need to flatten the pins to save space. You can get a thinner device using SMD which is only 1,7mm thick, but it is somewhat more tricky to program and soldier ! tricking the switches... For the trick to be perfect (I mean allowing to see all the external wiring and forbidding to see anything else) I found a good solution was to modify the switches. You'll have to buy switches with metallic flanges covering nearly the whole body (see picture) Now, you need to open each switch and modify them to bring the electrical contact to the metallic body while insulating one pin ... with a small screwdriver gently force on the metallic flange on one side then on the other in order to extract the plastic body from the U metallic flange. Once done you should fing an empty plastic case, a small metallic piece set in equilibrium inside the plastic body : remove it (and keep it !) cut a piece of adhesive paper tape and glue it on top one extremity pin (this will act as the insulation piece) cut 3 cm of 3mm width copper adhesive band (found on ebay for few bucks) and glue it on the isolated pin, then all along on side , then outside the plastic case: Take care not to shortcut the middle pin with the copper band... set the small lever metallic piece in proper position and insert back the U frame arounf the plastic body... Et voilà, the hardest part is done, you own now 4 special switches. congratulations! final wiring : first of all here is the complete schematic: the 4 switches shall be connected to SW1-4 which are pulled up digital inputs, while ethe LEDs shall be connected to LED1-4 (digital output) with an appropriate 75 Ohm resistor in serial. As a convention, I've drawn with thick wire everything which is outside the board and remains visible to the user, while thinner wires are all located inside the board (between the two plates). The blue, red , black and green circular pads on the drawing means that a contact must be established between the wire and the metallic part of the item (either tricked switch or socket or the screws to which is connected the battery). The red wire is connected to the plus pad of the 3V batt while the black one is connected to the minus pad. Concerning the switches, please note that the orange wires are soldered to the tricked insulated pin which means those wires are just here for decoration to give the illusion that the current is flowing via the switch throught the orange wire ... And to avoid any missunderstanding, on the schematic everytime a wire of one color is crossing another wire of different color, there is NO connection ... The 4 blue wires LED1-4 are connected to the corresponding pin of the PIC, idem for the 4 switches. Finally, you'll have to build 4 LEDs lamps including a male jack a 75 Ohms SMD resistor and the LED itself. Usually the longest pin of the LED is the one to be connected to the + (here the middle pin of the jack) and here is the last time you'll see it open. It is the wired version of the above schematic. Please note that you have to perform good contact between the wires and the LED sockets or the switches. On the picture (first prototype) I tried two options either keepping around 3 cm of wire to make several turns around the screw of the switchs. The contacts are performed only by the pressure excercized by the top plate when the switches are screwed in position. or soldering a piece of adhesive copper at the extremity of the wires. And gluing this copper inside the holes for the switches. You can see this for the LEDs sockets I would strongly recommend this second option which makes a highly reliable contact... Just to be accurate, the PIC shall be oriented upside down with the slot in the body in the direction of the switches (see red dot) facing the 3D printed plate and therefore not visible in the picture don't forget to check the proper orientation of the switch ... option 2 : programming and trimming the ESP8266 microcontroler The firmware of the magic switchboard is also available for an ESP8266 that can easily be programmed under arduino IDE using a cheap bluetooth serial port. EDIT : the new firmware V201 fixes a bug in special sequence 3... Wire the ESP as on the following picture and schematic The source code is provided in the files section. just import it in your arduino IDE and change those two lines with your WIFI login information: const char ssid = "mySSID"; //

Download Model from thingiverse

With this file you will be able to print magic switchboard with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on magic switchboard.