# Chaot

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.

Content

• Draw Winner Using a Magnetic Pendulum
• Idea Finding
• The Making-Of
• 15 Minutes of Fame
• Used Parts
• Current Issues
• Thanks To

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.

Idea Finding

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 Making-Of

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

The Chaot was used to make a live draw of winners. In the promotion of this event the Chaot got featured on Seeed's and Evil Mad Scientist Laboratories website and also on the frontpage of LMR.

Used Parts

To build this machine the following parts are needed.

 # Part Use 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 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.

Current Issues

1. Stepper number 2 has weird behavior. Replace driver with new one.
2. 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 !

http://demonstrations.wolfram.com/ChaoticDynamicsOfAMagneticPendulum/
"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"

http://de.wikipedia.org/wiki/Magnetisches_Pendel
Anziehungskräfte der 3 Magneten:
$\vec{F}_m=-\nabla\sum_{i=0}^{N=3}V_i(\vec{r})$.

"Add a little trigonometry, and the Wii controller knows exactly where it is in relation to the screen."

http://wiki.bildr.org/index.php/Category:I2C
"I²C is a 2-wire serial connection, ..."

http://www.arduino.cc/en/Reference/Wire
"This library allows you to communicate with I2C devices."

http://letsmakerobots.com/node/7752
"Using the Wii Remote IR camera directly with an Arduino."

http://www.stephenhobley.com/blog/2009/02/22/pixart-sensor-and-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."

http://letsmakerobots.com/node/25518
"Hello I was wondering what would be coding for using an i2c device like the wiimote's camera."

http://letsmakerobots.com/node/21141
"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."

http://letsmakerobots.com/node/28398#comment-71834
"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."

http://www.instructables.com/id/I2C-between-Arduinos/
"Ever wanted to connect more Arduino's to transfer data or commands between them? ..."

http://www.arduino.cc/en/Tutorial/ShiftOut
"At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers."

http://www.jukebox-world.de/Forum/Archiv/FAQ-Technik/Kondensator.htm
"Kondensatorenwerte und -bezeichnungen. Kondensatoren sind Bauelemente, die elektrische Ladungen/Energien speichern können."

http://letsmakerobots.com/node/25926
"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."

http://www.hobby-hour.com/electronics/resistor_color_code.php
"Resistor color codes. How to read Resistor Color Codes"

http://de.wikipedia.org/wiki/Kondensator_%28Elektrotechnik%29#Parallel-_und_Reihenschaltung
"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."

http://www.statman.info/conversions/octal.html?original=7&finaltext=1
"Octal To Decimal Conversion. The utility will enable you to convert octal to decimal and vice versa."

http://youtu.be/Lf4ZmWc_jmA

http://www.divms.uiowa.edu/~jones/step/
"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."

http://www.datasheetarchive.com/indexdl/Datasheets-SL4/DSASL0060849.pdf
Link to Datasheet. "Qualitativ hochstehender Stepper Motor / Schrittmotor 28BY J48."

http://www.stepperworld.com/Tutorials/pgUnipolarTutorial.htm
"With center taps of the windings wired to the positive supply, the terminals of each winding are grounded, in sequence, to attract the rotor."

http://www.stepperworld.com/Tutorials/pgBipolarTutorial.htm
"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."

http://arduino-info.wikispaces.com/SmallSteppers
"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."

http://arduino.cc/hu/Tutorial/StepperUnipolar
"This page shows two examples on how to drive a unipolar stepper motor."

http://diyautolab.blogspot.com/2011/06/moteur-pas-pas.html
"...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."

http://www.phidgets.com/documentation/Primer_Stepper_Motors.pdf

"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."

http://www.robotplatform.com/howto/L293/motor_driver_1.html
"...I have written a detailed tutorial on the driver; just in case it might help someone."

http://letsmakerobots.com/node/2074

http://letsmakerobots.com/node/32208
"Driving One Stepper Motor With L293D Using Two Pins"

http://www.datasheetcatalog.org/datasheet/texasinstruments/l293d.pdf
Datasheet of the L293D chip.

http://html.alldatasheet.com/html-pdf/433163/MCC/S8050-D/54/1/S8050-D.html
Datasheet of the NPN transistor

http://www.hobby-bastelecke.de/halbleiter/transistor_pruef.htm
"Man kann einen Transistor aber auch einfach mit einem Ohmmeter oder Multimeter im Bereich Ohmmessung prüfen."

## Comment viewing options

This machine got terminated on the 3. January 2013, 20:31. RIP.

Outstanding work, NilsB!

Outstanding :D

Wow, this is one amazing and extremely detailed article. I hope that there will be more soon because I think a lot of us really would love to see the final product. Thank you for sharing.

This is amazing. Using a magnetic pendulum to build random numbers, chapeau. A worthy opponent for the challenge.

Yeah this is one neato or should i say Magneato way of choosing randow numbers .... yes i would trust it ....

.... however would i trust the "Migros" metal ballbearing loaded Nanomania bots..... hanging from its loose thread...hmmm

In Wild Guys We Trust ;-)

Awesome invention Nils!! You look like you are determined to prove me wrong (and actually, I'll love to be proved wrong by Chaot :).

Well Vishu, by following what you proposed in your comment we LMR would have a lot less work to do. From my point of view that comment was not wrong but pragmatic.

That pragmatism just missed the point a bit. We want to make things that physically exist and therefore we want to make a machine or a robot to achieve this physical manifestation. We take the effort to make more than just the program because we are LMR.

As robot makers we have access to the real world with our programs. This distincts us. This gives us the chance to take it to the next level and interact with the world. And this is why we prefer real random numbers over pseudo-random numbers.

I totally understand your point Nils. At that time, I was new to this and I wanted to do something for the site. My knowledge was truly limited but spending a few days shouting, I have enough knowledge to not only understand your point but make an effort to help anyone who may make a similar mistake. I hope you'll forgive me. This site has given me a lot even before I became a member of this site and I wanted to do something for this site. Since I'm not good in web designing and I can't make a robot (you know the reasons), I tried to offer you help in the only way I could. A few days with the truly talented people of this site was enough for me to realize my mistake and I sometimes think why I even wrote that comment. I hope you'll forgive me.

Sometimes it is good to have a Counter-Point to make a Point. Thanks for the Counter-Point, Vishu. And Thank's for the engagement.