Saturday, May 9, 2015

Esp8266 Esp-12

There are several configurations of the Esp8266 modules which is denoted with a Exp-XX suffix. Currently I know of Esp-01 through Esp-12, each have their advantages and dis-advantages.

Although I have be experimenting with the Esp8266 Esp-11 (see previous post), my goal is to use the Esp-12 configuration for more complex applications. The Esp-11 configuration has only 8 pins, while the Esp-12 has 16 pins, and therefore more I/O options.

Breakout boards are available for each, but there are trade-offs; the Esp-12 Breakout Board is much wider than the Esp-12 itself. Even though the breakout Esp-12 Breakout Board is protoboard friendly (i.e., 0.1in spacing), it is so wide that there is little space to attach jumpers (I think only one hole row on each side is usable).

I decided to try the technique of bending header pins as necessary to match the 2mm spacing, I originally used this method on the Esp-11 (see previous post).

The pin spacing of the Exp-11 is smaller at 1.27mm, while the Esp-12 is 2.0mm. A good microscope is needed to solder headers directly onto either.

Esp8266 Esp-12 with two 0.1in Headers Attached

Now all that is needed is wiring-it-up and some software (Yeah, . . . famous last words).



-- Home Page: https://WA0UWH.blogspot.com

Friday, May 8, 2015

Esp8266 - Programming Success

For several weeks, I have been failing at programming the Esp8266 ES-11.

I had purchased a group of five Esp8266's for initial experimentation. I also purchased a small number of 3.3v/5.0v FTDI (USB to Serial) Adapters which are used to program the Esp8266's (see previous post).

Esp8266 and FTDI
The FTDI is also used to configure the Esp8266's using simple (default) "AT" instructions.  I could configure the Esp for "Station", "Access Point", and for "Both" modes. In "Both" modes, the Esp can be configured as a WIFI-to-WIFI Router. The cellphone APPs; "Net Scan" and "WIFI Analyser" are very useful to understand what is going on (or not).

Everything was looking great.

So, the next step was to compile a program, to replacing the Default functions with a Program that I have written. The instructions looked simple, and there are several Programming Environments to choose from; Arduino IDE, nodemcu, ESPlorer, and others. Besides, supposedly, there are easy to use programs to re-Flash the device back to the "Factory Fresh" original (ROM) state (so I thought).

This is where the Trouble Started.

At each attempt to do something interesting, that is; Program the Device or Reflash it back to original configuration - I killed another of my Esp8266s, in other words I BRICKED it!

Of the five purchased Esp8266's, I managed to BRICK three of them, I only had two good Esp's left. Now, being gun shy, with the new Exp8266, everything was suspect.

The goal became "How to UnBrick a Esp8266" without "Bricking" another. I have been working this problem for about two weeks without progress or solution.

There is a ton of information on the Internet regarding Bricked Exp8266's, but a lot of it is confusing and conflicting.

This post is about what I did to UnBrick my Esp8266's.

I gave my friend Jeff - KO7M a Bricked Esp8266 and one of my FTDI USB-to-Serial Adapters. We worked several days trying to download or ReFlash the Exp8266 - without much luck.


The Fix.

After several more hours of work, Jeff suggested and tried a different FTDI.

It worked !

To make a very long story short, we replaced the FTDI with another variety, the Parallax PropPlug. We think the previous FTDI was corrupting the downloaded data that was being sent to the Esp8266's.

Yes I know, the PropPlug is a 5V device and Esp8266 are 3.3v devices. But I forgot that on the original test, and it is working, so I have not changed the configuration (only TX/RX/RST/GND are connected).

UPDATE: One of my readers (yeti) provided correction, the PropPlug is actually a 3.3v chip and device, I have always thought it was 5v. See Link,  Thanks !!

The PropPlug (on the right)
connected to
the Esp8266 (on the left)
Question: why would the original FTDI work interactively, but would NOT work to download Batch and Binary files? - "I Don't Know, and Don't Care" - with the PropPlug, I now have something that works.

Since I started using the PropPlug I have NOT had a single failure, and we have recovered each of the Esp8266's with either the original Binaries, or my compiled programs.

