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!