Thursday, June 28, 2018

ESP32: a microcontroller with WiFi

I have been learning how to program microcontrollers lately, starting with the Arduino Uno, then the Arduino Nano, and then moving on to the ESP8266 and ESP32. My favorite is the ESP32 by Espressif Systems, a company based in China.

Unlike the Arduino UNO and Nano, which are based on the Atmel's ATmega328 8-bit processor, the ESP32 is a 32-bit microcontroller with built-in WiFi. Yes, built-in WiFi. Its predecessor is the ESP8266, also by Espressif. But the ESP32 is much faster, at 240 MHz, and has more on-board RAM (520KB). And it only costs a few dollars.

Besides being able to connect to existing networks via WiFi, it can also act as its own access point, which means that even in places without WiFi, people can still connect to it. And there is also a function called ESPNow which allows two ESP32s to communicate directly with each other wirelessly. No need for a router in between. Cool!

A lot of information on the ESP32 can be found at esp32.net. This includes information on the versions of the chip itself, modules, and development boards. Many development boards can be found on eBay or Aliexpress; just search for "ESP32 development board" on these sites. You can also buy a PCB module (such as the ESP-32S) and solder it onto a breakout board. A development board which seems quite interesting is the MH-ET ESP32 MiniKit. There is also the ESP32-DevKitC V2 from Espressif. There are also development boards with OLED, with battery holders, and even LoRA. Andreas Spiess has compiled a great comparison of what's available here.

Programming the ESP32 used to be via C using the development framework provided by Espressif, but there is now support for Arduino-style programming too.
https://github.com/espressif/arduino-esp32

If you only needs a few GPIO pins to do simple stuff, an 8-bit controller like the ATmega328, or even ATtiny85 would be enough. But once you start to do something more complex, I guess the ESP32 would be a better candidate. Personally, that's what I do now. 8-bit controllers for the simple stuff, ESP32 for everything else.

There are even people trying to design controller boards for 3D printers using the ESP32.
ESPRamps
ESP32 3D printer controller
Even Marlin 2.0 (still under development, available as bugfix-2.0.x branch) is trying to include support for the ESP32 as a 3D printer controller. Wow!

That's all for now. I will subsequently touch on the boards that I use, which includes the M5Stack series that aims to make prototyping with the ESP32 that much easier. Until then!

Saturday, June 23, 2018

So which is it, Trump?

Donald Trump says North Korea still poses 'extraordinary threat' as he extends sanctions for a year
Huh? I thought Trump said North Korea is no longer a threat? I thought he said the summit was a huge success?

Trump Urges Republican Lawmakers to Drop Immigration Bill Until Election
Huh? I thought he wanted Congress to quickly work on passing immigration regulation so that families don't have to be separated? I thought he wanted Congress to work on closing American borders?

So which is it, Trump?
Is the North Korean threat gone, and your summit a success? Or was the summit a failure, and the threat still exists?
Do you want Congress to work on closing the borders, or are you telling them the borders (and solving illegal immigration) can wait?
You can't have it both ways. So which way do you want your cake?

Friday, June 22, 2018

Looking at China's response to Trump's tariffs

When I look at China's response to the tariffs being imposed by the Trump administration, I cannot help but try and analyze it from the angle of strategy. After all, China is the country which gave birth to Sun-tzu, whose Art of War is still being studied today. In this case, what stands out is that Sun-tzu advocates: attack the enemy's strategy; if not, attack his alliances; avoid direct conflict (attacking his armies); and the worst thing one can do is a protracted conflict of attrition (attacking his cities).

In the context of this trade war, what does it mean? At first, China's retaliation with tariffs of its own seems to be a strategy of direct conflict. But I think that is only an appearance. This "direct conflict" is more likely a tactical move; the strategy is to set an example to the rest of the world that they can also stand up to the U.S. in this trade issue. In other words, it is an attempt at attacking U.S. alliances. It sets a precedence for Canada and the E.U. to retaliate with their own tariffs. And this works because Trump did not limit his rhetorics to China; he chose to cast his net wider, which only isolates him from America's friends. If Trump had limited his tariffs to China, China would be isolated. But now, instead, China can actually recoup the losses in trade with the U.S. through increasing trade with other countries which are similarly suffering from losses in trade with the U.S.

