OK how does it work and can a Picaxe do it?

jpyle1

New Member
Magic Box

Just my two cents worth. I also modified the time on the program to 6 seconds. I struggled with how to color the bulbs (6v 250ma) run on 4 "D" cells. I have a seperate regulator for the Picaxe. Glass paint did not seem to work, did not dry completly. I rigged a section of dowling, a battery pack, and a bulb holder. I insert the bulb, and use spray paint to "tint" the bulbs while lit so you can see your results as you go. Worked perfectly. The switch "handles" are cut sections of a heavy duty plastic clothes hanger, drilled and painted with the same spray paint. I found that after much use, bulbs and handles would "scuff" badly. The remedy was to use clear tape on both. Mine are old Radio Shack project boxes that are not available anymore, however they work perfectly. I made 4 with minor changes on each, and gave a couple away to friends. I very much like the other designs I have seen here, and have had a lot of fun building and using these
 

Attachments

Dear All,

Well, I have finally managed to make my second version of this amazing magic trick. This time I have introduced the concept of "The Magic Knot of Doom". The banter goes along the line of ... "I had a bit of trouble building this circuit and couldn't untangle the wires. I then discovered that the knot actually knows what each user is thinking. Amazing discovery etc etc ...".

I used various sheets of laminated wood. The perception is that it is simply a piece of scrap wood (witha hole right through the middle) with the "fake circuit" clearly visible on the surface. It actually fooled over 40 people last weeked at a family gathering. Not one asked if there was another circuit inside. Most thought there was something hidden on the knot itself or in the battery box.

The globes are the LEDs mentioned earlier in this thread. The only issue is that the are all clear until switched on, so I had to paint the actual colours around the rim. I also used the same colours on magnetic discs, to use as colour indicators which stick to the switches.

Enjoy,
PiChucker
Very nice effect and well executed in woodworking!
One technical picky point though... the knife switches have red wires going between the switches going to each side of the knife. These are double pole, double throw switches. These red wires don't actually "go" anywhere. Someone who knows how these switches work, will either suspect or "know" that there are wires below the switches because these wires don't otherwise have any connection with anything. The knife itself have insulated arms and don't cross through the plastic 'throw' part of the switch.

Just a comment in case you were looking for advice/feedback.

Thanks for taking the time to share this with us.
Doug
 

frank_p

Member
Did anyone notece that the guy always switches the first one first, then the second and so on. First he always switches them the correct sequence, then the switches them randomly, but always always the proper sequence the first time?

Any thoughts about this?
 

Andrew Cowan

Senior Member
Yup - that is how it's done. Quite alot of us have made them - the program learns the sequence. However, after they have all been off for 10 seconds or so, it goes back into learning mode.

A
 

hippy

Technical Support
Staff member
With a good algorithm, once a switch has been set ( the mapping learned ) it's possible to turn on and off those switches randomly in any order. It's an "if this switch hasn't been set before, it maps to the next bulb along which hasn't previously been lit" algorithm.

The means that you don't have to light the bulbs all in order first and can add some extra distractions and confusions into the mix to disguise what's actually happening. It's a long thread but I think most aspects of its operation are covered.
 

frank_p

Member
Unscrewing the bulb is enough to reset the picaxe. Discharging a small capacitance from any of the switches can also do the job. Either/Or will be the trigger to clear the learing sequence.

I don't think this is magic but if he wants to say so!!! Why break is heart?
 

Protolisk

Member
What about that part where he asks the guy to put in 1 switch on. What if put a colour that didn't match up to the first bulb on the left.

Say if he put a green switch on the 2nd cap

Would that mean he would have to flick a random switche then hit the green switch?
 

WayneT

Member
Convert for PicAxe 18x?

Here's our version!

Code:
#picaxe 14m
 
' Assumptions
' Times out after 10 seconds of all switches in the off position
' All switches must be off at start
' All 4 switches must be switched on before that sequence is learnt
' bulbs/LEDs on outputs 0 to 3
' switches on inputs 0 to 3
 
symbol flags = b0  ' flags to remember whether a switch has been learnt yet
symbol flag0 = bit0
symbol flag1 = bit1
symbol flag2 = bit2
symbol flag3 = bit3
 
symbol light0 = b1 ' variable to remember which switch is which light
symbol light1 = b2
symbol light2 = b3
symbol light3 = b4
 
symbol position = b5  ' position counter
 
symbol timeout_counter = w6 ' timeout counter
symbol timeout = 1000  ' timeout set to 10s = 10 000ms = 1000 x 10ms
'Change to smaller number when simulating or you will get bored!
 
