# Bookmarks – “Imaginary Numbers Are Real” by Welch Labs

Imaginary Numbers Are Real” by Welch Labs

Imaginary numbers are not some wild invention, they are the deep and natural result of extending our number system. Imaginary numbers are all about the discovery of numbers existing not in one dimension along the number line, but in full two dimensional space. Accepting this not only gives us more rich and complete mathematics, but also unlocks a ridiculous amount of very real, very tangible problems in science and engineering.

Part 1: Introduction
Part 2: A Little History
Part 3: Cardan’s Problem
Part 4: Bombelli’s Solution
Part 5: Numbers are Two Dimensional
Part 6: The Complex Plane
Part 7: Complex Multiplication
Part 8: Math Wizardry
Part 9: Closure
Part 10: Complex Functions
Part 11: Wandering in Four Dimensions
Part 12: Riemann’s Solution
Part 13: Riemann Surfaces

# The Wireless Protocol of a Sports Wrist Watch (Part 3)

– Computer, scan all the wireless codes!
– Scanning…, scanning complete.

– Computer, read the scanning summary.
– Tested: 8192 codes. Decoded as valid: 213 codes. Decoded range: from 30 to 239.

– Computer, why are there more valid codes than the range allows?
– There are 3 duplicated codes.

– Computer, list duplicates.
– Listing…

```Wireless code:        Should display:     Displays as:
======================================================
1111000000101100110   28                  92
1111000100101100110   92                  92
1111000000101101010   29                  93
1111000100101101010   93                  93
1111000000101111100   31                  95
1111000100101111100   95                  95
```

Well, it was not exactly like that, but I love the idea: Let a machine do the work for you.

OK, but how it actually was?

From where we left last time, we already had a computer controlled radio Tx. To test all the possible 8192 codes, we can write a script to Tx all the codes one by one, while looking at the number displayed on the wrist watch.

For a solid radio connection, it would be nice to send first a known working code and confirm the displayed number is as expected, then send a known invalid code and confirm the display shows invalid.

Then, send the code we want to test and read the display.

Now, save the results. Job done.

For a computer, the most difficult part is to read the display of the wrist watch, so a compromise was made: No optical recognition of the displayed number, recognize just if the heart symbol is blinking on the display.

If blinking, then we have a valid code, so take a snapshot from the WebCam and save it on the disk. We will look later at all the taken pictures. If not blinking, then the code is invalid, go to the next one.

Data flow setup:

Python script that parses all the 8192 codes ->
Wrist watch displayed number ->
WebCam streaming the wrist watch display ->
OpenCV video stream preprocessing/filtering ->

Snapshot save and text logging of the results.

Hardware setup:

OpenCV and computer vision:

Never did this before, so I went head first. After watching a few OpenCV YouTube tutorials from the sentdex channel – thank you sentdex – it was the time to write some OpenCV based code:

https://github.com/RoGeorge/OpenCV_Controlled_TX_Emulator

```# Usage:
#   - plug the USB camera and the Arduino UNO programmed with 'Crivit_ChestBelt_TX_Emulator.ino'
#   - set the 'COM_PORT' number taken by the Arduino UNO
#   - if it's missing, create folder 'captures' near 'OpenCV_Controlled_TX_Emulator.py'
#   - 3 windows will open, 1'st is a color live image, 2'nd a black and white, 3'rd with your selection
#   - put the Crivit HRM wrist-watch in front of the USB camera and set it to HRM monitor mode
#   - in the first 2 windows, adjust the sliders for the camera sensitivity and the black and white threshold
#   - in the 2'nd window, select (by mouse dragging) a blinking area from the blinking heart displayed by the watch
#   - tip: a single point selection (a click instead of a drag) works very good
#   - the selected area will be seen live in the 3'rd window
#   - all the bitstreams written in 'captures/input_bitstreams.txt' will be sent one by one to the radio Tx
#   - the script will look in the 3'rd window if the heart symbol displayed by the wrist-watch is blinking
#   - if blinking, a jpg snapshot will be saved in 'captures'
#   - results will be displayed on the command line, then added to the log file 'captures/working_bitstreams.csv'
#   - NOTE: Do not close the live windows. To exit teh script, press the 'ESC' key.
# Installation:
#   pip install numpy
#   pip install pyserial
#
# to install OpenCV (32-bit) download and unpack, then go to folder
#   'opencv\build\python\2.7\x86\'
#   and copy the file 'cv2.pyd' into folder 'C:\Python27\Lib\site-packages'
#
# To check the OpenCV installation, open Python and type
#   >>> import cv2
#   >>> print cv2.__version__
#   3.2.0
#
```

This is a print screen taken while adjusting the light and the B&W filter threshold:

After a few days of automated testing, puzzling results:

The encoding scheme has a limited display range, between 30 and 239, and 3 duplicated codes.

An example for a duplicated code snapshot:

I don’t know if this is a bug or a feature, and I must admit that I don’t understand how this encoding scheme was designed, but so far it was a lot of fun looking into it.

:o)

# The Wireless Protocol of a Sports Wrist Watch (Part 2)

This post is a continuation of the The Wireless Protocol of a Sports Wrist Watch, and it is all about testing the hypothesis made so far.

