I read an article in Elektor about an amazing Maixduino hardware board which provides an AI system in an Arduino compatible package.
The board is packed full of juicy hardware, including an ESP32 for ancilliary processing, a camera, SD card, audio and an LCD screen. At its heart is a Sipeed Maix 64 bit RISC-V module which processes AI. It can be programmed through the Arduino IDE which avoids a steep learning curve.
I purchased one from Mouser and started to follow Elektor article to set it up. If you follow detailed instructions and an installation works first time you have an immensely satisfying experience but you tend to learn a little. When events dont go as planned and issues need to be investigated by looking around different sites and articles, it can be frustrating but you learn a lot more. Needless to say my installation experience was a struggle.
After some unsuccessful attempts at installing the Arduino software I tried the PC based micropython environment which is described well at icircuit.net and I was soon able to flash Maixduino using the kflash command line tool. The documentation provided by sipeed also provides good detailed explanations. Maixduino uses two COM ports one for the Maix processor and the other for the ESP32. It was exciting to see them both communicating properly, giving me more confidence with the hardware setup and PC connection. The test program I ran was great, it showed a camera image on the LCD screen.
Returning to the Arduino environment, with my hardware setup validated, I looked a bit more closely at the software environment. The Elektor article had described a simple Arduino installation which obviously worked for the author. I was pleased when I found out how to setup multiple Arduino environments on the same PC. Some of the software included in Maixduino libraries has been used by me on other projects, in particular Adafruit graphics libraries. I set up a "portable" Arduino IDE environment which uses a separate copy of libraries and configuration files. I then repeated the installation process. The portable environment is nice as you can see everything relating to libraries you have installed, sketches you have written etc in sub folders of the portable folder.
Using the new environment I could compile a sketch (with a number of warning messages) but still not "upload" to the board. I saw two flags in preferences.txt for compile.debug and upload.debug, both set to False. I turned them on and could see the detailed commands the IDE uses to create and upload a program to a board. I could see kflash running and failing so I lowered the upload speed from 1,500,000 to 1,000,000bps. Rebooting and resetting the board now allowed the upload to proceed.
I tried a few demo programs to verify the environment. Using the Kendryte K210 AI module you declare the ST7789 screen and use the Adafruit GFX library to draw shapes, lines, text etc. Using th ESP32 I started with a "Hello World" serial monitor display.
I was now able to return to the Elektor article and try the "selfie" program which shows a camera image on the LCD display. I still had some minor problems, there were duplicate Adafruit GFX libraries (I deleted the one not provided by Maixduino) and a typo in a Maixduino library(googling provided me with a correction to apply). Finally I was able to complete the first experiment and take a picture, as shown below it is a picture of a rock.
The second example described by Elektor is to run a demo which is a real image recognition program. It isn't practical to "train" the AI system oneself without a lot of effort and thousands of images but the sipeed demo provides you with a pre-prepared "neural net" which is copied to the SD card. A simple sketch reads in the net then analyses a video image before guessing what it shows.
Bella was the first subject. The program is incredibly fast, it analyses the picture in about a second then guesses. Bella isn't a very good subject as she moves around and takes whatever position she wants in front of the camera. The best guess is shown below, the AI top answer is "Fur coat" - very funny, but actually accurate, after that it suggests she is a German Shepherd or police dog! Wow.
I found this a stunning result. AI hardware, costing £20 can actually identify a dog and have a good guess at the breed within a second. It shows how real AI technology is and indicates that practical systems are within our reach. Another stunning Elektor article which is the start of a short series, so there should be more to blog about soon.
No comments:
Post a Comment