' Start of program
do_reset:
 position = 0 ' reset position counter
 flags = 0  ' reset flags
 
' Learning loop
waiting_to_learn_loop:
' if not learnt switch learn it
 if pin0 = 1 and flag0 = 0 then learn0
 if pin1 = 1 and flag1 = 0 then learn1
 if pin2 = 1 and flag2 = 0 then learn2
 if pin3 = 1 and flag3 = 0 then learn3
 
 ' we have learnt that switch so light output accordingly
 if flag0 = 1 then
  if pin0 = 1 then
   high light0
  else
   low light0
  end if
 end if 
 if flag1 = 1 then
  if pin1 = 1 then
   high light1
  else
   low light1
  end if
 end if 
 
 if flag2 = 1 then
  if pin2 = 1 then
   high light2
  else
   low light2
  end if
 end if 
 
 if flag3 = 1 then
  if pin3 = 1 then
   high light3
  else
   low light3
  end if
 end if
 
 goto waiting_to_learn_loop
 
' Learn a light position and set flag so we know that switch is done
learn0:
 ' position gives you the output for this switch
 flag0 = 1    ' set flag
 light0 = position   ' remember position for this switch
 goto learn_end
 
learn1:
 ' position gives you the output for this switch
 flag1 = 1    ' set flag
 light1 = position   ' remember position for this switch
 goto learn_end
 
learn2:
 ' position gives you the output for this switch
 flag2 = 1    ' set flag
 light2 = position   ' remember position for this switch
 goto learn_end
 
learn3:
 ' position gives you the output for this switch
 flag3 = 1    ' set flag
 light3 = position   ' remember position for this switch
 'goto learn_end
 
learn_end:
 inc position     ' add 1 to position counter
 if position > 3 then have_learnt_all ' all done
 goto waiting_to_learn_loop   ' not all done so back to loop
 
' now simply loop reacting to the switches
' timeout_counter value will increment every 10ms
' however if any light is on the timeout_counter is reset
' so this means the timeout will only 
' occur after 10 secoonds of all switches off
 
have_learnt_all:
 if pin0 = 1 then
  high light0
  timeout_counter = 0
 else
  low light0
 end if
 
 if pin1 = 1 then
  high light1
  timeout_counter = 0
 else
  low light1
 end if
 
 if pin2 = 1 then
  high light2
  timeout_counter = 0
 else
  low light2
 end if
 
 if pin3 = 1 then
  high light3
  timeout_counter = 0
 else
  low light3
 end if
 
 pause 10   ' wait 10ms
 inc timeout_counter ' inc timeout
 
 ' if timed out then reset else loop
 if timeout_counter > timeout then do_reset
 goto have_learnt_all
I know it's not proper etiquette to resurrect such an old thread - but I have a spare 18x chip and I was trying to see if this code would run on it, despite the fact it was for the 14m. Once I change the top line to indicate it is running on a PicAxe 18x, the simulator hangs with a bug in the following line:

"if pin 3 = 1 and flag 3 = 0 then learn3"

It doesn't seem to like the symbol "pin3". The manual indicates that this is a valid symbol, so why is it hanging at this point on the 18x?
 

WayneT

Member
I think it should be "pin3" rather than "pin 3" like it is in your code.

Massive bump!
Just figured it out - (I mistyped the line in my previous message but...) the PicAxe 18x doesn't have Pin3 option, only pins 0-2, and 6 & 7. I changed pin3 to pin6 everywhere it existed and it works, although it requires a switch on pin6 to activate the last light instead of pin3.

I should have just experimented a little more before asking for help.
 

BeanieBots

Moderator
I should have just experimented a little more before asking for help.
Nothing wrong with asking for help but it would have been better to read the manual and understand the code and the difference between the two chips before 'experimenting';)

If you were ever intending to MAKE the circuit with an 18X, where would you have connected the switch that went to "pin3"?
That would have answered your own question.
 

WayneT

Member
Nothing wrong with asking for help but it would have been better to read the manual and understand the code and the difference between the two chips before 'experimenting';)

If you were ever intending to MAKE the circuit with an 18X, where would you have connected the switch that went to "pin3"?
That would have answered your own question.
It works on the simulator using inputs 0, 1, 2, 6 and outputs 0, 1, 2, 3. That is where I plan to make the connections. Due to the small number of outputs, I figure I can probably use just 4 transistors to use less space than a darlington IC.
 

BeanieBots

