Let's Make Robots!


Creates and indicates a random number

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.

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.

1Arduino Uno R3Contains the Software
4L293DMotor-Driver. Used to drive the stepper motors.
174HC595Shift-Register. 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. Used to light the LEDs on and off.
428YBJ-48Stepper-Motor. Used for the number indicator.
8Strong MagnetsUsed for the magnetic pendulum.
1Light Strong MagnetUsed inside the pendulum.
1Iron SphereUsed inside the pendulum.
1LDRUsed to sense the position of the pendulum.
8LEDUsed to sense the position of the pendulum.
8220Ohm ResistorUsed with the LEDs.
8S8050 D331 NPN TransistorUsed to drive a Stepper Motor with two Microcontroller pins.
81kOhm ResistorUsed to drive a Stepper Motor with two Microcontroller pins.
810kOhm ResistorUsed to drive a Stepper Motor with two Microcontroller pins.
1ServoUsed to shake the pendulum.
1Wooden Wine-BoxUsed as the body.
2Wooden PlanesUsed as the lower and upper table.
2mCableUsed 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 ! 



Further Readings

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Fine. This is the way I try it. The tickets are scaled and each person gets as many tickets as there are available. Then almost all available numbers point to a ticket and therefore to a winner.

As I understand: If we have 10 figures and 2 donors that makes 5 tickets for donor A and 5 for donor B. Then the list with the random ticket distribution could look like this: [1=A,2=A,3=B,4=B,5=B,6=A,7=B,8=A,B=9,A=10]. Then every selection points to eigther A or B, i.e. 7 points to B.

Is this what you proposed, Antonio?


PS: For now the Chaot uses three digits only. So 000 is min and 777 is max.

The example you gave is exactly how it would work. Only some entries will point to "None".

By shuffling the list the draw is fair even if the magnetic generator is biased.

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. 

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

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.

Outstanding work, NilsB!

Outstanding :D

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