axodus, K.C. Lee, killy.mxi (AKA Killy) and Asterek have all contributed to reverse engineer the radio protocol, and Killy came up with the following algorithm:

Encoded sequence has variable lenght. There are some stuffed bits for better signal recovery.

Output sequence:
* in1
* in2
* (in1 nor in2) stuffed if (in1 nand in2)
* in3
* in4
* (in3 nor in4) stuffed if (in3 nand in4)
* in5
* in6
* (in5 nor in6) stuffed if (in5 nand in6)
* in7
* in8
* (in7 xnor in8)
* (in7 nand in8)

Speaking simple, stuffing rule works like this:
* if pair of bits is 00, stuff 1;
* if 01 or 10, then stuff 0;
* if 11, don’t stuff anything here.

More details can be found in the Discussions section of https://hackaday.io/project/13142-sniff-the-wireless-data-of-a-sports-wrist-watch

I want to thank you all for reverse engineering the encoding scheme, great job!

Now, it’s time to test the hypothesis.

To do this, it would be helpful to be able to transmit any code, valid or invalid, and see how the receiver will react. The Crivit chest belt can’t do that, so we need to build our own radio transmitter. With a carrier frequency of only 110 KHz, it should be easy to digitally synthesize the entire modulated carrier.

A few lines of code later, it proves out that a simple wire connected to a digital output is good enough as a Tx antenna, and an Arduino UNO is fast enough to generate the carrier, modulate it, and in the same time talk to a computer over the serial port:

This will allow us to put on air any combination of 0’s and 1’s that we might want to test.

New findings

• for an invalid code, the wristwatch will keep displaying the last valid number received, but the heart symbol will stop blinking, just like in the case of no signal
• there is no handshake protocol, so the watch will display any valid code received, even if the chest belt ID is changed. All the following codes were displayed as one hundred:
```S 111100 0101000100011
S 111010 0101000100011
S 111001 0101000100011
S 110011 0101000100011
```
• the total number of bits can vary, i.e. the following codes are both displayed as a valid one hundred:
``` S 110011 0101000100011
S 1100100 0101000100011
```
• so far, the encoding scheme found by @killy.mxi can predict valid codes even for numbers that were out of reach for the original chest belt transmitter. The following codes predicted for numbers between 234..239 were displayed as valid:
```1110010010010
1110010011100
1110011001100
1110011010100
1110011100100
1110011111000
```

Still, for predicted codes corresponding to numbers greater than 239, the blinking heart stops. This might be because the receiver was designed to act like that, but this it’s not yet for sure.

Manually typing each code to be tested proves to be useful, but also very time consuming and prone to errors. Since our radio Tx is now able to transmit any codes coming from the serial port, it will allow us to do automated testing. This will be the next step.

# DS1054Z tricks, less known or undocumented (Part 2)

DS1054Z is LXI compliant. What I like the most at any LXI ready instrument is that it can be operated over LAN without installing any drivers, and without any dedicated software.

Want to save a screenshot from your oscilloscope? You don’t need to install anything. No VISA, no IVI, no Rigol drivers, no UltraScope or any other application, nothing. Just plug the LAN cable, open a Terminal and type:
``` # save a screenshot from the oscilloscope's display to the file 'image.png' echo ":DISPLAY:DATA? ON,OFF,PNG" | nc -w1 192.168.32.208 5555 | dd bs=1 skip=11 of=image.png ```
Now, this is beautiful, isn’t it? All the credit for the above command goes to S Clark, thank you!

Of course, you need to replace “192.168.32.208” with your oscilloscope’s IP address, and it should work with any Rigol oscilloscope model from the series DS1000Z, DS2000, DS4000 and DS6000, not only the DS1054Z. It should also work under Windows using Cygwin, but I didn’t test it.

You can always use Telnet or Netcat (AKA ‘nc’) to send SCPI commands to any Rigol oscilloscope using the oscilloscope’s IP address and port 5555. Telnet is not recommended when binary data is expected because Telnet might mangle some characters (see RFC854 page 10). For text only it’s OK.

Netcat is safe for both text or binary data, and there is a free standalone Netcat for Windows that does not require any Cygwin installation. Please be advised that Windows might consider ‘nc’ as a potential threat and block it, so you need to add ‘nc.exe’ to the safe programs list in order to run it under Windows.

# DS1054Z tricks, less known or undocumented (Part 1)

## Description

DS1054Z is a digital oscilloscope made by Rigol. This particular model is very popular now. It is so popular because it has tons of features and it is

• hackable:
This model was designed to be upgradable by buying unlocking codes from Rigol, without adding or modifying the oscilloscope’s hardware. Bandwidth upgrade from 50MHz to 100MHz, advanced triggers, memory depth, serial decoding protocols and so on, are all possible by simply typing a code on the oscilloscope’s screen. There is a free tool that can generate the upgrading codes: it’s called riglol.
• built very well:
Rigol used to be a manufacturer for Agilent. Agilent was just re-branding the Rigol oscilloscopes and sell them as Agilent oscilloscopes.
• cheap:
Only USD \$400 for a 4 channels oscilloscope is affordable even for hobbyists and makers.

