Wednesday, February 27, 2019

Override or not?

Washington intrigue.

As Democrats move to block Trump's emergency declaration over the wall, Republicans are faced with a dilemma.

If the Mueller report comes out with damning evidence that Republicans cannot deny, it is not a zero chance that Pelosi becomes acting President until January 2021. After all, Pence is so tied up in Trump's campaign and administration, there may just be enough to push for his impeachment too.

And if so... then setting a precedence for executive overreach is not going to work out for the Republicans. In that one year while she is in power, she may use that precedence against the Republicans, and the Republicans will have no one else to blame.

So Republicans are faced with a choice:
1. Pray that Mueller has nothing. Stick with Trump's emergency declaration, and do not override his veto when it happens. Given the number of indictments to date on this case, hindsight may make them look like ostriches sticking their heads in the sand. But who knows? It is a political gamble, and some may be willing to take it.
2. Override Trump's veto when it happens. Break from Trump before the bad news from Mueller breaks, so that Trump doesn't end up dragging the entire GOP with him when he goes down. This may even be used to strike a deal with the Democrats (behind closed doors) to keep Pence. But of course, this will bring the Twitter wrath of Trump, so it is a political gamble that the GOP will be able to survive without Trump.

So it all boils down to Mueller. If Mueller remains tight-lipped, the GOP will need to take a gamble. But if Mueller lets slip some info to the GOP on where his report is going, the GOP will then be able to make a better assessment of the situation in choosing between Option 1 or 2 (probably 2, given all the indications to date).

And there is an Option 3: Trump declares war somewhere in the world (Iran, or most likely, Venezuela), and basically forces everyone to keep him in power so as not to risk the US losing a war through presidential impeachment. Dirty trick that ends up with people getting killed, but nothing is beyond or below Trump.

I guess this will be a week of backroom deals...
🤔

Thursday, February 21, 2019

Dune, as a movie--my thoughts

I am a fan of Dune by Frank Herbert. No secret to that. And a fan of The Lord of the Rings by J.R.R.Tolkien too. And it got me thinking, "Why can someone pull of a The Lord of the Rings movie, but no one has really succeeded yet at a Dune one?"

There has been The Lord of the Rings movies in the past, not just the one directed by Peter Jackson. But I think we can all agree that the ones by Peter Jackson were somewhat successful at visualizing the story. And there were Dune movies in the past too. But none of those were of similar success. Why?

Here are my thoughts.

For a start, movie length. Each movie in Peter Jackson's depiction was more than 3 hours long; more like 4 hours. That is really pushing the limit for movies; it is not an easy task to keep someone in a seat for 4 hours. But one movie per book, and Peter Jackson managed to do it. I think it is because Tolkien's writing style is very descriptive, which means a significant portion of the books were things that can become part of visual effects and costumes and scenery. Unlike words, movies don't need as much "time" to portray these. Another feature of Tolkien's writing is the effort he puts into world-building. There is quite a significant portion of the books spent on providing backgrounds to everything and everyone in the world. These can selectively be left out of the movie to cut down time without heavily impacting the overall plot.

But Frank Herbert's Dune is different in style and length. For a start, the series spans 6 books (or 8, if you could the two by his son, Brian, who sought to bring closure to the world developed by his father). If each book is going to become at least a 3-hour movie, we are looking at something like 20 hours or more. A daunting task even for someone thinking about making this into a TV series.

Then, there is the actual style. Frank Herbert's style of writing is less descriptive. He gave a lot of effort into building his characters, and developing plots within plots within plots. Which makes it hard for a director to choose what to cut; every part of the book is there to build up a plot within a plot within a plot, which the viewer may fail to comprehend fully if anything is left out. A lot of screen time is going to be devoted toward portraying all those dialogues and subplots. This means each book can easily run beyond 4 hours. Multiply that by 6 (or 8) books, and I think we know why no director is ready to take up the challenge of portraying the Dune series. Unless it is a TV series. But the problem is: some plots run deep and slow; something that happened in episode 3 may only be fully realized in episode 20. It is hard to convince a network to produce a series where a person must watch EVERY episode in order to get an idea of what is happening.