Currently I am playing with Arduino IDE Compiled WIFI WebServers, one of the servers has been running for greater than 48 hours, and has serviced about 4800 test page requests. I have three running side-by-side.

Three Web Servers
These will become a part of my Internet-of-Things (IoT).

I can't guarantee that they are online, but you can check at: http://dc02.ebcon.com:8160/

Esp8266 Web Server
Note: the page refreshes each 30 seconds.

More fun and information to follow.


-- Home Page: https://WA0UWH.blogspot.com

Monday, May 4, 2015

K7QYP - A Bit of History

 A Bit of History, and a Blast from the Past
(the way I remember it)

About 48 years ago, I graduated from the US Navy's "A", "B" and "C" Electronic Training Schools. Due to the Training received in "C" School, also known as "PMEL" (Precision Measurement Electronic Lab), I was assigned to the Electronics Calibration Lab aboard the USS Howard W. Gilmore AS-16 in Charleston SC. Where I met Don Sehulster - K7QYP, who was my Shop's Lead.

Don was a Amateur (Ham) Radio Operator. On our first trip to sea together, Don brought his Ham Gear and portable antenna on board. The antenna was mounted on the hand rail outside the shop door. Don worked many Phone Patches back to the States for crew, including the XO which enjoyed getting updates and weather from his wife. The FCC, the Captain, and the Shipboard Radio Operations Officer were all aware of and supported Don's Ham Radio activities. To be able to talk with folks at home was a BIG morale boost for the Crew!

I was not a Ham at the time, this activity convinced me to get a Ham Ticket.

One of our planned Port-of-call was San Juan Puerto Rico, which just happen to have a FCC Field Office. Bob Stothfang and I studied together in preparation for the Ham test, we were both just out of Naval Electronic School and therefore hopefully, it would be easy, we just needed to brush up on the Regulations and some radio details.

At the FCC Office we both took the Amateur Radio; Technician, and General Tests. We also took the FCC; Third, Second, and First Class Radio Telephone License Tests. And while we were there, we took the Ship Board Radar Endorsement Test. A few weeks later, Bob and I, both received notice that we had passed ALL tests  :-)

I became; Eldon - WA0UWH, and Bob - WB8BEQ.

Later while on board, we were in the Ship Yard for some Refit and Repairs. Don received a new piece of Lab Equipment, a HP-117A VLF WWVB Receiver. We were the Shipboard Calibration Lab and this was to support the Time Standard for all calibrations. Of course, the VLF Receiver needed an outside antenna mount, and with the best coax money could buy, all plumbed directly to our LAB.

The Ship Yard did a great job on the installation, all of the through bulkhead water tight fitting were first class. The VLF Loop Antenna mount was up on the HeliDeck, but within arms reach while standing on the deck hand rails, this was so that the loop antenna could be rotated as necessary at each Port-of-Call (or at least that is what Don told me).

On our next trip to Sea, Don again brought his Ham Gear, and a new AVQ Antenna, which we mounted on the HeliPort VLF Antenna mounting stub (removed VLF antenna), with direct coax cable access to our LAB. With this configuration, we had much better signal into the States,  which produced many more and better Phone Patches for the Captain, XO and the Crew.

So, why relate all of this history?

Well because, a piece of that History has come full circle.

One of the QSL cards that Don sent 47 years ago, while on board the USS Howard W. Gilmore AS-16 running Phone Patches for the crew, was just recently seen on ebay for sale. And yes, Don has purchased it.

K7QYP - QSL on Ebay

Note, the 4 cent Stamp
Don sent the card for 4 cents, and received it back 48 years latter for $12.00 plus shipping - now that IS inflation !

When Don left the Navy, I became the Calibration Lab Lead, and continued the tridition of providing Phone Patches for the Crew with my Ham Gear and a 4BTV mounted on the same VLF antenna mounting stub.

Don is no longer K7QYP, he is now W4LSC, I am still WA0UWH, and I think, Bob is still WB8BEQ?

Somewhere, I still have the Radio Logs of those calls.