Looking deeper, I think it is also an attack on Trump's plan, which is to use tariffs to show that he is "doing something to help Americans." Trump's plan only works if the tariffs are one-way, impacting imports into the U.S and forcing American consumers to increase consumption of domestic production. But when it is two way, impacting American exports, it becomes a losing situation for both American consumers and producers. This is an attack on Trump's plan, that tariffs will improve American lives.

So China's retaliation, while looking like a lose-lose draw out trade war, may actually be a strategy of attacking America's alliances and Trump's strategy. We won't know for sure, but it certainly looks so to me. We just have to see how it plays out.

Tuesday, June 19, 2018

Fight fire with fire

With this policy of taking children away from their parents, the administration has entered a new low. Using children to blackmail his political opponents into doing his will is just too low a blow.

But instead of staying on this one issue, I think the way to expose the orange pumpkin is to overwhelm him. His WH is understaffed. It cannot deal with a multitude of issues. When the media is playing catch-up, responding to his actions, the WH is setting the tempo. That has to stop.

The media needs to seize the initiative. They need to force him to play at their pace, not his.

Keep throwing issues at him. Keep making him come up with "solutions" to issues, whether they are real or random. "What are you going to do about trade with Cuba?" "What are you going to do to help the farmers in Texas?" "When are you going to come up with a replacement for Obamacare?" "What are you going to do about the work being outsourced to India?" "How are you going to improve the ratings of American universities which are starting to fall behind Chinese ones?" Interview every woman who alleges something about him. Run TV programs about his failed businesses. Ask him what he is going to do to ensure fair admissions into American universities.

An understaffed WH cannot deal with all these issues coherently. The more issues they are pressed with, the less time they have to think through each one. And the orange pumpkin, when pressed, will sprout off whatever comes into his brain at that time. And then he will keep to it, thinking it is a good idea (no matter how bad). That will generate real issues, which can then be used to further pressurize him. Make it a cycle of endless issues for the WH to deal with, and eventually, they will do something that his base cannot stand. Pressurize him until he does something that turns his own base against him. And then, he will be out.

Don't let him start the fires. Light the fires around him, and let him and his staff tire themselves into mistake putting those fires out. Don't let him write your TODO list; the media should be the ones filling his TODO list until it runs out of space.

The way to fight fire is with fire.

Monday, June 18, 2018

Earthquake hits populous Osaka but there is no panic

Fires, collapsed walls, fallen pillars, power blackout, and the Japanese are acting as if this is just yet another day. Yes, there was quite a bit of coverage on the news when the earthquake hit the Osaka region this morning, but regular programming came back soon.

You really have to admire them.

First responders know what to do. The general public does not panic, they just bear with the inconvenience (no power, no water due to pipe bursts, trains stopped) and either wait or get on with life. Such is the Japanese people. 👍

Saturday, June 16, 2018

Wake up, America!

The United States of America used to be the shining beacon for democracy. The land of dreams. The country which exemplifies the rule of law. The country that fights for human rights.

And now, it has become a country that turns a blind eye to pussy-grabbers, child molestors. A country that invokes the name of God to inflict emotional pain on the children of God. Where people turn a blind eye even when those in power seek to undermine the rule of law.

A country where showmanship brings power. A country where truth is ignored in favor of lies. A country where elected officials do not dare to question or check the power of its leader. A country where the leader is the law, instead of being held to the law.

Wake up, America!

It pains those who love you to see you in such a state.

Sunday, June 10, 2018

No deal at G7, how about in Singapore?

In bombshell, Trump says U.S. backs out of G7 communique, criticizes Trudeau

“And it’s going to stop. Or we’ll stop trading with them.”

Yes! The best way to be America First is for America to be alone. When you are alone, you are always first! Bravo!

Trump leaves G-7 for North Korea summit, says Kim Jong Un has 'one-time shot'

“'I think within the first minute I’ll know' if North Korea is serious about a deal, said the president, who then touted his dealmaking abilities. 'Just my touch, my feel. That’s what I do.'”