I am not affiliated or payed by Rigol in any way, just a happy DS1054Z owner.

## Here is some less known info about DS1054Z

1. Any DS1054Z can be turned into the highest model of the DS1000Z family, the DS1104Z. All you need to do is to simply type a code on the oscilloscope’s screen. The hardware for the DS1054Z, DS1074Z and DS1104Z is the same. DS1054Z is just a software limited version of a DS1104Z. DS1104Z is the top of the DS1000Z series, and is 2-5 times more expensive than a DS1054Z.
2. Being LXI ready, the scope can be controlled by SCPI commands sent over LAN without installing any drivers on the PC side. No NI VISA, no IVI drivers and no Rigol drivers are required when controlling the oscilloscope over LAN.
3. All you need when controlling the scope over LAN is simply a TCP socket using port 5555. You can even send SCPI commands manually, by using Telnet or NetCat. NetCat (AKA ‘nc’) is recommended, since Telnet protocol might filter out some characters, like i.e. chr(0). There is a NetCat version for Windows too.
4. The SCPI programming manual for DS1000Z series scopes is incomplete. If you feel like some SCPI commands are missing, like e.g. MASK:DATA?, then check the programming manuals from the higher models (like DS2000 or even DS4000) in order to find out the correct syntax. Most of them will also work for DS1000Z series too.
5. To check the firmware version normally, press UTILITY -> SYSTEM -> SYSTEM INFO in the “MENU” buttons group, but to check for more software details (undocumented):
Quickly press buttons MENU -> MENU -> FORCE -> MENU on “TRIGGER” buttons group, then go to info panel by pressing buttons UTILITY -> SYSTEM -> SYSTEM INFO in the “MENU” buttons group.
6. To find out the manufacturing date by serial number:
DS1ZA yy ww xxxxx
yy: 15=2013, 16=2014, 17=2015, 18=2016
ww: week number in indicated year
http://beyondmeasure.rigoltech.com/acton/fs/blocks/showLandingPage/a/1579/p/p-0019/t/page/fm/0

## Acronyms

MHz – Megahertz
PC – Personal Computer
LXI – LAN Extensions for Instrumentation
SCPI – Standard Commands for Programmable Instruments
LAN – Local Area Network

NI – National Instruments, http://www.ni.com
VISA – Virtual Instrument Software Architecture
IVI – Interchangeable Virtual Instrument
TCP – Transmission Control Protocol
AKA – Also Known As

Type ‘Chewbacca’.
Select ‘Chewbacca’.
Press ‘F1’.

:o)

