Introduction: Movie Reccommender
Lights! Camera! Action!
We will explore Internet Queries using the Intel® Edison and the Arduino breakout board.
Using a set of dials, set a decade and a movie genre. Pressing the button will activate the Movie Recommender and the search begins. After the magic is done, the curtain will open to reveal the movie that fits the criteria.
So get this project done, make some popcorn, dim the lights, and get ready to watch a sci-fi movie from 1988... “My Stepmother is an Alien”?!
Thanks to The Open Movie Database (OMDB) for providing the search API.
Here is a video of the completed project.
This tutorial was originally published on Intel Communities here.
Step 1: Needed Components
- Intel® Edison with the Arduino breakout board
- Edison power supply
- Arduino Protoshield
- 4 mm MDF components - lasercut according to drawing
- Fabric component - lasercut according to drawing
- Decorative printout - printed in color
- 2 10k Ohm potentiometer
- 2 Knob covers
- 1 push button
- 1 standard servo
- 1 16*2 LCD screen
- 4 M8 bolts
- Nuts and bolts
- Spray glue
Step 2: Sort the Lasercut Pieces for Easier Construction
Sort all the pieces according to the image
Step 3: Solder the Electronics
Use the schematic to solder the electronic components together
Step 4: Optional: Attach Decorative Printout (Part C1) to Part A1 to Using Spray Adhesive
Step 5: Make Movie Curtain
- Attach Part A11 and Part A12 along the long edges of Part D1
- Cut string (approx. 30 cm) and tie to Part A11
Step 6: Mount Intel® Edison to Base and Attach Electronics
- Attach Intel® Edison to Part A10 using Parts B4 as spacers in between
- Attach Part A10 to Part A5
- Attach Protoshield
- Attach screen
- Place the LCD into Part A5
- Insert Part A5 into Part A10
- Attach curtain, side panel, and dials/button
- Place the potentiometers and button through the slit on Part A10
- Attach Part A2 to Part A4
- Slide the curtain into the appropriate slots
- Attach Part A6 to assembly
- Attach the potentiometers and button to Part A1 and secure
- Place dial covers on potentiometer
- Attach front panel and weigh down and secure curtain
- Attach Part A1 to assembly
- Place two M8 bolts on each side of Part A12
- Place Part B2 into the slots on Part A11
- Attach servo and assemble wheel
- Insert the servo into Part A3 and secure from behind using Part B3
- Attach Part A3 to assembly
Step 7: Assemble and Attach Wheel
- Attach Part A7, Part A8, and Part A9 together in that order
- Insert the servo arm and secure
- Attach to the servo
- Attach string to curtain mechanism
- Pull the string through Part A3 and place Parts B1 into Part A2 to act as a guide for the string
- Turn the wheel counter clockwise as far as possible and then back a little
- Slide string through the slot and wrap around multiple times to secure
Step 8: Scp the Python Script to the Intel® Edison and Upload Sketch
- Find out the ip address of Intel® Edison. Type “ifconfig” in the serial terminal, you can see the ip in wifi network under section “wlan0”
- Open a terminal in your computer. Copy the python script over by typing “scp /path/to/MovieRecommender.py root@EdisonIP:/home/root/”
Upload the sketch
Step 9: Behind the Scenes
The basic LCD screen is a simple and low tech way of adding a display to your project. Follow the example to connect the LCD to Intel® Edison
The “system()” command
When running Arduino sketches on the Intel® Edison, you can use the “system()” command to execute any Linux system commands. This makes it much easier for people familiar with Arduino to access advanced functionalities in the Linux system.
However the system() command only accepts char array as argument. In order to execute dynamically created commands, it would be much easier if the command string can be assembled dynamically, e.g., Char path=”~/myFolder”; String cmd=“ls “+path;
Using char array would be too rigid to be convenient. To convert String to char array, you can use the String.buffer property. So from the example above, just carry it out by calling system(cmd.buffer);
The actual movie finding is handled by the python script. It is activated in Arduino sketch by calling the “system()” command.
Despite the dials labels, the OMDB API actually doesn’t allow search by genre or decade. So instead, a list of frequently appearing title words are used for keyword searching. Science fiction, for instance, may have “space”, “ufo”, “alien”, “laser”, “star”, etc.
Once set and the button is pushed, the Intel® Edison will send a randomized year within the decade and a random associated word - e.g. “1988” and “alien”. OMDB will then send back a list of movies from 1988 that contain “alien” in its title.
After the list is retrieved, the Intel® Edisonuses the first movie and sends another request to OMDB for its genre. If it doesn’t match the science fiction genre, it will continue to send requests of the other movie titles until it finds one that does. If none are found, it will repeat the process using a different associated word until successful.
We have a be nice policy.
Please be positive and constructive.