Arduino and Raspberry Pi Working Together
I want to showcase a project presented in the book “Progetti per maker con Raspberry Pi”, Ed. Ulrico Hoepli (Milan, Italy), on sale next May, 8th 2020.
This project has been shown for the first time in a four-part video show on the Element14 Presents channel (Element14.com Community) with the title “The Scary Mirror” on the occasion of a series of projects focused on the Halloween event.
The suggestive visual impact and the mirror special effects are obtained running in-synch an Arduino Uno R3 and a Raspberry Pi 3B+
The Arduino microcontroller covers the role to manage the backlights thanks to a 144 LEDs NeoPixel strip while the front “magic” effects of the mirror, as well as the sounds and observer overlay effects, are created by the Raspberry Pi reacting to the presence, movement and distance of the observer reading a PIR sensor hidden in the front bottom side of the round frame of the Scary Mirror.
To manage the visual effects and the interaction together, the Raspberry Pi runs the Magic Mirror 2 platform by MichMich controlling a video player.
A set of background Python scripts and bash custom commands control the sound effects, the horror soundtrack, and the camera overlay effects accordingly with the data detected by the PIR sensor.
At the time when this project has been created, there was a bug in the Raspbian distribution for the Raspberry Pi 3B+ generating a serious issue in the I2C bus communication. To work around this problem, the Arduino board has been set to manage the backlight NeoPixel string on a timed based sequence and a series of different color patterns independently by the Raspberry Pi tasks managing the remaining part of the mirror interaction with the observer.