The MAGIC SWITCHBOARD or SWITCHBOX

erco

Senior Member
This Brit Tim has a great Youtube channel on vintage puzzles & toys. Check out the "puzzle calculator" at 3:00, which has movable buttons yet they always work properly, much like this Magic Switchbox. His channel is always worth browsing.

 

Mark3092

Member
Hi, thanks for this excellent project. I have built it and it's working fine. I have seen another version of this which has some extra cool features to it but it's based on the 16F1825 chip. Could any of you coding wizards write the "special features" of this one https://www.thingiverse.com/thing:2021161 into the picaxe code?

That would make this on epic.

Thanks again

Mark
 

oracacle

Senior Member
Which extra features? Am i going reverse engineer it. No, not for the foreseeable future.
If you want a wifi connection, I haven't seen any wifi hardware that can operate with picaxe.
The sequence locking should be possible but i would suggest that is something you should look into.
The code is only about 400 lines and well commented so is potentially easier to revese engineer and translate. I just don't ahve the energy atm.
 

Mark3092

Member
Hi thanks for the reply. It's a feature that's activated when you switch off with the last switch 2 or 3 if I remember. It gives two extra features so you can remove a switch cap and it then doesn't activate any bulb. It's impressive and described in the description on the link I shared. I'm sure the code that does it is obvious to someone in the know and could be added to the picaxe code but I am absolutely brand new to this and have no coding experience as yet. This is my first project and I simply copied the tutorial. Hope someone could help

Regards

Mark
 

oracacle

Senior Member
Code:
* The order of lamps is default 1-2-3-4 and after that set by last switch turned off and time out.
* If last switch off =
* 1 gets seq 1 = 1-2-3-4
* 2 gets seq 2 = 2-3-4-1 + special trick #2 (see below).
* 3 gets seq 3 = 3-4-1-2 + special trick #3 (see below).
* 4 gets seq 4 = 4-3-2-1.
* Condition for reset is: All switches off AND at least one switch learned AND reset_time elapsed (4 seconds)--- then resets to new
* seq determined by last switch off, 1-2-3 or 4.
*
* #2 special trick on sequence 2 is started when in seq 2 all lamps are ON:
* - a) remove 2 lamps
* - allow the user to swap or not the lamps
* - they remain ON but the switches will follow later on
* - b) if the lamps have been swapped, turn OFF the 2 other lamps
*      start with right switch first then the left one (associated to the both other lamps)
   then you can switch the swapped lamps in the order you wish...
*  if the lamps have not been swapped turn OFF one left switch first then another switch located at the right of the first one
*
* - repeat subsequence a to b how often you want
* - then finish the sequence with all LEDs OFF
* -  new seq is as usual determined by last switch off, 1-2-3 or 4.
*
* #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 4 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 4 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
* -  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 ==> you've locked the switchboard.
* 2) remove the battery, turn ON switch 2 only, replace the battery
* 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)
*
* to unlock the device, remove the battery, turn ON swotch 1 only and insert the battery back
*
* Remember to start unit with all switches in OFF (open) state.
*
* turn ON wifi if boot occurs with both Switchs 1 & 2 grounded (ON posiiton)
assuming you men #3 special trick
This came from the code, I have read the info from thingiverse. I don't know if they have updated their servers but they were terible, even the search didn't work correctly with it being more effective using google or bing to search the site.
 

oracacle

Senior Member
I very quick scan through would indicate that it simply look for a specific switch setting and LED output then run the sequence to that.
It is just a set of "if and" statements.

I would strongly adive tht you have a look at the code. It's ewrll commented so would be a good learning oportunity.
 

Mark3092

Member
It would be easier for me to learn Chinese. I like building projects but I'll have to walk before I can run with the coding side. It's rocket science
 

oracacle

Senior Member
So if it's challanging, and results in learning lots...
The best way to learn to get out of that confort zone, don't just follow what other have done and tutorials.

One project went from controlling some LEDs using a encoder and an LDR to being a misrocontoller controlling some LED, watching an encoder, 4 potentiometers, 2 switches, 9 buttons (thios was cut back from 15 buttons) and wirelessly connecting to the other controller. The second controller controlled 11 servos, 3 motors and a string of RGB LEDs. That was then added into a whole lot of 3D design and printing with some interesting mechanisms. The code had to be able to, handshake between the 2 wirelessly, error correct, track the status of each of their conditions and in some cases they both had to know what each other were doing. And all this while learning a no code language.

Then there is the macro rail that went from a simple move an object back and fourth to something that used an FPU to calaulate everything from a few basic inputs. I mean it calculated DoF, CoC, magnification, the number of steps to move the stepper motor had to move and a few other things. While working around the limitations of the Picaxe.

Without trying it will always be out of reach.
 

Mark3092

Member
I build stuff as a hobby, learn a bit along the way but it's all about fun of it. This was my first project of this type, never heard of picaxe before this and i figured out how to program it to make this switchboard. Whatever my next project involves I'll learn a whatever is needed to accomplish it. I get what you are saying but if someone isn't willing write the code for me then it's literally beyond me
 

The bear

Senior Member
@Mark3092,
I can assure you, that you will overcome these obstacles in due course.
I almost took up Mandarin myself, assuming it would be easier than Picaxe basic.
It's a great forum, plenty of help (You do have to make an effort yourself), then ask a question.
My good friend JPB33 introduced me to Picaxe.
Picaxe has given me a new lease of life. 81 and not counting.
If you would like to compare forums, look at the Arduino one.
Good luck.............
 

Mark3092

Member
Well like I keep saying I like building things (physically) if writing code is part of it then I enjoy the challenge of getting it to work. I'm not going to learn basic just for this project especially when I could just build the version on thingy verse.
If after building lots of things from the likes of this forum coding becomes an interest then fair enough. I was just asking for help not asking for someone to tell me to figure it out for myself.

All the best...
 

regpye

New Member
Including code written by Technical (and more code written/modified by others) on how to make your own using a PICAXE.

I made mine using an 18X for about £5.
How about this one found on youtube. It has me baffled on how this is done, especially when the batteries are removed.
 

papaof2

Senior Member
The basic magicbox is well-defined on the forum - probably an hour or two of reading ;-) The only difference with this box is having the lights turn on without the removeable batteries.

First guess: lithium coin cell(s) in a layer of the battery holder or a Li-poly flat pack battery under/as part of the battery holder. Probably not enough space to do that with 1F capacitors. Do notice that without the batteries, each light was turned ON, then OFF before the next light was turned ON - something that would be needed when using a much smaller capacity battery or a high value capacitor.

Sorry if I took away a bit of the magic. I was working in an uncle's "magic and hobby" shop when I was 13. I got pretty good with the small "pocket" magic (have to be able to do a good demo for a potential customer) and because the uncle also did "stage magic" I learned a lot of the "how it's done". Maybe 90% of "magic" is misdirection so you must look for what is done and how it is done and any differences in the process that cause one outcome to be different from another outcome.
 
Last edited:

hippy

Technical Support
Staff member
I would also guess it's powered by a battery or capacitor hidden in the base of the battery box. It is possible it could be inductive wireless powering from below the table top.
 
Top