All Good Memories :-)


-- Home Page: https://WA0UWH.blogspot.com

Friday, May 1, 2015

Enigma - Hardware Implemented in Software

For several years, actually more like 30, I have being fascinated with the workings of the Enigma Machine.

On several occasions I have toyed with a Enigma Machine software design, but was never able to build an accurate solution. I have a very specific implementation in mind. So far, nothing has worked correctly. But, I guess, I have had a low-grade mental effort constantly considering the problem.

About three years ago, Wardy posted his build of a hardware implementation. That renewed my interest, but even with more work on my software implementation, and even with still a lot more thinking, there was no real progress.

Recently, my friend Jeff - KO7M posted his Enigma Machine implementation, I purposely did NOT read his details, because I wanted to continue with my implementation without external insight. But then again, his efforts renewing my interest in my software implementation. I still have that specific implementation in mind that I wanted to pursue.

So now, after several weeks of casual work on my software Enigma Machine, it still does NOT work as expected, some character are encoded correctly, but many others are NOT.

So, . . .

At night, sometimes I wake up,  thinking about the problem. And each night I seem to understand a little bit more.

There are several ideas that have helped me understanding the Enigma Machines operation. To simplify, I like to think of it in terms of:
  • Forget the Plug Board, it is a simple character exchange.
  • Code Wheels act like a "Fixed Wired, but Rotating PlugBoard", with simple two-letter exchanges.
  • The logic of the rotation of wheels is easier to understand if I think about it like a PlugBoard without cables plugged in, that is, character are not exchanged (i.e., A-to-A, B-to-B, etc)
  •  And, the Reflector is a simple adjacent character exchange (i.e., A-to-B, C-to-D, etc)
  • The code algorithm from the Input-to-the-Reflector, and the Reflector-to-the-Output, should mirror each other.
  • All wheel advancement and algorithms use Clock Maths.
  • Exchange of characters can be implemented after a correct wheel advancement algorithm is found and implemented.

Last Night

Last night, I suddenly woke up, . . . and had a algorithmic solution I wanted to try. In about five minutes, I had it typed in (see below).


IT WORK!

With proper Settings, I can now correctly Encode and Decode any M3 and M4 Enigma message, as verified.

ABC AAA AAA --
VERYXCOOLXJEFFXCANXYOUXREADXTHISXX
RLXVTMMQARSTKDJADSKMLAPGCXBRPZZFPE

The following is the guts of my software Enigma Machine implementation:



# Get Message Character
$i = ord($m)-65;

# Inc Wheels as Necessary
@P[3] += 1;     # Increment with each character
@P[2] += ((@P[3]%26) == $Adv3_Static+1);
@P[1] += ((@P[2]%26) == $Adv2_Static+1);
@P[0] += 0;

$R3 = @P[3] % 26;
$R2 = @P[2] % 26;
$R1 = @P[1] % 26;
$R0 = @P[0] % 26;

# Do Enigma, Encode or Decode
$i = @PB[$i];
$i = (@WL3[($i+$R3)%26]+26-$R3)%26;
$i = (@WL2[($i+$R2)%26]+26-$R2)%26;
$i = (@WL1[($i+$R1)%26]+26-$R1)%26;
$i = (@WL0[($i+$R0)%26]+26-$R0)%26;
$i = @R[$i]; 
$i = (@WR0[($i+$R0)%26]+26-$R0)%26;
$i = (@WR1[($i+$R1)%26]+26-$R1)%26;
$i = (@WR2[($i+$R2)%26]+26-$R2)%26;
$i = (@WR3[($i+$R3)%26]+26-$R3)%26;
$i = @PB[$i];

# Show Light, The Encode Character
print chr($i+65);



I will post a complete listing, after I code a proper User Interface and implement Multi-Notch Wheel advancements.

There are some details of newer Enigma Machine versions that I will not try implement, but they should be simple.

Note: There are probably optimizations that could be used in the code (I am still learning python).

This has be a long, mentally challenging, and fun project. But now, I guess I need to find another  :-)


-- Home Page: https://WA0UWH.blogspot.com