Moderator
Proabaly not much in it space wise between the darlington and descretes by the time you've added the base resistors.
Personally, I'd probably stick with the darlington for simplicity and because I'm lazy. Commercially, it would be decided by cost of parts and cost/time of manufacture. For a hobby, it's probably more about what you already have.
 

tman900

New Member
check out this version

http://www.youtube.com/watch?v=l9ShZQepZ0o

Please check out this version and see if anyone can crack the method.

This guy has the spectator do all of the moving of bulbs and flipping the switches.

It looks like painted washers with a rivet in them to stick on to the board to mark the switches. And if he has a hidden circuit it’s well hidden.
 

kevrus

New Member
Well he definitely has a circuit hidden. Its very well made though and looks quite impressive on a larger scale.
 

mikie_121

Member
Wow! That's clever.

He doesn't use any pattern or sequence to turn on the lights, so the system must sense or there is someone in the crowd with a remote programmer.

I'm really keen to know how this works!
 

hippy

Technical Support
Staff member
Very impressive, both in hardware and operationally. Although not clear, it looks like the wires run through the switch to the bulbs so 'impossible' to light a bulb unless the switch is closed. That's very convincing that 'magic' is at work.

The thing to remember is that professional magicians will spend a lot of money on props to achieve a desired illusion.
 

Rickharris

Senior Member
Very impressive, both in hardware and operationally. Although not clear, it looks like the wires run through the switch to the bulbs so 'impossible' to light a bulb unless the switch is closed. That's very convincing that 'magic' is at work.

The thing to remember is that professional magicians will spend a lot of money on props to achieve a desired illusion.
Maybe the guy from "the audience" is an accomplice. One tends to assume the audience is what it appears to be.
 

hippy

Technical Support
Staff member
Possibly, but that's more common on TV - which I suppose this is - and it's a doddle on radio :)

People are far more convinced in a live setting when it's someone they know and the rest of the audience is convinced it's a real person. It gets quite elaborate and costly to pull that off well.

I think it's reasonable to assume it's not a con in the sense of a rigged show, but certainly well-rigged equipment. I could be wrong, but it's certainly possible to do automatically, no assistance except by electrons required.
 

thunderrat

New Member
Magic Switchboard 2000

The clear version does indeed look fantastic, but there is a clear tell of the method. You will notice that the performer spends all of the time with his arms crossed. What that suggests is that there is a key pad on one of his biceps that allows him to associate bulbs with switches. The performer simply has to press four buttons to indicate which switch controls which light. The colors of the light are unimportant, the magician just signals which switch controls bulb 1, bulb 2, bulb 3 and bulb 4. For example, suppose the color sequence for the lights is RYGB. If the spec puts RYG washers under switch 1, and the B washer under switch 4, then the magician simply presses button 1 three times and then hits button 4. That is all that's needed.

Another tell is the price of the board is around $650 (£400). I'll enquire about the method, but I'm pretty sure this is it.
 
Last edited:

OLDmarty

Senior Member
OK people,

This magic trick can be taken to a much higher level if you use bluetooth controlled portable light-bulbs (or modified magician bulbs etc), and then the magicians final part of the act would be to unscrew any of the light-bulbs, and have it still light up when the matching switch is activated.
This finale would freak people out to no end ;-)

I'm sure adding a bluetooth transmitter onto the picaxe to "talk" to 4 bulbs wouldn't be too difficult? but the end result would clearly outnumber the sum of its parts, 100 fold! ;-)
 

BESQUEUT

Senior Member
check out this version


Please check out this version and see if anyone can crack the method.

This guy has the spectator do all of the moving of bulbs and flipping the switches.

It looks like painted washers with a rivet in them to stick on to the board to mark the switches. And if he has a hidden circuit it’s well hidden.
I think of a 4 OneWire Busses
Controllers in the switches, and maybe another protocol to communicate between switches ?
All is alway connected, but a bulb is only lighted if correct adresse is send.

But colored tags seem to be connected with only one Wire ; maybe that all have a battery inside ?

Radio transmission does'not explain how switches as associated with tags.
I think that this is done by the wire, because vertical proximity is very difficult to achieve, but how ?

The only thing I know working with only one wire is
TDR reflectometer
 
Last edited:

BESQUEUT

Senior Member
A way to associate each switch to the coloreds tags on the same wire :
- using female jack connectors with integrated switch on the board,
- male jack for each tag with Schotky diodes (0,15 V 0,3V 0,6V and 1,2 V dropdown)

Each switche=controller receive a specific voltage, depending on what tags are on the line...
Starting with a 6V battery pack, 3,6 V is enought even with the 4 tags...
 
