https://arduinoplusplus.wordpress.com/2017/10/29/robot-eye-expressions-using-led-matrix-display/
Robot Eye Expressions using LED Matrix Display
- Post authorBy marco_c
- Post dateOctober 29, 2017
- 21 Commentson Robot Eye Expressions using LED Matrix Display
I was exploring ways to make a future robot project more appealing and came across a number of articles about animated robotic eyes created to convey expression or mood. This looked like a bit of fun and quite achievable using the LED matrix modules that I have been playing with for a while. Here’s the result.
Hardware
This project works well with all the standard LED matrix modules supported by the MD_MAX72xx library, so no special hardware is needed to run the software.
However, I decided to build a dedicated 2-module unit for the displays, as I am planning to integrate this into a mobile robot in future. The design is based on the Parola modules I designed some time ago, but this time using a surface mount version of the MAX7219 IC to make the PCB smaller. Using Eagle CAD it was a simple process to copy and duplicate the existing design to create the required circuit, shown below.
The PCB footprint was designed to be the same size as the 2 LED matrix modules (at right, click to enlarge) and was manufactured at SeeedStudio’s Fusion PCB service. It took about 2 weeks from design through receiving the 10 neatly packed PCB prototypes in the mail.
The PCB was quickly populated and worked first time, as expected for this repeat design. The only issue was that the distance between the two sides of the LED matrix pins was too close and the outside pins need to be angled into the socket. Not a big deal and it does ensure that the matrices butt tightly against each other in the middle. An updated version of the Eagle CAD schematic and PCB layout files for this project can be downloaded here.
The images below show the PCB front and back, and the populated PCB with one matrix removed to show the components underneath.
Software
An animation is a basic sequence of images that, when played one after the other as ‘frames’, convey a sense of movement. In this instance the target is to animate the images for two eyes so as to convey mood.
To simplify the software, the eye animations start from a neutral expression (ie, eyes open looking forward) and progress through a series of intermediate frames to the main frame that conveys the desired ‘look’. After some time, the sequence can then be reversed back to the neutral expression. In this way, only half of the sequence needs to be defined, as the second half is just the same sequence in reverse.
It is also worth noting that some expressions are identical for both eyes (eg, a blink), others are completely independent of each other (eg, a wink) and still others have a reflected symmetry around where the nose would be (ie, they have a left and a right side). This means that the eyes will need to be independently animated, possibly unsynchronized.
Also, to make the neutral expression more life-like, the software should occasionally just blink the eyes rather than keep a spooky fixed stare.
Using the MD_MAX72xx library, each eye is just an 8×8 bitmap that can be defined using the font editor, described in this previous blog article. A simple sequence for a blink, starting from the eye wide open, is shown left to right in the figure below. The eye opening again is the reverse of this sequence.
This architecture allows the software to define animations sequences as tables of pairs of bitmaps and display duration. The tables are all managed using straightforward code leveraging the font handling features of the MD_MAX72xx library. In fact, all the data for the application can be set up in tables, making it easy to adapt and change the available expressions.
All this is implemented in a class that hides most of the detail from the calling program. As a bonus the class also allows text messages to be scrolled in the LED matrices.
This implementation is available as an example of the MD_MAX72xx library. The video below shows the example program running.
All-in-all a fun project that was easier than I expected, mostly due to being able to leverage existing infrastructure provided by the MD_MAX72xx library.
LIB example MD_Max72xx_RobotEyes (MD_Max72xx_RobotEyes.ino/MD_RobotEyes.cpp/MD_RobotEyes.h/MD_RobotEyes_Data.h)
If 1088AS
then #define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
// PAROLA_HW, ///< Use the Parola style hardware modules.
// GENERIC_HW, ///< Use 'generic' style hardware modules commonly available.
// ICSTATION_HW, ///< Use ICStation style hardware module.
// FC16_HW ///< Use FC-16 style hardware module.
'프로세싱+아두이노+안드로이드' 카테고리의 다른 글
PID 온도제어 (0) | 2022.07.25 |
---|---|
MPU6050 상보(상호보완) 필터 (0) | 2022.07.21 |
Arduino I2C SPI (1) | 2022.06.26 |
Moving Average Filter (Physical Computing) (0) | 2022.06.21 |
ESP-IDF Programming Guide (0) | 2022.06.05 |
댓글