```const int nbQuote = 205;
Quote quotes[nbQuote] =
{
{"Notepad++", "I hate reading other people's code.\nSo I wrote mine, made it as open source project, and see others suffer."},
{"Notepad++ #2", "Good programmers use Notepad++ to code.\nExtreme programmers use MS Word to code, in Comic Sans, center aligned."},
{"Richard Stallman?", "If I'm the Father of Open Source, it was conceived through artificial insemination using stolen sperm without my knowledge or consent."},
{"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."},
{"L. Peter Deutsch", "To iterate is human, to recurse divine."},
{"Seymour Cray", "The trouble with programmers is that you can never tell what a programmer is doing until it's too late."},
{"Brian Kernighan", "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."},
{"Alan Kay", "Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves."},
{"Bill Gates", "Measuring programming progress by lines of code is like measuring aircraft building progress by weight."},
{"Christopher Thompson", "Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Monday's code."},
{"Vidiu Platon", "I don't care if it works on your machine! We are not shipping your machine!"},
{"Edward V Berard", "Walking on water and developing software from a specification are easy if both are frozen."},
{"pixadel", "Fine, Java MIGHT be a good example of what a programming language should be like. But Java applications are good examples of what applications SHOULDN'T be like."},
{"Oktal", "I think Microsoft named .Net so it wouldn't show up in a Unix directory listing."},
{"Bjarne Stroustrup", "In C++ it's harder to shoot yourself in the foot, but when you do, you blow off your whole leg."},
{"Mosher's Law of Software Engineering", "Don't worry if it doesn't work right. If everything did, you'd be out of a job."},
{"Bob Gray", "Writing in C or C++ is like running a chain saw with all the safety guards removed."},
{"Roberto Waltman", "In the one and only true way. The object-oriented version of \"Spaghetti code\" is, of course, \"Lasagna code\". (Too many layers)"},
{"Linus Torvalds", "Software is like sex: It's better when it's free."},
{"Cult of vi", "Emacs is a great operating system, lacking only a decent editor."},
{"Church of Emacs", "vi has two modes - \"beep repeatedly\" and \"break everything\"."},
{"Steve Jobs", "Picasso had a saying: \"Good artists copy, great artists steal.\".\nWe have always been shameless about stealing great ideas."},
{"brotips #1001", "Do everything for greatness, not money. Money follows greatness."},
{"Robin Williams", "God gave men both a penis and a brain, but unfortunately not enough blood supply to run both at the same time."},
{"Darth Vader", "You don't get to 500 million star systems without making a few enemies."},
{"Doug Linder", "A good programmer is someone who always looks both ways before crossing a one-way street."},
{"Jean-Claude van Damme", "A cookie has no soul, it's just a cookie. But before it was milk and eggs.\nAnd in eggs there's the potential for life."},
{"Michael Feldman", "Java is, in many ways, C++--."},
{"Don Ho", "Je mange donc je chie."},
{"Don Ho #2", "RTFM is the true path of every developer.\nBut it would happen only if there's no way out."},
{"Don Ho #3", "Smartphone is the best invention of 21st century for avoiding the eyes contact while crossing people you know on the street."},
{"Anonymous #1", "An opinion without 3.14 is just an onion."},
{"Anonymous #2", "Before sex, you help each other get naked, after sex you only dress yourself.\nMoral of the story: in life no one helps you once you're fucked."},
{"Anonymous #3", "I'm not totally useless. I can be used as a bad example."},
{"Anonymous #4", "Life is too short to remove USB safely."},
{"Anonymous #5", "\"SEX\" is not the answer.\nSex is the question, \"YES\" is the answer."},
{"Anonymous #6", "Going to Mc Donald's for a salad is like going to a whore for a hug."},
{"Anonymous #7", "I need a six month holiday, TWICE A YEAR!"},
{"Anonymous #8", "Everything is a knife if you're strong enough."},
{"Anonymous #9", "I just read a list of \"the 100 things to do before you die\". I'm pretty surprised \"yell for help\" wasn't one of them..."},
{"Anonymous #10", "Roses are red,\nViolets are red,\nTulips are red,\nBushes are red,\nTrees are red,\nHOLY SHIT MY\nGARDEN'S ON FIRE!!"},
{"Anonymous #11", "We stopped checking for monsters under our bed, when we realized they were inside us."},
{"Anonymous #12", "I would rather check my facebook than face my checkbook."},
{"Anonymous #13", "Whoever says Paper beats Rock is an idiot. Next time I see someone say that I will throw a rock at them while they hold up a sheet of paper."},
{"Anonymous #14", "A better world is where chickens can cross the road without having their motives questioned."},
{"Anonymous #15", "If I didn't drink, how would my friends know I love them at 2 AM?"},
{"Anonymous #16", "Q: How do you generate a random string?\nA: Put a Windows user in front of vi, and tell him to exit."},
{"Anonymous #17", "All you need is love,\nall you want is sex,\nall you have is porn.\n"},
{"Anonymous #18", "Never get into fights with ugly people, they have nothing to lose."},
{"Anonymous #19", "F_CK: All I need is U."},
{"Anonymous #20", "Never make eye contact while eating a banana."},
{"Anonymous #21", "I love my sixpack so much, I protect it with a layer of fat."},
{"Anonymous #22", "\"It's impossible.\" said pride.\n\"It's risky.\" said experience.\n\"It's pointless.\" said reason.\n\"Give it a try.\" whispered the heart.\n...\n\"What the hell was that?!?!?!?!?!\" shouted the anus two minutes later."},
{"Anonymous #23", "Everybody talks about leaving a better planet for the children.\nWhy nobody tries to leave better children to the planet?"},
{"Anonymous #24", "An Architect's dream is an Engineer's nightmare."},
{"Anonymous #25", "In a way, I feel sorry for the kids of this generation.\nThey'll have parents who know how to check browser history."},
{"Anonymous #26", "I would never bungee jump.\nI came into this world because of a broken rubber, and I'm not going out cause of one."},
{"Anonymous #27", "I don't have a problem with caffeine.\nI have a problem without caffeine."},
{"Anonymous #28", "Why 6 afraid of 7?\nBecause 7 8 9 (seven ate nine) while 6 and 9 were flirting."},
{"Anonymous #30", "Why do Java developers wear glasses?\nBecause they don't C#."},
{"Anonymous #31", "A baby's laughter is one of the most beautiful sounds you will ever hear. Unless it's 3 AM. And you're home alone. And you don't have a baby."},
{"Anonymous #32", "Two bytes meet. The first byte asks, \"You look terrible. Are you OK?\"\nThe second byte replies, \"No, just feeling a bit off.\""},
{"Anonymous #33", "Programmer - an organism that turns coffee into software."},
{"Anonymous #34", "It's not a bug - it's an undocumented feature."},
{"Anonymous #35", "Should array index start at 0 or 1?\nMy compromised solution is 0.5"},
{"Anonymous #36", "Every single time when I'm about to hug someone extremely sexy, I hit the mirror."},
{"Anonymous #37", "My software never has bugs. It just develops random features."},
{"Anonymous #38", "LISP = Lots of Irritating Silly Parentheses."},
{"Anonymous #39", "Perl, the only language that looks the same before and after RSA encryption."},
{"Anonymous #40", "People ask me why, as an atheist, I still say: OH MY GOD.\nIt makes perfect sense: We say \"Oh my God\" when something is UNBELIEVABLE."},
{"Anonymous #41", "1. Dig a hole.\n2. Name it love.\n3. Watch people falling in love.\n"},
{"Anonymous #42", "Don't think of yourself as an ugly person.\nThink of yourself as a beautiful monkey."},
{"Anonymous #43", "Afraid to die alone?\nBecome a bus driver."},
{"Anonymous #44", "The first 5 days after the weekend are always the hardest."},
{"Anonymous #45", "Rhinos are just fat unicorns."},
{"Anonymous #46", "Sometimes when I'm writing Javascript I want to throw up my hands and say \"this is bullshit!\"\nbut I can never remember what \"this\" refers to."},
{"Anonymous #47", "Kids are like farts.\nYou can only stand yours."},
{"Anonymous #48", "If you were born in Israel, you'd probably be Jewish.\nIf you were born in Saudi Arabia, you'd probably be Muslim.\nIf you were born in India, you'd probably be Hindu.\nBut because you were born in North America, you're Christian.\nYour faith is not inspired by some divine, constant truth.\nIt's simply geography."},
{"Anonymous #49", "There are 2 types of people in this world:\nPeople who say they pee in the shower, and the dirty fucking liars."},
{"Anonymous #50", "London 2012 Olympic Games - A bunch of countries coming across the ocean to put their flags in britain and try to get a bunch of gold... it's like history but opposite."},
{"Anonymous #51", "I don't need a stable relationship,\nI just need a stable Internet connection."},
{"Anonymous #52", "What's the difference between religion and bullshit?\nThe bull."},
{"Anonymous #53", "Today, as I was waiting for my girlfriend in the street, I saw a woman who looked a lot like her. I ran towards her, my arms in the air ready to give her a hug, only to realise it wasn't her. I then had to pass the woman, my arms in the air, still running. FML"},
{"Anonymous #54", "Today, I finally got my hands on the new iPhone 5, after I pulled it out of a patient's rectum. FML"},
{"Anonymous #55", "Violent video games won't change our behaviour.\nIf people were influenced by video games, then the majority of Facebook users would be farmers right now."},
{"Anonymous #56", "Religion is like circumcision.\nIf you wait until someone is 21 to tell them about it they probably won't be interested."},
{"Anonymous #57", "No, no, no, I'm not insulting you.\nI'm describing you."},
{"Anonymous #58", "I bought a dog once. Named him \"Stay\".\n\"Come here, Stay.\"\nHe's insane now."},
{"Anonymous #60", "Yesterday I named my Wifi network \"hack me if you can\"\nToday when I woke up it was changed to \"challenge accepted\"."},
{"Anonymous #61", "Your mother is so fat,\nthe recursive function computing her mass causes a stack overflow."},
{"Anonymous #62", "Oral sex makes my day, but anal sex makes my hole weak."},
{"Anonymous #63", "I'm not saying I am Batman, I am just saying no one has ever seen me and Batman in the same room together."},
{"Anonymous #64", "I took a taxi today.\nThe driver told me \"I love my job, I own this car, I've got my own business, I'm my own boss, NO ONE tells me what to do!\"\nI said \"TURN LEFT HERE\".\n"},
{"Anonymous #65", "A man without God is like a fish without a bicycle."},
{"Anonymous #66", "I hate how spiders just sit there on the walls and act like they pay rent!"},
{"Anonymous #67", "Whenever someone starts a sentence by saying \"I'm not racist...\",they are about to say something super racist."},
{"Anonymous #68", "I'm not laughing at you, I'm laughing with you, you're just not laughing."},
{"Anonymous #69", "Women need a reason to have sex. Men just need a place."},
{"Anonymous #70", "If abortion is murder then are condoms kidnapping?"},
{"Anonymous #71", "Men also have feelings.\nFor example, they can feel hungry."},
{"Anonymous #72", "Project Manager:\nA person who thinks 9 women can deliver a baby in 1 month."},
{"Anonymous #73", "If you try and don't succeed, cheat. Repeat until caught. Then lie."},
{"Anonymous #74", "Olympics is the stupidest thing.\nPeople are so proud to be competing for their country.\nThey play their stupid song and raise some dumb flags.\nI'd love to see no flags raised, no song, no mention of country.\nOnly people."},
{"Anonymous #75", "I think therefore I am\nnot religious."},
{"Anonymous #76", "Even if being gay were a choice, so what?\nPeople choose to be assholes and they can get married."},
{"Anonymous #77", "Governments are like diapers.\nThey should be changed often, and for the same reason."},
{"Anonymous #78", "If you expect the world to be fair with you because you are fair, you're fooling yourself.\nThat's like expecting the lion not to eat you because you didn't eat him."},
{"Anonymous #79", "I'm a creationist.\nI believe man create God."},
{"Anonymous #80", "Let's eat kids.\nLet's eat, kids.\n\nUse a comma.\nSave lives."},
{"Anonymous #81", "A male engineering student was crossing a road one day when a frog called out to him and said, \"If you kiss me, I'll turn into a beautiful princess.\" He bent over, picked up the frog, and put it in his pocket.\n\nThe frog spoke up again and said, \"If you kiss me and turn me back into a beautiful princess, I will stay with you for one week.\" The engineering student took the frog out of his pocket, smiled at it; and returned it to his pocket.\n\nThe frog then cried out, \"If you kiss me and turn me back into a princess, I'll stay with you and do ANYTHING you want.\" Again the boy took the frog out, smiled at it, and put it back into his pocket.\n\nFinally, the frog asked, \"What is the matter? I've told you I'm a beautiful princess, that I'll stay with you for a week and do anything you want. Why won't you kiss me?\" The boy said, \"Look I'm an engineer. I don't have time for a girlfriend, but a talking frog is cool.\"\n"},
{"Anonymous #82", "Programmers never die.\nThey just go offline."},
{"Anonymous #83", "Copy from one, it's plagiarism.\nCopy from two, it's research."},
{"Anonymous #84", "Saying that Java is nice because it works on all OSes is like saying that anal sex is nice because it works on all genders."},
{"Anonymous #85", "Race, religion, ethnic pride and nationalism etc... does nothing but teach you how to hate people that you've never met."},
{"Anonymous #86", "Farts are just the ghosts of the things we eat."},
{"Anonymous #87", "I promised I would never kill someone who had my blood.\nBut that mosquito made me break my word."},
//{"Anonymous #88", ""},
{"Anonymous #89", "I'm drunk and you're still ugly."},
{"Anonymous #90", "Clapping:\n(verb)\nRepeatedly high-fiving yourself for someone else's accomplishments."},
{"Anonymous #91", "CV: ctrl-C, ctrl-V"},
{"Anonymous #93", "[In a job interview]\nInterviewer: What's your greatest weakness?\nCandidate: Honesty.\nInterviewer: I don't think honesty is a weakness.\nCandidate: I don't give a fuck what you think."},
{"Anonymous #94", "Hey, I just met you\nAnd this is crazy\nHere's my number 127.0.0.1\nPing me maybe?"},
{"Anonymous #95", "YES!\nI'm a programmer, and\nNO!\nIt doesn't mean that I have to fix your PC!"},
{"Anonymous #96", "Code for 6 minutes, debug for 6 hours."},
{"Anonymous #97", "Real Programmers don't comment their code.\nIf it was hard to write, it should be hard to read."},
{"Anonymous #98", "My neighbours listen to good music.\nWhether they like it or not."},
{"Anonymous #99", "I've been using Vim for about 2 years now,\nmostly because I can't figure out how to exit it."},
{"Anonymous #100", "Dear YouTube,\nI can deal with Ads.\nI can deal with Buffer.\nBut when Ads buffer, I suffer."},
{"Anonymous #101", "It's always sad when a man and his dick share only one brain...\nand it turns out to be the dick's."},
{"Anonymous #102", "If IE is brave enough to ask you to set it as your default browser,\ndon't tell me you dare not ask a girl out."},
{"Anonymous #103", "Turn on your brain, turn off TV."},
{"Anonymous #104", "The main idea of \"Inception\":\nif you run a VM inside a VM inside a VM inside a VM inside a VM,\neverything will be very slow."},
//{"Anonymous #105", ""},
{"Anonymous #106", "When I die, I want to go peacefully like my grandfather did, in his sleep\n- not screaming, like the passengers in his car."},
{"Anonymous #107", "Remember, YOUR God is real.\nAll those other Gods are ridiculous, made-up nonsense.\nBut not yours.\nYour God is real. Whichever one that is."},
{"Anonymous #108", "I hope Bruce Willis dies of a Viagra overdose,\nThe way you can see the headline:\nBruce Willis, Died Hard"},
//{"Anonymous #109", ""},
{"Anonymous #110", "A programmer had a problem, so he decided to use threads.\nNow 2 has. He problems."},
{"Anonymous #111", "I love how the internet has improved people's grammar far more than any English teacher has.\nIf you write \"your\" instead of \"you're\" in English class, all you get is a red mark.\nMess up on the internet, and may God have mercy on your soul."},
{"Anonymous #112", "#hulk {\n height: 200%;\n width: 200%;\n color: green;\n}"},
{"Anonymous #113", "Open source is communism.\nAt least it is what communism was meant to be."},
{"Anonymous #115", "YOLOLO:\nYou Only LOL Once."},
{"Anonymous #116", "Every exit is an entrance to new experiences."},
{"Anonymous #117", "A Native American was asked:\n\"Do you celebrate Columbus day?\"\nHe replied:\n\"I don't know, do Jews celebrate Hitler's birthday?\""},
{"Anonymous #118", "I love necrophilia, but i can't stand the awkward silences."},
{"Anonymous #119", "\"I'm gonna Google that. BING that, Bing that, sorry.\"\n- The CEO of Bing (many times per day still)"},
{"Anonymous #120", "Life is what happens to you while you're looking at your smartphone."},
{"Anonymous #121", "Thing to do today:\n1. Get up\n2. Go back to bed"},
{"Anonymous #122", "Nerd?\nI prefer the term \"Intellectual badass\"."},
{"Anonymous #124", "You don't need religion to have morals.\nIf you can't determine right from wrong then you lack empathy, not religion."},
{"Anonymous #125", "Pooping with the door opened is the meaning of true freedom."},
{"Anonymous #126", "Social media does not make people stupid.\nIt just makes stupid people more visible."},
{"Anonymous #127", "Don't give up your dreams.\nKeep sleeping."},
{"Anonymous #128", "I love sleep.\nNot because I'm lazy.\nBut because my dreams are better than my real life."},
//{"Anonymous #129", ""},
{"Anonymous #130", "Common sense is so rare, it's kinda like a superpower..."},
{"Anonymous #131", "The best thing about a boolean is even if you are wrong, you are only off by a bit."},
{"Anonymous #132", "Benchmarks don't lie, but liars do benchmarks."},
{"Anonymous #133", "Multitasking: Screwing up several things at once."},
{"Anonymous #134", "Linux is user friendly.\nIt's just picky about its friends."},
{"Anonymous #135", "Theory is when you know something, but it doesn't work.\nPractice is when something works, but you don't know why.\nProgrammers combine theory and practice: nothing works and they don't know why."},
{"Anonymous #136", "Documentation is like sex:\nwhen it's good, it's very, very good;\nwhen it's bad, it's better than nothing."},
{"Anonymous #137", "Home is where you poop most comfortably."},
{"Anonymous #138", "Laptop Speakers problem: too quiet for music, too loud for porn."},
{"Anonymous #139", "Chinese food to go: \$16\nGas to go get the food: \$2\nDrove home just to realize they forgot one of your containers: RICELESS"},
{"Anonymous #140", "MS Windows is like religion to most people: they are born into it, accept it as default, never consider switching to another."},
{"Anonymous #141", "To most religious people, the holy books are like a software license (EULA).\nNobody actually reads it. They just scroll to the bottom and click \"I agree\"."},
{"Anonymous #142", "You are nothing but a number of days,\nwhenever each day passes then part of you has gone."},
{"Anonymous #143", "If 666 is evil, does that make 25.8069758011 the root of all evil?"},
{"Anonymous #144", "I don't want to sound like a badass but...\nI eject my USB drive without removing it safely."},
{"Anonymous #145", "feet (noun)\na device used for finding legos in the dark"},
{"Anonymous #146", "Buy a sheep\nName it \"Relation\"\nNow you have a Relationsheep\n"},
{"Anonymous #147", "I dig, you dig, we dig,\nhe dig, she dig, they dig...\n\nIt's not a beautiful poem,\nbut it's very deep."},
{"Anonymous #148", "UNIX command line Russian roulette:\n[ \$[ \$RANDOM % 6 ] == 0 ] && rm -rf /* || echo *Click*"},
{"Anonymous #149", "unzip, strip, top, less, touch, finger, grep, mount, fsck, more, yes, fsck, fsck, fsck, umount, sleep.\n\nNo, it's not porn. It's Unix."},
{"Anonymous #150", "To understand what recursion is, you must first understand recursion."},
{"Anonymous #151", "Q: What's the object-oriented way to become wealthy?\nA: Inheritance."},
{"Anonymous #152", "A SQL query goes into a bar, walks up to two tables and asks, \"Can I join you?\""},
{"Anonymous #153", "You are not fat, you are just more visible."},
{"Anonymous #154", "Minimalist\n (. .)\n ) (\n ( Y )\nASCII Art"},
{"Internet #1", "If you spell \"Nothing\" backwards, it becomes \"Gnihton\" which also means nothing." },
{"Louis C.K.", "I'm a good citizen. I'm a good father. I recycle and I masturbate."},
{"Mary Oliver", "Someone I loved once gave me a box full of darkness.\nIt took me years to understand that this, too, was a gift."},
{"Floor", "If you fall, I will be there."},
{"Simon Amstell", "If you have some problem in your life and need to deal with it, then use religion, that's fine.\nI use Google."},
{"James Bond", "James, James Bond."},
{"Albert Einstein", "Only 3 things are infinite:\n1. Universe.\n2. Human Stupidity.\n3. Winrar's free trial."},
{"Terry Pratchett", "Artificial Intelligence is no match for natural stupidity."},
{"Stewart Brand", "Once a new technology starts rolling, if you're not part of the steamroller,\nyou're part of the road."},
{"Sam Redwine", "Software and cathedrals are much the same - first we build them, then we pray."},
{"Jan L. A. van de Snepscheut", "In theory, there is no difference between theory and practice. But, in practice, there is."},
{"Jessica Gaston", "One man's crappy software is another man's full time job."},
{"Barack Obama", "Yes, we scan!"},
{"George W. Bush", "Where is my Nobel prize?\nI bombed people too."},
{"Gandhi", "Earth provides enough to satisfy every man's need, but not every man's greed."},
{"R. D. Laing", "Life is a sexually transmitted disease and the mortality rate is one hundred percent."},
{"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company)\nto shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."},
{"Hustle Man", "Politicians are like sperm.\nOne in a million turn out to be an actual human being."},
{"Mark Twain", "Censorship is telling a man he can't have a steak just because a baby can't chew it."},
{"Friedrich Nietzsche", "There is not enough love and goodness in the world to permit giving any of it away to imaginary beings."},
{"Dhalsim", "Pain is a state of mind and I don't mind your pain."},
{"Elie Wiesel", "Human beings can be beautiful or more beautiful,\nthey can be fat or skinny, they can be right or wrong,\nbut illegal? How can a human being be illegal?"},
{"Dennis Ritchie", "Empty your memory, with a free(), like a pointer.\nIf you cast a pointer to a integer, it becomes the integer.\nIf you cast a pointer to a struct, it becomes the struct.\nThe pointer can crash, and can overflow.\nBe a pointer my friend."},
{"Chewbacca", "Uuuuuuuuuur Ahhhhrrrrrr\nUhrrrr Ahhhhrrrrrr\nAaaarhg..."},
{"#JeSuisCharlie", "Freedom of expression is like the air we breathe, we don't feel it, until people take it away from us.\n\nFor this reason, Je suis Charlie, not because I endorse everything they published, but because I cherish the right to speak out freely without risk even when it offends others.\nAnd no, you cannot just take someone's life for whatever he/she expressed.\n\nHence this \"Je suis Charlie\" edition.\n" }
};

const int nbWtf = 6;
char* wtf[nbWtf] =
{
"WTF?!",
"lol",
"FAP FAP FAP",
"ROFL",
"OMFG",
"Husband is not an ATM machine!!!"
};
```