Last edited:

BESQUEUT

Senior Member

I only saw him cross his arms at the end.
I agree. And first time, both hands are visibles...
He may have an assistant, or he may code with his feet...
but I think it's possible to make a true coded circuit...
 
Last edited:

Bill.b

Senior Member
Hi all.

I have constructed the unit described be techElder.
here is the 14m2 program I used.

One addition I made to the circuit was to add a 1f super capacitor to the circuit. This allowed the operator
to remove the battery and the lights and switched still worked up to 15 min with no external power supplied.

Code:
#picaxe 14m2

' Magic Switchboard - original source by "Technical" from PicAxe Forum
' Modified for PicAxe 18x by Wayne Thomason of Addison, TX USA
' 7/15/2009
' Modified for Picaxe 14m2 By Bill Brown
' 12/8/2012
'
' mods: 1. Now is easily configurable via switch? and bulb? variables
' 2. "timeout" functions even without learning all 4 switches
' 3. starting point and sequence direction dependent on last switch turned off
' 4. Now has Audience_lockdown feature. If power is turned on while switch-4
' is set, each light will respond only to corresponding switch position
' until circuit is reset.
'
' Assumptions
' 1. Times out after 10 seconds of all switches in the off position
' regardless of whether all switches are learned yet
' 2. All switches must be off at start
' (If switch 4 on when started, it starts up in audience-mode.)
' 3. All 4 switches must be switched on before that sequence is learned
' 4. Set bulb/LED outputs using bulb1, bulb2, bulb3 & bulb4
' 5. Set switch inputs using switch1, switch2, switch3 and switch4
' 6. first pattern is left to right, bulbs 1, 2, 3, 4
' 7. subsequent patterns are determined by last SWITCH turned off:
' Switch 1 = 1234 order (bulb 1 first, then right in sequence)
' Switch 2 = 2143 order (bulb 2 first, then left in sequence, wrapping after first)
' Switch 3 = 3412 order (bulb 3 first, then right in sequence, wrapping after last)
' Switch 4 = 4321 order (bulb 4 first, then left in sequence)

symbol switch1 = pinc.3 ' input pin for switch 1 (pinc.0, pinc.1, pinc.2 and pinc.3)
symbol switch2 = pinc.2 ' input pin for switch 2
symbol switch3 = pinc.1 ' input pin for switch 3
symbol switch4 = pinc.0  ' input pin for switch 4
symbol bulb1 = b.3       ' output for bulb 1  (b.0, b.1, b.2 and b.3)
symbol bulb2 = b.2 ' output for bulb 2
symbol bulb3 = b.1 ' output for bulb 3
symbol bulb4 = b.0       ' output for bulb 4
symbol timeout = 250  ' each loop takes a little more than twice as long as original code
' by "Technical (about 2ms per loop). 450 x 2ms x 10ms = about 10
' seconds. Your mileage may vary - tweak timeout if needed.

'Change "timeout" to smaller number when simulating or you will get bored!

symbol flags = b0 ' flags to remember whether a switch has been learnt yet
symbol flag0 = bit0
symbol flag1 = bit1
symbol flag2 = bit2
symbol flag3 = bit3

symbol light0 = b1 ' variable to remember which switch is which light
symbol light1 = b2
symbol light2 = b3
symbol light3 = b4

symbol bulb = b7
symbol starting_lite = b6 ' variable to set starting light position (and direction)
symbol position = b5 ' position counter
symbol timeout_counter = w6 ' timeout counter
if switch4=1 then audience_lockdown

starting_lite = 1

' Start of program
do_reset:
' ' reset position counter
if starting_lite = 1 then ' if starting with bulb 1, position reset to 0.
position = 0
end if

if starting_lite = 2 then ' if starting with bulb 2, position reset to 1.
position = 1
end if

if starting_lite = 3 then ' if starting with bulb 3, position reset to 2.
position = 2
end if

if starting_lite = 4 then ' if starting wtih bulb 4, position reset to 3.
position = 3
end if

flags = 0 ' reset flags

' Learning loop
waiting_to_learn_loop:
' if not learnt switch learn it
if switch1 = 1 and flag0 = 0 then learn0
if switch2 = 1 and flag1 = 0 then learn1
if switch3 = 1 and flag2 = 0 then learn2
if switch4 = 1 and flag3 = 0 then learn3

' we have learnt that switch so light output accordingly
if flag0 = 1 then
if switch1 = 1 then
high light0
else
low light0
end if
end if
if flag1 = 1 then
if switch2 = 1 then
high light1
else
low light1
end if
end if