So there you have it, my superficial thoughts on the difficulties of portraying the Dune series on film. While the number of books is one issue, the more significant one, I believe, is the way the books are written. Still, as a Dune fan, I do hope someone will eventually take on the daunting task. After all, with video on-demand, it is easier nowadays for a person to not miss an episode.

Sunday, February 17, 2019

3D printing parts for military aircraft

First metallic 3D printed part installed on F-22

Wow.
Wow!

I had always been trying to push for the idea of adopting 3D printing technology to lower the cost of having to lug around spare parts onboard ships. Spare parts take up space which can be used for other purposes. But the issue with widespread implementation is: certification. Very few companies are willing to certify 3D printed parts as "meeting the required specifications to be used as a replacement" for their parts. After all, this puts them out of the parts business. They won't be able to sell spares anymore. It then falls on the onus of the ship owner to determine if those 3d printed parts are good enough, and given the risks involved, most owners are going to simply say, nada, not worth my time to try and test and certify.

But what we have now is the U.S. military setting an example. If 3D printed parts are good enough to be used as spares on a multi-million state-of-the-art fighter jet, there is no reason why they cannot be good enough for other forms of transportation. Of course, there is still the need for testing to make sure those parts meet the required specifications. But this move does help to lower the mindset hurdle.

Hopefully, more and more people will see the merits of using 3D printing to produce spare parts. The savings in storage space is obvious. But beyond that, it also helps to reduce the number of types of spares that one needs to keep on hand, and the turn-around time; the logistics implication is huge. There is a possibility here, an opportunity waiting to be explored. Let us move beyond the confines of traditional mindsets to see things at a different level.

Saturday, February 16, 2019

Palpatine and Trump, declaring emergencies

I really think Trump is a Star Wars fan.

Palpatine created a crisis by forming the separatists, then used this crisis made by him to gain emergency powers. Which eventually led to him usurping power for himself, and declaring himself emperor.

Trump created the rhetoric of a crisis at the border, and has now used this "crisis" created by him to declare an emergency to give him emergency powers. If we follow the movie script, this is going to end with him declaring himself emperor... 😅

Thursday, January 10, 2019

Update 1 on ESP32 3D printer control board

An update on the ESP32-based 3D printer control board I have been working on.

After getting everything soldered, I gave it a try. Connected it to a 12V power supply, with stepper drivers in place, a hotend and thermistor too.

And nearly started a fire.

Due to my own stupid oversight, the inductor on the board is too small. The rated current was not high enough to handle what the LM2596 needs. This resulted in the LM2596 not functioning as it should, giving an output voltage that is way too high. The 74HCT02 was also not functioning as planned, resulting in the MOSFET gates always on, and you can imagine the amount of current flowing into the hotend... I think this has to do with my understanding of how the 74HCT02 works. I am going to replace it with a 74HC126, which is more straightforward.

Will be changing the design to use a bigger inductor, and then check if it works, and changing to use a 74HC126. If this combination still does not work, then it may be time to use a proper MOSFET driver like the TPS2812.

Comments can be given here, or on GitHub.
GitHub repo.

Note: Issue fixed. Pre-launch version now available here. Some information on this has been updated here.

Tuesday, January 08, 2019

SMD reflow soldering with a frying pan

So I mentioned I was working on a 3D printer control board based on the ESP32.

I managed to solder this today. Using a frying pan for the SMD parts.

This is the same board, with through-hole parts hand-soldered.

But this post is more about the frying pan reflow method.

It was quite simple, actually.
1. Put solder paste onto the pads (I had a stencil).
2. Spend a few hours placing the SMD components onto the board.
3. Put the board on a frying pan.
4. Put pan on the stove.
5. Fire up the stove.
6. Use an infrared thermometer (like this one or this one) to check the temperature of the board. Once the board reaches about 200+ degrees Celsius, the solder paste should start to turn silvery. When that happens, turn down the heat a bit, to the minimum needed to maintain temperature.
7. Keep at this temperature (around 240 degrees Celsius) for about 30 seconds. That should be enough to ensure all parts are properly soldered.
8. Turn off the stove.

The important thing is to check the results. I had a bit of cross connection on the USB connector, where the TX and RX pins were joined by solder. So I used a hot gun to do a bit of rework, and now it works perfectly.

The next step is to test the board with an actual printer!

