So it turns out I may have been wrong about much of the below (as I thought) The user 'eivind' left me a comment pointing me to This video which probably explains things better than I did.
I'm still trying to get my head around it all.
This is a bit of a weird one and I’m almost definitely going to get some concepts wrong here so bear with me.
I was reading up about Quantum Physics the other day, trying to make any sense of it at all and I got to The Uncertainty principle – which is essentially (from my limited understanding) where any quantum particle (wave?) measured is affected by the equipment used to measure it.
So basically whatever you try and measure you affect and so cannot get an accurate measurement of.
I don’t understand it fully, so what better time to try and make a project about it, right?
- Make an device that when closed has a certain output that can’t be seen, based on a value from an environmental sensor
- Ensure that when opened and attempted to be measured the sensor input is changed and thus the output is changed
- Arduino Pro Mini
- Barkleys Mint Tin
- Coin Cell Battery holder
- CR-2025 Batteries
- RGB LED
- Resistor Kit
- Omron Microswitch
- Electrical Tape
The idea is that when open and switched on the LED will be first off – then when closed the Omron switch is clicked, the LDR sensor value is read which feeds into a seed for a random number generator which generates 3 numbers (0-255) for the R, G, B elements of the LED.
At this point the colour of the LED will not be able to be determined as it’s in the closed box – the only way to see it is to open the box. Opening the box un-clicks the switch and resets the seed, generates 3 more random numbers for the RGB LED and thus the colour is changed – so by trying to see what colour the LED is, you change the environment the LDR sensor is in and reset the LED thus causing a different colour.
I’m using the LDR to introduce a truly random element to the RGB LED colours – I’m using the number from the LDR to seed a random number generator as you can configure the RNG to a range, in this case 0-255. It also prevents the LDR number from just being a linear conversion to the RGB numbers – where you would end up the more light the LDR receives the brighter the LED.
The LDR should also always be getting a different and I’m fairly certain random value as either it will be reading a value influenced by ambient light and/or light from the LED.
You may be thinking why I didn’t use the LDR to detect when the box was closed, the reason is because the light from the LED would be affecting it and it wouldn’t be truly dark in there, so I opted for the switch to detect open/closed and the LDR for the random RGB values.
I stuck on an episode of Star Trek and got to work.
The build is reasonably simple – being essentially a button circuit the same as from my Nerf Scope Module project with the RGB LED setup from my Original Xbox RGB Ring Mod and combined with the wiring from this handy tutorial for the LDR.
First I prototyped it to check it would all work as expected:
Then I put the uploaded the code and gave it a test, adjusted as needed until it worked right. You can grab the final code from my GitHub.
With that all working I soldered it up:
Then I prepared the tin with some electrical tape to stop the circuit from shorting when it’s put in:
Then I put the circuit board in with some hot glue:
Then tested the position of the switch to get it in the right place for when the lid closes:
So as you can see from the video, you can’t see the LED change colours when the lid is closed or see the colour at all when closed – so the only way to see the LED colour is to open the box, which of course; changes the colour. So you will never know what colour it was when it was closed.
And when the lid is closed again, the numbers are regenerated and it changes again to a colour you can’t see unless you try to open the lid – which changes the colour again and so on ad infinitum.
This was a little evening project and I’m happy with it, the LDR sensor value feeding the random number generator means the LED is truly random when reset – also the tin being totally sealed off truly prevents you from knowing what colour the LED is when closed.
Once closed I imagine the only way of knowing the colour without changing it would be to drill in the side or something but even then I imagine that would disturb the switch at some point and cause a reset.
You can of course cheat and press the button manually, but that isn’t the point – it’s mean to be unknown while the tin is closed.
Anyway I think it’s quite interesting and fun to play about with, let me know if you enjoyed the concept!
Also let me know about what I got wrong in terms of the Heisenberg Principle – it would be good to learn more about it.
See you next time.