Saturday, December 15, 2018

BASIC Programming for CHAOS


BASIC Programming for CHAOS







The last time I played with BASIC programming was on my Commodore 64 computer. I'm attempting run a program that shows chaotic bifurcations (just like my Chaotic Chua Circuits).


We'll start with a simple 7 line code that will become the center of our chaos inducing 23 line code (don't worry, you can just copy and paste from here once you download a BASIC emulator).


So, here is an iterated logistic difference equation showing animal population growth. If you run it on an online BASIC simulator it works. For this, an online simulator works fine. Try this one:  https://repl.it/repls/InsignificantTepidEquipment



TURN ON YOUR CAPS LOCK FOR ALL CAP LETTERS!

If you type "2" as your input the population hovers at around half an animal. If you type "5" as your starting population it goes to infinity (which is an error). So you need numbers less than 4 to keep it running true. The population levels out if you put in 1.5 as a start:


10 N=.1
20 INPUT"VALUE OF R";R
30 FOR I=1 TO 30
40 N1=R*N*(1-N)
50 PRINT N1
60 N=N1
70 NEXT I




Here is the screen capture of it in action:


Infinity: that's a lot of kitties! But an error in the program of going too high (R=5).



So here is R = 3.999




There is a new version of BASIC from Microsoft available as a download or an online simulator here: https://smallbasic-publicwebsite.azurewebsites.net/

It's called Small Basic...and the language is different.

Here's a cut and paste version of the above script in the new language (it works, but doesn't give as many lines of results):

N=0.1
TextWindow.Write("What is the value of R? ")
R = TextWindow.ReadNumber()
FOR I=1 TO 30
N1=R*N*(1-N)
TextWindow.WriteLine("The result it " + N1 + ".")
N=N1
ENDfor

Each one of these lines is a seperate line in Small Basic (just number them 1, 2, 3, etc.) like this screenshot:

Oddly, it cannot handle decimals for the R value, so here is R=5:



Fun in (Small) BASIC for the year 2020!!!!!!!!!!!

Bifurcation/Chaos

Now here is the bifurcation program, which I snagged from a booksale of weeded library books (I'm a librarian). There was a whole pile of stuff on chaos, but it was written in the early 1990s, so it was computer stuff and not oscilloscope stuff--pretty cool! Check out "Science of Chaos" by Christopher Lampton, the appendix (Page 111) has a great little primer on BASIC; although most of the commands seem to be in QBASIC and not BASIC (but it's been about 3 decades ago for me, so who knows). It doesn't matter because this is super easy (just copy and paste what I did).

You download and install a BASIC emulator onto your computer, like I did for the following video and screen shots you can just paste the code in. I used "PC-BASIC" made by Rob Hagemans because it is one of the few emulators that also emulates graphics that are needed to display the chaos! I got it off a site called SourceForge. A lot of BASIC/QBASIC/GW-BASIC emulators don't do graphics. PC-BASIC does. Worked for me on a modern Lenovo ThinkCentre desktop, LOL! https://sourceforge.net/projects/pcbasic/



There is an emulator is called "DOSBOX" also works but is very slow, and you can't paste into it--you just have to retype everything. It runs online, so no downloads. The problem is that you can't pause/exit a program without crashing/locking up:  https://archive.org/details/msdos_qbasic_megapack



Anyway, it is also one of the few emulators that seems to allow pasting lines of code in. That sure beats retyping everything.  I typed this program into an email at some point. Then I just copied it in the email program like normal (Control + C) and pasted into into PC-BASIC by hitting F11+V and it all appeared. Then I typed RUN and it started drwing the lines/single attractor/two splits (4) attractors and finally the chaos.



Here is the BASIC code for Bifurcation Leading To Chaos:


10 KEY OFF:CLS
20 SCREEN 7
30 DEFSNG A-Z
40 COLUMNS = 320
50 ROWS = 200
60 START = 1
70 FINISH = 3.999
80 TOP = 0
90 BOTTOM = 1
100 MAXREPS = 10
110 HEIGHT = BOTTOM - TOP
120 VPCT = 1/HEIGHT
130 FOR R = START TO FINISH STEP(FINISH - START)/COLUMNS
140 X = .1
150 FOR I = 1 TO 100
160 X = R * (X - X * X)
170 NEXT I
180 FOR I = 1 TO 30
190 X = R * (X - X * X)
200 PSET ((R- START) * COLUMNS/(FINISH - START), ROWS-(X - TOP) * ROWS * VPCT)
210 NEXT I
220 NEXT R
230 A$ = INPU$(1)


This was way easier than my Chua Circuit + Oscilloscope adventures in chaos (which were lots of fun too though).

After you cut and paste and run the program the line drawing will eventually stop. If you hit any key and then type LIST it will show you the lines of the program again.

Then comes a neat part: if you want to make a change in a line you could use arrow keys and move up and retype little bits and pieces of the code; or you could just retype the line.

Lets say you want to change line 20 from having a screen value of 7 to a value of 9. Right at the cursor that you're left at after hitting list just type:    20 SCREEN 9      then hit enter and then type RUN and it will change the line and run the program and you can see the changes it makes (or get an error).






COOL CHANGES YOU CAN MAKE TO THE ABOVE CODE:

Line 20 
This sets the screen resolution to 7.
You can change that to 9 and get higher resolution. It worked for me.
I tried setting it to 12, but got an error message. Probably because the emulator couldn't handle that high of a resolution. Here, the higher resolutions are the emulation of old EGA and VGA video cards, LOL! This program is actually best performed on an old CGA graphics adapter (which is why the crappy value of 7 is chosen--it's low res, but works).

Many emulators I tried gave an error at line 10 or 20, meaning they didn't emulate graphics adapters.