For those interested, this board is v0.6 of the MRR ESP 3DP board.

Friday, January 04, 2019

A.I. Thinker's ESP32-CAM module

I have always been interested in small wireless devices capable of streaming video, and had been trying to get the ESP32 to work with a camera module (OV7670) for quite a while with little luck. Then came the M5Stack camera module, which is an ESP32 module with an OV2640, and it works quite well. Except the ESP32 is a WROOM32, so it does not have PSRAM, and video processing is thus a bit slow. Code to get it working is here.

Then A.I. Thinker came up with a module that packs an ESP32, OV2640, and PSRAM. And guess what, it works! There is even an example in the official Espressif ESP32 Arduino core that supports this module.
To flash this module, you will need a USB to serial adapter, something like this. Connect 3.3V to 3.3V, GND to GND, TX on the adapter to RX (IO3) on the module, and RX on the adapter to TX (IO1) on the module. Then connect IO0 and IO2 to GND, and you are in flash mode. Use Arduino to flash the example (select baud rate as 115200; I had issues trying to flash at higher speeds), then remove IO0 from GND, press the RST button on the module, and you should be running the camera web server. If you open a terminal before pressing the RST button, you should see the ESP32 boot messages, plus a line that tells you what is the IP address of the camera. Oh, do remember to edit the sketch first with your SSID and password.

Resolution-wise, 400x225 works great, 640x480 was still okay. Anything larger was a bit laggy, but I have tried 1600x1200 and it was still working.

Specifications in English
Specifications in Chinese (A.I. Thinker website)

BTW, M5Stack has also came up with a PSRAM version of their camera module. It is called M5Camera. From what I gather, it uses a WROVER (which comes with PSRAM inside) instead of an external PSRAM chip.M5Stack's official code for it is here. The official Espressif example also supports the M5Camera.

Espressif's camera library/example.

My thoughts on artificial intelligence development in 2019

AI is all the hype now, and will probably continue to remain in the spotlight for years to come. 2019 is no exception. So what are the issues we need to be thinking about?

Well, imitation learning is making headway, with computers now able to learn how to move by looking at videos of humans making the same movements. Deep learning has always been good at imitation; AI is very much about computers trying to imitate humans in the first place. The next step in imitation learning is likely to be the inculcation of human values. Computers learn from data, and data is value-neutral; there is no "right" and "wrong", no "good" or "bad". But if AI is to be useful in the real world, it must be able to understand human values, and learn what we humans perceive as good and bad, right and wrong. Then, it must be able to apply these values in the same way that humans would.

A classic problem, and a very practical one, is how a car, autonomously driven, should react when it is in a situation where there is danger to human life. When it has to choose between endangering its occupants versus endangering the lives of those around it. When a human driver is faced with the same situation, he or she will make a split second decision based on values, experience, and past training. AI would have past training, and probably experience, but values are something that is still being pondered over. Coupled with the varying values that human beings have, what are those universal values, if they even exist, that should be incorporated into AI? How do we get computers to reflect these values in their actions? Should we allow users to customize values to suit the users, or are these values set by the companies who develop these products? And who is ultimately responsible for the actions of AI, and why?

Another interesting idea I have is about machine translation. As a translator with an interest in AI, development in machine translation is a double-edged sword. I want to see AI develop to a stage where it can do proper translations, but that would mean a drop in my own income. Still, I think the current challenges for machine translation are:
1. Machine learning of languages. Maybe we should split this learning up, into how we humans learn. We learn vocabulary, so maybe AI should have a portion set aside for machine learning using bilingual dictionaries. We then move on to sentences, and then entire paragraphs for context. So maybe, machine learning for machine translation should have a three-stage algo: vocabulary, sentence formation, context.
2. Bilingual texts. We know the Bible is widely used for machine learning in machine translation, because it is one of the few texts which is available in various languages. Still, the Bible is not the full scope of human experiences, and its context and vocabulary may be somewhat dated. The challenge, then, is how to take existing books that we have which are available in more than one language, and convert these into usable training texts, in an automated way. This requires natural language processing with text/sentence matching. This is not actually machine translation, but is part of the development essential for machine translation.

