The Chaot is my contestant for the LMRv4 Donor Appreciation Robot Challenge.
The machine creates a random number using physical chaos and combines the random numbers to an four digit index.
This index can be used to select a winner.
- Draw Winner Using a Magnetic Pendulum
- Idea Finding
- The Making-Of
- 15 Minutes of Fame
- Used Parts
- Current Issues
- Thanks To
- Further Reading
Draw Winner using a Magnetic Pendulum
The physical chaos is created using a pendulum that moves through two magnetic fields. The space where the magnetic fields come together introduce a force into the pendulum. The direction and amount of force depend on where the pendulum swings through this field. In the field is a critical line where it is not 100% predictable to what side the pendulum is going to swing - to what direction the force pushes the pendulum and how strong the push is.
Given a tiny change in the initialization of the swing the end position is not predictable.
The initial question was how to get a random number using a physical process that involves mechanics, electronics, mathematics and software. Inspired by the internet, friends and work collegues I soon had gathered many ideas how to physically create a random number. There is an infinite number of possibilities to do that. Some involve least-significant-bits in analog values. Others have found chaotic behavior in fluid-dynamics, thermo-dynamics, magnetism, insect movement observations, temperatures from around the world and many many others.
The proven random behavior of the magnetic pendulum, the available online documentation out there and the need to have a solid mathematical base that everyone can see the inherent chaotic nature of the pendulum the magnetic pendulum became my selection. A magnetic pendulum had to be built.
Thinking about that I desided to use only parts I have laying around at home. So the magnets holding photos on the freezer dissapeared in my lab, some childrens mighty beans, an empty wooden wine box and some wood plane left overs. All that material was there and laying on the maker-table ready for transformation into a machine.
So here some impressions and comments from the making.
The wood box from a red-wine gets reused to be the body of the machine.
The pendulum is mounted on a servo inside the body of the Chaot. The servo is used to initiate the chaotic process where the pendulum swings.
Eventually the pendulum stops and the stop position is the random number.
To find out where the pendulum stopped a LDR is mounted to the pendulum and over each magnet there is a LED. Using a shift register each LED is turned on and the LED position where dhe LDR value is the lowest is the stop position.
Initially I wanted to detect the position using the Wii IR Camera and a IR reflector on the pendulum... but the LDR and the LEDs do the job quite well.
On the pendulum there gets the LDR mounted and wired. The shift register is soldered to a base and wired to the LEDs. All LEDs are positioned in a circle with a strong magnet behind each LED.
The behaviors are in sequence so first the controller starts the shaker. The shaker shakes the pendulum. Then the chaotic process happens until a timeout. Then the measure process starts to find out where the pendulum points to. The number from where the pendulum points to gets indicated by the indicator.
The pendulum hovers above a circle of the magnets.
The LEDs make a little light-show and in the end are used by the LDR that is mounted on the pendulum to detect the brightest position that is the number.
The LEDs are controlled by the shift register. So this needs a circuit where the register can be connected to the LEDs.
To indicate the number four stepper motors are used. The motors are embedded on top of the machines body.
The indicator is a round wood cutted from a birch-wood-plane, glued together and beveled.
Each stepper is controlled by a L293D that is setup with two NPN transistors and pull-up resistors. Using this setup it is possible to run a stepper motor with only two pins instead of four.
The Chaot's 15 Minutes of Fame
To build this machine the following parts are needed.
|1||Arduino Uno R3||Contains the Software|
|4||L293D||Motor-Driver. Used to drive the stepper motors.|
|1||74HC595||Shift-Register. 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. Used to light the LEDs on and off.|
|4||28YBJ-48||Stepper-Motor. Used for the number indicator.|
|8||Strong Magnets||Used for the magnetic pendulum.|
|1||Light Strong Magnet||Used inside the pendulum.|
|1||Iron Sphere||Used inside the pendulum.|
|1||LDR||Used to sense the position of the pendulum.|
|8||LED||Used to sense the position of the pendulum.|
|8||220Ohm Resistor||Used with the LEDs.|
|8||S8050 D331 NPN Transistor||Used to drive a Stepper Motor with two Microcontroller pins.|
|8||1kOhm Resistor||Used to drive a Stepper Motor with two Microcontroller pins.|
|8||10kOhm Resistor||Used to drive a Stepper Motor with two Microcontroller pins.|
|1||Servo||Used to shake the pendulum.|
|1||Wooden Wine-Box||Used as the body.|
|2||Wooden Planes||Used as the lower and upper table.|
|2m||Cable||Used to wire all together.|
- Stepper number 2 has weird behavior. Replace driver with new one.
- Paint all in White
Thanks To (Unordered List)
- Mogul, Maxhirez, Ro-Bot-X, Merser and Geir for the support on the stepper motor driver.
- Birdmun for all your support, the mapping from the stepper driver to the cables. And your standing-by while the smoke-tests.
- Franz for the idea about using the shift register and hooking me up with one.
- Frank for your insights about the randomness of this approach and the 16 pin DIP IC sockets.
- Mani for the idea to have the sensor mounted on the pendulum.
- Ignoblegnome for all your support and this cool challenge.
- My wife for accepting her husband working in the night.
- Chris the Carpenter for the express delivery of the Wii IR Remote Camera.
- My boy that by accident connects two cables that led to the real first move of the machine's mechanics.
- ...and thank's to all that supported this little project. You all ROCK !
"A highly sensitive dependence on initial conditions is one of the fundamental properties of chaos. An example of such a chaotic system is a magnetic pendulum in which a magnet attached to the end of a pendulum oscillates over a plane where a set of attractive magnets are present. Depending on the initial conditions, the pendulum will come to rest at one of the magnet positions, but the final resting point can be highly sensitive to initial conditions."
"... the pendulum is given a slightly different starting position (with identical initial velocity, etc.), and the pendulum ends up over a different magnet"
Anziehungskräfte der 3 Magneten:
"Add a little trigonometry, and the Wii controller knows exactly where it is in relation to the screen."
"I²C is a 2-wire serial connection, ..."
"This library allows you to communicate with I2C devices."
"Using the Wii Remote IR camera directly with an Arduino."
"I finally got round to desoldering a Pixart camera sensor from the front of WiiMote and hooking it up to the I2C bus of an Arduino."
"Hello I was wondering what would be coding for using an i2c device like the wiimote's camera."
"The Picasso style painting robot, using a Hacked Wii-Mote as tracking system picking up an infrared triangle mounted to the back of a picaxe based robot."
"The wiicamera will output data to the microcontroller showing the X and Y position (within it's field of view) the size of that point of light, and the brightness. If a second IR source is introduced, more data will be sent including the above information. This continues with the 3rd and 4th point of light. This data can be used for all kinds of wonderful things."
"...IR camera from the Wiimote and interfaced it with an arduino controlling a servo."
"Ever wanted to connect more Arduino's to transfer data or commands between them? ..."
"At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers."
"Kondensatorenwerte und -bezeichnungen. Kondensatoren sind Bauelemente, die elektrische Ladungen/Energien speichern können."
"Programming plug in action and servo driver clock window."
"Dual stepper motor driver shield can drive 2 stepper motors at the same time by Arduino."
"The easiest way to measure a resistive sensor is to connect one end to Power and the other to a pull-down resistor to ground."
"Resistor color codes. How to read Resistor Color Codes"
"Kondensatoren sind in einer elektrischen Schaltung als Parallelschaltung miteinander verbunden, wenn dieselbe Spannung an allen Bauteilen anliegt. In diesem Fall addieren sich die Kapazitäten der einzelnen Bauteile zur Gesamtkapazität."
"Octal To Decimal Conversion. The utility will enable you to convert octal to decimal and vice versa."
Funny video about randomness.
"This tutorial covers the basic principles of stepping motors and stepping motor control systems, including both the physics of steppers, the electronics of the basic control systems, and software architectures appropriate for motor control."
Link to Datasheet. "Qualitativ hochstehender Stepper Motor / Schrittmotor 28BY J48."
"With center taps of the windings wired to the positive supply, the terminals of each winding are grounded, in sequence, to attract the rotor."
"Stepper motors have numerous wires--4,5,6, or 8. When you turn the shaft you will usually feel a "notched" movement. Motors with 4 wires require a Bipolar controller, such as the Dual H-Bridge."
"This is a 5v 28YBJ-48 Stepper Motor with Gear Reduction, so it has good torque for its size, but relatively slow motion. These motors/drivers are made by the millions for A/C units, fans, duct controls etc. which is why they are so inexpensive."
"This page shows two examples on how to drive a unipolar stepper motor."
"...To manage these engines more simply done with my H-Bridge with 4 NPN, I ordered a chip (which contains two H-Bridge needed to operate a stepper motor."
"When choosing a stepper motor with a gearbox, keep in mind that the gearbox is rated to sustain a specific amountof torque, beyond which the gearbox could become damaged. This limit is often much lower than the amount oftorque specified by the above equation.
The Gearbox Step Angle can be determined by:
[ GearboxStepAngle = MotorStepAngle / GearboxRatio ] (degrees/step)"
"Calibration of Linear Motion Systems Driven by a Stepping Motors."
"...I have written a detailed tutorial on the driver; just in case it might help someone."
"Control your motors with L293D"
"Driving One Stepper Motor With L293D Using Two Pins"
Datasheet of the L293D chip.
Datasheet of the NPN transistor
"Man kann einen Transistor aber auch einfach mit einem Ohmmeter oder Multimeter im Bereich Ohmmessung prüfen."