# Zero Parts Thermostated Soldering Station

A quick and dirty temperature controller for a soldering iron. It is made out of lab test equipment and a Python script.

# Description

Usually a dedicated soldering station is used to control the temperature of a soldering iron, but this time, a PC, a DP832 power source, a DS1054Z oscilloscope, and a Python script were all used together to control a soldering iron.

Why use \$3k+ lab equipment instead of a \$30 soldering station?

Because I have a few cheap (\$3-\$4) soldering iron handles and a bag of fake Hakko 900M tips, but no soldering station for them, and I was curious to see how well these can perform in comparison with the other type of the fake Hakko tips that I have, the T12 series.

T12 type are definitely better then 900M type. T12 are also five to ten times more expensive then 900M, but how worst the 900M series can be? Does the 900M deserve their space on a workbench?

# Details

## Intro

There are some very cheap soldering iron handles available as spare parts. They usually work with 900M type tips, the heating element has 50W at 24V, and the temperature sensor is a 40uV/*C type K thermocouple integrated into the heating element. Mine were Gordak type handles.

These cheap soldering irons use Hakko 900M series type of tips, but despite their similar heating element and similar soldering tips, the temperature sensor is different between the Hakko and the clones. Hakko uses an RTD, while the rest of the other producers are using a K type thermocouple.

The total cost for a non-Hakko complete handle with one tip included and free shipping is about 3-4 USD, and a pack of 10 soldering tips is about 2-3 USD with free shipping.

## Setup

To test these soldering irons, an adjustable power source (Rigol DP832) and an oscilloscope (Rigol DS1054Z) were used. Both the source and the scope have LXI, meaning they are remote controllable from a PC via SCPI commands sent over LAN (for acronyms please see the end section, ‘Acronyms’).

The oscilloscope probe is connected to the soldering irons thermocouple. The power source is connected to the heating element of the soldering iron.

## How it works

The PC runs a Python script that sends commands to the oscilloscope and to the power source, in order to implement a PID temperature control loop.

Temperature can be changed in steps of five degrees Celsius by pressing the Up/Down arrow keys. Python source code is available at https://github.com/RoGeorge/SCPI_solder_station.

The PC reads the thermocoulpe voltage from the oscilloscope, calculates the thermocouple temperature and sends commands to adjust the voltage of the power source that feeds the heating element. The temperature is kept stable enough to make a first impression about the heating power of these kind of soldering irons.

This solution was implemented mostly for testing purposes, to see how well various soldering irons and tips performs. It can be used for real soldering too, but not recommended.

If something goes wrong, this setup might become a fire hazard.
Just in case you want to replicate it, do not leave it unattended.

# Conclusions

– Does this setup works?
– Yes.

– Does these soldering handles needs a PID control loop?
– No. For 900M soldering tips, the sensor is too loosely coupled with the tip. The sensor is inside the heating element, so keeping the heating element at a constant temperature does not imply the soldering tip will stay at a constant temperature too.

– Can the tip temperature be properly calibrated?
– No. The handle temperature can easily vary within 10-20*C from the room temperature, but there is no cold junction compensation for the thermocouple inside the handle. Assuming you measure the room temperature, and the sensor is perfectly coupled with the tip, the temperature offset can still vary in a range of 20*C from the set temperature, depending of the handle temperature variations.

– Can these handles be used for occasional/hobby soldering?
– Yes.

– Can these handles be used for heavy work or precision soldering?
– No. The soldering tip arrives at the working temperature only 10-20 seconds later after the sensor temperature has stabilized, which makes any temperature control pretty useless. It seems that the 900M soldering is based mostly on the heat accumulated into the metal of the tip, but the temperature sensor is in the heating element, so the tip can not be maintained at a precise temperature during soldering. Also, no matter which tip model from the 900M series I choose, it can not provide enough heat to solder on a big ground plane.

# Acronyms

RTD – Resistance Temperature Detector
PC – Personal Computer
LXI – LAN Extensions for Instrumentation
SCPI – Standard Commands for Programmable Instruments
LAN – Local Area Network
PID – Proportional-Integral-Derivative