The QBASIC Screen values represent:

SCREEN 0: Textmode, cannot be used for graphics. This the screen mode that text based programs run on.

SCREEN 1: 320 x 200 Resolution. Four Colors

SCREEN 2: 640 x 200 Resolution. Two Colors (Black and White)

SCREEN 7: 320 x 200 Resolution. Sixteen Colors (USE THIS ONE)

SCREEN 8: 640 x 200 Resolution. Sixteen Colors

SCREEN 9: 640 x 350 Resolution. Sixteen Colors

SCREEN 10: 640 x 350 Resolution. Two Colors (Black and White)

SCREEN 11: 640 x 480 Resolution. Two Colors

SCREEN 12: 640 x 480 Resolution. Sixteen Colors

SCREEN 13: 320 x 200 Resolution. 256 Colors.





Line 40 and Line 50
I changed the values from the original 320 & 200 to higher values. This changed the aspect ratios and distorted things. Once the values got too high (around 800) it gave stack overflow errors. It also tended to start the line drawing near the center of the screen, and/or have stuff run off the edge of the screen which was annoying.




Lines 160 through Line 200
You'll notice these mirror the equation in the first (animal breeding) program.
What's crazy, is that if you plug in other equations, you'll get nearly identical chaotic bifurcations on screen...because whenever something breeds chaos, the chaos is the same. Chaos = Chaos!




Lines 60 through Line 90
Here's where it gets really interesting and beautiful. These lines are Start, finish, top and bottom. Which you would assume to just shift the same image on the screen left or right or up or down, just like the line 40 and line 50 stuff tended to do. You'd be wrong. It actually enlarges portions of the original output--and because it's a fractal like chaos it stays interesting and amazing.

Here are the original lines:

60 START = 1
70 FINISH = 3.999
80 TOP = 0
90 BOTTOM = 1

And here are a new set of values:

60 START = 3.5601
70 FINISH = 3.59
80 TOP = .34
90 BOTTOM = .35



I'll pop them into the entire code, so you can cut and paste one block:


10 KEY OFF:CLS
20 SCREEN 7
30 DEFSNG A-Z
40 COLUMNS = 320
50 ROWS = 200
60 START = 3.5601
70 FINISH = 3.59
80 TOP = .34
90 BOTTOM = .35
100 MAXREPS = 10
110 HEIGHT = BOTTOM - TOP
120 VPCT = 1/HEIGHT
130 FOR R = START TO FINISH STEP(FINISH - START)/COLUMNS
140 X = .1
150 FOR I = 1 TO 100
160 X = R * (X - X * X)
170 NEXT I
180 FOR I = 1 TO 30
190 X = R * (X - X * X)
200 PSET ((R- START) * COLUMNS/(FINISH - START), ROWS-(X - TOP) * ROWS * VPCT)
210 NEXT I
220 NEXT R
230 A$ = INPU$(1)


...and here are the results, which are a an enlarged portion of the lower "eye" of the original:



Keep playing with lines 60 through 90 and get your own crazy, unique views of chaos.




Line 150 / Line 180
Change the numbers in these so instead of 1 to 30. Let's say: make it 1 to 10 and 1 to 20 it will draw faster, but also differently!!! If you make the numbers larger (especially on Line 180 it will draw much slower, and also give an error at the end that might blank the screen out--so take a photo before it reaches the end just in case--or video).



Lower numbers in Lines 150 and 180 so it drew very quickly, and gave a sort of negative Lorenz Butterfly type look:




This one had a larger number on Line 180 and took a couple minutes to finish. It's filled in quite a bit in the chaotic area (which might not be chaotic anymore I guess).






Another useful feature you can use in QBASIC (which I think most of these commands are actually from) is BEEP.

At the end of your program add another line and write BEEP.

So for the above experiments we would add:

240 BEEP

Then, when your chaos is done drawing you're treated to a very loud BEEP! Don't have headphones on with that one.



Saturday, November 24, 2018

Link to Omega 1250 9162 f300hz Tuning Fork Movement Service Manual PDF


https://drive.google.com/open?id=1cAna84osa1M3aaP-JF9scC0thZX7l_BG 




https://drive.google.com/open?id=1cAna84osa1M3aaP-JF9scC0thZX7l_BG 


This is for the tuning fork movement, referred to as a 1250 by Omega and as 9162 by ESA. It was used in a variety of watches by different manufacturers. The Omega version is identical, except that it was always a copper plated color instead of nickel (chrome looking).


I've been inside a few f300Hz movements and the first thing the repair manual (above) tells you as that you MUST NEVER INSTALL OR REMOVE the 1250/1255/1260 movements from the case with the oscillation mechanisms installed. Before you case or uncase the movement the oscillator module MUST be removed!!!!! Of course, they tell you that on page 16 of a 66 page technical manual, lol!



I've found this movement (working and clean) in a cheap, used Titus wristwatch.

It is used in the Electronic Omega Seamaster f300Hz shown above and the Omega Constellation below.



There are variations:

Omega Calibre 1250 = ESA 9162 (date only)
Omega Calibre 1255 = ESA 9210 (chronograph day and date)
Omega Calibre 1260 = ESA 9164 (day and date)


Common problems:

The watch doesn't hum! Put a new battery in it. 

I use Reneta batteries, but for no other reason in that I had some already.


ESA 9162 / 9164    
Old: Mercury Battery (not made anymore) 343
New: 344, 350, SR1136SW

The old mercury batteries were only about 1.3v and the new silver oxide ones are 1.55v, but the f300Hz movements can handle it just fine.

Some other battery movements had "issues" and would run double-speed with a new battery, then you'd have to either: install a new coil (hundreds of dollars) or use Accucell Batteries that are made for this issue--but they only last about 9 months in a watch.