if flag2 = 1 then
if switch3 = 1 then
high light2
else
low light2
end if
end if

if flag3 = 1 then
if switch4 = 1 then
high light3
else
low light3
end if
end if

if switch2=0 and switch1=0 and switch3=0 and switch4=0 then ' count down to timeout even while in learning loop
pause 10 'wait 10ms
inc timeout_counter 'inc timeout
if timeout_counter > timeout then
timeout_counter=0
goto do_reset
end if
else
timeout_counter=0
end if


goto waiting_to_learn_loop

' Learn a light position and set flag so we know that switch is done
learn0:
gosub bulbset
' position gives you the output for this switch
flag0 = 1 ' set flag
light0 = bulb ' remember position for this switch
goto learn_end

learn1:
gosub bulbset
' position gives you the output for this switch
flag1 = 1 ' set flag
light1 = bulb ' remember position for this switch
goto learn_end

learn2:
gosub bulbset
' position gives you the output for this switch
flag2 = 1 ' set flag
light2 = bulb ' remember position for this switch
goto learn_end

learn3:
gosub bulbset
' position gives you the output for this switch
flag3 = 1 ' set flag
light3 = bulb ' remember position for this switch
'goto learn_end

learn_end:
if starting_lite = 1 then    'if starting with 1st lamp, sequence = 1-2-3-4
inc position
if position > 3 then have_learnt_all
goto waiting_to_learn_loop
end if

if starting_lite = 2 then 'if starting with 2nd lamp, sequence = 2-1-4-3
if position > 0 then 'don't dec if position=0, will cause error
dec position
else
position = 3 'position was 0 before dec, set to "3"
end if
if position = 1 then have_learnt_all 'if position=1 then we have come full circle
goto waiting_to_learn_loop 'not finished, loop and learn more switches
end if
if starting_lite = 3 then                'if starting with 3rd lamp, sequence = 3-4-1-2
inc position
if position > 3 then 'if position greater greater than 4th lamp, reset to "0"
position = 0
end if
if position = 2 then have_learnt_all 'if position=2 then we have come full circle
goto waiting_to_learn_loop 'not finished, loop and learn more switches
end if
if starting_lite = 4 then                'if starting with 4th lamp, sequence = 4-3-2-1
if position > 0 then 'don't dec if position=0, will cause error
dec position
else
goto have_learnt_all 'position is "0", we have learned last position.
end if
goto waiting_to_learn_loop
end if


' now simply loop reacting to the switches
' timeout_counter value will increment every 10ms
' however if any light is on the timeout_counter is reset
' so this means the timeout will only
' occur after 10 secoonds of all switches off

have_learnt_all:
if switch1 = 1 then
high light0
timeout_counter = 0
else
low light0
end if

if switch2 = 1 then
high light1
timeout_counter = 0
else
low light1
end if

if switch3 = 1 then
high light2
timeout_counter = 0
else
low light2
end if

if switch4 = 1 then
high light3
timeout_counter = 0
else
low light3
end if

'Set which bulb will start next round. (only if switches all learned)
if b0 = 15 and switch1=1 and switch2=0 and switch3=0 and switch4=0 then ' if switch 1 on alone, set lamp 1 first
starting_lite=1
end if

if b0 = 15 and switch1=0 and switch2=1 and switch3=0 and switch4=0 then ' if switch 2 on alone, set lamp 2 first
starting_lite=2
end if

if b0 = 15 and switch1=0 and switch2=0 and switch3=1 and switch4=0 then ' if switch 3 on alone, set lamp 3 first
starting_lite=3
end if

if b0 = 15 and switch1=0 and switch2=0 and switch3=0 and switch4=1 then ' if switch 4 on alone, set lamp 4 first
starting_lite=4
end if

pause 10 ' wait 10ms
inc timeout_counter ' inc timeout

' if timed out then reset else loop
if timeout_counter > timeout then do_reset
goto have_learnt_all
bulbset:
if position=0 then
bulb = bulb1
end if
if position=1 then
bulb = bulb2
end if
if position=2 then
bulb = bulb3
end if

if position=3 then
bulb = bulb4
end if
return
audience_lockdown:
if switch1 = 1 then
high bulb1
else
low bulb1
  end if
  if switch2 = 1 then
high bulb2
else
low bulb2
  end if
  if switch3 = 1 then
high bulb3
else
low bulb3
  end if
  if switch4 = 1 then
high bulb4
else
low bulb4
end if
goto audience_lockdown
23190
Bill
 
Last edited:
Top