Lastly, I would like to see the current trend in applying AI to social good continue. We know that AI is not the magic cure, but still, its scope of application is getting wider by the day. What are the types of social issues which AI can be most effective in solving? How do we adapt AI to solve those issues? It may be time to take stock of this. While this is not a technical development, but findings in this area will help to shape the focus of technical development in AI.

Looking forward to a wonderful year of AI development in 2019!

Friday, December 28, 2018

Japan shared video of P-1 supposedly lit up by South Korean warship's fire control radar

Regarding the incident of an ROK naval vessel directing its fire-control radar at an MSDF patrol aircraft

Something new... I believe this is Japan's first use of social media to try and influence international opinion to be on its side.

BTW, 971 might not have replied on 121.5 MHz because she might not have been guarding on that frequency as she was not operating aircraft. And while the P-1 was well clear of 971... flying so near a warship is still poor manners. Observing minimum safety distances doesn't necessarily mean it is diplomatically sound.

And when the next Chinese aircraft flies this close to a JMSDF ship next time... very hard for Japan to complain with this video plain out in the open for everyone to see.

Thursday, December 27, 2018

Fast PCB prototyping

I am currently working on a 3D printer control board based on the ESP32.

Github: MRR_ESP_3DP

So I sent v0.6 of the board to JLCPCB, a PCB manufacturer in China, to take advantage of their special offer: USD2.00 for 10 pieces of PCB, as long as the PCB measures 100mm by 100mm or less. Really cheap, considering that most other Chinese manufacturers would charge at least USD5.00 for something similar.

I placed the order on 19 December, and received the product on 26 December! Wow! One week! And I choose the cheapest delivery option (S.F. Express).

The board was  designed using EasyEDA, which allows you to choose parts from LCSC (a Chinese components seller). And LCSC allows you to combine shipping with JLCPCB, which means that when I order those components from LCSC, they were also delivered together with the PCBs.

Now, the only thing left is to wait... because while most of the components are here, I am still waiting for my MOSFETs, bought on Aliexpress, to arrive. And those are taking the slow route here.

Anyway, for those who are interested, you can leave me your comments about the board here or in the comments section for this post.

Monday, December 17, 2018

65% in Japan against new immigration bill?

65% against Diet passage of foreign workers’ bill: Kyodo News poll

Japan has a shrinking population. It has an aging population. It is a no-brainer that it needs more young people to work and support the old and give them care. So trying to give reasons, whatever they may be, to stave off immigration is really detrimental to Japan's future.

The existing visa for foreign trainees does not really facilitate technology transfer to foreign countries. It is just being exploited as a workaround for companies to hire cheap foreign labour. Having a more comprehensive immigration bill is actually in the interest of these foreign workers, not against them. It is not morally right to bring in cheap labour, then turn them away after 5 years. If they have contributed to Japanese society, and can continue to contribute, there is no reason to send them home. The Japanese people may want Japan to stay Japanese, but maybe it is time to rethink what "Japanese" means. Is it about blood, ethnicity, and race? Is it about geographical boundaries? Or is it about an ideal held by a group of people?

Countries and people worry about immigration usually because they have a lack of identity. If they have a strong and well-defined identity, then immigration does not erode it; instead, it brings in diverse strengths to make it stronger.

Development of basic 3D printer control board based on the ESP32 microcontroller

This is a very basic 3D printer control board based on the ESP32.
MRR ESP 3DP

