Chaot

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.

Content

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

# 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 ! 

 

 

Further Readings

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

http://mathforum.org/advanced/robertd/magneticpendulum.html
   "... 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:
  

27ac85d0a52b96638ee89b62b4e5a41b.png

.

https://sites.google.com/a/rocketbrandstudios.com/rocket-brand-studios/store/pcb-s-and-boards/wiicamera-arduino
   "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."

https://www.robotshop.com/letsmakerobots/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."

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

https://www.robotshop.com/letsmakerobots/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."

https://www.robotshop.com/letsmakerobots/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."

http://www.youtube.com/watch?v=Jw7Z7GrjLWs
   "…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."

https://www.robotshop.com/letsmakerobots/node/25926
   "Programming plug in action and servo driver clock  window."

http://iteadstudio.com/store/images/produce/Shield/Shields/Dual_stepmotor_shield/Dual_step_motor_shield_DS.pdf
   "Dual stepper motor driver shield can drive 2 stepper motors at the same time by Arduino."

http://www.ladyada.net/learn/sensors/cds.html
   "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
   Funny video about randomness.

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

IdeadStepperMotorShieldWiringOnly.jpg

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

http://www.youtube.com/watch?v=6vY26CIrVwg
   "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."

https://www.robotshop.com/letsmakerobots/node/2074
   "Control your motors with L293D"

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

http://en.wikipedia.org/wiki/Bipolar_junction_transistor
  

220px-Transistor_animation.gif

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

https://www.youtube.com/watch?v=PSd3RXJ9d-c

chaos!

oooh chaos theory! i like it!

I see that you have problems

I see that you have problems with the stepper motor. Could that be the same issues that I had and was pointed out by neuraxon77 ?

This is from the Arduino forum:

“I was trying to find a cheap geared stepper motor and found the 28BYJ-48 a number of places online and from the specs it seemed to fill the bill. 64 steps to the motor and 64X gear reduction 4096 steps per revolution. I received it and wired it up and ran it for the better part of three days with various programs. I kept finding that a full revolution was somewhere between 4072 and 4080. Maybe I was slipping with acceleration and deceleration??? Slowed everything down. No change. Finally I cracked the geartrain open and found the following gear teeth counts 9, 9, 10, 11, 22, 26, 31, and 32. If you calculate this out it is: (22X26X31X32)/(9X9X10X11) = 63.68395… Multipied by the 64X motor that is 4075.7728… steps per revolution not 4096!!! I was expecting an integral number of turns to return to zero. If you reduce this to the lowest common denominator ( 283712/4455) it means I have to go 4455 revolutions to get back to zero degrees! I’m disappointed that it’s not an integral number of steps to get 360 degrees. It was cheap but now I’m looking for a stepper motor that is actually an integral number of steps per 360 degrees. I’d like to find a stepper motor that’s >1000 steps/revolution and returns to zero every revolution.”

Not integral, that is a surprise

Yes Geir. I ran into this problem too. My observation was that after a proper calibration of the indicator to zero 0 after a few runs the indicator must be recalibrated.

I thought the motor slips. Like neuraxon77 I slowed all down and had no change too. This stepper needs an additional sensor to recalibrate from time to time since the step count is not an integral value. Currently the software does a soft calibration and makes some additional steps after a defined time of usage. Now that I know it is 4075.7728 I can do that more precise.

But my stepper problems are driver related at the moment. I think I solder a new driver and see, if it is better then.

This is insane and way cool,

This is insane and way cool, NilsB :smiley:

My biggest worry is that

My biggest worry is that when shown live, the low FPS will mess up the effect.

You’ll have to shoot it at HD and show us as well - I’ll need 25 FPS at least :slight_smile:

Stepper motor problem solved

Stepper motor problem solved by solder a new circuit. Now the stepper goes FWD and BWD.

My worry is the missing convergence

Another worry is that the approach of the Chaot creates an index. This index is like a LOTTO figure selection. There might be a winner or not.

Since we have about 160 donations the Chaot must draw three octal digits. Each digit can is [0…7] that gives the lowest number of 000 and the highest of 777. In the end there are only about decimal 160 actually used indexes but decimal 511 available.

So I need to extend the Chaot that it draws three digit numbers until a match occures from index to donor. That might be fast or never ending since this is random and does not convergate to 0… it can convergate. But it mustn’t.

…actually it is not

…actually it is not related to the chaos theory. This machine is chaos in practise.

unpredictable

well i think that it has a chaos property by chaos theory, you don’t know what might happened, this is awesome!

Chaotic Theory

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

As robot makers have access to the real world with our programs

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

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.

This is amazing. Using a

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

Wow, this is one amazing and
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.

 

Robots are gaining in popularity in a community but apparently you have to be really smart in order to build one that is going to perform as well as you want it to.

It is ok if it creates an index

You can map that index into the range of donors so you don’t really need to repeat the draw.

An even better way would be to assign all the possible numbers from 0 to 7777(8) to the donors using “true” randomness, as if everyone bought an equal number of the 4096 "tickets"

Let’s say there are 167 donors.

4096 / 167 = 24.5269461

So, we can assign 24 numbers to each donor (using a random shuffle with a random number sequence from random.org).

88 numbers will be left unassigned, but if one of these is picked the robot draws another number.

This list of assignments can be generated and published before the robot draws the actual numbers. I could write the code to generate it, it’s really simple.

Sometimes it is good to have a Counter-Point to make a Point

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. 

Multiple Tickets for each Donor. Fine.

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.

Yup

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.

Outstanding work,

Outstanding work, NilsB!

Outstanding :smiley: