UPDATED:
As previously posted, I just needed a Round TUIT.
I receive the replacement CDSH270 Diodes for my Antenna Tuner today, with a little work and with a TUIT they were installed. The Tuner now works as before.
While during the surgery on the tuner, I installed some sharp pointed spark gaps at the SO-239 connectors, and between the Balanced Line Terminals. Maybe they will help save the Diodes the next time I forget to disconnect the Antenna during the an Electric Storm.
For the spark gaps, I soldered one end of a heavy copper wire directly to the SO-239 RF center connector, and then bolted the other end directly to ground (at the connector mount point). After the "Short" was installed, I cut it at the center with dull side-cutters, leaving sharp points on each side. The gap was adjusted to about 1/20 of a inch. The same was done between the Balanced Terminals.
With another TUIT, I installed a 6 AWG ground wire to the Tuner, but waiting for a large spade lug to make the final connection. My available lugs are not big enough for 6 AWG.
Today was nice and sunny, so I also raised the Long Wire Antenna to it normal height. Yesterday when I was repairing it, it was too cold and wet to futz with it to bring it to full height at 90 feet AGL.
Two years ago I tried to work on the antenna, but could not get the 3/32 support line to slide back down the tree. I suspected it had "grown" into a limb, or was pitched into a warren slot. My friend Jeff - KO7M and I was able to pull together hard enough to finally break it free. To avoid the same problem again, I slipped the line into a 20 foot piece of 1/4 inch polypropylene ice-make tube. which we pulled up into the tree where the support line goes over the branches. Now two years later the line was easy to pull down and then back up.
So far I have made a few SSB contacts with the current antenna configuration. Now I am anxious to work some WSPR - but another TUIT is in the way.
-- Home Page: https://WA0UWH.blogspot.com
My Amateur Radio Station and Project Blog.
Home: http://WA0UWH.blogspot.com - Grid: CN88xc
Located Near Seattle in Puget Sound
and I Love to Build HomeBrew Ham Radio Projects
Local Pages
Monday, December 14, 2015
Sunday, December 13, 2015
Some Antenna Work and Repair
UPDATED: Tue Dec 22 21:38:59 PST 2015
I removed the 9:1 BalBal from my Off-Center-Fed Long Wire Antenna, as described below, it did not work as well as expected. More testing and measurement needed.
There has been a lot of chatter on the local Yahoo pQRP email list about building some 9:1 Ununs as a group project. I already have the Toroids and Wire and had planned to make several of my own - I was just waiting for a Round-TUIT (TUIT).
For the last several (6 or so) years, I have been using a 300 foot Off-Center-Fed (OCF) Long Wire antenna. It is strung up near the top of some nice tall trees with the feed point at about 90 feet AGL. It has worked very well on all bands for WSPR, QRSS, CW, and general Ham use. The antenna is fed with 450 ohm ladder line fed from a Tuner with an internal Balun. I rarely have to provide much L or C adjustment for reasonable performance.
With a crippled antenna (see below), last night I worked Sandy - KG7FFP as she is new General License Ham - Good going Sandy! We were on 80m, 3.885MHz.
There are several things that I have wanted to try, to see if I could improve performance.
The first, is a no-brainer; Ground the Tuner and the Rig, something that has always been waiting for another TUIT.
The second, may be more controversial, I have wanted to put a 9:1 BalBal at the feed point of the OCF Long Wire. With 450 ohms ladder line in, the output should approximate 4050 ohms, which I think would more closely match typical OCF Long Wire feed impedance. In my case the short end of the Long Wire is about 20 feet. The Feed Line drops straight into my Loft's window, across the celling to the Ham Rig, I think more impedance is desirable, in reality, I thing everything in close proximity becomes the antenna, that is; the long wire, feed line, metal roof, and the moss soaked wet-trees, and I don't think they are typically just 450 ohms :-)
Another "nit" that I wanted to improve (or remove) is the "egg" insulator at the feed point. I have never really liked this centre point set up, but it is what I had when it was first installed. The new set up is a now a 14 inch long, 3/4 inch PVC (conduit) with three holes in each end. The antenna wire goes through a "Z" bend at each end of the conduit, then "V's" down to my new 9:1 BalBal, which is about 18 inch lower. The antenna wire is standard, solid copper 12 AWG conduit wire.
My antenna tuner is still in my eShop waiting replacement diodes (CDSH270), they are on order and should arrive soon. The antenna and Tuner took a near hit during one of the last electric storms. I was near the radio and heard a snap or spark across the terminals or somewhere inside, the radio did not suffer any ill effects, the tuner TOOK it ALL.
So, now what?
My newly configured OCF Long Wire Antenna is now up and ready for use, but still waiting tuner repair.
I am expecting some VERY GOOD to EXCELLENT performance from this antenna configuration, because it was installed exactly as per the weather-man specification - that is, it was raining all the time I was outside working with; support lines, antenna wire, BalBal, and feed line. I got soaked ! Everyone knows, that the best antennas always go up during inclement weather.
But, time will tell, I will post my impressions, measurement, and results, when available.
-- Home Page: https://WA0UWH.blogspot.com
I removed the 9:1 BalBal from my Off-Center-Fed Long Wire Antenna, as described below, it did not work as well as expected. More testing and measurement needed.
There has been a lot of chatter on the local Yahoo pQRP email list about building some 9:1 Ununs as a group project. I already have the Toroids and Wire and had planned to make several of my own - I was just waiting for a Round-TUIT (TUIT).
For the last several (6 or so) years, I have been using a 300 foot Off-Center-Fed (OCF) Long Wire antenna. It is strung up near the top of some nice tall trees with the feed point at about 90 feet AGL. It has worked very well on all bands for WSPR, QRSS, CW, and general Ham use. The antenna is fed with 450 ohm ladder line fed from a Tuner with an internal Balun. I rarely have to provide much L or C adjustment for reasonable performance.
With a crippled antenna (see below), last night I worked Sandy - KG7FFP as she is new General License Ham - Good going Sandy! We were on 80m, 3.885MHz.
There are several things that I have wanted to try, to see if I could improve performance.
The first, is a no-brainer; Ground the Tuner and the Rig, something that has always been waiting for another TUIT.
The second, may be more controversial, I have wanted to put a 9:1 BalBal at the feed point of the OCF Long Wire. With 450 ohms ladder line in, the output should approximate 4050 ohms, which I think would more closely match typical OCF Long Wire feed impedance. In my case the short end of the Long Wire is about 20 feet. The Feed Line drops straight into my Loft's window, across the celling to the Ham Rig, I think more impedance is desirable, in reality, I thing everything in close proximity becomes the antenna, that is; the long wire, feed line, metal roof, and the moss soaked wet-trees, and I don't think they are typically just 450 ohms :-)
Another "nit" that I wanted to improve (or remove) is the "egg" insulator at the feed point. I have never really liked this centre point set up, but it is what I had when it was first installed. The new set up is a now a 14 inch long, 3/4 inch PVC (conduit) with three holes in each end. The antenna wire goes through a "Z" bend at each end of the conduit, then "V's" down to my new 9:1 BalBal, which is about 18 inch lower. The antenna wire is standard, solid copper 12 AWG conduit wire.
My antenna tuner is still in my eShop waiting replacement diodes (CDSH270), they are on order and should arrive soon. The antenna and Tuner took a near hit during one of the last electric storms. I was near the radio and heard a snap or spark across the terminals or somewhere inside, the radio did not suffer any ill effects, the tuner TOOK it ALL.
So, now what?
My newly configured OCF Long Wire Antenna is now up and ready for use, but still waiting tuner repair.
I am expecting some VERY GOOD to EXCELLENT performance from this antenna configuration, because it was installed exactly as per the weather-man specification - that is, it was raining all the time I was outside working with; support lines, antenna wire, BalBal, and feed line. I got soaked ! Everyone knows, that the best antennas always go up during inclement weather.
But, time will tell, I will post my impressions, measurement, and results, when available.
-- Home Page: https://WA0UWH.blogspot.com
Saturday, December 12, 2015
More Fun with Cyclops Numbers
UPDATED:
Added Details and Links
I created a fun function to compute Cyclops Numbers, see previous post.
Where:
D=8; C=3; L=2; => 838
D=8; C=3; L=3; => 88388
D=8; C=3; L=4; => 8883888
D=4; C=8; L=5; => 444484444
D=9; C=0; L=6; => 99999099999
The results for the above function:
99999999999999999999999999099999999999999999999999999
It is all fun and games, until someone pokes the Cyclops Eye :-)
-- Home Page: https://WA0UWH.blogspot.com
Added Details and Links
I created a fun function to compute Cyclops Numbers, see previous post.
D=9; C=0; L=27;
echo "obase=${D}+1;(${D}+1)^(2*${L}-1) -1 -(${D}-(${C}%${D}))*(${D}+1)^(${L}-1)" | bc
Where:
- D = Is the side Digits, 1 to 9
- C = Is the single Cyclops Eye Digit, must be < D, or C mod D will be used
- L = The Cyclops Eye Location (width)
D=8; C=3; L=2; => 838
D=8; C=3; L=3; => 88388
D=8; C=3; L=4; => 8883888
D=4; C=8; L=5; => 444484444
D=9; C=0; L=6; => 99999099999
The results for the above function:
99999999999999999999999999099999999999999999999999999
It is all fun and games, until someone pokes the Cyclops Eye :-)
-- Home Page: https://WA0UWH.blogspot.com
Wednesday, December 9, 2015
More Large Numbers
UPDATED:
Added Details and Links
Update: Jan 7, 2016 - New Largest Prime found: echo "2^74207281-1" | bc, which is 22 Million Digits, the function takes 77.25 minutes to compute on a 3.4GHz Processor. See, youtube at: https://goo.gl/C7ngE7
See previous post.
The largest known prime number is: 17,425,170 digits long, it can be computed with this very short function:
On my Workstation (2.2GHz) it takes about 82 minutes to compute, but with more than 17M digits, it takes much longer to display or print.
To print, it would require 7.7 Reams of paper; single sided, 80 character per line, 56 lines to a page, and 500 pages pre ream.
Note: The person that finds the "next" larger prime number will be famous.
-- Home Page: https://WA0UWH.blogspot.com
Added Details and Links
Update: Jan 7, 2016 - New Largest Prime found: echo "2^74207281-1" | bc, which is 22 Million Digits, the function takes 77.25 minutes to compute on a 3.4GHz Processor. See, youtube at: https://goo.gl/C7ngE7
See previous post.
The largest known prime number is: 17,425,170 digits long, it can be computed with this very short function:
echo "2^57885161 -1" | bc
On my Workstation (2.2GHz) it takes about 82 minutes to compute, but with more than 17M digits, it takes much longer to display or print.
To print, it would require 7.7 Reams of paper; single sided, 80 character per line, 56 lines to a page, and 500 pages pre ream.
Note: The person that finds the "next" larger prime number will be famous.
-- Home Page: https://WA0UWH.blogspot.com
Large Numbers
UPDATED:
Added Details and LInks
As noted in previous posts, I am a fan of Large Numbers, I am especially interested in small functions that compute Large Numbers.
Recently I watched a Numberphile Youtube video, which captivated my interest. The numbers that I found most interesting are large "Cyclops Numbers".
The following Linux function will compute a large Cyclops:
Can you spot the Cyclops Eye?
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999909999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999
-- Home Page: https://WA0UWH.blogspot.com
Added Details and LInks
As noted in previous posts, I am a fan of Large Numbers, I am especially interested in small functions that compute Large Numbers.
Recently I watched a Numberphile Youtube video, which captivated my interest. The numbers that I found most interesting are large "Cyclops Numbers".
The following Linux function will compute a large Cyclops:
echo "10^(2*253-1) -1 -9*10^(253-1)" | bc
Can you spot the Cyclops Eye?
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999909999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999999
-- Home Page: https://WA0UWH.blogspot.com
Tuesday, December 8, 2015
Email from Raspberry PI or the Esp8266
UPDATED:
Added Details and Links
If you have been following my recent blog post, I posted about using "curl" to send SMS messages to a Cell Phone Number, I have also created a software function to send a similar SMS messages from Esp8266, and/or using the same strategy this could be used on a Raspberry PI. The SMS messages are transferred to the "textbelt.com" Open SMS Gateway. Access is via a HTML URL post, or via a command line "curl" command which simulates a HTTP post. The textbelt.com server imposes some limits, that is; no more than 3 messages per 3 minutes, and no more than 75 messages per day from a single IPA.
The folks at Textbelt are gracious to allow us "small-time" users to access their gateway for FREE, - SPAMMERS are not welcome.
But, if you want your Raspberry PI or Esp8266 to send an actual "email", that is another problem. Accessing an "Open" Simple Mail Transport Protocol Gateways (an SMTP) is normally a problem for most users. The reason an "Open" SMTP is desirable for our Internet-of-Things (IoT's) is that authentication is NOT required on Open SMTP's, and therefore there is NO need for a "clear text" password saved in a file, nor is it transferred over the Internet.
There are a few Open SMTP available, where services are purchased by SPAMMERS to do their thing. A few of these SMTP gateways allow low-volume users access to their services for FREE, with some restrictions. I have tried several Open SMTP gateways, and found most have additional requirements that I did not agree, like; sign up with a credit card.
I am currently using "smtp2go.com" which has a FREE Option and does not require a credit card to sign up. For low volume users like myself, it has a limit of 25 emails per hour, and/or 1000 emails per month, - which is more than enough email for my IoT's to report status, and/or other reports to me via email.
I have implemented a Mail Transfer Agent (MTA) which "talks" to the Open SMTP to send my messages. Messages can be sent to my normal Gmail Account, or to my Cell Phone as an SMS text message, or to any other email address that I desire.
I have written complete MTA function for my use with my ERB-EspWebServer Farm, but provided just some excerpts here for discussion. At some point I will post the complete listing on my GitHub.
Sorry, I did not include the "set up", but I think the upper case "#define" are obvious.
As can be seen, the logic of the MTA is really very simple: send a message, and then wait for a response, repeat as necessary, stop on error or finished.
Note: For the Raspberry IP, this can be implemented as a Bash script, in fact the details for the above program were first worked out using a script on a Linux Workstations. I will post the script later.
If you find this useful - leave a comment.
-- Home Page: https://WA0UWH.blogspot.com
Added Details and Links
If you have been following my recent blog post, I posted about using "curl" to send SMS messages to a Cell Phone Number, I have also created a software function to send a similar SMS messages from Esp8266, and/or using the same strategy this could be used on a Raspberry PI. The SMS messages are transferred to the "textbelt.com" Open SMS Gateway. Access is via a HTML URL post, or via a command line "curl" command which simulates a HTTP post. The textbelt.com server imposes some limits, that is; no more than 3 messages per 3 minutes, and no more than 75 messages per day from a single IPA.
The folks at Textbelt are gracious to allow us "small-time" users to access their gateway for FREE, - SPAMMERS are not welcome.
But, if you want your Raspberry PI or Esp8266 to send an actual "email", that is another problem. Accessing an "Open" Simple Mail Transport Protocol Gateways (an SMTP) is normally a problem for most users. The reason an "Open" SMTP is desirable for our Internet-of-Things (IoT's) is that authentication is NOT required on Open SMTP's, and therefore there is NO need for a "clear text" password saved in a file, nor is it transferred over the Internet.
There are a few Open SMTP available, where services are purchased by SPAMMERS to do their thing. A few of these SMTP gateways allow low-volume users access to their services for FREE, with some restrictions. I have tried several Open SMTP gateways, and found most have additional requirements that I did not agree, like; sign up with a credit card.
I am currently using "smtp2go.com" which has a FREE Option and does not require a credit card to sign up. For low volume users like myself, it has a limit of 25 emails per hour, and/or 1000 emails per month, - which is more than enough email for my IoT's to report status, and/or other reports to me via email.
I have implemented a Mail Transfer Agent (MTA) which "talks" to the Open SMTP to send my messages. Messages can be sent to my normal Gmail Account, or to my Cell Phone as an SMS text message, or to any other email address that I desire.
I have written complete MTA function for my use with my ERB-EspWebServer Farm, but provided just some excerpts here for discussion. At some point I will post the complete listing on my GitHub.
Sorry, I did not include the "set up", but I think the upper case "#define" are obvious.
// ###########################################################
//////////////////////////////////////////////////////////////
//
//
boolean
_MTA(WiFiClient client, String aStr, String aPat, unsigned long aTimeout)
{
boolean myStatus = false;
if (aStr.length() ) client.println(aStr);
yield();
// Wait For Response
unsigned long ts = millis();
while (true) {
if ( ts + aTimeout < millis() ) {
myStatus = false;
break;
}
yield();
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
DEBUG_INDENT; Serial.println(sE(" Waiting: ") + aPat + E(" . . . ") );
#endif
String line = client.readStringUntil('\n');
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
DEBUG_INDENT; Serial.println(sE(" ") + line);
#endif
if(line.indexOf(aPat) >= 0) {
myStatus = true;
break;
}
}
return myStatus;
}
// ###########################################################
//////////////////////////////////////////////////////////////
//
// Provides easy access to page via Email Gateway
//
boolean
eMTA( String aDomain = MY_DEFAULT_NODE_DOMAIN,
String aTo = MY_DEFAULT_EMAIL_TO,
String aFrom = MY_DEFAULT_EMAIL_FROM,
String aMesg = MY_DEFAULT_EMAIL_MESSAGE,
String aHost = MY_DEFAULT_EMAIL_HOST,
int aPort = MY_DEFAULT_EMAIL_PORT )
{
digitalWrite ( gBluLED, ON );
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
DEBUG_INC_INDENT; Serial.println ( E("Starting Email Client ...") );
#endif
boolean myStatus = false;
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
DEBUG_INDENT; Serial.println( sE(" Connecting to: ") + aHost );
#endif
// Use WiFiClient class to create TCP connections
WiFiClient client;
if (!client.connect(aHost.c_str(), aPort)) {
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
DEBUG_DEC_INDENT; Serial.println( E(" Connection Failed") );
#endif
myStatus = false;
}
else {
// Wait for Client to Start Sending
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
DEBUG_INDENT; Serial.println( E(" Waiting for Connection") );
#endif
// The MTA Exchange
while(true) {
if (_MTA(client, "", "220 ", 10*SECs ) == false) break;
if (_MTA(client, "EHLO " + aDomain, "250 ", 10*SECs ) == false) break;
if (_MTA(client, "MAIL FROM:" + aFrom + "", "250 ", 10*SECs ) == false) break;
if (_MTA(client, "RCPT TO:" + aTo + "", "250 ", 10*SECs ) == false) break;
if (_MTA(client, "DATA", "354 ", 10*SECs ) == false) break;
if (_MTA(client, aMesg + "\r\n.\r\n", "250 ", 10*SECs ) == false) break;
myStatus = true;
break;
}
client.flush();
client.stop();
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
if (myStatus == true) {
DEBUG_DEC_INDENT; Serial.println( E(" Connection Closed Successfully") );
}
else {
DEBUG_DEC_INDENT; Serial.println( E(" Connection Closed With Error") );
}
#endif
}
digitalWrite ( gBluLED, OFF );
return myStatus;
}
As can be seen, the logic of the MTA is really very simple: send a message, and then wait for a response, repeat as necessary, stop on error or finished.
Note: For the Raspberry IP, this can be implemented as a Bash script, in fact the details for the above program were first worked out using a script on a Linux Workstations. I will post the script later.
If you find this useful - leave a comment.
-- Home Page: https://WA0UWH.blogspot.com
Wednesday, December 2, 2015
Playing with Diffie Hellman
UPDATED:
Added Details and Links
Note: I am not a cryptographer, I just like playing with large numbers.
There are no secret information provided in this blog post, it is all available online, this is just my added two cents, take it for what it is worth.
The Diffie-Hellman Key Exchange method is used to share a "Secret Key" between two users, without sending the shared Secret Key across the network.
See: Google Diffie Hellman.
The idea is simple, and the maths can be simple:
k=<my secret number>
g=<a publicly shared number>
p=<a publicly shared large prime number>
A new Shared or Secret Key: G = (g ^ k) mod p
What can make it difficult and secure is that VERY large numbers can be used, and therefore making it very difficult for an observer (villain) to use brute force to discover the Shared Secret Key.
If you read the available documentation about Diffie Hellman Key Exchange, you will no doubt learn all about; Alice, Bob (the good guys), and Eve (the villain). I suggest it for some bed time reading.
Note: the online documentation suggest that Alice and Bob must first each know some public numbers for "g" and "p".
But, there is nothing preventing a proper and secure Key Exchange when Alice initiates the process by sending Bob three numbers; "g", "p" and "g2B" (g to Bob) values.
Bob would need to use these three values to compute the "Shared Secret Key". Bob also returns to Alice a computed "g2A" (g to Alice), now Bob is finished, he now knows the Shared Secret Key. Alice will also know the Shared Secret Key when she completes her next calculation.
Alice uses the returned "g2A" value to compute the same "Shared Secret Key".
It looks like magic, but it is simple when you look at the maths with small numbers, and knowing:
where: "a" is Alice's secret key ("kA"), and "b" is Bob's secret key ("kB").
See the online documentation.
You will also learn from online documents, that "p" should be a Large Prime Number, and "g" should be greater than "0", but less than "p", and "k" is a Secret Key that should NOT be shared.
Which is all good advice, if you are implementing a banking system, or saving the world via encrypted text messages. But the Diffie Hellman function works regardless of the numbers used, so in the examples below, some small and maybe inappropriate values are used.
What started my interested in Diffie Hellman Key exchange is the UNIX provided, and neat little and powerful, utility called "bc". The "bc" command can deal with VERY large numbers without difficulty.
An Example:
A Diffie Hallman Example, with small numbers.
Assume that Alice, Bob and Eve will know and/or use the following:
gP =16
pP = 101
As stated above, these numbers could be suggested by Alice or Bob, or both. Or, the numbers could be hard coded into a application that they both use. If large enough, the knowledge of these numbers does NOT detract from security.
Note: For this example, I will use the upper case "P" to denote a number is "Public", "pP" is normally prime. I will use "kA" for Alice secret key, and "kB" for Bob's secret key. Also, "g2B" and "g2A" are the computed exchanged values. Then finally, "gS" becomes the value of the "Shared Secret Key".
Note: "g2B" and "g2A" are just like other "g" values that can be used in the same Diffie Hellman formula.
Eve can eavesdrop on all of the network data exchanges between Alice and Bob, but will NOT be able to compute the Shared Secret Key, because Eve is not privy to Alice's or Bob's Secret Keys.
-----------------------
Alice's Secret Key, known only by her, is: kA = 7
Alice wants to Share a Secret Key with Bob.
Alice computes a: g2B = (gP ^ kA) mod pP with her key.
Alice will do this on UNIX system with the values above using the following command:
Alice can now send "qP", "pP" and "g2B" to Bob as clear text within an email (or whatever). Note: Eve may or can eavesdrop on the Internet traffic.
-----------------------
Bob's Secret Key, known only by him, is: kB = 11
Because Bob also uses a UNIX system, he computes from the values sent from Alice a value to be returned to Alice: g2A = (gP ^ kB) mod pP
Bob can now sends Alice "g2A", so she can complete her side of the key exchange.
Bob is now finished, he knows the Shared Secret Key as "54".
-----------------------
With the value of "g2A" sent by Bob, Alice can complete her side of the exchange, by computing: gS = (g2A ^ kA) mod pP
Alice now finished, she knows the Shared Secret Key as "54".
-----------------------
Both Alice and Bob both know the same value of "gS", the Share Secret Key as "54". Alice or Bob, could now use the Shared Secret Key to encrypt messages that hopefully only the opposite could decrypt.
Eve is left clueless.
-----------------------
But there is a flaw !
With small numbers, as used in this example, Eve could Brute Force a decryption solution, by trying all numbers starting with "0". In this case it will only take 54 iterations to find the correct Shared Secret Key that would successfully decrypt Alice's message. Eve could easily know (via eavesdropping) the value of "pP" is small, and therefore, can assume the Secret Key is some number between 0 and 101, which implies a brute force attack is warranted.
But Normally
Normally, the values of "gP", "pP", and the resulting "g2B" and "g2A" are VERY much larger numbers, maybe hundreds or thousands of digits.
Imagine what Eve prospects of having enough CPU horse power to attempt a sequential attack if "pP" is extremely large number - prospects = none.
If "pP" is large enough, a brute force attack could take forever even with multiple very fast computers.
Some Experiments
Remember I said "bc" can deal with large numbers, well, to avoid "typing" a large number I will use exponentiation to generate some numbers for "qP" and "pP", for Alice try this:
$ gP="(3^456)"
$ pP="(2^4253-1)" # A Large Prime Number
$ kA="12345"
$ time echo "${gP}^${kA} % ${pP}" | bc
On my 3.2GHz Workstation, this took about 6 minutes to compute, if necessary try shorten the lapse time, by changing Alice's key to "123".
The results is about 1200 digits for "g2B".
Stay tuned, more interesting "bc" observations to follow.
Me?, I just like very BIG numbers :-)
-- Home Page: https://WA0UWH.blogspot.com
Added Details and Links
Note: I am not a cryptographer, I just like playing with large numbers.
There are no secret information provided in this blog post, it is all available online, this is just my added two cents, take it for what it is worth.
The Diffie-Hellman Key Exchange method is used to share a "Secret Key" between two users, without sending the shared Secret Key across the network.
See: Google Diffie Hellman.
The idea is simple, and the maths can be simple:
k=<my secret number>
g=<a publicly shared number>
p=<a publicly shared large prime number>
A new Shared or Secret Key: G = (g ^ k) mod p
What can make it difficult and secure is that VERY large numbers can be used, and therefore making it very difficult for an observer (villain) to use brute force to discover the Shared Secret Key.
If you read the available documentation about Diffie Hellman Key Exchange, you will no doubt learn all about; Alice, Bob (the good guys), and Eve (the villain). I suggest it for some bed time reading.
Note: the online documentation suggest that Alice and Bob must first each know some public numbers for "g" and "p".
But, there is nothing preventing a proper and secure Key Exchange when Alice initiates the process by sending Bob three numbers; "g", "p" and "g2B" (g to Bob) values.
Bob would need to use these three values to compute the "Shared Secret Key". Bob also returns to Alice a computed "g2A" (g to Alice), now Bob is finished, he now knows the Shared Secret Key. Alice will also know the Shared Secret Key when she completes her next calculation.
Alice uses the returned "g2A" value to compute the same "Shared Secret Key".
It looks like magic, but it is simple when you look at the maths with small numbers, and knowing:
g^(ab) mod p == g^(ba) mod p
where: "a" is Alice's secret key ("kA"), and "b" is Bob's secret key ("kB").
See the online documentation.
You will also learn from online documents, that "p" should be a Large Prime Number, and "g" should be greater than "0", but less than "p", and "k" is a Secret Key that should NOT be shared.
Which is all good advice, if you are implementing a banking system, or saving the world via encrypted text messages. But the Diffie Hellman function works regardless of the numbers used, so in the examples below, some small and maybe inappropriate values are used.
What started my interested in Diffie Hellman Key exchange is the UNIX provided, and neat little and powerful, utility called "bc". The "bc" command can deal with VERY large numbers without difficulty.
An Example:
A Diffie Hallman Example, with small numbers.
Assume that Alice, Bob and Eve will know and/or use the following:
gP =16
pP = 101
As stated above, these numbers could be suggested by Alice or Bob, or both. Or, the numbers could be hard coded into a application that they both use. If large enough, the knowledge of these numbers does NOT detract from security.
Note: For this example, I will use the upper case "P" to denote a number is "Public", "pP" is normally prime. I will use "kA" for Alice secret key, and "kB" for Bob's secret key. Also, "g2B" and "g2A" are the computed exchanged values. Then finally, "gS" becomes the value of the "Shared Secret Key".
Note: "g2B" and "g2A" are just like other "g" values that can be used in the same Diffie Hellman formula.
Eve can eavesdrop on all of the network data exchanges between Alice and Bob, but will NOT be able to compute the Shared Secret Key, because Eve is not privy to Alice's or Bob's Secret Keys.
-----------------------
Alice's Secret Key, known only by her, is: kA = 7
Alice wants to Share a Secret Key with Bob.
Alice computes a: g2B = (gP ^ kA) mod pP with her key.
Alice will do this on UNIX system with the values above using the following command:
$ g2B=`echo "(16^7)%101" | bc`
g2B becomes 80
Alice can now send "qP", "pP" and "g2B" to Bob as clear text within an email (or whatever). Note: Eve may or can eavesdrop on the Internet traffic.
-----------------------
Bob's Secret Key, known only by him, is: kB = 11
Because Bob also uses a UNIX system, he computes from the values sent from Alice a value to be returned to Alice: g2A = (gP ^ kB) mod pP
$ g2A=`echo "(16^11)%101" | bc`
g2A becomes 71
Bob can now sends Alice "g2A", so she can complete her side of the key exchange.
Bob also can compute the "Shared Secret Key" as: gS = (g2B ^ kB) mod pP
$ gS=`echo "(80^11)%101" | bc`
gS becomes 54
Bob is now finished, he knows the Shared Secret Key as "54".
-----------------------
With the value of "g2A" sent by Bob, Alice can complete her side of the exchange, by computing: gS = (g2A ^ kA) mod pP
$ gS=`echo "(71^7)%101" | bc`
gS becomes 54
Alice now finished, she knows the Shared Secret Key as "54".
-----------------------
Both Alice and Bob both know the same value of "gS", the Share Secret Key as "54". Alice or Bob, could now use the Shared Secret Key to encrypt messages that hopefully only the opposite could decrypt.
Eve is left clueless.
-----------------------
But there is a flaw !
With small numbers, as used in this example, Eve could Brute Force a decryption solution, by trying all numbers starting with "0". In this case it will only take 54 iterations to find the correct Shared Secret Key that would successfully decrypt Alice's message. Eve could easily know (via eavesdropping) the value of "pP" is small, and therefore, can assume the Secret Key is some number between 0 and 101, which implies a brute force attack is warranted.
But Normally
Normally, the values of "gP", "pP", and the resulting "g2B" and "g2A" are VERY much larger numbers, maybe hundreds or thousands of digits.
Imagine what Eve prospects of having enough CPU horse power to attempt a sequential attack if "pP" is extremely large number - prospects = none.
If "pP" is large enough, a brute force attack could take forever even with multiple very fast computers.
Some Experiments
Remember I said "bc" can deal with large numbers, well, to avoid "typing" a large number I will use exponentiation to generate some numbers for "qP" and "pP", for Alice try this:
$ gP="(3^456)"
$ pP="(2^4253-1)" # A Large Prime Number
$ kA="12345"
$ time echo "${gP}^${kA} % ${pP}" | bc
On my 3.2GHz Workstation, this took about 6 minutes to compute, if necessary try shorten the lapse time, by changing Alice's key to "123".
$ gP="(3^456)"
$ pP="(2^4253-1)"
$ kA="12345"
$ time echo "${gP}^${kA} % ${pP}" | bc
80926261610442626577264521832490790161484618732554432140432039188058\
63206215275578738866144144831890725477013508191723348004478728927721\
95788786903156432412894232199564275068253627223471477034284902245829\
91421266442623706953457344345029183351048403313211524973218664085545\
87664348342026922029976056154815423683953094807171496683969416932115\
99132155230551185025739817346443301752666222054850477088018492513173\
91624760224393336362809726321106680382250456588357956381388166323729\
38771361918677860624224646340387910263769022858722611291936528412356\
03100668125135517222317410124988021081469568935461035793383680680665\
55390092789716566511778596204161424690071853937453863897083377508927\
67048039381017256779118656382146384480277810498377460548282809326731\
69234441684180112706844382298511472521071812891762065337050899792993\
70060526297317940169650082051030560624756658527561344770507458651702\
43716790444907248809569095106287466645236990947552803718232042574873\
11042448383261839081283910961519762548619655187688322601121778057413\
25524176872795543285574829694591574831681802471828336907766795593351\
38229222971475049624002124059810014875496597620324310354937668694220\
99070653730452586152318927155511512700751348007603716449001964877066\
01906432412801407287885578931224463376104843439581857726
real 5m48.432s
user 5m44.929s
sys 0m0.400s
The results is about 1200 digits for "g2B".
Stay tuned, more interesting "bc" observations to follow.
Me?, I just like very BIG numbers :-)
-- Home Page: https://WA0UWH.blogspot.com
Monday, November 30, 2015
Esp8266 - Interactive SMS from the Web Page
UPDATE: Mon Nov 30 21:34:56 PST 2015
Added Links and Detail
Added RAW HTML listing
In the previous post I listed a code snippet that provides non-interactive SMS from the Esp8266. But sometime it is desirable to provide a simple interactive SMS interface for the Web User. An interactive SMS interface could be used to "page the SysAdmin" with the web user's supplied message.
The interactive SMS interface is simple and requires only some HTML code to be inserted within a web page. Note: the previous post was a SMS method where user interaction was not needed nor desired.
Note: the Open SMS Gateway domain name that is used in the example is "textbelt.com", read their web page for details for Canadian and International use.
The following are excerpts from my ERB-EspWebServer.
Note: the RAW HTML code could be extracted from the example below and used with any Web Server.
The Setup:
Web Server Code Arduino Sketch Snippet:
Note: I use my own custom "wprintln" function within the above example, modify as necessary.
For reference and to make things simple, I have extracted just the HTML from the above Sketch, as shown below.
HTML:
If you find this useful, leave a comment.
-- Home Page: https://WA0UWH.blogspot.com
Added Links and Detail
Added RAW HTML listing
In the previous post I listed a code snippet that provides non-interactive SMS from the Esp8266. But sometime it is desirable to provide a simple interactive SMS interface for the Web User. An interactive SMS interface could be used to "page the SysAdmin" with the web user's supplied message.
Example Interactive Web SMS Interface |
Note: the Open SMS Gateway domain name that is used in the example is "textbelt.com", read their web page for details for Canadian and International use.
The following are excerpts from my ERB-EspWebServer.
Note: the RAW HTML code could be extracted from the example below and used with any Web Server.
The Setup:
// The Setup
#define OPT_MONITOR_DEBUG_OUTPUT 1
// ERB - Force format stings and string constants into FLASH Memory
// I use E() as an Alias for F() so that DEBUG code can be inserted
#define E(x) F(x)
// Used as an F() when being used as the first Element
// of a Multi-Element Expression
#define sE(x) String( F(x) )
// Defaults for Pager
#define DEFAULT_PAGER_GATEWAY "textbelt.com"
#define DEFAULT_PAGER_NUMBER "202-555-1212"
#define SYSTEM_ADMIN_PAGER_NUMBER DEFAULT_PAGER_NUMBER
Web Server Code Arduino Sketch Snippet:
// Pager - User Interactive Web Interface
sz += wprintln( E("\r\n<!-- Pager - User Interactive Web Interface -->") );
sz += wprintln( E("<center>") );
sz += wprintln( E("<hr width='75%' />") );
sz += wprintln(sE("<form action="http://")
+ DEFAULT_PAGER_GATEWAY + E("/text method='POST' target='SMS_Report' >") );
sz += wprintln( E(" <b>Page SysAdmin with </b>") );
sz += wprintln(sE(" <input name='number' type='hidden' value='")
+ SYSTEM_ADMIN_PAGER_NUMBER + E("' />") );
sz += wprintln( E(" <b>Message:</b>") );
sz += wprintln(sE(" <input name='message' type='text' value='")
+ gDeviceName + E(": ' />") );
sz += wprintln( E(" <input type='submit' value='GO' />") );
sz += wprintln( E("</form>") );
sz += wprintln( E("Or<br>") );
sz += wprintln(sE("<form action="http://")
+ DEFAULT_PAGER_GATEWAY + E("/text method='POST' target='SMS_Report' >") );
sz += wprintln( E(" <b>SMS Number:</b>") );
sz += wprintln( E(" <input name='number' type='tel' />") );
sz += wprintln( E(" <b>Message:</b>") );
sz += wprintln(sE(" <input name='message' type='text' value='")
+ gDeviceName + E(": ' />") );
sz += wprintln( E(" <input type='submit' value='GO' />") );
sz += wprintln( E("</form>") );
sz += wprintln( E("</center>") );
Note: I use my own custom "wprintln" function within the above example, modify as necessary.
For reference and to make things simple, I have extracted just the HTML from the above Sketch, as shown below.
HTML:
<!-- Pager - User Interactive Web Interface -->
<center>
<hr width='75%'>
<form method='POST' action='http://textbelt.com/text' target='SMS_Report' >
<b>Page SysAdmin with </b>
<input type='hidden' name='number' value='202-555-1212' />
<b>Message:</b>
<input type='text' name='message' value='Nod129: ' />
<input type='submit' value='GO' />
</form>
Or<br>
<form method='POST' action='http://textbelt.com/text' target='SMS_Report' >
<b>SMS Number:</b>
<input type='tel' name='number' />
<b>Message:</b>
<input type='text' name='message' value='Nod129: ' />
<input type='submit' value='GO' />
</form>
</center>
If you find this useful, leave a comment.
-- Home Page: https://WA0UWH.blogspot.com
Sunday, November 29, 2015
Esp8266 - with SMS
UPDATE: Sun Nov 29 22:14:04 PST 2015
Added details and Links
For my Esp8266 I wanted a easy way to send to my Cell Phone an SMS message.
For example: On a normal computers (Workstations and Raspberry PI) it is a simple mater of using "curl" to access an Open SMS Gateway (see previous post). I used this feature to report simple things like "reboot" and "backup finished" messages.
One such Open SMS Gateway is "textbelt.com", which is the one that I use. But, recently they were "black listed" by some of the Phone Carriers (my carrier) for abuse, apparently there was too much illegal traffic by the Gateway's users.
Textbelt has recently fixed the abuse and their Gateways is up and running again, or at least for my carrier.
For the Exp8266, I have created some functions that implements the "curl" protocol, (the heavy lifting), so now paging to my Cell Phone is a snap.
I am providing the functions here as just application snippets, hopefully you find them useful. I will put this in my ERB-EspWebServer GitHub (eventually).
The Setup:
The Functions:
Let me know if you find this useful, leave a comment.
-- Home Page: https://WA0UWH.blogspot.com
Added details and Links
For my Esp8266 I wanted a easy way to send to my Cell Phone an SMS message.
For example: On a normal computers (Workstations and Raspberry PI) it is a simple mater of using "curl" to access an Open SMS Gateway (see previous post). I used this feature to report simple things like "reboot" and "backup finished" messages.
One such Open SMS Gateway is "textbelt.com", which is the one that I use. But, recently they were "black listed" by some of the Phone Carriers (my carrier) for abuse, apparently there was too much illegal traffic by the Gateway's users.
Textbelt has recently fixed the abuse and their Gateways is up and running again, or at least for my carrier.
For the Exp8266, I have created some functions that implements the "curl" protocol, (the heavy lifting), so now paging to my Cell Phone is a snap.
I am providing the functions here as just application snippets, hopefully you find them useful. I will put this in my ERB-EspWebServer GitHub (eventually).
The Setup:
// The Setup
#define OPT_MONITOR_DEBUG_OUTPUT 1
// ERB - Force format stings and string constants into FLASH Memory
// USE WITH CAUTION !
// I use E() as an Alias for F() so that DEBUG code can be inserted
#define E(x) F(x)
// Used as an F() when being used as the first Element of a Multi-Element Expression
#define sE(x) String( F(x) )
// Defaults for Pager
#define DEFAULT_PAGE_GATEWAY "textbelt.com"
#define DEFAULT_PAGE_PORT 80
#define DEFAULT_PAGE_NUMBER "202-555-1212"
#define DEFAULT_PAGE_MESSAGE "Test"
boolean gPageStnReady = false;
The Functions:
// Pager
// ###########################################################
//////////////////////////////////////////////////////////////
//
// Provides easy access to page via SMS Gateway
//
boolean
//ICACHE_FLASH_ATTR
page( String aMesgText = DEFAULT_PAGE_MESSAGE,
String aNumber = DEFAULT_PAGE_NUMBER,
String aHost = DEFAULT_PAGE_GATEWAY,
int aPort = DEFAULT_PAGE_PORT )
{
digitalWrite ( gBluLED, ON );
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
Serial.println ( );
Serial.println ( E("Starting Pager Client ...") );
#endif
String timeUTCBuf = "";
String mesgTextHeader = String(gDeviceName)
+ E(": ")
+ String(gRev)
+ E(", ")
+ timeUTC(timeUTCBuf, gTimeZONE)
+ E(" - ");
String mesg="number=" + aNumber
+ "&message=" + mesgTextHeader + aMesgText ;
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
Serial.println( sE(" Connecting to: ") + aHost );
#endif
// Use WiFiClient class to create TCP connections
WiFiClient client;
if (!client.connect(aHost.c_str(), aPort)) {
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
Serial.println(" Connection Failed");
#endif
return false;
}
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
Serial.println( sE(" MESG: ") + mesg );
#endif
// This will send the request to the server
client.print( sE("POST /text/ HTTP/1.1\r\n")
+ E("User-Agent: Esp8266/") + gRev + E("\r\n")
+ E("Host: ") + aHost + E("\r\n")
+ E("Accept: */*\r\n")
+ E("Content-Length: ")
+ String( mesg.length() ) + E("\r\n")
+ E("Content-Type: application/x-www-form-urlencoded\r\n")
+ E("\r\n") // The Required Blank Line
+ mesg + E("\r\n") );
delay(10);
// Wait for Client to Start Sending
int i = 0;
while( !client.available() ) {
delay(10);
if (i++ > 200) break;
}
// Read all the lines of the reply from server and print some to Serial
boolean myStatus = false;
while(client.available()){
String line = client.readStringUntil('\n');
if(line.indexOf("\"success\": true") >= 0) {
myStatus = true;
}
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
if(line.indexOf("\"success\": ") >= 0 ||
line.indexOf("\"message\": ") >= 0
) Serial.println(line);
#endif
}
client.flush();
client.stop();
#if (OPT_MONITOR_DEBUG_OUTPUT) > 0
Serial.println(" Connection Closed");
#endif
digitalWrite ( gBluLED, OFF );
return myStatus;
}
// ###########################################################
//////////////////////////////////////////////////////////////
//
// Provides easy access to Pager via SMS Gateway
//
unsigned long gPageHoldOff = millis();
void
//ICACHE_FLASH_ATTR
pageOnStnReady() {
if ( gPageHoldOff < millis() ) {
gPageHoldOff = millis() + 1 * MINs;
if ( gPageStnReady == false ) {
gPageStnReady = page("Stn Ready");
}
}
return;
}
// ###########################################################
// End
Let me know if you find this useful, leave a comment.
-- Home Page: https://WA0UWH.blogspot.com
Wednesday, November 25, 2015
Email sent from Raspberry PI
UPDATE:
Added details and Links
Sending Email from a Raspberry PI (or any typical Linux workstation) is NOT normally configured. But with the help of some optional commands it can be done with ease.
Also, see my previous post.
Some History
In the early days of Unix Workstations and Server, "sendmail" was typically configured by default, and therefore sending email was easy. In fact, it was "too easy", which allowed the bad guys to anomalously send SPAM. To combat SPAM most ISP's started requiring mail be "signed" (user name and password) by the originator, so it could be traced back to the point of origin.
Today
Often it is useful to send a simple status report, information, attachments, or a quick SMS messages from; a Linux Workstation, a small Raspberry PI, or a Beagle Bone.
Today "most" email must be signed, and because of that it has become more difficult to use email for sending mail even to oneself.
Note: There are a "few" Open Mail (SMTP) Gateways that can be used. But the gateways can not, and will not guarantee any kind of performance, or can not provide any reasonable expectations. These Open SMTP's are often used by SPAMMER.
Google'ing "Raspberry PI email" will provide several solutions.
But, most (if not all), require you use/save your EmailAddress and EmailPasswd as clear open-text on the command line or within a configuration file. I do not like that idea. There has got to be a better way?
One of the suggested solutions is "sendEmail", unfortunately it has a (some what) "complex" command line interface, and as above it normally requires the user to type an email password as clear open-text on the command line.
Note the upper case "E" in the sendEmail name.
To simplify, I have created a "Wapper Script", that can be used similar to those used in the early days of UNIX.
Examples:
$ date | mysendgmail some_user@gmail.com
or,
$ mysendgmail some_user@gmail.com < textfile
or, SMS
$ echo "Meet me for Lunch" | mysendgmail phonenumber@vtext.com
or, with an attachement
$ echo "Here is my report" | mysendgmail some_user@yahoo.com -a myfile
or
$ mysendgmail some_user@aol.com -s "My Status" -m I am driving, Do you want a ride.
Note: in the above example, @vtext.com is the Verizon SMS gateway, others could be used as necessary.
For the above examples, using my "Wapper Script", the users Gmail Password is prompted for, but does not display, see help text.
Also, see the included Help text for install instructions.
This Script makes my life easy, I hope you also find it useful. It is a little long for a blog post, but I wanted to provide it here before going to the trouble of setting up its own GitHub.
Note: some of the options of "sendEmail" have been used/perverted by this script to make the user interface easy and simple, which I find is a good compromise for functionality and usability.
Note: there is a BUG in the Raspberry PI implementation of "sendEmail", Again, see the Help text.
If all else fails, "sendEmail" is a useful tool even when used by itself.
This following is mysendgmail script:
-- Home Page: https://WA0UWH.blogspot.com
Added details and Links
Sending Email from a Raspberry PI (or any typical Linux workstation) is NOT normally configured. But with the help of some optional commands it can be done with ease.
Also, see my previous post.
Some History
In the early days of Unix Workstations and Server, "sendmail" was typically configured by default, and therefore sending email was easy. In fact, it was "too easy", which allowed the bad guys to anomalously send SPAM. To combat SPAM most ISP's started requiring mail be "signed" (user name and password) by the originator, so it could be traced back to the point of origin.
Today
Often it is useful to send a simple status report, information, attachments, or a quick SMS messages from; a Linux Workstation, a small Raspberry PI, or a Beagle Bone.
Today "most" email must be signed, and because of that it has become more difficult to use email for sending mail even to oneself.
Note: There are a "few" Open Mail (SMTP) Gateways that can be used. But the gateways can not, and will not guarantee any kind of performance, or can not provide any reasonable expectations. These Open SMTP's are often used by SPAMMER.
Google'ing "Raspberry PI email" will provide several solutions.
But, most (if not all), require you use/save your EmailAddress and EmailPasswd as clear open-text on the command line or within a configuration file. I do not like that idea. There has got to be a better way?
One of the suggested solutions is "sendEmail", unfortunately it has a (some what) "complex" command line interface, and as above it normally requires the user to type an email password as clear open-text on the command line.
Note the upper case "E" in the sendEmail name.
To simplify, I have created a "Wapper Script", that can be used similar to those used in the early days of UNIX.
Examples:
$ date | mysendgmail some_user@gmail.com
or,
$ mysendgmail some_user@gmail.com < textfile
or, SMS
$ echo "Meet me for Lunch" | mysendgmail phonenumber@vtext.com
or, with an attachement
$ echo "Here is my report" | mysendgmail some_user@yahoo.com -a myfile
or
$ mysendgmail some_user@aol.com -s "My Status" -m I am driving, Do you want a ride.
Note: in the above example, @vtext.com is the Verizon SMS gateway, others could be used as necessary.
For the above examples, using my "Wapper Script", the users Gmail Password is prompted for, but does not display, see help text.
Also, see the included Help text for install instructions.
This Script makes my life easy, I hope you also find it useful. It is a little long for a blog post, but I wanted to provide it here before going to the trouble of setting up its own GitHub.
Note: some of the options of "sendEmail" have been used/perverted by this script to make the user interface easy and simple, which I find is a good compromise for functionality and usability.
Note: there is a BUG in the Raspberry PI implementation of "sendEmail", Again, see the Help text.
If all else fails, "sendEmail" is a useful tool even when used by itself.
This following is mysendgmail script:
#! /bin/bash
# mysendgmail - Command line mail interface for Linux users,
# often on Raspberry Pi and other similar
# This script is a user friendly wrapper for "sendEmail"
# Because this script requires customization for each user,
# it should be save in each users $HONE/bin directory,
# as $HOME/bin/mysendgmail (or what ever name you like).
AUTHOR='Eldon R. Brown - WA0UWH - 2015/11/22'
REV='1.02.30'
# Notes:
# I think Google gmail allows 99 SMTP emails to be sent per day.
# Note: an SMS sent to a Cell Phone has a 160 Character Limit.
progname=`basename $0`
# The Gmail Account, these must be customized per user
from_user='userName@gmail.com'
gmail_user='userName'
#This is for Google Gmail, others could be used
SMTP='smtp.gmail.com:587'
# Setup for Bold, Highlight, and Normal output
B=`tput bold` G=`tput setf 2` N=`tput sgr0` H=${B}${G}
Usage="
${B}${progname}-${REV}, by: ${AUTHOR}${N}
${H}Usage:${N}
${progname} [mode] [-t] user@domain.com [[-s|-u] subject] [sendEmail args] -m message . .
. . | ${progname} [mode] [-t] user@domain.com [[-s|-u] subject] [sendEmail args]
Where: [mode] =
-n = Dry Run
-v = Verbose
-h = This help message
--h = This help message, plus more Info
--help = sendEmail help message, also see the
man page, as: man sendEmail
"
Info="
${H}More Info:${N}
To Install supporting functions:
$ sudo aptitude install sendEmail perl
$ sudo aptitude install libio-socket-ssl-perl libnet-ssleay-perl
See some sendEmail Examples, at: http://goo.gl/6LqX8Q
NOTE: There is a BUG in Raspberry PI's implementation
of: /usr/bin/sendEmail REV=1.56
Workaround:
replace 'SSLv3 TLSv1' with 'SSLv3' within /usr/bin/sendEmail
NOTE: The Gmail Passwd can be saved (and somewhat hidden)
in the current environment with:
$ export GPW; read -s -p 'Gmail Passwd: ' GPW; echo
And then later, it can be removed with:
$ unset GPW
"
# Main
# Check first arg for Help Message, or Version Info
case "${1}" in
(-V) echo -e "${progname}-${REV} by ${AUTHOR}"; exit;;
(-h|"") echo -e "${Usage}" >&2; exit;;
(--h) echo -e "${Usage} ${Info}" >&2; exit;;
(-help|--help) sendEmail --help >&2; exit;;
esac
# Check first arg for Dry Run or Verbose
case "${1}" in
(-n) DRYRUN='yes'; shift;;
(-v) VERBOSE='yes'; shift;;
esac
# Check next arg for Dry Run or Verbose, again to avoid order conflict
case "${1}" in
(-n) DRYRUN='yes'; shift;;
(-v) VERBOSE='yes'; shift;;
esac
# Prompt for Gmail Account Passwd, OR used the Environment Varrible $GPW
gmail_passwd="${GPW}"
if [ -z "${GPW}" ]
then read -s -p "Gmail Password: " gmail_passwd </dev/tty; echo
fi
# Parse Mail Address and Subject Args
# Check if First arg is "-t", if so ignore, ignore it and
# assume the next is email address
case "${1}" in (-t) shift;; esac
# Assume Next arg is the TO address
to="${1}"; shift
# Check if Next arg is "-s" or "-u", if so, ignore it and
# assume the next is the Subject
case "${1}" in (-u|-s) shift;; esac
Default_Subject="Sent: `date '+%Y/%m/%d %H:%M:%S'`"
# Assume Next arg is Subject
sub="${1:-${Default_Subject}}"; shift
# Setup DEBUG modes
# Check for DRYRUN mode, if so, Munge passwd for DRYRUN
if [ "${DRYRUN}" = "yes" ]; then gmail_passwd='"*****"'; fi
# Check for VERBOSE, For Debug
if [ "${VERBOSE}" = "yes" ]; then MODE='set -xv'; fi
# Build the Command
CMD="sendEmail -o tls=yes -s ${SMTP} \
-xu ${gmail_user} -xp ${gmail_passwd} \
-f ${from_user} -t ${to} -u ${sub} \
$@" # Adds user supplied sendEmail options
# Finally, Run Command
case "${DRYRUN}" in
(yes) echo $CMD;; # For Debug
(*) ${MODE}; $CMD | grep "`date '+%b %d'`";; # Report just the "basic" status
esac
# End
-- Home Page: https://WA0UWH.blogspot.com
Saturday, November 14, 2015
More 10m WSPR
UPDATE:
Added details and Links
Here is my: Today's 10m WSPR Report:
Most of the USA spots were logged during daylight hours, and then late in the day Australia and Japan spots were logged.
Sadly, even though I got up very early (2am local) to start my 10m WSPR Beacon, I did not receive any spots from Europe. Maybe I will get a Europe-Spot later next summer when we will share more daylight hours.
-- Home Page: https://WA0UWH.blogspot.com
Added details and Links
Here is my: Today's 10m WSPR Report:
My 2015/11/14 10m WSPR Report |
Info from Database |
Sadly, even though I got up very early (2am local) to start my 10m WSPR Beacon, I did not receive any spots from Europe. Maybe I will get a Europe-Spot later next summer when we will share more daylight hours.
-- Home Page: https://WA0UWH.blogspot.com
Thursday, November 12, 2015
10m WSPR from PNW
UPDATE:
Added details and Links
After reading Roger's - G3XBM 10m WSPR to USA Blog, I decided to try to help make a USA to Europe WSPR connection.
It took a little futzing to adjust the normal WSPR Radio Dial Frequency 28.1246MHz (down by 110Hz) to get my RF into the center of the 200Hz wide WSPR band. My first spot report indicated that I was above the band by a few Hertz. Setting to 28.1245MHz fixed the problem.
Sever spots later, it is obvious that the Pacific Northwest was very much under represented on the 10m WSPR map, my station is the only one, see: upper-left on the map below.
My goal now is to wait for the band to change for Europe and/or Far East stations. I will have to wait and see if it opens.
Currently I am running my Phone WSPR Beacon APP, with acustic/VOX connection to the Radio (see previous post). I have a Proper wired Phone/Tablet "Radio Interface" on order. With the new interface I will be able to run this and other Digital APPs without room noise interference.
But for proper encode/decode WSPR operations, a Workstation running the complete "WSPR" program is really necessary as the Android WSPR App does not decode received signals, it runs in Beacon mode only. Some other Digital Phone Apps will encode and decode, see DroidPSK.
UPDATE: 21:45Z
Now 10m is opening West to Australia.
It will be interesting to see what happen when the "Gray Line" gets nearer my location.
Interesting, some people spell it "Gray Line" and others "Grey Line"? I think "Gray Line" is correct.
UPDATE: 01:30Z
Well, the "Gray Line" was uneventful, only one station, I was expecting more Far East spots.
UPDATE: 01:50Z
QSY to 40m WSPR.
-- Home Page: https://WA0UWH.blogspot.com
Added details and Links
After reading Roger's - G3XBM 10m WSPR to USA Blog, I decided to try to help make a USA to Europe WSPR connection.
It took a little futzing to adjust the normal WSPR Radio Dial Frequency 28.1246MHz (down by 110Hz) to get my RF into the center of the 200Hz wide WSPR band. My first spot report indicated that I was above the band by a few Hertz. Setting to 28.1245MHz fixed the problem.
Sever spots later, it is obvious that the Pacific Northwest was very much under represented on the 10m WSPR map, my station is the only one, see: upper-left on the map below.
I am the only Northwest 10m WSPR Station |
Currently I am running my Phone WSPR Beacon APP, with acustic/VOX connection to the Radio (see previous post). I have a Proper wired Phone/Tablet "Radio Interface" on order. With the new interface I will be able to run this and other Digital APPs without room noise interference.
But for proper encode/decode WSPR operations, a Workstation running the complete "WSPR" program is really necessary as the Android WSPR App does not decode received signals, it runs in Beacon mode only. Some other Digital Phone Apps will encode and decode, see DroidPSK.
UPDATE: 21:45Z
Now 10m is opening West to Australia.
10m at 21:45Z |
Interesting, some people spell it "Gray Line" and others "Grey Line"? I think "Gray Line" is correct.
UPDATE: 01:30Z
Well, the "Gray Line" was uneventful, only one station, I was expecting more Far East spots.
10m Spots At and After Gray Line |
UPDATE: 01:50Z
QSY to 40m WSPR.
-- Home Page: https://WA0UWH.blogspot.com
Wednesday, November 11, 2015
Working WSPR With a Phone APP
UPDATE:
Added, additional details.
Today for fun, I wanted to try working with WSPR again, I have not done that for a long time.
I found a Android Phone WSPR Beacon APP, that generates the WSPR tones, which when acoustically coupled to a Radio with VOX, transmits as necessary.
The WSPR Beacon App runs on both my Cell Phone and my Samsung Android Tablet. As with all WSPR programs, the system clock must be set within a second (or two) of the real time.
The Cell Phone network maintains my phone with an accurate system clock.
But my Tablet does NOT allow itself or "third party" Apps to "Automatically" change the clock from an Internet or GPS time standard. And therefore, an Interactive Clock Set is necessary. I use the ClockSync App for this. It is reasonably simple - just set the Time to the next whole minute, and then press an on-screen button at the beep (after a count down, it tell you when).
Using my Cell Phone to Generate WSPR Tones, here are the results on the WSPR Map:
After 2.5 hours of working 40m and 20m, my WSPR Beacon was received by 16 stations for a total of 89 Spots, some spots were obviously repeats. The furtherest station was 3894km.
Note: The WSPR Phone APP is "Beacon-ONLY", that is, it does NOT receive, decode, or report on signals.
It was fun and simple !
-- Home Page: https://WA0UWH.blogspot.com
Added, additional details.
Today for fun, I wanted to try working with WSPR again, I have not done that for a long time.
I found a Android Phone WSPR Beacon APP, that generates the WSPR tones, which when acoustically coupled to a Radio with VOX, transmits as necessary.
The Acoustic WSPR Interface (Note: Unlike what the photo shows, the Power was actually set to 5 Watts) |
The Radio was Set Up for VOX on 20M |
The Cell Phone network maintains my phone with an accurate system clock.
But my Tablet does NOT allow itself or "third party" Apps to "Automatically" change the clock from an Internet or GPS time standard. And therefore, an Interactive Clock Set is necessary. I use the ClockSync App for this. It is reasonably simple - just set the Time to the next whole minute, and then press an on-screen button at the beep (after a count down, it tell you when).
Using my Cell Phone to Generate WSPR Tones, here are the results on the WSPR Map:
16 Stations, 89 Spots |
From My Location |
Timestamp Call MHz SNR Dft Grid Pwr Repter RGrid km az
2015-11-11 18:44 WA0UWH 14.097177 -24 3 CN88xc 5 XE1NW EK08 3894 140
2015-11-11 18:56 WA0UWH 14.097171 -30 0 CN88xc 5 W0RPK FM15hn 3891 94
2015-11-11 18:44 WA0UWH 14.097182 -30 4 CN88xc 5 KU4QI EM87bx 3260 96
2015-11-11 18:44 WA0UWH 14.097189 -26 4 CN88xc 5 K5CZD EM32vn 3032 114
2015-11-11 18:56 WA0UWH 14.097211 -24 0 CN88xc 5 KD6RF EM22lb 2883 118
2015-11-11 19:00 WA0UWH 14.097208 -20 0 CN88xc 5 K9DZT EN52wx 2679 90
2015-11-11 18:44 WA0UWH 14.097189 -11 3 CN88xc 5 AL7Q BP40fc 2310 316
2015-11-11 18:44 WA0UWH 14.097180 -27 3 CN88xc 5 WD0AKZ EN34mx 2238 88
2015-11-11 18:48 WA0UWH 14.097250 -3 0 CN88xc 5 NO1D DM34tn 1705 148
2015-11-11 19:28 WA0UWH 14.097225 -10 0 CN88xc 5 N6RDR DM13cx 1610 166
2015-11-11 19:00 WA0UWH 14.097196 -27 1 CN88xc 5 K6PZB CM88nk 1077 184
2015-11-11 17:48 WA0UWH 7.040173 -4 1 CN88xc 20 W0AY DN26xo 625 103
2015-11-11 17:52 WA0UWH 7.040175 +2 0 CN88xc 20 KD7OA DN16 418 114
2015-11-11 17:24 WA0UWH 7.040178 -20 1 CN88xc 20 KF7O CN85oh 316 191
2015-11-11 18:12 WA0UWH 7.040180 -4 2 CN88xc 20 NC7U CN87qp 67 221
2015-11-11 17:52 WA0UWH 7.040180 -24 0 CN88xc 20 KD7HGL CN87ts 45 214
Note: The WSPR Phone APP is "Beacon-ONLY", that is, it does NOT receive, decode, or report on signals.
It was fun and simple !
-- Home Page: https://WA0UWH.blogspot.com
Saturday, October 24, 2015
XprotoLab USB Oscilloscope
UPDATE:
Added Fritzing Diagram and corrected other details.
My friend Larry - KB7KMO put me on to a neat little device - An XprotoLab USB Oscilloscope.
I write most of my Software Projects at my Desk, which is three flights of stairs above my Electronic Shop, below is where my normal 100MHz Oscilloscope Lives. Often a simple voltage measurement or logic level on a Protoboard Project pin or clock line is needed while developing software. A "local" and cheap oscilloscope would be handy.
The XprotoLab USB Oscilloscope is rated at 200KHz and -14v to +20v with Duel Inputs for Analogue Signals, 8 Digital Logic Lines, and Internal and External Sync. It also provides one Programmable Signal Output. It is powered from the USB, and can provide low-current power at 5v and 3.3v to external circuits, see the online Features and Specification. All of which is fine for my needs and simple measurements.
The XprotoLab USB Oscilloscope comes in several different configurations, I chose the inexpensive $20.00 XprotoLab-Plain configuration. This configuration requires an external Display via a MS Window or a Linux Workstation Application (xscope Free), or a Android Phone/Tablet Application (Oscilloscope Pro $8.00), and there may be other options.
The XprotoLab-Plain comes with User installed simple Headers, but I decided to install my own Double Sided Headers so that the board can be used upside-down with the Pin Labels exposed. Also, regardless of orientation, the double-sided headers provide additional pins for attaching female jumper wires on the exposed side. I am using it on a dedicated Solderless ProtoBoard.
I jumpered the 5v and 3.3v Pins out to the upper and lower ProtoBoard Rails and Added some 470uF Caps. I also provided DC Blocking Capacitors for quick and easy use for Analogue Input signals (depending on which hole the jumper wires are connected).
The software User Interface takes some time to understand, but most things are obvious. Currently I have the XprotoLab hooked up to my Esp8266 Esp13 Project.
It also seems to works well with both my Android Phone and Tablet.
So far, . . . I am impressed, I like it, . . . it does a great job, Thanks Larry !
-- Home Page: https://WA0UWH.blogspot.com
Added Fritzing Diagram and corrected other details.
My friend Larry - KB7KMO put me on to a neat little device - An XprotoLab USB Oscilloscope.
I write most of my Software Projects at my Desk, which is three flights of stairs above my Electronic Shop, below is where my normal 100MHz Oscilloscope Lives. Often a simple voltage measurement or logic level on a Protoboard Project pin or clock line is needed while developing software. A "local" and cheap oscilloscope would be handy.
The XprotoLab USB Oscilloscope is rated at 200KHz and -14v to +20v with Duel Inputs for Analogue Signals, 8 Digital Logic Lines, and Internal and External Sync. It also provides one Programmable Signal Output. It is powered from the USB, and can provide low-current power at 5v and 3.3v to external circuits, see the online Features and Specification. All of which is fine for my needs and simple measurements.
The XprotoLab USB Oscilloscope comes in several different configurations, I chose the inexpensive $20.00 XprotoLab-Plain configuration. This configuration requires an external Display via a MS Window or a Linux Workstation Application (xscope Free), or a Android Phone/Tablet Application (Oscilloscope Pro $8.00), and there may be other options.
XprotoLab With my Double Sided Headers Installed |
Fritzing Layout Diagram |
XprotoLab on Dedicated ProtoBoard |
The software User Interface takes some time to understand, but most things are obvious. Currently I have the XprotoLab hooked up to my Esp8266 Esp13 Project.
Xscope Display on my Linux Workstation |
So far, . . . I am impressed, I like it, . . . it does a great job, Thanks Larry !
-- Home Page: https://WA0UWH.blogspot.com
Monday, October 12, 2015
Esp8266 Esp-13 - Testing
Today I found time to do some Contrived Stress and Speed Tests on my latest ERB-EspWebServer Code, using the Esp8266 Esp-13 module.
( 20Esp Tabs x 30KB ) / 4Sec = 150KB Per Second Created and Transferred
The Esp-13 ran for about 1 hour, before I got GREEDY, an attempted to
open more Browser Tabs. At about 35 Tabs things started to FAIL, the
update page rate was decreasing, and eventually the Esp-13 crashed and
rebooted itself.
That was fun, . . . the Esp-13 was just . . . Smok'ng !!
I am impressed and very happy with the results.
I will soon update my GitHub Repository with the revised and much faster code.
Let me know if you are interested in participating in a Live Internet Stress Test.
The initial Internet Tests (with my friend Jeff) suggests the Home Page will update at about 6 seconds per page over the Internet, with the Auto Update rate set to 3 Seconds. And, which, of course, is going to be very dependant on my end of a very slow network. So far, we have not done any multi-Tab Test.
Soon, for some more Tests, I plan to connect the Esp-13 to a Very Fast Internet Connection at my Son's house, stay tuned for that.
-- Home Page: https://WA0UWH.blogspot.com
- For the Tests , the Esp-13 was on a local WIFI network, running at 160MHz, with 4MB of 80 MHz Flash.
- My Workstation is hard wired connected to the same network via a switch.
- The Http Transfer Protocol used is "CHUNKED".
- The Automatically Refreshed (4 Second) Home Page was a little over 30KB.
- My Workstation had 20 Tabs open, each connected to the Esp's Home Page.
- The included Graphic was showing a steady 15.8KB FreeHeap.
- The Test Home Page has; Text, Graphs, Charts, and SVG Images, all Dynamically Created for each Http request.
- Also, during the Test, mDNS was scheduled and updated each 5 minutes, ntp was updated each 30 minutes.
- Diagnostic Trace and Status was being Created and Displayed on the Workstation Arduino IDE Monitor via USB.
- My Normal Workstation work (which was unavoidable) was also being done during the Tests.
( 20Esp Tabs x 30KB ) / 4Sec = 150KB Per Second Created and Transferred
One of 4 Groups of 5 Esp Tabs |
Typical Monitor Output |
I am impressed and very happy with the results.
I will soon update my GitHub Repository with the revised and much faster code.
Let me know if you are interested in participating in a Live Internet Stress Test.
The initial Internet Tests (with my friend Jeff) suggests the Home Page will update at about 6 seconds per page over the Internet, with the Auto Update rate set to 3 Seconds. And, which, of course, is going to be very dependant on my end of a very slow network. So far, we have not done any multi-Tab Test.
Soon, for some more Tests, I plan to connect the Esp-13 to a Very Fast Internet Connection at my Son's house, stay tuned for that.
-- Home Page: https://WA0UWH.blogspot.com
Wednesday, October 7, 2015
Esp8266 Esp-13 Programming Fixture
UPDATE:
Updated Image with Chip Bypass Cap
Here is my Esp-13 Programming Fixture in Fritzing format.
The Esp-13 and its Adaptor plugs in place of the dual 9-pin headers, see previous blog page.
-- Home Page: https://WA0UWH.blogspot.com
Updated Image with Chip Bypass Cap
Here is my Esp-13 Programming Fixture in Fritzing format.
Esp8266 Esp-13 Programming Fixture |
-- Home Page: https://WA0UWH.blogspot.com
Sunday, October 4, 2015
Esp8266 - Futzing with Fritzing
UPDATE:
Updated Image with Chip Bypass Caps
My friend Larry - KB7KMO mentioned Fritzing (CAE) in one of his email the other day.
Several years ago, I looked at Fritzing when is was very beta, it was interesting then, but lacked a lot of what I needed for Experimental Circuits and PCB Hobby Productions.
I updated to the latest Revision (0.9.2b), to take another look.
For what I am doing now with PlugBoards (protoboards) it may help with documentation and project sharing.
This is my first real Fritzing Project, it is my Esp8266 Programming Board. Note: the ERB-EspWebServer Farm (see previous posts) will similarly be documented in another Post.
I still need to create some custom parts. For the above Image, I have used "place-holders" images for the Power Source, Esp's and Prop Plug.
So far, Fritzing has been a little frustrating, but that maybe just my leaning curve. You will likely see Fritzing used in some of my future Posts.
UPDATE:
To increase brightness of LED, Reduce the value of the LED Resistors (e.g., down to 2.2K).
-- Home Page: https://WA0UWH.blogspot.com
Updated Image with Chip Bypass Caps
My friend Larry - KB7KMO mentioned Fritzing (CAE) in one of his email the other day.
Several years ago, I looked at Fritzing when is was very beta, it was interesting then, but lacked a lot of what I needed for Experimental Circuits and PCB Hobby Productions.
I updated to the latest Revision (0.9.2b), to take another look.
For what I am doing now with PlugBoards (protoboards) it may help with documentation and project sharing.
Esp8266 Esp-11 Programming Fixture |
So far, Fritzing has been a little frustrating, but that maybe just my leaning curve. You will likely see Fritzing used in some of my future Posts.
UPDATE:
To increase brightness of LED, Reduce the value of the LED Resistors (e.g., down to 2.2K).
-- Home Page: https://WA0UWH.blogspot.com
Wednesday, September 9, 2015
Esp8266 - An Unplanned Stress Test
Saturday (9/5) about 5:00pm, I had an interesting and unexpected surprise, HACKADAY publish a note about my ERB-EspWebServer.
As a result, my Blog and the my ERB-EspWebServer Farm were hammered with Internet requests.
With only one Esp8266 Farm Server working (nod169) at the time (others were offline) the request rate was intense. For the next 16 hours the single Esp8266 served about 1650 page requests for 1050 unique visitors. When "choked" with Internet Requests, the Esp successfully rebooted itself (several times), and I only occasionally had to help with a power-on reboot.
The above shows the first 16 hours of the onslaught.
The next day about 10:00am the Internet Requests were still coming in, I had to leave for the day, and therefore had to leave the Esp to its own fate. It eventually crashed, and therefore it was mostly down for the next 24 hours.
Once I returned, the Internet Requests started up again, with a little less intensity. And now, 4 days later, the Esp is receiving about 10 hits per hour, see current/live stats here. So far, the Esp has handled about 3500 requests.
Today I added new code to serve a local "Server Farm Photo" which is about 30KB, it can be seen on the current Esp Server Info Page.
This has been a fun and exciting Experiment of Esp Web Server Load Survivability, the Esp8266 did well for itself !!
-- Home Page: https://WA0UWH.blogspot.com
As a result, my Blog and the my ERB-EspWebServer Farm were hammered with Internet requests.
With only one Esp8266 Farm Server working (nod169) at the time (others were offline) the request rate was intense. For the next 16 hours the single Esp8266 served about 1650 page requests for 1050 unique visitors. When "choked" with Internet Requests, the Esp successfully rebooted itself (several times), and I only occasionally had to help with a power-on reboot.
The above shows the first 16 hours of the onslaught.
The next day about 10:00am the Internet Requests were still coming in, I had to leave for the day, and therefore had to leave the Esp to its own fate. It eventually crashed, and therefore it was mostly down for the next 24 hours.
Once I returned, the Internet Requests started up again, with a little less intensity. And now, 4 days later, the Esp is receiving about 10 hits per hour, see current/live stats here. So far, the Esp has handled about 3500 requests.
Today I added new code to serve a local "Server Farm Photo" which is about 30KB, it can be seen on the current Esp Server Info Page.
This has been a fun and exciting Experiment of Esp Web Server Load Survivability, the Esp8266 did well for itself !!
-- Home Page: https://WA0UWH.blogspot.com
Tuesday, September 1, 2015
My Experimental Exp8266 Web Sever - is on GitHub
UPDATE:
Here are some interesting links for the Esp8266:
I have put my “ERB Esp8266 Experimental Web Server” on GitHub, at:
My Esp8266 server is “often/sometimes” online at:
The SSID and Passwd are blank and need to be set in the Main.ino file
A shared Visitor Map IdKey is also set in Main.ino, if used as is, any access to your server will generate a “Shared Visitor Map”. In Ham Radio terms, this is called a “Reverse Beacon” to a shared service. Of course, you can request your own private IdKey.
I hope you find it useful as a working example. I have tried to include many pages and functions that I plan to use in my other Esp Projects
NOTE: All web page data is purposefully dynamically created by the Esp8266, except the “Server Farm” image on the InfoPage, and the “Visitor Map” function on the HomePage.
More functions and/or pages will be added as time permits, and I will update the GitHub as necessary.
As maybe expected, the Esp is sometimes fickle, reboot may be needed occasionally.
Feedback is always welcome.
-- Home Page: https://WA0UWH.blogspot.com
Here are some interesting links for the Esp8266:
- http://tech.scargill.net/esp13/
- http://www.esp8266.com/
- https://www.facebook.com/esp8266wifi
- https://hackaday.com/2015/09/05/esp8266-web-server-farm
I have put my “ERB Esp8266 Experimental Web Server” on GitHub, at:
My Esp8266 server is “often/sometimes” online at:
The SSID and Passwd are blank and need to be set in the Main.ino file
A shared Visitor Map IdKey is also set in Main.ino, if used as is, any access to your server will generate a “Shared Visitor Map”. In Ham Radio terms, this is called a “Reverse Beacon” to a shared service. Of course, you can request your own private IdKey.
I hope you find it useful as a working example. I have tried to include many pages and functions that I plan to use in my other Esp Projects
NOTE: All web page data is purposefully dynamically created by the Esp8266, except the “Server Farm” image on the InfoPage, and the “Visitor Map” function on the HomePage.
More functions and/or pages will be added as time permits, and I will update the GitHub as necessary.
As maybe expected, the Esp is sometimes fickle, reboot may be needed occasionally.
Feedback is always welcome.
-- Home Page: https://WA0UWH.blogspot.com
Friday, August 28, 2015
Esp8266 Esp-13 to DIP Adaptor
UPDATE:
Added Links and Details
I recently received my homebrew Esp8266 Esp-13 to DIP Adaptors from OSHPark.com. With only a little sanding of the edges they were ready to assemble.
I made the adaptor available as a free "shared project" on OSHPark.com site. They are inexpensive at $4.20 for a set of three. Note: I suggest you order 9 or 12 (or more) to make the free shipping more tolerable for the good folks a OSHPark.
Let me know if you find this adaptor board useful.
Soldering the two Castellated Edge Connections was much easier than I thought, with a little rosin on each edge, solder wicked into half-round-holes to form a nice solder bridges between the two boards.
The SMT Headers were easily soldered on the back. They are inexpensive and available on ebay, for example: here.
The results can be plugged into a Solder-Less Protoboard, or into a 18 Pin DIP socket. For production, this adaptor would not be appropriate, but for experiments and prototypes, it works great.
The Esp8266 Esp-13 has 4M Bytes of Flash, compared to 512K Bytes on the typical lower numbered modules. Esp-13's are available from several suppliers on ebay. for example: here.
Note: Currently, Esp-13 information is a little sparse on the Internet.
UPDATE:
An another Esp-13 Resource link
-- Home Page: https://WA0UWH.blogspot.com
Added Links and Details
I recently received my homebrew Esp8266 Esp-13 to DIP Adaptors from OSHPark.com. With only a little sanding of the edges they were ready to assemble.
I made the adaptor available as a free "shared project" on OSHPark.com site. They are inexpensive at $4.20 for a set of three. Note: I suggest you order 9 or 12 (or more) to make the free shipping more tolerable for the good folks a OSHPark.
Let me know if you find this adaptor board useful.
The Adaptor and Parts |
SMT Headers Installed |
Ready to Use |
Inserted into a Solder-Less Protoboard |
Note: Currently, Esp-13 information is a little sparse on the Internet.
Esp8266 Esp-13 Face Plate (18 x 20mm) |
Esp8266 Esp-13 Pinouts |
UPDATE:
An another Esp-13 Resource link
-- Home Page: https://WA0UWH.blogspot.com
Friday, August 21, 2015
More Esp8266 Web Server Farm
I have my Experimental Esp8266 Web Server Farm
up and running (see photo on original post), for your continued review,
it is even faster, and will support many more browse connections.
With "AutoUpdate" set to 60 seconds, I have had as many as 25 browser tabs connected to one of my Esp servers. It normally eventually fails, that is, when more than 4 connections are requesting updates simultaneously. But it was fun to watch the mayhem. Sometimes the ESP even recovers on its own.
I have now included a "Visitor Map", so I can see where connections are coming from, see below.
There are three Esp8266's in this "farm", all using the identical source code. And because of that; the displayed Visitor Map will appear Identical on each, that is because they all contain the same "map registration key" which is used by http://www.revolvermaps.com.
As indicated on a previous post, access to my farm is via a generic IPA:Port connection, which is: http://dc02.ebcon.com:8160, which I had previously changed in my router as necessary to externally connect to a particular Esp (local IPA:80).
For the other devices in my Esp Farm (and bench), use PORT: 8162, 8168, 8169 and/or 8172 (note: one of these will also be also connected to the generic 8160 port). Note: one or more may not be working at any point in time, try one of the others.
With only my local tests and a little WIFI activity, so far the small and simple power supply has survived, and actually worked well. I may need to add "more power" with more concurrent user accesses.
An Interesting Idea: If other Esp Programmers with similar Experimental Public Accessible Esp Servers include the same "map registration key" (a short line line of Html code) we could create a "pseudo reverse beacon" that would display to the "world" our intense shared interest in the Esp. On each configured Esp Web Servers, the "Visitor Map" will display all web connections to our "Esp Web Collective". How fun is that!!??
Let me know if you are interested, I will share details (or you can extract the keys from my Esp web Home Page source list).
It's all fun, . . . with the ESP's !!!
For more Esp8266 information on this blog use this Search.
-- Home Page: https://WA0UWH.blogspot.com
With "AutoUpdate" set to 60 seconds, I have had as many as 25 browser tabs connected to one of my Esp servers. It normally eventually fails, that is, when more than 4 connections are requesting updates simultaneously. But it was fun to watch the mayhem. Sometimes the ESP even recovers on its own.
I have now included a "Visitor Map", so I can see where connections are coming from, see below.
There are three Esp8266's in this "farm", all using the identical source code. And because of that; the displayed Visitor Map will appear Identical on each, that is because they all contain the same "map registration key" which is used by http://www.revolvermaps.com.
As indicated on a previous post, access to my farm is via a generic IPA:Port connection, which is: http://dc02.ebcon.com:8160, which I had previously changed in my router as necessary to externally connect to a particular Esp (local IPA:80).
For the other devices in my Esp Farm (and bench), use PORT: 8162, 8168, 8169 and/or 8172 (note: one of these will also be also connected to the generic 8160 port). Note: one or more may not be working at any point in time, try one of the others.
With only my local tests and a little WIFI activity, so far the small and simple power supply has survived, and actually worked well. I may need to add "more power" with more concurrent user accesses.
An Interesting Idea: If other Esp Programmers with similar Experimental Public Accessible Esp Servers include the same "map registration key" (a short line line of Html code) we could create a "pseudo reverse beacon" that would display to the "world" our intense shared interest in the Esp. On each configured Esp Web Servers, the "Visitor Map" will display all web connections to our "Esp Web Collective". How fun is that!!??
Let me know if you are interested, I will share details (or you can extract the keys from my Esp web Home Page source list).
It's all fun, . . . with the ESP's !!!
For more Esp8266 information on this blog use this Search.
-- Home Page: https://WA0UWH.blogspot.com
Wednesday, August 19, 2015
My WIFI Transfer Improvement - 160 Times
UPDATE: Aug 25, 2015
I was using an older revision of the Arduino IDE (old 1.6.4) and an old set of Exp Extensions.
With current IDE 1.6.5 and current Esp Ext's the "server.send()", "server.sendContent()", and "server.client().print()" functions all have about the same performance - fast.
The moral of the story, make sure your environment is up-to-date.
I use, and like, the Arduino IDE for ESP8266 software development and have used the "example code" for my initial efforts, but now, my interest expand beyond trivial examples.
Above is My Experimental Web Server Farm :-) (a little under powered, but it works)
Like many of the published ESP examples, I used a form of "server.send()" to transfer data via WIFI, but then I found "that" function is somewhat limited (or at least the way I understand it) and therefore I explored the available documentation and source code for other capabilities.
I found "server.sendContent()" which appeared more flexible and more to my desires for a transfer function. I have used "it" for several months for building my apps. My typical transfers are about 5K to 15K bytes, but can be as large as 100K bytes.
My dynamically created WEB Pages typically take about "6.5 seconds" to transfer to a browser, for a small device like the ESP's, I thought that was a little slow, but still usable.
Actually, for my application, I started considering abandoning the ESP's, due to lack of WIFI transfer speed.
BUT THEN, in some obscure recesses of some online web page, I found the "server.client().print()" function - A BIG SPEED IMPROVEMENT. Now the same dynamic WEB Page transfers in only "0.043 seconds" !!!!
For my application, that is a BIG speed improvement of 160 times faster. From my perspective, the little ESP is now a WIFI "screamer" !!
I really like it, . . . when something WORKS !!
This note is published here in hope that someone else finds this information useful. If previously known, it would have save me a lot of time and anguish.
I only wished I understood or knew this earlier, but then I am still learning the ESP (there is much to know). I am sure there are other ESP improvements or coding strategies that I have yet to discover. I plan to publish my "example" application code for others to review, use, and/or abuse.
For your review, my experimental ESP Web Server is (sometimes) running at:
-- Home Page: https://WA0UWH.blogspot.com
I was using an older revision of the Arduino IDE (old 1.6.4) and an old set of Exp Extensions.
With current IDE 1.6.5 and current Esp Ext's the "server.send()", "server.sendContent()", and "server.client().print()" functions all have about the same performance - fast.
The moral of the story, make sure your environment is up-to-date.
I use, and like, the Arduino IDE for ESP8266 software development and have used the "example code" for my initial efforts, but now, my interest expand beyond trivial examples.
Above is My Experimental Web Server Farm :-) (a little under powered, but it works)
Like many of the published ESP examples, I used a form of "server.send()" to transfer data via WIFI, but then I found "that" function is somewhat limited (or at least the way I understand it) and therefore I explored the available documentation and source code for other capabilities.
I found "server.sendContent()" which appeared more flexible and more to my desires for a transfer function. I have used "it" for several months for building my apps. My typical transfers are about 5K to 15K bytes, but can be as large as 100K bytes.
My dynamically created WEB Pages typically take about "6.5 seconds" to transfer to a browser, for a small device like the ESP's, I thought that was a little slow, but still usable.
Actually, for my application, I started considering abandoning the ESP's, due to lack of WIFI transfer speed.
BUT THEN, in some obscure recesses of some online web page, I found the "server.client().print()" function - A BIG SPEED IMPROVEMENT. Now the same dynamic WEB Page transfers in only "0.043 seconds" !!!!
For my application, that is a BIG speed improvement of 160 times faster. From my perspective, the little ESP is now a WIFI "screamer" !!
I really like it, . . . when something WORKS !!
This note is published here in hope that someone else finds this information useful. If previously known, it would have save me a lot of time and anguish.
I only wished I understood or knew this earlier, but then I am still learning the ESP (there is much to know). I am sure there are other ESP improvements or coding strategies that I have yet to discover. I plan to publish my "example" application code for others to review, use, and/or abuse.
For your review, my experimental ESP Web Server is (sometimes) running at:
-- Home Page: https://WA0UWH.blogspot.com
Thursday, August 13, 2015
DipTrace 2.9 Beta
DipTrace has just made available Update 2.9 Beta, which includes several new capabilities or functions. The most interesting/useful to me is "Configurable HotKeys".
During the last stages of a PCB edit, my productivity will now jump 1000%.
Previously making small trace-edits to (ensure connections or adjust) of the pours was an extremely tedious task.
Also, I have assigned:
And then, "T" and "[" reverts back to the normal top side view.
Note: A little Silkscreen text on each side helps orient yourself for each side.
And Yes I know "Mirror" has always been there, but it was always a "Pain-in-the-butt" to find it in the drop down menus, and therefore I seldom used it.
Thanks, DipTrace Team !!!
-- Home Page: https://WA0UWH.blogspot.com
I have assigned:
- "]" to Object -> "Update All Copper Pours"
- "Ctl-]" to Object -> "Unpour All Copper Pours"
Previously making small trace-edits to (ensure connections or adjust) of the pours was an extremely tedious task.
Also, I have assigned:
- "[" to View -> "Mirror"
And then, "T" and "[" reverts back to the normal top side view.
Note: A little Silkscreen text on each side helps orient yourself for each side.
And Yes I know "Mirror" has always been there, but it was always a "Pain-in-the-butt" to find it in the drop down menus, and therefore I seldom used it.
Thanks, DipTrace Team !!!
-- Home Page: https://WA0UWH.blogspot.com
Saturday, August 8, 2015
Enigma - Revisited
UPDATE:
See Below
I have watched and read several more articles regarding cryptography. Each suggest that any method that uses "reused keys" or "reused sheets" is doomed to be deciphered, especial with very fast computers available today. The Enigma Machine had a very large Key, one of 158,962,555,217,826,360,000 settings. Which is computed as:
Note: I did NOT verify the above expression :-)
It has been suggested that the use of the Enigma, which did NOT use a "reused key", had its own downfalls. The most fatal where the facts that any single character would never encrypt to itself, and the "day key" was transmitted twice, or read from a code book. History may have been recorded very differently without these two flaws.
The mechanics of the Enigma changed the running "key" with each character as the message is encoded, which is good. But, the starting "day key" was normally transmitted in a predictable formant twice at the beginning of each day.
I have played with my software implementation of the Enigma Machine, and have recently realised that software does not have-to-have the "limitation" imposed on the original Enigma Hardware, which had only 26 letters, 3 or 4 mechanical wheels, and jumper wires to implement the cypher.
My software implementation "could" easily use all of the ASCII codes (256, or maybe even more), as many "wheels" as desired, and with coded jumpers (in wheels and plug-boards) that "could" encode to themselves.
I think, flaws could be removed, as the "published" problems with the Enigma. And, it is easy to do, it is just a mater of some easy to implement software! A very long "day key" could be created with Diffie-Hellman key exchange that could be easily transmitted via the Internet. The Software Enigma could instantly encode and transmit a message the same way.
It was suggested that even with the knowledge of the internal working of the Enigma. it would have been a lot harder to break the code (if the flaws had been eliminated). The same is true with a software solution, the algorithm could be published without much fear.
I wonder: How long would it take to decipher text from my Greatly Expanded Software Enigma Implementation? With just 256 Letter Codes, 256 Wheels, and 1 plug-board?
The German Enigma Key would appear to be a VERY SMALL fraction of the size of the possible Keys with 256 Letter Codes and 256 Wheels.
Actually, I do not think that would/could ever be answered, the problem is just too big.
For now, Software algorithms are always fun to think about :-)
UPDATE:
Maybe "it", the number of keys for a 256 Letter Codes and 256 Wheels would NOT too big to calculate, I think it would be about:
256! * 256^256 =
27722102253833147750378752929772591901157254707422810843994850662178\
68509346387893431488607772479277687787895866917592862787498012527341\
20202941212930977432442839904764004089399268000448724122711559911607\
60779312819264238191417519113442331359269075602333340924686925409483\
99343102411050829848501735482622253522121728830342877764078525005364\
11706629786567706584325065474995318449040370842738828586810575264794\
12348783633571725165157131881436322357402582839932654806407271765546\
89263529741167130237617046563306987828896526138415818160291921177505\
94348668287596740843119974305008513344652339955774268612605659633484\
22635140831895266181475491155749645385538913890911142141920032414770\
49936109897934583258064087400757197847628192792690203621377980075882\
62413792355253854197130918506290943714329430352099968868502454316347\
64297297921292809713502427667689713905790084360261562757916556588568\
03869079651490956618284957160374601554692062042172725556744686295735\
57378616587083471686842123962257930714832014899651587649367849037445\
00798192771870940669313631808910069334016000000000000000000000000000\
000000000000000000000000000000000000
This number is not as big as a "googolplex", but it is very large.
This was computed with the following on a Linux machine:
-- Home Page: https://WA0UWH.blogspot.com
See Below
I have watched and read several more articles regarding cryptography. Each suggest that any method that uses "reused keys" or "reused sheets" is doomed to be deciphered, especial with very fast computers available today. The Enigma Machine had a very large Key, one of 158,962,555,217,826,360,000 settings. Which is computed as:
5 * 4 * 3 * 26^3 * ( 26! / (6! * 10! * 2^10) ) = 158,962,555,217,826,360,000
Note: I did NOT verify the above expression :-)
It has been suggested that the use of the Enigma, which did NOT use a "reused key", had its own downfalls. The most fatal where the facts that any single character would never encrypt to itself, and the "day key" was transmitted twice, or read from a code book. History may have been recorded very differently without these two flaws.
The mechanics of the Enigma changed the running "key" with each character as the message is encoded, which is good. But, the starting "day key" was normally transmitted in a predictable formant twice at the beginning of each day.
I have played with my software implementation of the Enigma Machine, and have recently realised that software does not have-to-have the "limitation" imposed on the original Enigma Hardware, which had only 26 letters, 3 or 4 mechanical wheels, and jumper wires to implement the cypher.
My software implementation "could" easily use all of the ASCII codes (256, or maybe even more), as many "wheels" as desired, and with coded jumpers (in wheels and plug-boards) that "could" encode to themselves.
I think, flaws could be removed, as the "published" problems with the Enigma. And, it is easy to do, it is just a mater of some easy to implement software! A very long "day key" could be created with Diffie-Hellman key exchange that could be easily transmitted via the Internet. The Software Enigma could instantly encode and transmit a message the same way.
It was suggested that even with the knowledge of the internal working of the Enigma. it would have been a lot harder to break the code (if the flaws had been eliminated). The same is true with a software solution, the algorithm could be published without much fear.
I wonder: How long would it take to decipher text from my Greatly Expanded Software Enigma Implementation? With just 256 Letter Codes, 256 Wheels, and 1 plug-board?
The German Enigma Key would appear to be a VERY SMALL fraction of the size of the possible Keys with 256 Letter Codes and 256 Wheels.
Actually, I do not think that would/could ever be answered, the problem is just too big.
For now, Software algorithms are always fun to think about :-)
UPDATE:
Maybe "it", the number of keys for a 256 Letter Codes and 256 Wheels would NOT too big to calculate, I think it would be about:
256! * 256^256 =
27722102253833147750378752929772591901157254707422810843994850662178\
68509346387893431488607772479277687787895866917592862787498012527341\
20202941212930977432442839904764004089399268000448724122711559911607\
60779312819264238191417519113442331359269075602333340924686925409483\
99343102411050829848501735482622253522121728830342877764078525005364\
11706629786567706584325065474995318449040370842738828586810575264794\
12348783633571725165157131881436322357402582839932654806407271765546\
89263529741167130237617046563306987828896526138415818160291921177505\
94348668287596740843119974305008513344652339955774268612605659633484\
22635140831895266181475491155749645385538913890911142141920032414770\
49936109897934583258064087400757197847628192792690203621377980075882\
62413792355253854197130918506290943714329430352099968868502454316347\
64297297921292809713502427667689713905790084360261562757916556588568\
03869079651490956618284957160374601554692062042172725556744686295735\
57378616587083471686842123962257930714832014899651587649367849037445\
00798192771870940669313631808910069334016000000000000000000000000000\
000000000000000000000000000000000000
Or, about: 2.77221 x 10^1140 Keys
This number is not as big as a "googolplex", but it is very large.
This was computed with the following on a Linux machine:
$ echo "`echo 256 | factorial` * `echo '256^256'`" | bc
-- Home Page: https://WA0UWH.blogspot.com
Subscribe to:
Posts (Atom)