You could also adjust the watch, since it was excess power that would cause these watches to double click. Sometimes they would keep great time sitting on a table but would go too fast when warn: arm movements plus the extra power would make them double click every few seconds.

The watch doesn't hum! PART 2 
Coil or resonator.

Maybe the coil needs to be replaced because it's shorted? Bummer. Find a list of other (cheaper) manufacturers that used the 1250 and buy a donor watch). My Titus was like $40 with a WORKING and clean 1250 in it!!! A NOS (new old stock) 1250 is like $400 on eBay.

I've had a 1250 stop humming because a screw was too tight. Loosening: plate screws, battery holder screws has made a "dead" watch hum back to life for me.

Adjust the resonator. The double + or - adjustment thingies. I've had them be too asymmetrical and I've had them cranked all the way one way or another and fiddling with them brought a hummer back to life for me. The manual states that you can adjust one or both, but try to keep them reasonably symmetrical.


Take off the two coil units and measure their ohms. No ohms at all means open circuit which means you need a new coil (or two). Here is a scribble drawing i made showing the measurements you should get when testing:


The coils go bad because the varnish swells or lets rust in over the decades or the transistor capicitor units go bad, even if their not being used.

My current repair is a beautiful Omega constellation that gives me 1489 ohms (for the 1.5k ohms reading) which is great! Unfortunately, all the other 3 tests show no ohms and no continuity: so both units are bad.

I've got an entire new old stock (NOS) top plate with coils and gears on its way, but am going to also test some old spare parts from previous repairs I've got laying around. This fix might be free since I know I took off an entire plate from a broken Omega that still hummed but that had other problems. Fingers crossed (will update 11-27-2020) that it works.  Update 11-28-2020: fixed the Omega Constellation!

Left is an old messed up gear train movement, on the right is my Constellation. There are 4 screws to remove this electronic module plate and 3 screws to remove both coils. That was it!



Here is video of it running:



The calendar date doesn't advance? Put a new calendar wheel in!


