Updated: Oct 5
It's almost time for people to dress up in costumes, kids to go trick-or-treating with friends, and carve that special jack-o'-lantern with family. This year, with the help of the LEGO Mindstorms set and the OAK-D-Lite, we can easily build an A.I.-powered jack-o'-lantern that surprises your guests. Here is a picture to show you what it is going to look like after you are done.
In this build, we use the OAK-D-Lite to perform all of the real-time A.I. computations. For those unfamiliar with the OAK-D-Lite, it is an all-in-one computer vision device that integrates stereo depth with deep learning acceleration in a tiny hardware enclosure. It's made by Luxonis and OpenCV. There is still time left to support its Kickstarter campaign and get it for just $79. Programming the OAK-D-Lite is very simple. We will make use of the Cortic Edge Platform's (CEP) visual programming capability. It can literally be done in 10 minutes. The code is open-sourced as an example in the CEP repo.
First, let's start by building the physical components. Here is an overview of all of the components that you'll be putting together.
There are three small components that we'll need to make with LEGO pieces. We will start by building the LEGO base mount that attaches the jack-o'-lantern to the LEGO control base. Here are the LEGO parts you'll need.
The following series of pictures illustrates how you put it together.
Next, we will build the LEGO camera mount which hosts the OAK-D-Lite camera, and it attaches to the top of the jack-o'-lantern so that the camera can see people walking by. Here are the LEGO parts.
Follow the building steps below. The OAK-D-Lite camera fits into the holder in the final step. The last beam slides in at the top to secure the camera.
Finally, we will build the LEGO control base that is responsible for moving the attached jack-o'-lantern. Here are the LEGO parts you'll need.
The steps to put it together are quite simple, as illustrated below.
Now, all is left is to put the components together. We use commands strips to attach the LEGO base mount and the camera mount to the jack-o'-lantern. Once this is done, we can easily connect the base mount to the LEGO control base. These steps are shown here.
You are almost done! Now, you can follow the instructions on the GitHub repo to install CEP on your Raspberry Pi. The source code to control the jack-o'-lantern is in the "examples" folder. Please follow the README there if you want to add your own voices and sounds effects. Here is a screenshot of the jack-o'-lantern visual program. Follow the instructions on CEP's Wiki page to set up Bluetooth pairing between the Raspberry Pi 4B and the LEGO hub. Clicking on the "Run" button will activate the jack-o'-lantern.
That's it! Here is a video to show you the jack-o'-lantern in action. It is the perfect project to work on with kids. We hope you will have as much fun as we did building this project.