Bravo! The one-minute man! Great to let Kim know that all he needs to do is put up a great act in the first minute to convince you to stay at the table. What better way to negotiate and strike a deal than to let the other side know how to catch your attention.

Thursday, June 07, 2018

Emperor Trump

Oh my, I think Trump is taking a page from Palpatine's playbook!😅

Here are some similarities:
1. Palpatine used trade (or rather, the Trade Federation) as an issue to draw people to his side. Trump is using trade as a central issue for his actions.
2. Palpatine used differences (those systems separating from the Galactic Republic due to differing opinions) as a way to manipulate the Galactic Senate into letting him do what he wants. Trump is using divisions in the country to manipulate Congress into doing the same.
3. Palpatine built an army of the republic against an implied threat (which was planted by Palpatine in the first place). Trump has increased spending to beef up the military against threats he conceived in his mind, or created due to his rhetorics.

Palpatine consolidated his power through the Clone Wars. It seems that Trump is trying to do the same: have a war to consolidate his power. That may explain why he has been taking such extreme measures to provoke regions of instability: pulling out of the Iran deal, shifting the U.S. embassy to Jerusalem, and calling Kim Jong Un various names. While he seems to be making peace with Kim, that is likely only on the surface. He is probably quite sure the talks won't work out, then he gets to declare war on Kim for playing the United States. Or he may just fight Canada or Mexico for retaliating against his tariffs.

And once Trump has his war? He can be like Palpatine, and get the Galactic Senate (or the U.S. Congress, in this case) to make him emperor.

All hail Emperor Trump and the United Empire! 😱

Monday, June 04, 2018

What can come from Trump meeting Kim

With the summit between Trump and Kim coming up next week, the question I have in mind is: what can come out of it?

Well, one of the best outcomes would be a promise from Kim that North Korea will completely denuclearize, which would then have to be followed by the U.S. removing troops from South Korea and the lifting of sanctions once denuclearization has been verified. This will greatly stabilize the region, and will be a major political victory for Trump too.

But my military background has taught me to be prepared for the worst case scenario. So, what are some of the bad outcomes?

1. Kim gets to meet Trump, but no deal is struck at the summit as both sides cannot agree on anything, and talks end. This will be a major political victory for Kim, as he would be the only North Korean leader to have achieved this. It will give him significant power to consolidate his own country behind him. But for Trump, it is the exact opposite. He loses face, as he has been saying he is a great deal-maker, but he fails to close a deal this time. Mainstream media has a field day attacking Trump for his failure to close a deal, probably along the line of "he is not the deal-maker he says he is."

2. Taking this further, Trump gets mad at having lost face and being attacked by what he calls "fake news." He uses the "no deal" and plays it as a sign that North Korea refuses to deal via diplomatic means, and embarks on military action against North Korea. The Republican Congress, afraid of losing supporters in the mid-terms, grudgingly plays along with Trump. However, South Korea does not support the U.S. in this war, as they see it being waged for the pride of Trump rather than for the good of the Korean people. And while Abe may want to help Trump in this war, the Japanese people are likely to be totally against military action without any basis. The U.S. ends up in a unilateral military action without support from its allies, plus having to face criticism from the rest of the world.

3. This becomes a perfect chance for China to step in and act as peace maker. With North Korea playing victim, the U.S. being seen as the aggressor, any positive outcome that China delivers will only help to heighten China's global prestige, and further expose the U.S.'s double standards in its dealings. Once China comes into the picture, the U.S. Congress will have no choice but to impeach Trump so as to deescalate the situation, as they know that any war with China (backed by the rest of the world) will hurt all parties, and will be exceptionally bad for the U.S. This further divides the U.S., which becomes fragmented politically, socially, and economically.

4. While the U.S. is recovering from the fragmentation, China takes a more active role on the global stage, further consolidating its power. It will be a long time before anyone else can rise to challenge China's global influence.

So while there may be a good outcome to this summit, it can also be the start of a road down a dark and dangerous path. I just hope that whatever happens at the summit, cooler heads will prevail.