The main design considerations:
- Use only the ESP32, without any GPIO expansions.
- Fit within 100mm by 100mm of PCB space, so that cheap PCB fabrication services can be used for prototyping.
- Allow the use of TMC2130 and TMC2208 stepper motor drivers.
- Allow a heat bed current of up to 20A (theoretically, since I don't think it is really safe to be pushing so much current through a board).
- Allow 24V electronics (which means capacitors and mosfets must be rated for at least 24V).
- Have an AUX1 connector for MKS TFT32 or similar host, since the ESP32 does not have enough pins to support the Reprap LCD controllers (LCD2004 or LCD12864).

Well, if there are any comments, opinions, etc., please feel free to leave a comment here, or in the issues page for this.

Note: Pre-launch version now available here. Some information on this has been updated here.

Saturday, December 08, 2018

赏歌习字感慨万分

为何总在脑海里,
无法忘去,
无法放弃?
人生几何,
独自忧愁又有何意思?
明知走出去,
大好世界在等待,
却为何无法迈出那一步?
人生如梦,
全是一场空。
只怕梦醒后,
仍然一切空。

Tuesday, December 04, 2018

The on-going Nissan-Ghosn struggle

Ghosn’s legal woes highlight governance failings in Japan

"How do you do this without other people being complicit?"

Good question. The thing is, as with all corporate reports issued by major corporations, the report itself is a collective work, taking months to put together, and being approved by the Board of Directors before it is released. You would think that those on the Board would have noticed if there was anything unusual. Given the high salary they were paying Ghosn, you would think they would have noticed if that was under reported. And it is not just one report; it has been on-going for a while. Unless the entire board is a rubber stamp that approves anything put before it, it just doesn't make sense that no one pointed this out before, until now, when Ghosn is starting to work on a merger between Renault and Nissan.

"Japanese prosecutors say Ghosn and another Nissan executive, Greg Kelly, an American suspected of collaborating with him, were arrested because they are considered flight risks."

Bravo. And how is a foreigner as famous as Ghosn going to ever leave Japan without anyone noticing? Also, Kelly isn't really your Japanese ojisan who can easily mix into the crowd and leave the country. This just sounds more like Tokyo investigators trying to gain some media attention by arresting a prominent person. Well, this could backfire since it will draw unnecessary comparison to similar cases in the past, where most (Japanese) bosses were not thrown into detention. And those people can easily disappear; they are your Japanese ojisan.

Nissan reporting this major malpractice only now undermines Nissan as a company. If they can't even sort out their own house, how can we be sure they are doing the necessary to ensure that the cars they produce meet the safety standards required by law? Financial governance and safety governance are the same thing; it is a reflection of the management's commitment to adhering to the laws and regulations in place. The Board should be fired if they cannot uphold governance and maintain proper oversight over all activities within the company.

Ghosn's treatment, being thrown into detention, highlights the discrimination of the legal system in Japan, which treats foreigners harsher compare to Japanese counterparts. It undermines Japan's right to criticise other countries on human rights if they can't even sort that one out within Japan itself. North Korea detains foreigners. China detain foreigners. Japan can criticise them all Japan wants, but now Japan is going to earn itself a place close to North Korea and China for detaining foreigners without trial.

It looks good on TV, looks cool to have men in black suits carrying boxes of documents out of one's house or office, as if investigators are doing their jobs. But if you don't treat them equally, that cool image will always be tainted with one of bias.

Wednesday, November 28, 2018

Seminar at Australian Embassy in Tokyo

I attended a seminar at the Australian Embassy in Tokyo yesterday titled "Australia and Japan: Partners in a Time of Regional Turbulence." Guest speakers and panelists were Professor Michael Wesley, Professor Veronica Taylor, Professor John Blaxland, and Dr. Imelda Deinia from Australian National University; VADM (ret.) Hideaki Kaneda from the Okazaki Institute; and COL (ret.) Grant Newsham. They spoke and discussed about collaboration between Australia and Japan in various aspects ranging from economic to military amidst the changes of the times, with a more assertive China and the United States' current lack of a grand strategy in dealing with China.

Overall, the seminar was informative and, more importantly, thought-provoking. It made me think a lot more about the underlying issues, and what are the questions we really should be looking at. Dealing with China's actions in this day and age is one thing, but that means we will always be one step behind; we are reactive. The important thing is to have an overall grand strategy which guides the formation of plans as well as responses to China's actions.

And therein lies the next bigger question: what are we trying to achieve (the objective), and why do we want to achieve it (the purpose)?

Until we can answer ourselves on what the purpose is, what our objectives are, and what is our grand strategy for achieving this purpose and objectives, we will always be one step behind. And the most worrying part is: China is not as lost as us. China knows what it wants, and how to get there. China has shared a portion of its goals and plans with the rest of the world, but we would be stupid to believe that is everything, or that it is even entirely true. In trying to formulate our own purpose and objectives, we will need to discern China's through its actions and our understanding of the Chinese mindset, culture, political system, society, etc.

We have a late start in this race, but being late is better than not being there at all.

I will share more of my thoughts related to this in subsequent posts. Quite a bit to sort out.