The wheel with the date on it is HUGE, but has tiny little gear teeth. It's very easy to remove and replace...except if you replace it with a New Old Stock (NOS) part it'll still be a super-fragile, 50 year old piece of plastic. Look on eBay: there is a company in Germany that will ship you out a brand new METAL one. This metal wheel will only work on the 1250 movement (the one that is date ONLY, it doesn't have a day of week on the watch).

There are some Longines brand ones that are for the same movements and they're gold colored! But they may be (50 year old) brittle gold colored plastic, and they're the same price as the new metal ones.

Another issue on some watches is that if a certain area isn't oiled and you pull out the stem a couple gears won't disengage completely; then if you move the hands COUNTER-clockwise it breaks the teeth off and then either the hands won't work or the date wheel won't work or nothing will work. Destruction!

Luckily, the 1255 and 1260 versions that do have the day (and date) have a more robust plastic wheel that is harder to break. Sadly, nobody is manufacturing metal (or plastic) replacements for them at this time.

How to you damage a calendar wheel? You use the quick set feature between around 9pm and 2am. That destroys so many watches from all sorts of manufactures. I've seen (and done it) to Seikos, Omegas, automatics, quartz and tuning fork watches. 

NEVER change date, day or time on ANY BRAND wristwatch between 8pm and 4am!!!! The gears can slowly engage at that time to slowly flip the date/day over at around midnight. Fiddling with the watch can strip these gears.

So, what did I do with (to) a certain Omega Constellation? At around 8:30pm I went to adjust the minute hand slightly, but I accidentally had the 3rd detent (all the way out) instead of just a little on the crown and changed the date instead of minute. The next morning the date had failed to flip over...and this was on a NICE watch that instantly flipped the date # at 11:59 promptly and quickly!

So, did I wreck the date wheel? Well, if it was cracked then I probably couldn't advance it (which I can). If I wore the little tooth down/broke it then it will always fail to advance on that date (from the 23rd to the 24th). So: I ordered a little metal calendar wheel which should arrive from Germany.

I have other spare parts for the 1250 movement, but they're old. Old parts are fine, but old calendar wheels are all brittle.

That's the thing about these movements too: how many of the 31 days' teeth are worn, cracked, broken, bent, etc.? You'd need to disassemble the watch and look with a loupe/microscope to tell on many of the gears, however this one's calander wheel teeth are fairly large (but delicate).

Maybe I just goosed the gears at a bad time and it will sort itself out (I've had watches sort of heal themselves on occasion). The gear that flips the date wheel has a large paddle shark fin type thing on it which looks like it couldn't hurt the gears, but that's the fast set "calander driving wheel", the normal movement is from a hooked lever thing that can destroy the teeth. 

They can work fine but repeatedly stick on certain days/dates. 

Here goes with disassembly: battery out, 4 top plate screws out, pull off top plate, push down on pin to release stem and gear, remove 3 screws and tabs, remove entire movement (what was left of it), flip out two little hinge hooks and pull up on the face/dial to easily pry off hands (photo time on watch before), 3 screws and plate holding wheel comes off, change wheels, put plate back on, RESET THE LITTLE WIRE to the top of the date lever, carefully put all else back.

Note battery corrosion: shame!





With the plate screws off and ready to remove plate that holds in the date wheel:





This is a picture of the back of mine. That is a tiny golf pencil next to it! I put 3 pencil marks on bad teeth. They were worn down from original pyramid (triangle) shape to mesa (trapezoid) shape. What was worse is that they had grooves scartched into their side surfaces from the lever riding over or under them. This thinned them out.




The new metal wheel with strong teeth:



Once reassembled the watch hummed but second hand didn't go. I loosened the 4 screws holding the top plate oscillating module and tightened them slightly under everything meshed and the second started gloriously spinning.

Here it is pinging like an M1 Garand at the date change. It changes when both hands point at the date window, pretty fancy! You'll need the volume up all the way.




Lube/Clean!
Like any watch a TINY dab of Moebius Oil may be needed. Luckily, there aren't too many actual moving parts in a 1250 (compared to some other watches). Also, in some spots grease is called for, usually Molybdene.

Moebius 8000 is old fashioned and $8 a bottle. It lasts 1 year open and 2 sealed. Forget that and get 9xxx oil that is synthetic (but it's like $34 a bottle).

Better yet, try some other brand. I've heard bad things about Anchor oil like 10 years ago but they're still around. Oddly enough it was when people were complaining about a bad batch of Moebius oil gumming things up! Also, pay attention because oil and grease are different in the repair manuals: if you swap them in certain areas you just killed your watch. Most watches need 3 types of lubrication in different places: thin oil, medium oil, and thick grease. 

The second hand goes nuts? Possible fixes:
There is a "friction" part that sometimes has too much friction and needs grease (not oil). Or there is a messed up index gear (or poorly adjusted pawls), which will cause the second hand to spin when setting the time. 

In fact, issues with the indexing mechanisms can make the entire watch run backwards!


Another Omega fixed with new coils and then new metal date wheel from ebay (German seller that makes them):



Not bad, although while I was working Detroit Energy started to replace a woodpecker destroyed utility pole and remove wires from old pole to monstrously huge new pole. Lots of yelling and machinery noises. A very exciting time!


Literally hundreds of woodpecker holes!

Thursday, September 27, 2018

Colpitts Oscillator


Colpitts Oscillator






Transistor 2N3904 CBE (C to g31 / B to g32 / E to g33)

C1 = 1uF (Negative stripe goes to negative voltage – other leg goes to j31)
C2 = 33nF (g27-g29)
C3 = 10nF (h29 – h31)
C4 = 47nF (d29 – d31)
C5 = 100nF (h37 – h39)

R1 = 15k (h32 – positive voltage)
R2 = 5.6k (i32 – negative voltage)
R3 = 68 (g36 – negative voltage on other side)

Jumper wires:
e29 – f29
j27 – positive voltage
Negative voltage – other negative voltage
j31 – j37
h33 – h36
c31 – f33

Oscilloscope probe = g39 and ground clip attached to inductor L1’s i27 leg





Shorter jumpers are better because breadboards have parasitic inductance that adds to the inductor’s parameters. I had a few really long jumper wires-when I shortened them the circuit worked.

I think C1 (the electrolytic capacitor) shorts the “Base” (B) of the transistor so that you get an output AC wave. Oscillation = waves = alternating = AC. I forgot to put my oscilloscope on ‘AC’ setting so I was getting weird displays.

This circuit was much harder to get going than anything I’ve put together. Even when my Chua chaotic circuits are misbehaving I still see something sort of cool. This thing is all or nothing.

I have some variable capacitors I’m going to plunk in and play with to see what slight adjustments do to the waveform and frequency.

Sunday, September 9, 2018

HOW TO DISABLE FORD PATS ANTI-THEFT SYSTEM KEY CHIP






HOW TO DISABLE FORD PATS ANTI-THEFT SYSTEM KEY CHIP


Ford (and many other) vehicles have a transponder chip inside their physical keys. This is sometimes called PATS or VATS.


This only worked because I had a working key (with a chip transponder in it) that can start my car. I guess it's less "disable" and more "how to make $1.50 copies of my $200 keys that will start my car instead of just unlocking the doors".





A replacement key is around $150-$200 from a dealer, $80 from a locksmith. You can get a blank (with a chip) and use your car to program that blank’s internal transponder IF YOU HAVE TWO OTHER WORKING KEYS WITH TRANSPONDERS IN THEM. One of my keys is now old and the plastic base is cracking so I’m afraid to stick it in the ignition in case if breaks off in there.


I went to the hardware store and got a $1.75 copy key made. It does NOT have a transponder in it, so all it could do was unlock my vehicle’s door. It wouldn’t start the vehicle. I could turn the ignition with it, but not actually make the car start because there was no transponder chip.

If I held my real Ford key touching the cheap copy key in a certain way I could get the cheap copy to actually start my vehicle. It is very awkward to do, and then I’m still carrying around my cheap copy key and my cracked and about to fall apart real key with the transponder.

I could go to a Ford dealer and pay $200 and get a second real key with a transponder—which would then let me get a slightly cheaper uncoded transponder key and use both the real Ford keys to program the third. But I found a cheaper way online and tweaked the bypass method to make it easy. 

It takes less than 10 seconds to install/uninstall.

  • All I did was wrap a 6’ long wire around the real Ford key (with the transponder in it).
  • I made 10 wraps around the Ford key and secured it with two pieces of tape so it wouldn’t uncoil.
  • I then joined the bared wire ends together so that the wire was a loop. For kicks I hit that joint with a dab of solder.
  • This gave me a real key with a transponder in it hanging from a loop of wire. I went into my car and wrapped the wire twice around the part of the ignition that spins when you turn the key to start the car.


The wire loops sort of just tucked themselves in and disappeared inside that spinning ignition part. Nice! Then I stuck in my fake copy key (which has no transponder) and the vehicle started right up.

Then I tucked the dangling real Ford key into a space in the dashboard above the steering column because in the column or in the dash beneath the steering column has metal plates and wires that wouldn't let this work due to interference!


My finger is pointing where the key is tucked behind. Everywhere else had interference. I used red wire so it would be visible, I'll probably redo it in black. Although you can't see the red wire from the driver or passenger seat. If you look where the red wire is going on: the key for in there nicely BUT HAD INTERFERENCE SO THE CAR WOULDN'T START... MOVE OUT 3 INCHES HIGHER WHERE MY FINGER IS POINTING AND THE CAR STARTS.




I pushed the key down through the top of thet plastic bezel between the speedometer glass and the top of the steering wheel.

Then I pulled the wires through the rubber gasket that surrounds where the steering wheel column goes into/under that bezel.

Spend $6 and made 3 more fake no transponder keys for backups. Instead of $270 I spent less than $10 and less than 5 minutes on this. The hardest part was finding a wire that was long enough out of my junk bin.

WARNING: I’ve seen a LOT of online tutorials that say you have to disassemble the steering column and/or dashboard. These people look under the steering column and all say the same thing “There are 4 holes, but only 3 have screws in them”. They then say to take out those 3 screws which is WRONG!!! The 4th hole with no screw is an ignition release!! Jab a screwdriver in there and gently pull out the ignition. Duh! Although, I didn’t take anything apart, I just loop the wire twice around where the spinning ignition part meets the steering column. No need for any screwdrivers.

If you do pop out the ignition from the steering column you can see a round ring that is the antenna to detect the chip inside your real key. Crack open your real key, take out the chip, superglue it on/near that antenna and any old (non-chip) key will work but things inside the column can interfere with the chip as stated before, you could probably jam a screwdriver into the ignition instead of a key and it would start up. 

The best part: just yank on the wire and unloop it from around the ignition and it’s disconnected. It still works as a regular key; and because I didn't go crazy with the electrical tape holding the 10 loops around the key together it still (barely) fits in the ignition.

WARNING: if this is on the vehicle it’s reading the transponder from the real Ford key. If I  try to start the vehicle with another real Ford key (because I finally found a spare) the car won’t start supposedly, however my real key and my fake keys all work. Just don't test all your keys in quick succession because you'll put the car into key code program mode. The antitheft system will see BOTH keys and get confused. 

One real key with this setup tucked into the UPPER dash + a second real key at a relatives house for safe keeping + a bunch of cheap $1.50 copies.


This works with induction (coils of wire). There are very similar devices on Amazon for $10 but they want you to tap them into the 12volt system of the car for some reason. My way doesn’t physically connect to the vehicle’s electronics in any way. I just looped it around the real key 10 times and the spinning part of the ignition twice. Worked the first time and every time after that. Both ends of the wire have to touch each other or it won’t work—they have to be a loop. I wonder: if I put a simple on/off switch in the loop would it act as a kill switch? I think it would! That’s a future project.

I’m doing this for fun, the Blue Book Value of my vehicle is less than $3000 and it’s 18 years old so…I’m not terribly worried about theft. What would be the odds that a car thief would say “Hmmm…that vehicle over there came from the factory with anti-theft key chip transponders but I have this psychic sense that the owner did that famous antitheft defeat thing. I think I’ll smash the window and try and jiggle a screwdriver around in the ignition for a while trying to start it on the one in a zillion odds he did that.

Things I used:
  • A working Ford key with build in chip transponder that starts the vehicle by itself.
  • Cheap $1.50 hardware store copy that will unlock the doors and allow you to spin and try and start the vehicle, but won’t let the vehicle actually start (just a bunch of bells and blinking lights on the dash).
  • 6 to 8 feet of thin wire that has rubber insulation on it (so I don’t short out anything when tucking it in to the ignition 
  • Knife/wire stripper to remove insulation at both ends of the wire.
  • Two pieces of duct tape or electrical tape to hold the 10 loops around the real key together
  • For kicks I soldered the ends together, but I could have just twisted them together and taped it up.


The people at the hardware store were like “we can’t copy a car key with a fancy chip in it…because our crappy $2 copy has no chip inside, it’s just a key…BUT we can make a cheap copy that will still unlock your door in case you lock your real key inside. That way you can keep the cheap copy in your wallet! It will also turn inside your ignition in case you want to unlock your steering column/wheels to get a tow truck ride.”

I was like, oh, OK I don't want to argue. Then I did this trick and it’s all good.

My car is 18 years old and I don’t have theft insurance on it anymore (saving like $400 a year) so it’s all good. I’ve heard some car companies won’t pay out if your car gets stolen because you left the key inside. If that were the case I’d tuck the real Ford key way deeper into the interior somewhere deep, possibly using a longer wire…or I’d pop the little rectangular hatch open on the real Ford key and slide out the chip, which is tiny and even easier to conceal. Maybe even superglue that tiny chip onto the spinning part of the ignition so it's always there. Plus, it’s not a “key” left in the ignition either way. I dunno.




TO the left is my real, from the factory Ford key with the chip transponder in it. The wire is wrapped 10 times around it and the wraps are held in place with some black electricians tape.

The bare ends of the wire are just twisted together. The wire is now in a "loop" with no breaks in it.

To the right is the part I just wrap twice around the spinning ignition thingy that you turn to start the car. Just two or three loops around.

In the center is the tiny, light, thin $1.50 cheap fake copy key. It has no chip inside of it. Normally it will only unlock my doors and it will also try to start my engine but fails because the antitheft kicks in. 

Wrap, wrap around the ignition; tuck the real key into the upper dash (or let it hang loose). Good to start!

My next project might be to remove the transponder chip from the real key and superglue it to the turning part of the ignition. No wires.

Sunday, July 15, 2018

Chua Circuit Chaos Easy Build





Chua Circuit Chaos Easy Build - No Inductor




Here's a phase portrait of a beautiful single scroll chaotic attractor from my oscilloscope! I was able to also confure up a multiple scroll attractor and also a teeny-tiny double scroll illustrating the classic chaotic circuit output. A Strange Attractor is when a bounded chaotic system has some kind of long term pattern that isn’t a simple periodic oscillation or orbit.



Here is how two superimposed attractors form the famous double-scroll attractor:





Here is a video:;







Nice Mobius strip attractor, the only possible attractors in this pattern are limit cycles:







Here is a multile limit cycle attractor as it adds more ovals to become a single scroll chaotic attractor.



My oscilloscope settings for my "newer" scope.

There is a progression from steady state to limit cycle to chaos and bifurcation. Steady state is a dot; an oval signifies a 1 period limit cycle; multiple overlapped ovals show 2 or 3 or 4 limit cycles; once the ovals are plentiful and have a sort of inverted rounded pyramid shape (like mine above) it's a single scroll chaotic attractor. 

The famous double scroll chaotic attracot can have two appearances depending on your setup and equipment: the single chaotic attractor with some extra, lighter ovals underneath it; or sort of a figure 8 shape.



The circuit build is towards the bottom of this post.

Chua's Circuit is basically an oscillator that outputs waveforms that never repeat: chaos! Chua's Circuit is the simplest circuit that can output real chaos. Chaos in the form of a double swoosh set of circles on an oscilloscope screen. This waveform is called an attractor, which demonstrates chaos in a continuous time dynamical system...I like the idea of a waveform generator / oscillator that never repeats. A continuouly evolving, periodic output that never repeats: chaos!

What defines chaos in a system like this: extreme sensitivity to initial conditions; cause and effect are not proportional; and it is nonlinear.

This circuit will also display bifurcation: small, smooth changes lead to a sudden huge change in the system. Tuning a silent radio with a knob that you're barely moving, you keep trying to nudge the timing knob and you all of a sudden loud music starts playing. Or slowly as possible applying more pressure to a mousetrap until it springs shut. The straw that broken the camel's back.

We will make it less simple by replacing the supposedly hard to find, but definatly hard to choose thet correct value for inductor-with a gyrator circuit which acts as an ideal inductor. Just a couple extra cheap parts and it still works.



First off when looking at schematics to build your very own Chua Circuit you need to ignore 99% of the useless schematics out there. The schematics you'll see are for explaining this circuit, but not building it. Here is an example of the classic circuit...that doesn't tell you what you need to know:


You will see on the left side an "L". That denotes a simple 18mH inductor. These inductors are sort of hard to find. You could try and swap in and out various 18mH inductors with less than 30 ohms resistance and play around with that. They are pricey and might not be exactly the spec your circuit needs to operate. We will replace the "L" with a TL082 op-amp acting as a gyrator inductor simulator. It works like an inductor (in this circuit at least) and operates ideally. Simple! The gyrator is known as "The Fifth Linear Element" and basically couples voltage from one source to the current from a different source...and then does the same with the remaining devices' current and voltage. Once working I plan on replacing the gyrator with an actual inductor, since I just found a pile of different sized ones in a drawer. An actual inductor will add parasitic resistance that will have to be counteracted in the circuit.


You will see on the right side of the circuit "NR". That is Chua's Diode...except that there is no such thing as a Chua Diode. You can't buy one in a store, you have to make it. Luckily we can make our own Chua Diode using a second TL082 op-amp. 

There are versions of this circuit which leave the inductor and replace this Chua diode with a memristor, but it involves more potentiometers (knobs) than this way. You will soon learn of my hatred for wiring pots. Anyway Chua’s diode has nothing in common with  a diode; it has a non-linear voltage-current characteristic that makes the oscillator output “unrepeatable”.

Then we'll add in some resistors, capacitors (use metal film, not carbon, for best results), a couple of knobs (potentiometers), and a DC power supply instead of two 9v batteries oddly wired together in many of the circuit designs.


The only other fancy "thing" I've made has been a scanning tunneling electron microscope. This project is very similar in that it used op-amps and the x, y and z inputs on an old oscilloscope. Because this is low voltage you can use a PC computer-based oscilloscope without blowing stuff up-as long as it can handle 9vDC. However if you use a modern fancy standalone digital oscilloscope the swooshing waves of the the output (a Chaotic Attractor) turns into swarms of ugly dots that are really hard to interpret.


After the annoyance with the schematic above I became annoyed with the build schematics I found for one simple reason: they show 4 triangles that are op-amps. So, I assumed I needed four op-amps, but the TL082 is a double-op-amp: each black box with 8 legs (pins) sticking out actually has two triangles inside of it. Four triangles on the schematic = two TL082 op-amps. Nice.

Also, the schematic didn't label the triangles as being A/B pairs. Which I'm not used to. So, when I scribble out my diagrams I'm labeling them A and B. One A/B triangle pair is a single TL082. This will make total sense once you read the next few lines and check the pinouts.


So, the first thing to get straight is the op-amp circuits. While it might look like we'll be using four TL082 circuits we're really only using two of them!


Here's a simple pinout that is for a different op-amp, but which has the same pinout as a TLN082, but it's drawn better. It's much easier to see how each little TL082 microchip is actually a double op-amp. One amp is "A" triangle and the other is "B" triangle. Look at this and the build schematic will make sense:





You can see that there is an "A" op-amp, and a "B" op-amp.

A = pins 1, 2 and 3.
B = pins 5, 6 and 7.

Pins 48 power the entire TL082 (both A and B together).

Inverting inputs are negative (-) inputs.
Non-inverting inputs are positive (+) inputs.

So, in the schematics for Chua circuits (done without an inductor, using a gyrator instead) you will see four triangles. They represent the A & B portions of only two TL082 op-amp circuits.

You will see two triangles near each other, and two other triangles paired up on the other side of the schematic. Each pair of triangles near each other represents a single TL082!

You must treat each triangle as an A or B regarding pins. Decide which triangle in a pair is the "A triangle" and which is the "B triangle".

Anything that goes to the A triangle will only use pins 1, 2 and 3.
Anything that goes to the B triangle will only use pins 5, 6, and 7.
Pins 4 and 8 get the input from your power supply/batteries. It doesn't really matter which triangle those go to, but for simplicity we'll put the 4/8 power to the "A" triangles.

So, on the left side of the circuit where we are not using an inductor, but building a gyrator instead we have two triangles.



Left Side of Schematic-Gyrator Inductor Simulator


Triangle A is on the right:
Pin 1 = OUT A
Pin 2 = Inverting Input A (negative -)
Pin 3 = Noninverting Input A (positive +)
Pin 4 = Negative Power Supply input
Pin 8 = Positive Power Supply input

Triangle B is on the left:
Pin 7 = OUT B
Pin 6 = Inverting Input B (negative -)
Pin 5 = Noninverting Input B (positive +)

There, now you have all 8 pins on one of the TL082 op-amps wired up!




Right Side of Schematic-Chua Diode


Triangle A is on the right:
Pin 1 = OUT A
Pin 2 = Inverting Input A (negative -)
Pin 3 = Noninverting Input A (positive +)
Pin 4 = Negative Power Supply input
Pin 8 = Positive Power Supply input

Triangle B is on the left:
Pin 7 = OUT B
Pin 6 = Inverting Input B (negative -)
Pin 5 = Noninverting Input B (positive +)

There, now you have all 8 pins on your second TL082 op-amps wired up!

BREADBOARD WIRING

Wire Jumpers:

c18-c24
e18-f19
g19-g25
e21-f21
he21-h24
d23-d29
e29-f29
i26-i32
j28-j29
c25-c31
h32-h39
h42-h49
g48-g49
i48-i54
e49-f49
h52-h56
c48-c52
d49-d53
b51-b55
a55-a56
f56-f57
d3-g3
j50 to right power right outside
left power rail inner to b3
left power rail outer to a54
left power rail outer to a26
j50 to right power rail outer
j10 to right power rail inner
j51 to right power rail inner
left power rail outer to a10
j23 to right power rail inner
left power rail inner to b3
i3 to right power rail outer
left power rail outer to a54
left power rail outer to a26
j50 to right power rail outer
j10 to right power rail inner
j51 to right power rail inner
left power rail outer to a10
j23 to right power rail inner

TL082 Chips
Top of chip (with half circle dimple) pins 1 and 8: e23 and f23
Top of chip (with half circle dimple) pins 1 and 8: e51 and f51

Resistors
220 b10-b13
220 i10-i13
1k b21-b24
2.2k b25-b28
1k h25-h28
100 g26-g29
3.3k i39-i42
22k a48-a51
22k c53-c56
3.3k left power rail inner to a52
3.3k i39-i42
2.2k g50-g53
2.2k g54-g57
220 j53-j56

Capacitors (film metal not ceramic)
10nf j42 to right power rail outer
100nf a21-a25
100nf j26 to right power rail outer

LEDs
left power rail inner to to a13
j13 to right power rail outer

Batteries
9v Battery 1: red positive to c3 / black negative to c10
9v Battery 2: red positive to h10 / black negative to h3

Ground wire for oscilloscope probe ground clips
right power rail outer (last bottom, right hole)

Oscilloscope probe to leg of capacitor sticking out of hole j26
Oscilloscope probe to left of capacitor sticking out of hole j42

Potentiometers/Trim Pots
Pot 1: middle pin b31 / either other pin left power rail innter / 3rd pin unused
Pot 2: middle pin f39 / either other pin f42 / 3rd in unused

The left side of the breadboard usually has positive and negative...but in this circuit both columns are negative.

The right side of the breadboard is positve on inner column, negative on the outer column closest to the edge of the board.

10k linear potentiometers are recommended because they're easier to turn and are more precise. I used 10k trim pots with are less precise and have to be turned with a screwdriver--bad choice!




Connect the two halves of the circuit with some wires, knobs, outputs to oscilloscope or a USB PC computer-based oscilloscope (with a huge resistor on the outputs so you don't fry your computer or digital scope) and you're good to go. I have real oscilloscopes that are analog/tube and can handle high voltage inputs. Your digital and computer PC scopes might blow up if you try and put more than 3v into them. Read your specs. This thing basically has two 9vDC input spots that may total 18vDC if you mess things up.

As always my nemesis is the humble potentiometer (volume knob). On some projects you need to use all 3 pins, but some only 2...and the circuit schematics almost never tell you which. Is it a voltage divider (might be 3 pins) or is it a current adjuster (2 pins?) or is it a volume knob for audio (3 pins?) or a variable resistor (2 pins!)?

************On the most popular "fritzing" diagram for Chua circuits they show 3 wires going to the potentiometers but in the explanation 8 pages later they state that the third wire isn't wired to anything, it's just there to physically keep the pot from moving on the table as you spin the little knob!!!!!!!!!!!!!!!!! I'm so annoyed I spent so much time trying to figure out why/where that third wire was going to!!!! Use only two wires for your Chua circuit pots/knobs: the middle one and one on either side.


I had similar issues with my scanning electron microscope build: five pots labeled V1-V5 for variable resistor, and one of them showing connection to: ground, -negative voltage (which in a DC circuit is the same as the ground) and then the incoming wiper wire from ??? Ugh! Anyway, here we go:



PARTS


100 ohm x1

1k ohm x2

220 ohm x4

2.2k ohm x2

22k ohm x2

3.3k ohm x2

TL082 IC Op Amp Chips x2

LEDs x2

On/Off switch x1 (DPDT double pole/double throw 6 contact)

Potentiometers x2

9vDC power supply or two 9v batteries and wires.

Breadboard (or not).

Analog oscilloscope with two probes (or three if you use the "z" input on the back too). Or coax cables with fittings at one end (probably RG-58 BNC-connector 50ohm) to plug into analog scope inputs, and cut off the other ends to hook to the Chua Circuit. Or you could get some BNC female sockets and put them in your Chua's Circuit...but short lengths of coax wire with BNC connectors are super cheap on Amazon and eBay, so I buy them and cut them in half quite a bit: each coax cable cut in have gives me: two BNC to bare-wire cables. BNC plugs into oscilloscope or function generator or Geiger counter, etc. and the other end I solder to whatever circuit I'm building. Some of them were 75ohm, and some were even old 1970s cable TV wires that weren't marked. Whatever. 

Bits of wire, wire strippers, solder and iron if you're going to not use breadboard.

Two 1M resistors only if hooking up to digital oscilloscope or computer. Old analog oscilloscope don’t need them.

Just hook old analog oscilloscope probes to Capacitor 1 and Capacitor 2 (the two near each other) and then ground the probe ground clips to -9vDC (black) on the side rail of the breadboard.


This will be my first ever breadboard project, so I’ll be following Valentin Siderskiy’s instructions pretty much step-by step, but adding my own clarifying notes. Such as: you can leave a wire off of each potentiometer, they only need two in this circuit! Or the ever popular "I think LEDs are polarized so you have to stick them in the right way or they won't light up."



Also, you could easily (I think) leave off: 

On/off switch; 
Two LEDs; 
Resistors for the LEDs; 
Two more resistors that just smooth down the 5k pots to 2.5k--but then you'd need to probably buy actual 2.5k pots. Dumbing down 5k or 10k pots to only 2.5k makes it easier to make slight adjustments to the circuit while turning the knobs. 


Since this is my first breadboard I'm going to leave all that stuff in--when I point-to-point wire it up I'll be able to actually tell how to leave them off without breaking connections. I still think in "point-to-point" and not breadboard or circuit board layouts.

Running the circuit
I used a couple different oscilloscopes. One had 3 inputs: channel a and b (verticals) and a horizontal channel. I just used a and b and set the dial for A vs B to plot the voltages against eachother to get the single scroll chaotic attractor. This gave the same results as my older oscilloscope with a single vertical and single horizontal input (x vs y).

The slightest turn of the potentiometers resulted in HUGE changes to the image on the oscilloscope. This is called bifurcation. 

One of my potentiometers measured only 1.3k instead of 10k when tested on a multimeter: so I replaced it and immediately got better results. I'll probably invest in two full sized pots with convenient knobs to twist.

I had two old mismatched batteries, I'll add new ones.

When I unhook the oscillscope ground clips from the ground wire the whole circuit becomes very sensitive to hand movements. 
Bifurcation was observed: tiny, smooth changes to a paremeter (knob twist) results in huge changes to the output (dot turned into a chaotic attractor). Hysterisis (like my previous post about neon lamp bulbs) was observed: the spot where the chaotic attractor turns on is different from where it turns off--plus there's two knobs that influence eachother. 

Unplugging the inside leg of the 10nf capacitor gave an extremely small, single trace of the famous double scroll attractor. It was very low resolution: it looked like a number "8" written in Old English font! 

Here are some attractors that resulted when I changed one, then both of the pots from 10k to 5k:





Here are some sweet toroidal Class 1 Eigenvalue = 10 (sort of) attractors.







Here are some results after putting in two 5k pots, then replacing one of the batteries with a 9vDC power supply...but varying the DC voltages from around 1.3vDC to 10vDC:






Here is the shape you see right before the classic double scroll: I was playing with the voltage (I replaced one of the 9v batteries with a DC bench power supply and going from 1.3vDC to 10vDC. One of the IC chips was getting pretty warm though):


It's a homoclinic bifurcation, the periodic orbit grew units it collided with the saddle point.







Multiscroll attractor:









You can see how this double-double scroll attractor developed from multiple loops:


The Logusz Attractor (double-double or chaotic quad-attractor as I'm thinking of naming it)...although it's actually pretty close to what others have found as a projection of the Vc2 / IL plane or the Vc / IL1 plane. The literature on this and others:

Anshan, H. [1988] "A Study of the Chaotic Phenomena in Chua's Circuit," Proceedings of 1988 IEEE International Symposium on Circuits and Systems (Cat. No.88CH2458-8). IEEE. vol.1, pp.273-276.

Bartissol, P., Chua, L.O. [1988] "The Double Hook (Nonlinear Chaotic Circuits)," IEEE Transactions on Circuits & Systems, vol.35, no.12, pp.1512-1522.



Anshan in particular backs up what I discovered myself: op-amp voltage adjustments can lead to lots of new patterns and attractors. Of course he found this out in the 1980s--and I'm just playing around in my basement as something to do besides mow my lawn...it's nice to see my "weird" non-perfect, non-double scroll attractors have actual mathematical explanations in eigenvalues (weird math) but also voltages.














Great sources of information that I ripped off:


Professor Leon Chua, the inventor of this chaotic circuit.

"Jim" who made http://www.chaotic-circuits.com/

Valentin Siderskiy, Vikram Kapila and Aatif Mohammed of http://www.chuacircuits.com and published papers and a great Instructable post. Check out "Chua's Circuit for experimenters using readily available parts from a hobby electronics store".

"Chua’s Circuit for High School Students" by Gandhi, Gauruv., Muthuswamy, Bharathwaj2 and Roska, Tamas.

This list of awesomeness; hover your mouse over the titles and you can click and be rewarded with actual PDFs of the articles (and not just crummy citations): http://people.eecs.berkeley.edu/~chua/circuitrefs.html